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.
-
-
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 voidgetChildren(java.util.Set<PDFObject> children)PDFICCStreamgetICCStream()java.lang.StringgetName()intgetNumComponents()Get the number of color components for this colorspacebooleanisCMYKColorSpace()booleanisDeviceColorSpace()booleanisGrayColorSpace()booleanisRGBColorSpace()static PDFICCBasedColorSpacesetupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc)Sets sRGB as the DefaultRGB color space in the PDF document.static PDFICCStreamsetupsRGBColorProfile(PDFDocument pdfDoc)Sets up the sRGB color profile in the PDF document.static PDFICCBasedColorSpacesetupsRGBColorSpace(PDFDocument pdfDoc)Installs the sRGB color space in the PDF document.protected java.lang.StringtoPDFString()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 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:
getNumComponentsin interfacePDFColorSpace- Returns:
- the number of components
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacePDFColorSpace- Returns:
- the name of the color space
-
isDeviceColorSpace
public boolean isDeviceColorSpace()
- Specified by:
isDeviceColorSpacein interfacePDFColorSpace- Returns:
- true if the color space is a device-dependent color space (like DeviceRGB, DeviceCMYK and DeviceGray)
-
isRGBColorSpace
public boolean isRGBColorSpace()
- Specified by:
isRGBColorSpacein interfacePDFColorSpace- Returns:
- true if the color space is an RGB color space
-
isCMYKColorSpace
public boolean isCMYKColorSpace()
- Specified by:
isCMYKColorSpacein interfacePDFColorSpace- Returns:
- true if the color space is an CMYK color space
-
isGrayColorSpace
public boolean isGrayColorSpace()
- Specified by:
isGrayColorSpacein 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:
toPDFStringin 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:
getChildrenin classPDFObject
-
-