org.pdfbox.pdmodel.graphics.color

Class PDICCBased

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

static String
NAME
The name of this color space.

Constructor Summary

PDICCBased(COSArray iccArray)
Constructor.
PDICCBased(PDDocument doc)
Default constructor, creates empty stream.

Method Summary

ColorModel
createColorModel(int bpc)
Create a Java color model for this colorspace.
ColorSpace
createColorSpace()
Create a Java colorspace for this colorspace.
List
getAlternateColorSpaces()
This will return a list of alternate color spaces(PDColorSpace) if the display application does not support this icc stream.
COSBase
getCOSObject()
Convert this standard java object to a COS object.
COSStream
getMetadata()
This will get the metadata stream for this object.
String
getName()
This will return the name of the color space.
int
getNumberOfComponents()
This will return the number of color components.
PDStream
getPDStream()
Get the pd stream for this icc color space.
PDRange
getRangeForComponent(int n)
This will get the range for a certain component number.
void
setAlternateColorSpaces(List list)
This will set the list of alternate color spaces.
void
setMetadata(COSStream metadata)
This will set the metadata stream that is associated with this color space.
void
setNumberOfComponents(int n)
This will set the number of color components.
void
setRangeForComponent(PDRange range, int n)
This will set the a range for this color space.

Methods inherited from class org.pdfbox.pdmodel.graphics.color.PDColorSpace

createColorModel, createColorSpace, getCOSObject, getName, getNumberOfComponents

Field Details

NAME

public static final String NAME
The name of this color space.

Constructor Details

PDICCBased

public PDICCBased(COSArray iccArray)
Constructor.
Parameters:
iccArray - The ICC stream object.

PDICCBased

public PDICCBased(PDDocument doc)
Default constructor, creates empty stream.
Parameters:
doc - The document to store the icc data.

Method Details

createColorModel

public ColorModel createColorModel(int bpc)
            throws IOException
Create a Java color model for this colorspace.
Overrides:
createColorModel in interface PDColorSpace
Parameters:
bpc - The number of bits per component.
Returns:
A color model that can be used for Java AWT operations.

createColorSpace

public ColorSpace createColorSpace()
            throws IOException
Create a Java colorspace for this colorspace.
Overrides:
createColorSpace in interface PDColorSpace
Returns:
A color space that can be used for Java AWT operations.

getAlternateColorSpaces

public List getAlternateColorSpaces()
            throws IOException
This 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.

getCOSObject

public COSBase getCOSObject()
Convert this standard java object to a COS object.
Specified by:
getCOSObject in interface COSObjectable
Overrides:
getCOSObject in interface PDColorSpace
Returns:
The cos object that matches this Java object.

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.

getName

public String getName()
This will return the name of the color space.
Overrides:
getName in interface PDColorSpace
Returns:
The name of the color space.

getNumberOfComponents

public int getNumberOfComponents()
            throws IOException
This will return the number of color components. As of PDF 1.4 this will be 1,3,4.
Overrides:
getNumberOfComponents in interface PDColorSpace
Returns:
The number of components in this color space.

getPDStream

public PDStream getPDStream()
Get the pd stream for this icc color space.
Returns:
Get the stream for this icc based color space.

getRangeForComponent

public PDRange getRangeForComponent(int n)
This will get the range for a certain component number. This is will never return null. If it is not present then the range -100 to 100 will be returned.
Parameters:
n - The component number to get the range for.
Returns:
The range for this component.

setAlternateColorSpaces

public void setAlternateColorSpaces(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.

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.

setNumberOfComponents

public void setNumberOfComponents(int n)
This will set the number of color components.
Parameters:
n - The number of color components.

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.