org.apache.pdfbox.pdmodel.graphics.color
Class PDIndexed

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
      extended by org.apache.pdfbox.pdmodel.graphics.color.PDIndexed
All Implemented Interfaces:
COSObjectable

public class PDIndexed
extends PDColorSpace

This class represents an Indexed color space.

Version:
$Revision: 1.4 $
Author:
Ben Litchfield

Field Summary
static String ABBREVIATED_NAME
          The abbreviated name of this color space.
static String NAME
          The name of this color space.
 
Constructor Summary
PDIndexed()
          Constructor, default DeviceRGB, hival 255.
PDIndexed(COSArray indexedArray)
          Constructor.
 
Method Summary
 ColorModel createColorModel(int bpc)
          Create a Java color model for this colorspace.
protected  ColorSpace createColorSpace()
          Create a Java colorspace for this colorspace.
 PDColorSpace getBaseColorSpace()
          This will get the color space that acts as the index for this color space.
 int getHighValue()
          Get the highest value for the lookup.
 byte[] getLookupData()
          Get the lookup data table.
 String getName()
          This will return the name of the color space.
 int getNumberOfComponents()
          This will return the number of color components.
 int lookupColor(int lookupIndex, int componentNumber)
          This will perform a lookup into the color lookup table.
 void setBaseColorSpace(PDColorSpace base)
          This will set the base color space.
 void setHighValue(int high)
          This will set the highest value that is allowed.
 void setLookupColor(int lookupIndex, int componentNumber, int color)
          This will set a color in the color lookup table.
 
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
getCOSObject, getJavaColorSpace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

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

See Also:
Constant Field Values

ABBREVIATED_NAME

public static final String ABBREVIATED_NAME
The abbreviated name of this color space.

See Also:
Constant Field Values
Constructor Detail

PDIndexed

public PDIndexed()
Constructor, default DeviceRGB, hival 255.


PDIndexed

public PDIndexed(COSArray indexedArray)
Constructor.

Parameters:
indexedArray - The array containing the indexed parameters
Method Detail

getNumberOfComponents

public int getNumberOfComponents()
                          throws IOException
This will return the number of color components. This will return the number of color components in the base color.

Specified by:
getNumberOfComponents in class PDColorSpace
Returns:
The number of components in this color space.
Throws:
IOException - If there is an error getting the number of color components.

getName

public String getName()
This will return the name of the color space.

Specified by:
getName in class PDColorSpace
Returns:
The name of the color space.

createColorSpace

protected ColorSpace createColorSpace()
                               throws IOException
Create a Java colorspace for this colorspace.

Specified by:
createColorSpace in class PDColorSpace
Returns:
A color space that can be used for Java AWT operations.
Throws:
IOException - If there is an error creating the color space.

createColorModel

public ColorModel createColorModel(int bpc)
                            throws IOException
Create a Java color model for this colorspace.

Specified by:
createColorModel in class PDColorSpace
Parameters:
bpc - The number of bits per component.
Returns:
A color model that can be used for Java AWT operations.
Throws:
IOException - If there is an error creating the color model.

getBaseColorSpace

public PDColorSpace getBaseColorSpace()
                               throws IOException
This will get the color space that acts as the index for this color space.

Returns:
The base color space.
Throws:
IOException - If there is error creating the base color space.

setBaseColorSpace

public void setBaseColorSpace(PDColorSpace base)
This will set the base color space.

Parameters:
base - The base color space to use as the index.

getHighValue

public int getHighValue()
Get the highest value for the lookup.

Returns:
The hival entry.

setHighValue

public void setHighValue(int high)
This will set the highest value that is allowed. This cannot be higher than 255.

Parameters:
high - The highest value for the lookup table.

lookupColor

public int lookupColor(int lookupIndex,
                       int componentNumber)
                throws IOException
This will perform a lookup into the color lookup table.

Parameters:
lookupIndex - The zero-based index into the table, should not exceed the high value.
componentNumber - The component number, probably 1,2,3,3.
Returns:
The value that was from the lookup table.
Throws:
IOException - If there is an error looking up the color.

getLookupData

public byte[] getLookupData()
                     throws IOException
Get the lookup data table.

Returns:
a byte array containing the the lookup data.
Throws:
IOException - if an error occurs.

setLookupColor

public void setLookupColor(int lookupIndex,
                           int componentNumber,
                           int color)
                    throws IOException
This will set a color in the color lookup table.

Parameters:
lookupIndex - The zero-based index into the table, should not exceed the high value.
componentNumber - The component number, probably 1,2,3,3.
color - The color that will go into the table.
Throws:
IOException - If there is an error looking up the color.


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.