public abstract class PDColorSpace extends java.lang.Object implements COSObjectable
Constructor and Description |
---|
PDColorSpace() |
Modifier and Type | Method and Description |
---|---|
static PDColorSpace |
create(COSBase colorSpace)
Creates a color space given a name or array.
|
static PDColorSpace |
create(COSBase colorSpace,
PDResources resources)
Creates a color space given a name or array.
|
static PDColorSpace |
create(COSBase colorSpace,
PDResources resources,
boolean wasDefault)
Creates a color space given a name or array.
|
private static PDColorSpace |
createFromCOSObject(COSObject colorSpace,
PDResources resources) |
COSBase |
getCOSObject()
Convert this standard java object to a COS object.
|
abstract float[] |
getDefaultDecode(int bitsPerComponent)
Returns the default decode array for this color space.
|
abstract PDColor |
getInitialColor()
Returns the initial color value for this color space.
|
abstract java.lang.String |
getName()
Returns the name of the color space.
|
abstract int |
getNumberOfComponents()
Returns the number of components in this color space
|
abstract float[] |
toRGB(float[] value)
Returns the RGB equivalent of the given color value.
|
abstract java.awt.image.BufferedImage |
toRGBImage(java.awt.image.WritableRaster raster)
Returns the (A)RGB equivalent of the given raster.
|
protected java.awt.image.BufferedImage |
toRGBImageAWT(java.awt.image.WritableRaster raster,
java.awt.color.ColorSpace colorSpace)
Returns the (A)RGB equivalent of the given raster, using the given AWT color space
to perform the conversion.
|
protected COSArray array
public static PDColorSpace create(COSBase colorSpace) throws java.io.IOException
colorSpace
- the color space COS objectjava.io.IOException
- if the color space is unknown or cannot be createdpublic static PDColorSpace create(COSBase colorSpace, PDResources resources) throws java.io.IOException
colorSpace
- the color space COS objectresources
- the current resources.MissingResourceException
- if the color space is missing in the resources dictionaryjava.io.IOException
- if the color space is unknown or cannot be createdpublic static PDColorSpace create(COSBase colorSpace, PDResources resources, boolean wasDefault) throws java.io.IOException
create(COSBase, PDResources)
.colorSpace
- the color space COS objectresources
- the current resources.wasDefault
- if current color space was used by a default color space.MissingResourceException
- if the color space is missing in the resources dictionaryjava.io.IOException
- if the color space is unknown or cannot be created.private static PDColorSpace createFromCOSObject(COSObject colorSpace, PDResources resources) throws java.io.IOException
java.io.IOException
public abstract java.lang.String getName()
public abstract int getNumberOfComponents()
public abstract float[] getDefaultDecode(int bitsPerComponent)
bitsPerComponent
- the number of bits per component.public abstract PDColor getInitialColor()
public abstract float[] toRGB(float[] value) throws java.io.IOException
value
- a color value with component values between 0 and 1java.io.IOException
- if the color conversion failspublic abstract java.awt.image.BufferedImage toRGBImage(java.awt.image.WritableRaster raster) throws java.io.IOException
raster
- the source rasterjava.io.IOException
- if the color conversion failsprotected java.awt.image.BufferedImage toRGBImageAWT(java.awt.image.WritableRaster raster, java.awt.color.ColorSpace colorSpace)
raster
- the source rastercolorSpace
- the AWTpublic COSBase getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable