|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.color.ColorSpace
org.faceless.pdf2.CMYKColorSpace
public final class CMYKColorSpace
A subclass of ColorSpace
representing the uncalibrated (device-dependent)
CMYK color space available in PDF documents.
If colors need to be specified in CMYK, but device-independent color (the kind
available with an ICC Profile) is not required, this ColorSpace should be used,
as it doesn't require an ICC profile to be embedded in the PDF (resulting in a
much smaller file). For some subsets of PDF (specifically PDF/X
),
RGB colors are not allowed, so anyone creating documents for that profile will probably make
heavy use of this colorspace.
Typically this class will be used as follows:
Color cyan = CMYKColorSpace.getColor(1,0,0,0);
org.faceless.pdf2.DeviceCMYK
to one of the following options:
generic | A generic CMYK profile |
---|---|
swop | A fast approximation of US Web Coated (SWOP) v2 |
fogra | A fast approximation of Coated FOGRA39 from ISO12647-2:2004 |
photo | A high-contrast CMYK profile of the type used to print photos |
adobe | Conversion to RGB is done using the algorithm from the PDF specification. This generally gives oversaturated, poor results. |
ghostscript | Conversion to RGB is done using the algorithm used by GhostScript. This gives results only slightly better than the Adobe algorithm. |
PDFToImage
example
as follows:
java -Dorg.faceless.pdf2.DeviceCMYK=swop --model rgb PDFToImage altona_visual_1v2a_x3.pdf
Field Summary | |
---|---|
static Color |
BLACK
A convenient constant that represents the color black in the uncalibrated CMYK colorspace |
static ColorSpace |
GRAYSPACE
|
static Color |
WHITE
A convenient constant that represents the color white in the uncalibrated CMYK colorspace |
Fields inherited from class java.awt.color.ColorSpace |
---|
CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy |
Method Summary | |
---|---|
float[] |
fromCIEXYZ(float[] xyz)
|
float[] |
fromRGB(float[] rgb)
|
static Color |
getColor(float c,
float m,
float y,
float k)
A convenience method, returning an opaque color in the CMYK colorspace with the specified levels of cyan, magenta, yellow and black. |
static Color |
getColor(float c,
float m,
float y,
float k,
float a)
A convenience method, returning a color in the CMYK colorspace with the specified levels of cyan, magenta, yellow and black, and the specified alpha value. |
static double |
getDeltaE(ColorSpace c1,
ColorSpace c2)
Return a number representing the difference between 2 ColorSpaces. |
static CMYKColorSpace |
getInstance()
Return a CMYK Color Space |
static CMYKColorSpace |
getInstance(String type)
|
float[] |
toCIEXYZ(float[] cmyk)
|
float[] |
toRGB(float[] cmyk)
|
int[] |
toRGB(int[] cmyk,
int[] rgb)
|
Methods inherited from class java.awt.color.ColorSpace |
---|
getInstance, getMaxValue, getMinValue, getName, getNumComponents, getType, isCS_sRGB |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Color BLACK
public static final Color WHITE
public static final ColorSpace GRAYSPACE
Method Detail |
---|
public static CMYKColorSpace getInstance(String type)
public static CMYKColorSpace getInstance()
public float[] toRGB(float[] cmyk)
toRGB
in class ColorSpace
public int[] toRGB(int[] cmyk, int[] rgb)
public float[] fromRGB(float[] rgb)
fromRGB
in class ColorSpace
public float[] fromCIEXYZ(float[] xyz)
fromCIEXYZ
in class ColorSpace
public float[] toCIEXYZ(float[] cmyk)
toCIEXYZ
in class ColorSpace
public static Color getColor(float c, float m, float y, float k)
IllegalArgumentException
is thrown
c
- the level of cyan from 0.0 to 1.0m
- the level of magenta from 0.0 to 1.0y
- the level of yellow from 0.0 to 1.0k
- the level of black from 0.0 to 1.0
IllegalArgumentException
- if any of the parameters are outside the renage 0 <= n <= 1
public static Color getColor(float c, float m, float y, float k, float a)
IllegalArgumentException
is thrown
c
- the level of cyan from 0.0 to 1.0m
- the level of magenta from 0.0 to 1.0y
- the level of yellow from 0.0 to 1.0k
- the level of black from 0.0 to 1.0a
- the alpha level to use - 0 is transparent, 1 is opaque.
IllegalArgumentException
- if any of the parameters are outside the renage 0 <= n <= 1
public static double getDeltaE(ColorSpace c1, ColorSpace c2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |