|
||||||||||
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.SpotColorSpace
public final class SpotColorSpace
A type of ColorSpace dealing with Separation ("Spot") Colors.
Spot colors are used to define an exact color in the printed output. This is usually done by printing these colors using a matching ink onto a separate film, ink which may be outside the gamut of the normal CMYK printing process. Commonly used Spot colors include those from the PANTONE™ and Focoltone™ range of colors.
Every Spot colorspace has a name, which is the name used by the printer to identify the ink. Because not every output device may have the specified ink available (displaying the PDF on screen for example), every Spot color must have a "fallback" color specified as a process color (RGB or CMYK) as well. Remembering that not every spot color can be reproduced in CMYK, the fallback color is often just a close match.
Like normal colorspaces (RGB, CMYK and so on), different colors can be specified within this space, although they will all be just a different intensity of the specified ink - ranging from zero (no ink is applied) to one (the full intensity of the specified color is applied).
Here's an example showing how to use the PANTONE™ color "PANTONE Reflex Blue" to print a line of text.
Color fallback = CYMKColorSpace.getColor(1.0, 0.72, 0, 0.06); SpotColorSpace blueink = new SpotColorSpace("PANTONE Reflex Blue CVC", fallback); Color logoblue = blueink.getColor(1); PDFStyle style = new PDFStyle(); style.setFillColor(logoblue); page.setStyle(style); page.drawText("This is in PANTONE Reflex Blue CVC", 100, 100);
Note the three stages. First we create the fallback color, specified in CMYK. As it happens this spot color is outside the gamut of the CMYK colorspace, so our fallback is an approximation only. Then we create the colorspace, and finally we select a color which is this ink at 100% intensity. From there we can just use the color as normal.
The special color "All" can be used to create a "registration color" - objects drawn in this color will appear on all plates, including the process color plates, and this feature is commonly used for printer marks.
In the PDF specification Spot color is referred to as a "Separation" color.
Field Summary |
---|
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 |
Constructor Summary | |
---|---|
SpotColorSpace(String name,
Color color)
Create a new SpotColorSpace representing a single custom ink. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
float[] |
fromCIEXYZ(float[] xyz)
Theoretically transforms a color value assumed to be in the XYZ ColorSpace into values in this ColorSpace. |
float[] |
fromRGB(float[] rgb)
Theoretically transforms a color value assumed to be in the sRGB ColorSpace into values in this ColorSpace. |
Color |
getColor()
A convenience method returning the color specified by the full intensity of this colorspace. |
Color |
getColor(float amt)
A convenience method to return a color from this ColorSpace. |
Color |
getColor(float amt,
float alpha)
A convenience method to return a color from this ColorSpace. |
String |
getName()
Get the name of this colorspace |
String |
getName(int i)
Returns the name of the component given the component index. |
int |
getNumComponents()
Returns the number of components of this ColorSpace. |
int |
hashCode()
|
float[] |
toCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into the CIEXUZ values. |
float[] |
toRGB(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space. |
int[] |
toRGB(int[] in,
int[] out)
|
String |
toString()
|
Methods inherited from class java.awt.color.ColorSpace |
---|
getInstance, getMaxValue, getMinValue, getType, isCS_sRGB |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpotColorSpace(String name, Color color)
name
- the name of the inkcolor
- the color to use as a fallback color if this ink is
not available. Must be from either an RGB, CMYK or Grayscale
ColorSpace, or an IllegalArgumentException is thrown.Method Detail |
---|
public int[] toRGB(int[] in, int[] out)
public String getName()
public Color getColor()
public Color getColor(float amt)
amt
- The intensity of the color. Any value between zero and
one, where zero means no ink at all and one means the full intensity.
If the number is outside this range, an IllegalArgumentException
is thrown
IllegalArgumentException
public Color getColor(float amt, float alpha)
amt
- The intensity of the color. Any value between zero and
one, where zero means no ink at all and one means the full intensity.
If the number is outside this range, an IllegalArgumentException
is thrownalpha
- the alpha value of this color - 0 meaning transparent, 1 meaning opaque.
If the number is outside this range, an IllegalArgumentException is thrown
IllegalArgumentException
public String getName(int i)
getName
in class ColorSpace
i
- the component index
public int getNumComponents()
getNumComponents
in class ColorSpace
public String toString()
toString
in class Object
public float[] toRGB(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into a value in the
default CS_sRGB color space. Calls toRGB
on the fallback colorspace.
toRGB
in class ColorSpace
colorvalue
- a float array with length of at least the number of components in this ColorSpace
public float[] toCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into the CIEXUZ values.
Calls toCIEXYZ
on the fallback colorspace.
toCIEXYZ
in class ColorSpace
colorvalue
- a float array with length of at least the number of components in this ColorSpace
public float[] fromRGB(float[] rgb)
Theoretically transforms a color value assumed to be in the sRGB ColorSpace into values in this ColorSpace. In practice this can't easily be done and isn't useful, so throws an UnsupportedOperationException.
fromRGB
in class ColorSpace
rgb
- a float array with length of at least 3public float[] fromCIEXYZ(float[] xyz)
Theoretically transforms a color value assumed to be in the XYZ ColorSpace into values in this ColorSpace. In practice this can't easily be done and isn't useful, so throws an UnsupportedOperationException.
fromCIEXYZ
in class ColorSpace
xyz
- a float array with length of at least 3public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |