Package org.openpdf.renderer.colorspace
Class CMYKColorSpace
java.lang.Object
java.awt.color.ColorSpace
org.openpdf.renderer.colorspace.CMYKColorSpace
- All Implemented Interfaces:
Serializable
A ColorSpace for the CMYK color space.
Take from net.sf.jcgm.core.CMYKColorSpace.java
- Version:
- $Id: CMYKColorSpace.java,v 1.2 2011-01-06 12:12:21 xond Exp $
- See Also:
-
Field Summary
FieldsFields 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]fromCIEXYZ(float[] p_colorvalue) Converts to CMYK from CIEXYZ.float[]fromRGB(float[] p_rgbvalue) Converts a given RGB to CMYK.float[]normalize(float[] p_colors) Normalize ensures all color values returned are between 0 and 1.float[]toCIEXYZ(float[] p_colorvalue) Converts the CMYK color to CIEXYZ.float[]toRGB(float[] p_colorvalue) Converts CMYK colors to RGB.Methods inherited from class java.awt.color.ColorSpace
getInstance, getMaxValue, getMinValue, getName, getNumComponents, getType, isCS_sRGB
-
Field Details
-
icc
-
icc_cs
-
-
Constructor Details
-
CMYKColorSpace
public CMYKColorSpace()Create a new CMYKColorSpace Instance.
-
-
Method Details
-
fromCIEXYZ
public float[] fromCIEXYZ(float[] p_colorvalue) Converts to CMYK from CIEXYZ. We cheat here, using the RGB colorspace to do the math for us. The toCIEXYZ function has a description of how this is supposed to work, which may be implemented in the future.- Specified by:
fromCIEXYZin classColorSpace- See Also:
-
ColorSpace.fromCIEXYZ(float[])org.scantegrity.lib.CMYKColorSpace#toCIEXYZ
-
fromRGB
public float[] fromRGB(float[] p_rgbvalue) Converts a given RGB to CMYK. RGB doesn't really use black, so K will always be 0. On printers, the black should actually look dark brown. RGB (an additive space) is simply the backwards from CMY (a subtractive space), so all we do is: C = 1-R M = 1-G Y = 1-B- Specified by:
fromRGBin classColorSpace- Parameters:
p_rgbvalue- - The color to translate- Returns:
- a float[4] of the CMYK values.
- See Also:
-
toCIEXYZ
public float[] toCIEXYZ(float[] p_colorvalue) Converts the CMYK color to CIEXYZ. Because CIEXYZ is 3-component, we cheat, converting to RGB and then using the RGB colorspace function to do the conversion. Details on this colorspace are available on wikipedia: http://en.wikipedia.org/wiki/CIE_XYZ_color_space There is also an "ideal relationship" to CMYK, which might be implemented in the future (don't recall the reference we got this from, probably color.org): C = (C' - K)/(1 - K) M = (M' - K)/(1 - K) Y = (Y' - K)/(1 - K) K = Min(C', M', Y') X 41.2453 35.7580 18.0423 | 1-C' Y = 21.2671 71.5160 07.2169 | 1-M' Z 01.9334 11.9193 95.0227 | 1-Y'- Specified by:
toCIEXYZin classColorSpace- See Also:
-
toRGB
public float[] toRGB(float[] p_colorvalue) Converts CMYK colors to RGB. Note that converting back will be lossy. The formula for this is: K = 1 - K (go to additive) R = K * (1 - C) G = K * (1 - M) B = K * (1 - Y)- Specified by:
toRGBin classColorSpace- Parameters:
p_colorvalue- The color in CMYK.- See Also:
-
normalize
public float[] normalize(float[] p_colors) Normalize ensures all color values returned are between 0 and 1.- Parameters:
p_colors-- Returns:
- p_colors, with any values greater than 1 set to 1, and less than 0 set to 0.
-