Class PDICCBased
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
-
- org.apache.pdfbox.pdmodel.graphics.color.PDICCBased
-
- All Implemented Interfaces:
COSObjectable
public class PDICCBased extends PDColorSpace
This class represents a ICC profile color space.- Version:
- $Revision: 1.6 $
- Author:
- Ben Litchfield
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEThe name of this color space.-
Fields inherited from class org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
array
-
-
Constructor Summary
Constructors Constructor Description PDICCBased(COSArray iccArray)Constructor.PDICCBased(PDDocument doc)Default constructor, creates empty stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.ColorModelcreateColorModel(int bpc)Create a Java color model for this colorspace.protected java.awt.color.ColorSpacecreateColorSpace()Create a Java colorspace for this colorspace.java.util.ListgetAlternateColorSpaces()This will return a list of alternate color spaces(PDColorSpace) if the display application does not support this icc stream.COSBasegetCOSObject()Convert this standard java object to a COS object.COSStreamgetMetadata()This will get the metadata stream for this object.java.lang.StringgetName()This will return the name of the color space.intgetNumberOfComponents()This will return the number of color components.PDStreamgetPDStream()Get the pd stream for this icc color space.PDRangegetRangeForComponent(int n)Returns the range for a certain component number.voidsetAlternateColorSpaces(java.util.List list)This will set the list of alternate color spaces.voidsetMetadata(COSStream metadata)This will set the metadata stream that is associated with this color space.voidsetNumberOfComponents(int n)This will set the number of color components.voidsetRangeForComponent(PDRange range, int n)This will set the a range for this color space.java.lang.StringtoString()-
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
getJavaColorSpace
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
The name of this color space.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDICCBased
public PDICCBased(PDDocument doc)
Default constructor, creates empty stream.- Parameters:
doc- The document to store the icc data.
-
PDICCBased
public PDICCBased(COSArray iccArray)
Constructor.- Parameters:
iccArray- The ICC stream object.
-
-
Method Detail
-
getName
public java.lang.String getName()
This will return the name of the color space.- Specified by:
getNamein classPDColorSpace- Returns:
- The name of the color space.
-
getCOSObject
public COSBase getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObjectin interfaceCOSObjectable- Overrides:
getCOSObjectin classPDColorSpace- Returns:
- The cos object that matches this Java object.
-
getPDStream
public PDStream getPDStream()
Get the pd stream for this icc color space.- Returns:
- Get the stream for this icc based color space.
-
createColorSpace
protected java.awt.color.ColorSpace createColorSpace() throws java.io.IOExceptionCreate a Java colorspace for this colorspace.- Specified by:
createColorSpacein classPDColorSpace- Returns:
- A color space that can be used for Java AWT operations.
- Throws:
java.io.IOException- If there is an error creating the color space.
-
createColorModel
public java.awt.image.ColorModel createColorModel(int bpc) throws java.io.IOExceptionCreate a Java color model for this colorspace.- Specified by:
createColorModelin classPDColorSpace- Parameters:
bpc- The number of bits per component.- Returns:
- A color model that can be used for Java AWT operations.
- Throws:
java.io.IOException- If there is an error creating the color model.
-
getNumberOfComponents
public int getNumberOfComponents()
This will return the number of color components. As of PDF 1.4 this will be 1,3,4.- Specified by:
getNumberOfComponentsin classPDColorSpace- Returns:
- The number of components in this color space.
-
setNumberOfComponents
public void setNumberOfComponents(int n)
This will set the number of color components.- Parameters:
n- The number of color components.
-
getAlternateColorSpaces
public java.util.List getAlternateColorSpaces() throws java.io.IOExceptionThis will return a list of alternate color spaces(PDColorSpace) if the display application does not support this icc stream.- Returns:
- A list of alternate color spaces.
- Throws:
java.io.IOException- If there is an error getting the alternate color spaces.
-
setAlternateColorSpaces
public void setAlternateColorSpaces(java.util.List list)
This will set the list of alternate color spaces. This should be a list of PDColorSpace objects.- Parameters:
list- The list of colorspace objects.
-
getRangeForComponent
public PDRange getRangeForComponent(int n)
Returns the range for a certain component number. This will never return null. If it is not present then the range 0..1 will be returned.- Parameters:
n- the component number to get the range for- Returns:
- the range for this component
-
setRangeForComponent
public void setRangeForComponent(PDRange range, int n)
This will set the a range for this color space.- Parameters:
range- The new range for the a component.n- The component to set the range for.
-
getMetadata
public COSStream getMetadata()
This will get the metadata stream for this object. Null if there is no metadata stream.- Returns:
- The metadata stream, if it exists.
-
setMetadata
public void setMetadata(COSStream metadata)
This will set the metadata stream that is associated with this color space.- Parameters:
metadata- The new metadata stream.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPDColorSpace
-
-