public class ColorSpace
extends java.lang.Object
Note: In Pattern color space (i.e. for ColorSpace::e_pattern) 'color values' are PDF::PatternColor objects instead of the numeric component values (i.e. ColorPt) used with other spaces.
Modifier and Type | Field and Description |
---|---|
static int |
e_cal_gray
The Constant e_cal_gray.
|
static int |
e_cal_rgb
The Constant e_cal_rgb.
|
static int |
e_device_cmyk
The Constant e_device_cmyk.
|
static int |
e_device_gray
The Constant e_device_gray.
|
static int |
e_device_n
The Constant e_device_n.
|
static int |
e_device_rgb
The Constant e_device_rgb.
|
static int |
e_icc
The Constant e_icc.
|
static int |
e_indexed
The Constant e_indexed.
|
static int |
e_lab
The Constant e_lab.
|
static int |
e_null
The Constant e_null.
|
static int |
e_pattern
The Constant e_pattern.
|
static int |
e_separation
The Constant e_separation.
|
Constructor and Description |
---|
ColorSpace(Obj color_space)
Create a ColorSpace from the given SDF/Cos object listed under ColorSpaces entry
in page Resource dictionary.
|
Modifier and Type | Method and Description |
---|---|
static ColorSpace |
__Create(long impl,
java.lang.Object ref) |
ColorPt |
convert2CMYK(ColorPt in_color)
A convenience function used to convert color points from the current
color space to DeviceCMYK color space.
|
ColorPt |
convert2Gray(ColorPt in_color)
A convenience function used to convert color points from the current
color space to DeviceGray color space.
|
ColorPt |
convert2RGB(ColorPt in_color)
A convenience function used to convert color points from the current
color space to DeviceRGB color space.
|
static ColorSpace |
createDeviceCMYK()
Create a new DeviceCMYK ColorSpace object.
|
static ColorSpace |
createDeviceGray()
Create a new DeviceGray ColorSpace object.
|
static ColorSpace |
createDeviceRGB()
Create a new DeviceRGB ColorSpace object.
|
static ColorSpace |
createICCFromBuffer(Doc doc,
byte[] data)
Creates the icc from buffer in the given document
|
static ColorSpace |
createICCFromFile(Doc doc,
java.lang.String filepath)
Create a PDF 'ICCBased' color space given an ICC profile in the given document
|
static ColorSpace |
createICCFromFilter(Doc doc,
Filter filter)
Creates the icc from filter in the given document
|
static ColorSpace |
createPattern()
Create a new Pattern ColorSpace object.
|
ColorSpace |
getAlternateColorSpace()
Get the alternate color space.
|
ColorPt |
getBaseColor(byte color_idx)
Get the base color given a component value (index) in Indexed color space.
|
ColorSpace |
getBaseColorSpace()
Get the base color space.
|
int |
getComponentNum()
Get the component number
|
static int |
getComponentNum(int cs_type,
Obj cs)
Get the number of components (tint components) used to represent color point for
this color space
|
byte[] |
getLookupTable()
Get the lookup table.
|
Obj |
getSDFObj()
Get the SDFObj
|
Function |
getTintFunction()
Get the tint function.
|
int |
getType()
Get ColorSpace type
|
static int |
getType(Obj cs)
Get type from specified ColorSpace object
|
void |
initColor(ColorPt out_colorants)
Set color to the initial value used for this color space.
|
void |
initComponentRanges(double[] out_decode_low,
double[] out_decode_range)
Initialize default ranges for each color component in the color space.
|
boolean |
isAll()
Checks if Separation color space contains the colorant All.
|
boolean |
isNone()
Checks if Separation or DeviceN color space contains None colorants.
|
public static final int e_device_gray
public static final int e_device_rgb
public static final int e_device_cmyk
public static final int e_cal_gray
public static final int e_cal_rgb
public static final int e_lab
public static final int e_icc
public static final int e_indexed
public static final int e_pattern
public static final int e_separation
public static final int e_device_n
public static final int e_null
public ColorSpace(Obj color_space)
color_space
- the input color space as Objpublic static ColorSpace createDeviceGray() throws PDFNetException
PDFNetException
public static ColorSpace createDeviceRGB() throws PDFNetException
PDFNetException
public static ColorSpace createDeviceCMYK() throws PDFNetException
PDFNetException
public static ColorSpace createPattern() throws PDFNetException
PDFNetException
public static ColorSpace createICCFromFile(Doc doc, java.lang.String filepath) throws PDFNetException
doc
- input documentfilepath
- input document filepathPDFNetException
public static ColorSpace createICCFromFilter(Doc doc, Filter filter) throws PDFNetException
doc
- the input documentfilter
- the input filterPDFNetException
public static ColorSpace createICCFromBuffer(Doc doc, byte[] data) throws PDFNetException
doc
- the input documentdata
- the input bufferPDFNetException
public static int getComponentNum(int cs_type, Obj cs) throws PDFNetException
cs_type
- ColorSpace typecs
- Cos/SDF color space object.PDFNetException
public static int getType(Obj cs) throws PDFNetException
cs
- Cos/SDF color space object.PDFNetException
public int getType() throws PDFNetException
PDFNetException
public Obj getSDFObj()
public int getComponentNum() throws PDFNetException
PDFNetException
public void initColor(ColorPt out_colorants) throws PDFNetException
out_colorants
- initial valuePDFNetException
public void initComponentRanges(double[] out_decode_low, double[] out_decode_range) throws PDFNetException
Note: the size of resulting vectors will match the number of color components in this color space
out_decode_low
- an array of numbers representing the lower bound for
each color component.out_decode_range
- an array of numbers representing the the difference
between high and low bound for each color component.PDFNetException
- .public ColorPt convert2Gray(ColorPt in_color) throws PDFNetException
Note: the number to input colorants must match the number of colorants expected by the current color space.
in_color
- input color point in the current color spacePDFNetException
public ColorPt convert2RGB(ColorPt in_color) throws PDFNetException
Note: the number to input colorants must match the number of colorants expected by the current color space.
in_color
- input color point in the current color spacePDFNetException
public ColorPt convert2CMYK(ColorPt in_color) throws PDFNetException
Note: the number to input colorants must match the number of colorants expected by the current color space.
in_color
- input color point in the current color spacePDFNetException
public ColorSpace getAlternateColorSpace() throws PDFNetException
PDFNetException
public ColorSpace getBaseColorSpace() throws PDFNetException
PDFNetException
public byte[] getLookupTable() throws PDFNetException
Note: for color spaces other than Indexed this method throws an exception.
PDFNetException
public ColorPt getBaseColor(byte color_idx) throws PDFNetException
Note: for color spaces other than Indexed this method throws an exception.
color_idx
- color value represented in the index color spacePDFNetException
public Function getTintFunction() throws PDFNetException
Note: for color spaces other than Separation this method throws an exception.
PDFNetException
public boolean isAll() throws PDFNetException
Note: for color spaces other than Separation this method throws an exception.
PDFNetException
public boolean isNone() throws PDFNetException
Note: for color spaces other than Separation or DeviceN this method throws an exception.
PDFNetException
public static ColorSpace __Create(long impl, java.lang.Object ref)