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
Represents an ICCBased color space in PDF.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPDFICCBasedColorSpace
(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
Modifier and TypeMethodDescriptionvoid
getChildren
(Set<PDFObject> children) getName()
int
Get the number of color components for this colorspaceboolean
boolean
boolean
boolean
static PDFICCBasedColorSpace
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 String
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
-
Constructor Details
-
PDFICCBasedColorSpace
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
Constructs a the ICCBased color space.- Parameters:
iccStream
- the ICC stream to associate with this color space
-
-
Method Details
-
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
- 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
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
Sets sRGB as the DefaultRGB color space in the PDF document.- Parameters:
pdfDoc
- the PDF document- Returns:
- the newly installed color space object
-
setupsRGBColorSpace
Installs the sRGB color space in the PDF document.- Parameters:
pdfDoc
- the PDF document- Returns:
- the newly installed color space object
-
setupsRGBColorProfile
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
- Overrides:
getChildren
in classPDFObject
-