Package org.apache.fop.pdf
Class PDFICCBasedColorSpace
- java.lang.Object
-
- org.apache.fop.pdf.PDFObject
-
- org.apache.fop.pdf.PDFICCBasedColorSpace
-
- All Implemented Interfaces:
PDFColorSpace
,PDFWritable
public class PDFICCBasedColorSpace extends PDFObject implements PDFColorSpace
Represents an ICCBased color space in PDF.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
explicitName
private PDFICCStream
iccStream
private int
numComponents
-
Constructor Summary
Constructors Constructor Description PDFICCBasedColorSpace(java.lang.String explicitName, PDFICCStream iccStream)
Constructs a the ICCBased color space with an explicit name (ex.PDFICCBasedColorSpace(PDFICCStream iccStream)
Constructs a the ICCBased color space.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
getChildren(java.util.Set<PDFObject> children)
PDFICCStream
getICCStream()
java.lang.String
getName()
int
getNumComponents()
Get the number of color components for this colorspaceboolean
isCMYKColorSpace()
boolean
isDeviceColorSpace()
boolean
isGrayColorSpace()
boolean
isRGBColorSpace()
static PDFICCBasedColorSpace
setupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc)
Sets sRGB as the DefaultRGB color space in the PDF document.static PDFICCStream
setupsRGBColorProfile(PDFDocument pdfDoc)
Sets up the sRGB color profile in the PDF document.static PDFICCBasedColorSpace
setupsRGBColorSpace(PDFDocument pdfDoc)
Installs the sRGB color space in the PDF document.protected java.lang.String
toPDFString()
This method returns a String representation of the PDF object.-
Methods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF
-
-
-
-
Field Detail
-
iccStream
private PDFICCStream iccStream
-
explicitName
private java.lang.String explicitName
-
numComponents
private int numComponents
-
-
Constructor Detail
-
PDFICCBasedColorSpace
public PDFICCBasedColorSpace(java.lang.String explicitName, PDFICCStream iccStream)
Constructs a the ICCBased color space with an explicit name (ex. "DefaultRGB").- Parameters:
explicitName
- an explicit name or null if a name should be generatediccStream
- the ICC stream to associate with this color space
-
PDFICCBasedColorSpace
public PDFICCBasedColorSpace(PDFICCStream iccStream)
Constructs a the ICCBased color space.- Parameters:
iccStream
- the ICC stream to associate with this color space
-
-
Method Detail
-
getICCStream
public PDFICCStream getICCStream()
- Returns:
- the ICC stream associated with this color space
-
getNumComponents
public int getNumComponents()
Get the number of color components for this colorspace- Specified by:
getNumComponents
in interfacePDFColorSpace
- Returns:
- the number of components
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfacePDFColorSpace
- Returns:
- the name of the color space
-
isDeviceColorSpace
public boolean isDeviceColorSpace()
- Specified by:
isDeviceColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is a device-dependent color space (like DeviceRGB, DeviceCMYK and DeviceGray)
-
isRGBColorSpace
public boolean isRGBColorSpace()
- Specified by:
isRGBColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an RGB color space
-
isCMYKColorSpace
public boolean isCMYKColorSpace()
- Specified by:
isCMYKColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an CMYK color space
-
isGrayColorSpace
public boolean isGrayColorSpace()
- Specified by:
isGrayColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an Gray color space
-
toPDFString
protected java.lang.String toPDFString()
This method returns a String representation of the PDF object. The result is normally converted/encoded to a byte array by toPDF(). Only use this method to implement the serialization if the object can be fully represented as text. If the PDF representation of the object contains binary content use toPDF() or output(OutputStream) instead. This applies to any object potentially containing a string object because string object are encrypted and therefore need to be binary.- Overrides:
toPDFString
in classPDFObject
- Returns:
- String the String representation
-
setupsRGBAsDefaultRGBColorSpace
public static PDFICCBasedColorSpace setupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc)
Sets sRGB as the DefaultRGB color space in the PDF document.- Parameters:
pdfDoc
- the PDF document- Returns:
- the newly installed color space object
-
setupsRGBColorSpace
public static PDFICCBasedColorSpace setupsRGBColorSpace(PDFDocument pdfDoc)
Installs the sRGB color space in the PDF document.- Parameters:
pdfDoc
- the PDF document- Returns:
- the newly installed color space object
-
setupsRGBColorProfile
public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc)
Sets up the sRGB color profile in the PDF document. It does so by trying to install a very small ICC profile (~4KB) instead of the very big one (~140KB) the Sun JVM uses.- Parameters:
pdfDoc
- the PDF document- Returns:
- the ICC stream with the sRGB profile
-
getChildren
public void getChildren(java.util.Set<PDFObject> children)
- Overrides:
getChildren
in classPDFObject
-
-