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

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

public class PDCalGray
extends PDColorSpace

This class represents a Cal Gray color space.

Version:
$Revision: 1.5 $
Author:
Ben Litchfield

Field Summary
static String NAME
          The name of this color space.
 
Constructor Summary
PDCalGray()
          Constructor.
PDCalGray(COSArray gray)
          Constructor with array.
 
Method Summary
 ColorModel createColorModel(int bpc)
          Create a Java color model for this colorspace.
protected  ColorSpace createColorSpace()
          Create a Java colorspace for this colorspace.
 PDTristimulus getBlackPoint()
          This will return the BlackPoint tristimulus.
 COSBase getCOSObject()
          Convert this standard java object to a COS object.
 float getGamma()
          This will get the gamma value.
 String getName()
          This will return the name of the color space.
 int getNumberOfComponents()
          This will get the number of components that this color space is made up of.
 PDTristimulus getWhitepoint()
          This will return the whitepoint tristimulus.
 void setBlackPoint(PDTristimulus bp)
          This will set the BlackPoint tristimulus.
 void setGamma(float value)
          Set the gamma value.
 void setWhitepoint(PDTristimulus wp)
          This will set the whitepoint tristimulus.
 
Methods inherited from class org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace
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
Constructor Detail

PDCalGray

public PDCalGray()
Constructor.


PDCalGray

public PDCalGray(COSArray gray)
Constructor with array.

Parameters:
gray - The underlying color space.
Method Detail

getNumberOfComponents

public int getNumberOfComponents()
                          throws IOException
This will get the number of components that this color space is made up of.

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.

getCOSObject

public COSBase getCOSObject()
Convert this standard java object to a COS object.

Specified by:
getCOSObject in interface COSObjectable
Overrides:
getCOSObject in class PDColorSpace
Returns:
The cos object that matches this Java object.

getGamma

public float getGamma()
This will get the gamma value. If none is present then the default of 1 will be returned.

Returns:
The gamma value.

setGamma

public void setGamma(float value)
Set the gamma value.

Parameters:
value - The new gamma value.

getWhitepoint

public PDTristimulus getWhitepoint()
This will return the whitepoint tristimulus. As this is a required field this will never return null. A default of 1,1,1 will be returned if the pdf does not have any values yet.

Returns:
The whitepoint tristimulus.

setWhitepoint

public void setWhitepoint(PDTristimulus wp)
This will set the whitepoint tristimulus. As this is a required field this null should not be passed into this function.

Parameters:
wp - The whitepoint tristimulus.

getBlackPoint

public PDTristimulus getBlackPoint()
This will return the BlackPoint tristimulus. This is an optional field but has defaults so this will never return null. A default of 0,0,0 will be returned if the pdf does not have any values yet.

Returns:
The blackpoint tristimulus.

setBlackPoint

public void setBlackPoint(PDTristimulus bp)
This will set the BlackPoint tristimulus. As this is a required field this null should not be passed into this function.

Parameters:
bp - The BlackPoint tristimulus.


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