public final class PDICCBased extends PDCIEBasedColorSpace
Modifier and Type | Field and Description |
---|---|
private PDColorSpace |
alternateColorSpace |
private java.awt.color.ICC_ColorSpace |
awtColorSpace |
private java.awt.color.ICC_Profile |
iccProfile |
private PDColor |
initialColor |
private static boolean |
IS_KCMS |
private boolean |
isRGB |
private static org.apache.commons.logging.Log |
LOG |
private int |
numberOfComponents |
private PDStream |
stream |
private boolean |
useOnlyAlternateColorSpace |
array
Constructor and Description |
---|
PDICCBased(COSArray iccArray)
Deprecated.
This will be private in 3.0. Please use
create(org.apache.pdfbox.cos.COSArray, org.apache.pdfbox.pdmodel.PDResources)
instead, which supports caching. |
PDICCBased(PDDocument doc)
Creates a new ICC color space with an empty stream.
|
Modifier and Type | Method and Description |
---|---|
private static void |
checkArray(COSArray iccArray) |
private float[] |
clampColors(java.awt.color.ICC_ColorSpace cs,
float[] value) |
static PDICCBased |
create(COSArray iccArray,
PDResources resources)
Creates a new ICC color space using the PDF array, optionally using a resource cache.
|
private static java.awt.color.ICC_Profile |
ensureDisplayProfile(java.awt.color.ICC_Profile profile) |
private void |
fallbackToAlternateColorSpace(java.lang.Exception e) |
PDColorSpace |
getAlternateColorSpace()
Returns a list of alternate color spaces for non-conforming readers.
|
int |
getColorSpaceType()
Returns the type of the color space in the ICC profile.
|
float[] |
getDefaultDecode(int bitsPerComponent)
Returns the default decode array for this color space.
|
PDColor |
getInitialColor()
Returns the initial color value for this color space.
|
COSStream |
getMetadata()
Returns the metadata stream for this object, or null if there is no metadata stream.
|
java.lang.String |
getName()
Returns the name of the color space.
|
int |
getNumberOfComponents()
Returns the number of components in this color space
|
PDStream |
getPDStream()
Get the underlying ICC profile stream.
|
PDRange |
getRangeForComponent(int n)
Returns the range for a certain component number.
|
private static void |
intToBigEndian(int value,
byte[] array,
int index) |
private boolean |
is_sRGB(java.awt.color.ICC_Profile profile)
Returns true if the given profile is represents sRGB.
|
private static boolean |
isMinJdk8() |
private void |
loadICCProfile()
Load the ICC profile, or init alternateColorSpace color space.
|
void |
setAlternateColorSpaces(java.util.List<PDColorSpace> list)
Sets the list of alternateColorSpace color spaces.
|
void |
setMetadata(COSStream metadata)
Sets the metadata stream that is associated with this color space.
|
void |
setNumberOfComponents(int n)
Deprecated.
|
void |
setRangeForComponent(PDRange range,
int n)
Sets the range for this color space.
|
float[] |
toRGB(float[] value)
Returns the RGB equivalent of the given color value.
|
java.awt.image.BufferedImage |
toRGBImage(java.awt.image.WritableRaster raster)
Returns the (A)RGB equivalent of the given raster.
|
java.lang.String |
toString() |
create, create, create, getCOSObject, toRGBImageAWT
private static final org.apache.commons.logging.Log LOG
private final PDStream stream
private int numberOfComponents
private java.awt.color.ICC_Profile iccProfile
private PDColorSpace alternateColorSpace
private java.awt.color.ICC_ColorSpace awtColorSpace
private PDColor initialColor
private boolean isRGB
private boolean useOnlyAlternateColorSpace
private static final boolean IS_KCMS
public PDICCBased(PDDocument doc)
doc
- the document to store the ICC data@Deprecated public PDICCBased(COSArray iccArray) throws java.io.IOException
create(org.apache.pdfbox.cos.COSArray, org.apache.pdfbox.pdmodel.PDResources)
instead, which supports caching.iccArray
- the ICC stream object.java.io.IOException
- if there is an error reading the ICC profile or if the parameter is
invalid.public static PDICCBased create(COSArray iccArray, PDResources resources) throws java.io.IOException
iccArray
- the ICC stream object.resources
- resources to use as cache, or null for no caching.java.io.IOException
- if there is an error reading the ICC profile or if the parameter is
invalid.private static void checkArray(COSArray iccArray) throws java.io.IOException
java.io.IOException
public java.lang.String getName()
PDColorSpace
getName
in class PDColorSpace
public PDStream getPDStream()
private void loadICCProfile() throws java.io.IOException
java.io.IOException
private void fallbackToAlternateColorSpace(java.lang.Exception e) throws java.io.IOException
java.io.IOException
private boolean is_sRGB(java.awt.color.ICC_Profile profile)
private static java.awt.color.ICC_Profile ensureDisplayProfile(java.awt.color.ICC_Profile profile)
private static void intToBigEndian(int value, byte[] array, int index)
public float[] toRGB(float[] value) throws java.io.IOException
PDColorSpace
toRGB
in class PDColorSpace
value
- a color value with component values between 0 and 1java.io.IOException
- if the color conversion failsprivate float[] clampColors(java.awt.color.ICC_ColorSpace cs, float[] value)
public java.awt.image.BufferedImage toRGBImage(java.awt.image.WritableRaster raster) throws java.io.IOException
PDColorSpace
toRGBImage
in class PDCIEBasedColorSpace
raster
- the source rasterjava.io.IOException
- if the color conversion failspublic int getNumberOfComponents()
PDColorSpace
getNumberOfComponents
in class PDColorSpace
public float[] getDefaultDecode(int bitsPerComponent)
PDColorSpace
getDefaultDecode
in class PDColorSpace
bitsPerComponent
- the number of bits per component.public PDColor getInitialColor()
PDColorSpace
getInitialColor
in class PDColorSpace
public PDColorSpace getAlternateColorSpace() throws java.io.IOException
java.io.IOException
- If there is an error getting the alternateColorSpace color spaces.public PDRange getRangeForComponent(int n)
n
- the component number to get the range forpublic COSStream getMetadata()
public int getColorSpaceType()
TYPE_GRAY
, TYPE_RGB
,
TYPE_CMYK
, or -1 if that one is invalid.ColorSpace.getType()
and the static values of
ColorSpace
for more details.@Deprecated public void setNumberOfComponents(int n)
n
- the number of color componentspublic void setAlternateColorSpaces(java.util.List<PDColorSpace> list)
list
- the list of color space objectspublic void setRangeForComponent(PDRange range, int n)
range
- the new range for the a componentn
- the component to set the range forpublic void setMetadata(COSStream metadata)
metadata
- the new metadata streampublic java.lang.String toString()
toString
in class PDCIEBasedColorSpace
private static boolean isMinJdk8()