Class PDColorSpace
- java.lang.Object
-
- com.tom_roush.pdfbox.pdmodel.graphics.color.PDColorSpace
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
PDDeviceColorSpace
public abstract class PDColorSpace extends Object implements COSObjectable
A color space specifies how the colours of graphics objects will be painted on the page.
-
-
Constructor Summary
Constructors Constructor Description PDColorSpace()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static PDColorSpacecreate(COSBase colorSpace)Creates a color space space given a name or array.static PDColorSpacecreate(COSBase colorSpace, PDResources resources)Creates a color space given a name or array.COSBasegetCOSObject()Convert this standard java object to a COS object.abstract float[]getDefaultDecode(int bitsPerComponent)Returns the default decode array for this color space.abstract PDColorgetInitialColor()Returns the initial color value for this color space.abstract StringgetName()Returns the name of the color space.abstract intgetNumberOfComponents()Returns the number of components in this color spaceabstract float[]toRGB(float[] value)Returns the RGB equivalent of the given color value.abstract android.graphics.BitmaptoRGBImage(android.graphics.Bitmap raster)
-
-
-
Field Detail
-
array
protected COSArray array
-
-
Method Detail
-
create
public static PDColorSpace create(COSBase colorSpace) throws IOException
Creates a color space space given a name or array.- Parameters:
colorSpace- the color space COS object- Returns:
- a new color space
- Throws:
IOException- if the color space is unknown or cannot be created
-
create
public static PDColorSpace create(COSBase colorSpace, PDResources resources) throws IOException
Creates a color space given a name or array.- Parameters:
colorSpace- the color space COS objectresources- the current resources.- Returns:
- a new color space
- Throws:
MissingResourceException- if the color space is missing in the resources dictionaryIOException- if the color space is unknown or cannot be created
-
getName
public abstract String getName()
Returns the name of the color space.- Returns:
- the name of the color space
-
getNumberOfComponents
public abstract int getNumberOfComponents()
Returns the number of components in this color space- Returns:
- the number of components in this color space
-
getDefaultDecode
public abstract float[] getDefaultDecode(int bitsPerComponent)
Returns the default decode array for this color space.- Returns:
- the default decode array
-
getInitialColor
public abstract PDColor getInitialColor()
Returns the initial color value for this color space.- Returns:
- the initial color value for this color space
-
toRGB
public abstract float[] toRGB(float[] value) throws IOExceptionReturns the RGB equivalent of the given color value.- Parameters:
value- a color value with component values between 0 and 1- Returns:
- an array of R,G,B value between 0 and 255
- Throws:
IOException- if the color conversion fails
-
toRGBImage
public abstract android.graphics.Bitmap toRGBImage(android.graphics.Bitmap raster) throws IOException- Throws:
IOException
-
getCOSObject
public COSBase getCOSObject()
Description copied from interface:COSObjectableConvert this standard java object to a COS object.- Specified by:
getCOSObjectin interfaceCOSObjectable- Returns:
- The cos object that matches this Java object.
-
-