java.awt.color

Class ColorSpace

Implemented Interfaces:
Serializable
Known Direct Subclasses:
BogusColorSpace, ICC_ColorSpace

public abstract class ColorSpace
extends Object
implements Serializable

This abstract class is used to serve as a color space tag to identify the specific color space of a Color object or, via a ColorModel object, of an Image, a BufferedImage, or a GraphicsDevice. It contains methods that transform colors in a specific color space to/from sRGB and to/from a well-defined CIEXYZ color space.

For purposes of the methods in this class, colors are represented as arrays of color components represented as floats in a normalized range defined by each ColorSpace. For many ColorSpaces (e.g. sRGB), this range is 0.0 to 1.0. However, some ColorSpaces have components whose values have a different range. Methods are provided to inquire per component minimum and maximum normalized values.

Several variables are defined for purposes of referring to color space types (e.g. TYPE_RGB, TYPE_XYZ, etc.) and to refer to specific color spaces (e.g. CS_sRGB and CS_CIEXYZ). sRGB is a proposed standard RGB color space. For more information, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .

The purpose of the methods to transform to/from the well-defined CIEXYZ color space is to support conversions between any two color spaces at a reasonably high degree of accuracy. It is expected that particular implementations of subclasses of ColorSpace (e.g. ICC_ColorSpace) will support high performance conversion based on underlying platform color management systems.

The CS_CIEXYZ space used by the toCIEXYZ/fromCIEXYZ methods can be described as follows:

      CIEXYZ
      viewing illuminance: 200 lux
      viewing white point: CIE D50
      media white point: "that of a perfectly reflecting diffuser" -- D50 
      media black point: 0 lux or 0 Reflectance
      flare: 1 percent
      surround: 20percent of the media white point
      media description: reflection print (i.e., RLAB, Hunt viewing media)
      note: For developers creating an ICC profile for this conversion
            space, the following is applicable.  Use a simple Von Kries
            white point adaptation folded into the 3X3 matrix parameters
            and fold the flare and surround effects into the three
            one-dimensional lookup tables (assuming one uses the minimal
            model for monitors).

See Also:
ICC_ColorSpace, Serialized Form

Field Summary

static int
CS_CIEXYZ
The CIEXYZ conversion color space defined above.
static int
CS_GRAY
The built-in linear gray scale color space.
static int
CS_LINEAR_RGB
A built-in linear RGB color space.
static int
CS_PYCC
The Photo YCC conversion color space.
static int
CS_sRGB
The sRGB color space defined at http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .
static int
TYPE_2CLR
Generic 2 component color spaces.
static int
TYPE_3CLR
Generic 3 component color spaces.
static int
TYPE_4CLR
Generic 4 component color spaces.
static int
TYPE_5CLR
Generic 5 component color spaces.
static int
TYPE_6CLR
Generic 6 component color spaces.
static int
TYPE_7CLR
Generic 7 component color spaces.
static int
TYPE_8CLR
Generic 8 component color spaces.
static int
TYPE_9CLR
Generic 9 component color spaces.
static int
TYPE_ACLR
Generic 10 component color spaces.
static int
TYPE_BCLR
Generic 11 component color spaces.
static int
TYPE_CCLR
Generic 12 component color spaces.
static int
TYPE_CMY
Any of the family of CMY color spaces.
static int
TYPE_CMYK
Any of the family of CMYK color spaces.
static int
TYPE_DCLR
Generic 13 component color spaces.
static int
TYPE_ECLR
Generic 14 component color spaces.
static int
TYPE_FCLR
Generic 15 component color spaces.
static int
TYPE_GRAY
Any of the family of GRAY color spaces.
static int
TYPE_HLS
Any of the family of HLS color spaces.
static int
TYPE_HSV
Any of the family of HSV color spaces.
static int
TYPE_Lab
Any of the family of Lab color spaces.
static int
TYPE_Luv
Any of the family of Luv color spaces.
static int
TYPE_RGB
Any of the family of RGB color spaces.
static int
TYPE_XYZ
Any of the family of XYZ color spaces.
static int
TYPE_YCbCr
Any of the family of YCbCr color spaces.
static int
TYPE_Yxy
Any of the family of Yxy color spaces.

Constructor Summary

ColorSpace(int type, int numcomponents)
Constructs a ColorSpace object given a color space type and the number of components.

Method Summary

abstract float[]
fromCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in the CS_CIEXYZ conversion color space into this ColorSpace.
abstract float[]
fromRGB(float[] rgbvalue)
Transforms a color value assumed to be in the default CS_sRGB color space into this ColorSpace.
static ColorSpace
getInstance(int colorspace)
Returns a ColorSpace representing one of the specific predefined color spaces.
float
getMaxValue(int component)
Returns the maximum normalized color component value for the specified component.
float
getMinValue(int component)
Returns the minimum normalized color component value for the specified component.
String
getName(int idx)
Returns the name of the component given the component index.
int
getNumComponents()
Returns the number of components of this ColorSpace.
int
getType()
Returns the color space type of this ColorSpace (for example TYPE_RGB, TYPE_XYZ, ...).
boolean
isCS_sRGB()
Returns true if the ColorSpace is CS_sRGB.
abstract float[]
toCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into the CS_CIEXYZ conversion color space.
abstract float[]
toRGB(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CS_CIEXYZ

public static final int CS_CIEXYZ
The CIEXYZ conversion color space defined above.
Field Value:
1001

CS_GRAY

public static final int CS_GRAY
The built-in linear gray scale color space.
Field Value:
1003
Usages and Demos :

View More Examples of ColorSpace.CS_GRAY
   1: public class ColorSpaceSeparation extends ColorSpace {
   2:   private static final ColorSpace Gray = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   3: 
   4:   private ColorSpace base_;
   5:   private Function tint_;

View Full Code Here
   1:     
   2:             ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   3:             ColorConvertOp theOp = new ColorConvertOp(cs, rhs);
   4:     
   5:             dstImg = 

View Full Code Here
   1:     null,
   2:     new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null),
   3:     new RescaleOp(-1.0f, 255f, null),
   4:     new RescaleOp(1.25f, 0, null),
   5:     new LookupOp(new ByteLookupTable(0, brightenTable), null),

View Full Code Here
   1:     null,
   2:     new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null),
   3:     new RescaleOp(-1.0f, 255f, null),
   4:     new RescaleOp(1.25f, 0, null),
   5:     new LookupOp(new ByteLookupTable(0, brightenTable), null),

View Full Code Here
   1:     public static BufferedImage toGray(BufferedImage bufferedImage){        
   2:         ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   3:         ColorConvertOp op = new ColorConvertOp(cs, null);
   4:         bufferedImage = op.filter(bufferedImage, null);
   5:         return bufferedImage;

View Full Code Here

CS_LINEAR_RGB

public static final int CS_LINEAR_RGB
A built-in linear RGB color space. This space is based on the same RGB primaries as CS_sRGB, but has a linear tone reproduction curve.
Field Value:
1004
Usages and Demos :

View More Examples of ColorSpace.CS_LINEAR_RGB
   1:         if (csLinear)
   2:             return ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
   3:         else
   4:             return ColorSpace.getInstance(ColorSpace.CS_sRGB);
   5:     }

View Full Code Here
   1:     
   2:     private static ColorSpace csRGB = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
   3: 
   4:     private final double[] toYBR;
   5:     private final double[] toRGB;

View Full Code Here
   1:                 case ColorSpace.CS_sRGB:
   2:                 case ColorSpace.CS_LINEAR_RGB:
   3:                 case ColorSpace.TYPE_RGB:
   4:                     names[0] = "Red band";
   5:                     names[1] = "Green band";

View Full Code Here
   1:                 case ColorSpace.CS_sRGB:
   2:                 case ColorSpace.CS_LINEAR_RGB:
   3:                 case ColorSpace.TYPE_RGB:
   4:                     names[0] = "Red band";
   5:                     names[1] = "Green band";

View Full Code Here
   1:     private static ColorModel lrgbmodel_A = new DirectColorModel
   2:         (ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB),
   3:          32, 0xff0000, 0xFF00, 0xFF, 0xFF000000,
   4:         ...
   5:             if (dataModel.getColorSpace() ==
   6:                 ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)) {
   7:                 for (int i = 0; i < gradient.length; i++) {
   8:         ...
   9:             if (dataModel.getColorSpace() ==
  10:                 ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB)) {
  11:                 for (int j = 0; j < gradients.length; j++) {

View Full Code Here

CS_PYCC

public static final int CS_PYCC
The Photo YCC conversion color space.
Field Value:
1002

CS_sRGB

public static final int CS_sRGB
Field Value:
1000
Usages and Demos :

View More Examples of ColorSpace.CS_sRGB
   1: 
   2:     static final ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
   3:     int intent;
   4:     
   5:     public ICCColorSpaceExt(ICC_Profile p, int intent){

View Full Code Here
   1:         else
   2:             return ColorSpace.getInstance(ColorSpace.CS_sRGB);
   3:     }
   4: 
   5:     protected CachableRed convertSourceCS(CachableRed cr) {

View Full Code Here
   1: 
   2:         glAlphaColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
   3:                             new int[] {8,8,8,8},
   4:         ...
   5: 
   6:         glColorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
   7:                                                new int[] {8,8,8,0},
   8:                                                false,
   9:                                                false,

View Full Code Here
   1:             new ComponentColorModel(
   2:                 ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false,
   3:                 Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
   4: 
   5:         final BufferedImage img = new BufferedImage(cm, raster, false, null);

View Full Code Here
   1:     if( cs == null )
   2:       cs = ColorSpace.getInstance( ColorSpace.CS_sRGB );
   3: 
   4: 
   5:     return new ComponentColorModel(cs, bits, hasAlpha, false, 

View Full Code Here

TYPE_2CLR

public static final int TYPE_2CLR
Generic 2 component color spaces.
Field Value:
12
Usages and Demos :

View More Examples of ColorSpace.TYPE_2CLR
   1:                                            ICC_Profile.icSigSpace2CLR,
   2:                                            ColorSpace.TYPE_2CLR,
   3:                                            ICC_Profile.icSigSpace3CLR,
   4:                                            ColorSpace.TYPE_3CLR,
   5:                                            ICC_Profile.icSigSpace4CLR,

View Full Code Here

TYPE_3CLR

public static final int TYPE_3CLR
Generic 3 component color spaces.
Field Value:
13
Usages and Demos :

View More Examples of ColorSpace.TYPE_3CLR
   1:                                            ICC_Profile.icSigSpace3CLR,
   2:                                            ColorSpace.TYPE_3CLR,
   3:                                            ICC_Profile.icSigSpace4CLR,
   4:                                            ColorSpace.TYPE_4CLR,
   5:                                            ICC_Profile.icSigSpace5CLR,

View Full Code Here

TYPE_4CLR

public static final int TYPE_4CLR
Generic 4 component color spaces.
Field Value:
14
Usages and Demos :

View More Examples of ColorSpace.TYPE_4CLR
   1:                                            ICC_Profile.icSigSpace4CLR,
   2:                                            ColorSpace.TYPE_4CLR,
   3:                                            ICC_Profile.icSigSpace5CLR,
   4:                                            ColorSpace.TYPE_5CLR,
   5:                                            ICC_Profile.icSigSpace6CLR,

View Full Code Here

TYPE_5CLR

public static final int TYPE_5CLR
Generic 5 component color spaces.
Field Value:
15
Usages and Demos :

View More Examples of ColorSpace.TYPE_5CLR
   1:                                            ICC_Profile.icSigSpace5CLR,
   2:                                            ColorSpace.TYPE_5CLR,
   3:                                            ICC_Profile.icSigSpace6CLR,
   4:                                            ColorSpace.TYPE_6CLR,
   5:                                            ICC_Profile.icSigSpace7CLR,

View Full Code Here

TYPE_6CLR

public static final int TYPE_6CLR
Generic 6 component color spaces.
Field Value:
16
Usages and Demos :

View More Examples of ColorSpace.TYPE_6CLR
   1:                                            ICC_Profile.icSigSpace6CLR,
   2:                                            ColorSpace.TYPE_6CLR,
   3:                                            ICC_Profile.icSigSpace7CLR,
   4:                                            ColorSpace.TYPE_7CLR,
   5:                                            ICC_Profile.icSigSpace8CLR,

View Full Code Here

TYPE_7CLR

public static final int TYPE_7CLR
Generic 7 component color spaces.
Field Value:
17
Usages and Demos :

View More Examples of ColorSpace.TYPE_7CLR
   1:                                            ICC_Profile.icSigSpace7CLR,
   2:                                            ColorSpace.TYPE_7CLR,
   3:                                            ICC_Profile.icSigSpace8CLR,
   4:                                            ColorSpace.TYPE_8CLR,
   5:                                            ICC_Profile.icSigSpace9CLR,

View Full Code Here

TYPE_8CLR

public static final int TYPE_8CLR
Generic 8 component color spaces.
Field Value:
18
Usages and Demos :

View More Examples of ColorSpace.TYPE_8CLR
   1:                                            ICC_Profile.icSigSpace8CLR,
   2:                                            ColorSpace.TYPE_8CLR,
   3:                                            ICC_Profile.icSigSpace9CLR,
   4:                                            ColorSpace.TYPE_9CLR,
   5:                                            ICC_Profile.icSigSpaceACLR,

View Full Code Here

TYPE_9CLR

public static final int TYPE_9CLR
Generic 9 component color spaces.
Field Value:
19
Usages and Demos :

View More Examples of ColorSpace.TYPE_9CLR
   1:                                            ICC_Profile.icSigSpace9CLR,
   2:                                            ColorSpace.TYPE_9CLR,
   3:                                            ICC_Profile.icSigSpaceACLR,
   4:                                            ColorSpace.TYPE_ACLR,
   5:                                            ICC_Profile.icSigSpaceBCLR,

View Full Code Here

TYPE_ACLR

public static final int TYPE_ACLR
Generic 10 component color spaces.
Field Value:
20
Usages and Demos :

View More Examples of ColorSpace.TYPE_ACLR
   1:                                            ICC_Profile.icSigSpaceACLR,
   2:                                            ColorSpace.TYPE_ACLR,
   3:                                            ICC_Profile.icSigSpaceBCLR,
   4:                                            ColorSpace.TYPE_BCLR,
   5:                                            ICC_Profile.icSigSpaceCCLR,

View Full Code Here

TYPE_BCLR

public static final int TYPE_BCLR
Generic 11 component color spaces.
Field Value:
21
Usages and Demos :

View More Examples of ColorSpace.TYPE_BCLR
   1:                                            ICC_Profile.icSigSpaceBCLR,
   2:                                            ColorSpace.TYPE_BCLR,
   3:                                            ICC_Profile.icSigSpaceCCLR,
   4:                                            ColorSpace.TYPE_CCLR,
   5:                                            ICC_Profile.icSigSpaceDCLR,

View Full Code Here

TYPE_CCLR

public static final int TYPE_CCLR
Generic 12 component color spaces.
Field Value:
22
Usages and Demos :

View More Examples of ColorSpace.TYPE_CCLR
   1:                                            ICC_Profile.icSigSpaceCCLR,
   2:                                            ColorSpace.TYPE_CCLR,
   3:                                            ICC_Profile.icSigSpaceDCLR,
   4:                                            ColorSpace.TYPE_DCLR,
   5:                                            ICC_Profile.icSigSpaceECLR,

View Full Code Here

TYPE_CMY

public static final int TYPE_CMY
Any of the family of CMY color spaces.
Field Value:
11
Usages and Demos :

View More Examples of ColorSpace.TYPE_CMY
   1:             }
   2:             case ColorSpace.TYPE_CMY:
   3:             case ColorSpace.TYPE_CMYK: {
   4:                 switch (band) {
   5:                     case  0: return CYAN_BAND;

View Full Code Here
   1:                                            ICC_Profile.icSigCmyData,
   2:                                            ColorSpace.TYPE_CMY,
   3:                                            ICC_Profile.icSigSpace2CLR,
   4:                                            ColorSpace.TYPE_2CLR,
   5:                                            ICC_Profile.icSigSpace3CLR,

View Full Code Here
   1:                     break;
   2:                 case ColorSpace.TYPE_CMY:
   3:                     names[0] = "Cyan band";
   4:                     names[1] = "Magenta band";
   5:                     names[2] = "Yellow band";

View Full Code Here
   1:             }
   2:             case ColorSpace.TYPE_CMY:
   3:             case ColorSpace.TYPE_CMYK: {
   4:                 switch (band) {
   5:                     case  0: return ColorInterpretation.CYAN_BAND;

View Full Code Here
   1:                     break;
   2:                 case ColorSpace.TYPE_CMY:
   3:                     names[0] = "Cyan band";
   4:                     names[1] = "Magenta band";
   5:                     names[2] = "Yellow band";

View Full Code Here

TYPE_CMYK

public static final int TYPE_CMYK
Any of the family of CMYK color spaces.
Field Value:
9
Usages and Demos :

View More Examples of ColorSpace.TYPE_CMYK
   1:             case ColorSpace.TYPE_CMY:
   2:             case ColorSpace.TYPE_CMYK: {
   3:                 switch (band) {
   4:                     case  0: return CYAN_BAND;
   5:                     case  1: return MAGENTA_BAND;

View Full Code Here
   1:                                            ICC_Profile.icSigCmykData,
   2:                                            ColorSpace.TYPE_CMYK,
   3:                                            ICC_Profile.icSigCmyData,
   4:                                            ColorSpace.TYPE_CMY,
   5:                                            ICC_Profile.icSigSpace2CLR,

View Full Code Here
   1:                     break;
   2:                 case ColorSpace.TYPE_CMYK:
   3:                     names[0] = "Cyan band";
   4:                     names[1] = "Magenta band";
   5:                     names[2] = "Yellow band";

View Full Code Here
   1:             case ColorSpace.TYPE_CMY:
   2:             case ColorSpace.TYPE_CMYK: {
   3:                 switch (band) {
   4:                     case  0: return ColorInterpretation.CYAN_BAND;
   5:                     case  1: return ColorInterpretation.MAGENTA_BAND;

View Full Code Here
   1:                     break;
   2:                 case ColorSpace.TYPE_CMYK:
   3:                     names[0] = "Cyan band";
   4:                     names[1] = "Magenta band";
   5:                     names[2] = "Yellow band";

View Full Code Here

TYPE_DCLR

public static final int TYPE_DCLR
Generic 13 component color spaces.
Field Value:
23
Usages and Demos :

View More Examples of ColorSpace.TYPE_DCLR
   1:                                            ICC_Profile.icSigSpaceDCLR,
   2:                                            ColorSpace.TYPE_DCLR,
   3:                                            ICC_Profile.icSigSpaceECLR,
   4:                                            ColorSpace.TYPE_ECLR,
   5:                                            ICC_Profile.icSigSpaceFCLR,

View Full Code Here

TYPE_ECLR

public static final int TYPE_ECLR
Generic 14 component color spaces.
Field Value:
24
Usages and Demos :

View More Examples of ColorSpace.TYPE_ECLR
   1:                                            ICC_Profile.icSigSpaceECLR,
   2:                                            ColorSpace.TYPE_ECLR,
   3:                                            ICC_Profile.icSigSpaceFCLR,
   4:                                            ColorSpace.TYPE_FCLR
   5:                                          };

View Full Code Here

TYPE_FCLR

public static final int TYPE_FCLR
Generic 15 component color spaces.
Field Value:
25

TYPE_GRAY

public static final int TYPE_GRAY
Any of the family of GRAY color spaces.
Field Value:
6
Usages and Demos :

View More Examples of ColorSpace.TYPE_GRAY
   1:         switch (model.getColorSpace().getType()) {
   2:             case ColorSpace.TYPE_GRAY: {
   3:                 switch (band) {
   4:                     case  0: return GRAY_INDEX;
   5:                     default: return UNDEFINED;

View Full Code Here
   1:                                            ICC_Profile.icSigGrayData,
   2:                                            ColorSpace.TYPE_GRAY,
   3:                                            ICC_Profile.icSigHsvData,
   4:                                            ColorSpace.TYPE_HSV,
   5:                                            ICC_Profile.icSigHlsData,

View Full Code Here
   1:                 case ColorSpace.CS_GRAY:
   2:                 case ColorSpace.TYPE_GRAY:
   3:                     names[0] = "grayscale band";
   4:                     break;
   5:                 case ColorSpace.CS_sRGB:

View Full Code Here
   1:         switch (model.getColorSpace().getType()) {
   2:             case ColorSpace.TYPE_GRAY: {
   3:                 switch (band) {
   4:                     case  0: return ColorInterpretation.GRAY_INDEX;
   5:                     default: return ColorInterpretation.UNDEFINED;

View Full Code Here
   1:                 case ColorSpace.CS_GRAY:
   2:                 case ColorSpace.TYPE_GRAY:
   3:                     names[0] = "grayscale band";
   4:                     break;
   5:                 case ColorSpace.CS_sRGB:

View Full Code Here

TYPE_HLS

public static final int TYPE_HLS
Any of the family of HLS color spaces.
Field Value:
8
Usages and Demos :

View More Examples of ColorSpace.TYPE_HLS
   1:                                            ICC_Profile.icSigHlsData,
   2:                                            ColorSpace.TYPE_HLS,
   3:                                            ICC_Profile.icSigCmykData,
   4:                                            ColorSpace.TYPE_CMYK,
   5:                                            ICC_Profile.icSigCmyData,

View Full Code Here

TYPE_HSV

public static final int TYPE_HSV
Any of the family of HSV color spaces.
Field Value:
7
Usages and Demos :

View More Examples of ColorSpace.TYPE_HSV
   1:             }
   2:             case ColorSpace.TYPE_HSV: {
   3:                 switch (band) {
   4:                     case  0: return HUE_BAND;
   5:                     case  1: return SATURATION_BAND;

View Full Code Here
   1:                                            ICC_Profile.icSigHsvData,
   2:                                            ColorSpace.TYPE_HSV,
   3:                                            ICC_Profile.icSigHlsData,
   4:                                            ColorSpace.TYPE_HLS,
   5:                                            ICC_Profile.icSigCmykData,

View Full Code Here
   1:             }
   2:             case ColorSpace.TYPE_HSV: {
   3:                 switch (band) {
   4:                     case  0: return ColorInterpretation.HUE_BAND;
   5:                     case  1: return ColorInterpretation.SATURATION_BAND;

View Full Code Here

TYPE_Lab

public static final int TYPE_Lab
Any of the family of Lab color spaces.
Field Value:
1
Usages and Demos :

View More Examples of ColorSpace.TYPE_Lab
   1:         inputLab = false;
   2:         outputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab);
   3:         break;
   4:         ...
   5:           useMatrix = true;
   6:         inputLab = (profile.getPCSType() == ColorSpace.TYPE_Lab);
   7:         outputLab = false;
   8:         break;
   9:       default:

View Full Code Here
   1:                                            ICC_Profile.icSigLabData,
   2:                                            ColorSpace.TYPE_Lab,
   3:                                            ICC_Profile.icSigLuvData,
   4:         ...
   5:         if (pcsSig == ICC_Profile.icSigLabData)
   6:           profileColorSpace = ColorSpace.TYPE_Lab;
   7:       }
   8:     else
   9:       {

View Full Code Here
   1:                 break;
   2:             case ColorSpace.TYPE_Lab:
   3:                 imageType = TIFF_CIELAB;
   4:                 break;
   5:             case ColorSpace.TYPE_RGB:

View Full Code Here

TYPE_Luv

public static final int TYPE_Luv
Any of the family of Luv color spaces.
Field Value:
2
Usages and Demos :

View More Examples of ColorSpace.TYPE_Luv
   1:                                            ICC_Profile.icSigLuvData,
   2:                                            ColorSpace.TYPE_Luv,
   3:                                            ICC_Profile.icSigYCbCrData,
   4:                                            ColorSpace.TYPE_YCbCr,
   5:                                            ICC_Profile.icSigYxyData,

View Full Code Here

TYPE_RGB

public static final int TYPE_RGB
Any of the family of RGB color spaces.
Field Value:
5
Usages and Demos :

View More Examples of ColorSpace.TYPE_RGB
   1:             }
   2:             case ColorSpace.TYPE_RGB: {
   3:                 switch (band) {
   4:                     case  0: return RED_BAND;
   5:                     case  1: return GREEN_BAND;

View Full Code Here
   1:                                            ICC_Profile.icSigRgbData,
   2:                                            ColorSpace.TYPE_RGB,
   3:                                            ICC_Profile.icSigGrayData,
   4:                                            ColorSpace.TYPE_GRAY,
   5:                                            ICC_Profile.icSigHsvData,

View Full Code Here
   1:                 case ColorSpace.CS_LINEAR_RGB:
   2:                 case ColorSpace.TYPE_RGB:
   3:                     names[0] = "Red band";
   4:                     names[1] = "Green band";
   5:                     names[2] = "Blue band";

View Full Code Here
   1:             }
   2:             case ColorSpace.TYPE_RGB: {
   3:                 switch (band) {
   4:                     case  0: return ColorInterpretation.RED_BAND;
   5:                     case  1: return ColorInterpretation.GREEN_BAND;

View Full Code Here
   1:                 case ColorSpace.CS_LINEAR_RGB:
   2:                 case ColorSpace.TYPE_RGB:
   3:                     names[0] = "Red band";
   4:                     names[1] = "Green band";
   5:                     names[2] = "Blue band";

View Full Code Here

TYPE_XYZ

public static final int TYPE_XYZ
Any of the family of XYZ color spaces.
Field Value:
0
Usages and Demos :

View More Examples of ColorSpace.TYPE_XYZ
   1:                                            ICC_Profile.icSigXYZData,
   2:                                            ColorSpace.TYPE_XYZ,
   3:                                            ICC_Profile.icSigLabData,
   4:         ...
   5:         if (pcsSig == ICC_Profile.icSigXYZData)
   6:           profileColorSpace = ColorSpace.TYPE_XYZ;
   7:         if (pcsSig == ICC_Profile.icSigLabData)
   8:           profileColorSpace = ColorSpace.TYPE_Lab;
   9:       }

View Full Code Here

TYPE_YCbCr

public static final int TYPE_YCbCr
Any of the family of YCbCr color spaces.
Field Value:
3
Usages and Demos :

View More Examples of ColorSpace.TYPE_YCbCr
   1:   public YCbCr_ColorSpace() {
   2:     super(ColorSpace.TYPE_YCbCr, 3);
   3:   }
   4: 
   5:   public float[] fromCIEXYZ(float[] data) {

View Full Code Here
   1:                                            ICC_Profile.icSigYCbCrData,
   2:                                            ColorSpace.TYPE_YCbCr,
   3:                                            ICC_Profile.icSigYxyData,
   4:                                            ColorSpace.TYPE_Yxy,
   5:                                            ICC_Profile.icSigRgbData,

View Full Code Here
   1:                 break;
   2:             case ColorSpace.TYPE_YCbCr:
   3:                 imageType = TIFF_YCBCR;
   4:                 break;
   5:             default:

View Full Code Here

TYPE_Yxy

public static final int TYPE_Yxy
Any of the family of Yxy color spaces.
Field Value:
4
Usages and Demos :

View More Examples of ColorSpace.TYPE_Yxy
   1:                                            ICC_Profile.icSigYxyData,
   2:                                            ColorSpace.TYPE_Yxy,
   3:                                            ICC_Profile.icSigRgbData,
   4:                                            ColorSpace.TYPE_RGB,
   5:                                            ICC_Profile.icSigGrayData,

View Full Code Here

Constructor Details

ColorSpace

protected ColorSpace(int type,
                     int numcomponents)
Constructs a ColorSpace object given a color space type and the number of components.
Parameters:
type - one of the ColorSpace type constants
numcomponents - the number of components in the color space

Method Details

fromCIEXYZ

public abstract float[] fromCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in the CS_CIEXYZ conversion color space into this ColorSpace.

This method transforms color values using relative colorimetry, as defined by the International Color Consortium standard. This means that the XYZ argument values taken by this method are represented relative to the D50 white point of the CS_CIEXYZ color space. This representation is useful in a two-step color conversion process in which colors are transformed from an input color space to CS_CIEXYZ and then to an output color space. The color values returned by this method are not those that would produce the XYZ value passed to the method when measured by a colorimeter. If you have XYZ values corresponding to measurements made using current CIE recommended practices, they must be converted to D50 relative values before being passed to this method. See the fromCIEXYZ method of ICC_ColorSpace for further information.

Parameters:
colorvalue - a float array with length of at least 3
Returns:
a float array with length equal to the number of components in this ColorSpace
Throws:
ArrayIndexOutOfBoundsException - if array length is not at least 3
Usages and Demos :

View More Examples of fromCIEXYZ(float[] colorvalue)
   1: import java.awt.Color;
   2: import java.awt.color.ColorSpace;
   3: 
   4:         ...
   5: 
   6: public class ColorSpaceSeparation extends ColorSpace {
   7:         ...
   8:   private static final ColorSpace Gray = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   9: 
  10:         ...
  11:   public float[] fromCIEXYZ(float[] colorvalue) {
  12:     return Gray.fromCIEXYZ(invert(colorvalue));

View Full Code Here
   1: 
   2: import java.awt.color.ColorSpace;
   3: import java.awt.color.ICC_ColorSpace;
   4:         ...
   5: 
   6:     static final ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
   7:     int intent;
   8:         ...
   9:         float[] ciexyz = toCIEXYZ(values);
  10:         return sRGB.fromCIEXYZ(ciexyz);
  11:     }

View Full Code Here

fromRGB

public abstract float[] fromRGB(float[] rgbvalue)
Transforms a color value assumed to be in the default CS_sRGB color space into this ColorSpace.

This method transforms color values using algorithms designed to produce the best perceptual match between input and output colors. In order to do colorimetric conversion of color values, you should use the toCIEXYZ method of the CS_sRGB color space to first convert from the input color space to the CS_CIEXYZ color space, and then use the fromCIEXYZ method of this color space to convert from CS_CIEXYZ to the output color space. See toCIEXYZ and fromCIEXYZ for further information.

Parameters:
rgbvalue - a float array with length of at least 3
Returns:
a float array with length equal to the number of components in this ColorSpace
Throws:
ArrayIndexOutOfBoundsException - if array length is not at least 3
Usages and Demos :

View More Examples of fromRGB(float[] rgbvalue)
   1: import java.awt.Color;
   2: import java.awt.color.ColorSpace;
   3: 
   4:         ...
   5: 
   6: public class ColorSpaceSeparation extends ColorSpace {
   7:         ...
   8:   private static final ColorSpace Gray = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   9: 
  10:         ...
  11:   public float[] fromRGB(float[] rgbvalue) {
  12:     return Gray.fromRGB(invert(rgbvalue));

View Full Code Here

getInstance

public static ColorSpace getInstance(int colorspace)
Returns a ColorSpace representing one of the specific predefined color spaces.
Parameters:
colorspace - a specific color space identified by one of the predefined class constants (e.g. CS_sRGB, CS_LINEAR_RGB, CS_CIEXYZ, CS_GRAY, or CS_PYCC)
Returns:
the requested ColorSpace object
Usages and Demos :

View More Examples of getInstance(int colorspace)
   1: 
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     public ColorSpace getOperationColorSpace() {
   7:         if (csLinear)
   8:         ...
   9:             return ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
  10:         else
  11:         ...
  12:             return ColorSpace.getInstance(ColorSpace.CS_sRGB);

View Full Code Here
   1: import java.awt.Transparency;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5:         int dataType;
   6:         int colorSpace;
   7:         if (samples == 3) {
   8:         ...
   9:             dataType = DataBuffer.TYPE_BYTE;
  10:             colorSpace = ColorSpace.CS_sRGB;
  11:         } else {
  12:         ...
  13:         ColorModel cm = new ComponentColorModel(
  14:                 ColorSpace.getInstance(colorSpace), sm.getSampleSize(),

View Full Code Here
   1: import java.awt.Transparency;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5:             new ComponentColorModel(
   6:                 ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false,
   7:                 Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
   8: 
   9:         final BufferedImage img = new BufferedImage(cm, raster, false, null);

View Full Code Here
   1:     ComponentColorModel ccm = new ComponentColorModel(
   2:     ColorSpace.getInstance(ColorSpace.CS_sRGB),
   3:     new int[] {8,8,8},
   4:     false,
   5:     Transparency.OPAQUE,

View Full Code Here
   1: import java.awt.Transparency;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.BandedSampleModel;
   4:         ...
   5:         final ColorModel   colorModel;
   6:         final ColorSpace   colorSpace = getColorSpace(numBands);
   7:         if (model!=null) {
   8:         ...
   9:         if (numBands==1) {
  10:             return ColorSpace.getInstance(ColorSpace.CS_GRAY);
  11:         }

View Full Code Here

getMaxValue

public float getMaxValue(int component)
Returns the maximum normalized color component value for the specified component. The default implementation in this abstract class returns 1.0 for all components. Subclasses should override this method if necessary.
Parameters:
component - the component index
Returns:
the maximum normalized component value
Throws:
IllegalArgumentException - if component is less than 0 or greater than numComponents - 1
Since:
1.4

getMinValue

public float getMinValue(int component)
Returns the minimum normalized color component value for the specified component. The default implementation in this abstract class returns 0.0 for all components. Subclasses should override this method if necessary.
Parameters:
component - the component index
Returns:
the minimum normalized component value
Throws:
IllegalArgumentException - if component is less than 0 or greater than numComponents - 1
Since:
1.4

getName

public String getName(int idx)
Returns the name of the component given the component index.
Parameters:
idx - the component index
Returns:
the name of the component at the specified index
Throws:
IllegalArgumentException - if idx is less than 0 or greater than numComponents - 1

getNumComponents

public int getNumComponents()
Returns the number of components of this ColorSpace.
Returns:
The number of components in this ColorSpace.
Usages and Demos :

View More Examples of getNumComponents()
   1: import jp.ujihara.java.awt.Transparency;
   2: import jp.ujihara.java.awt.color.ColorSpace;
   3: import jp.ujihara.java.lang.reflect.Constructor;
   4:         ...
   5:   int[] bits;
   6:   ColorSpace cspace;
   7:   int transparency;
   8:         ...
   9: 
  10:   protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
  11:                        boolean hasAlpha, boolean isAlphaPremultiplied,
  12:         ...
  13:     
  14:     if ((bits.length < cspace.getNumComponents())

View Full Code Here
   1: 
   2: import jp.ujihara.java.awt.color.ColorSpace;
   3: import jp.ujihara.java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:   private final ColorSpace cs;
   7: 
   8:         ...
   9: 
  10:   public Color(ColorSpace space, float[] components, float alpha)
  11:   {
  12:         ...
  13:   {
  14:     int numComponents = cs == null ? 3 : cs.getNumComponents();

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5:                                 Rectangle       devRect,
   6:                                 ColorSpace      cs,
   7:                                 boolean         alpha) {
   8:         ...
   9: 
  10:         int nChannels = cs.getNumComponents();
  11:         if (alpha) nChannels++;

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5: 
   6:             ColorSpace colorSpace = colorModel.getColorSpace();
   7: 
   8:         ...
   9:             } else if(numBands > 1) {
  10:                 numExtraSamples = numBands - colorSpace.getNumComponents();
  11:             }

View Full Code Here

getType

public int getType()
Returns the color space type of this ColorSpace (for example TYPE_RGB, TYPE_XYZ, ...). The type defines the number of components of the color space and the interpretation, e.g. TYPE_RGB identifies a color space with three components - red, green, and blue. It does not define the particular color characteristics of the space, e.g. the chromaticities of the primaries.
Returns:
the type constant that represents the type of this ColorSpace
Usages and Demos :

View More Examples of getType()
   1: import java.awt.Rectangle;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5:         } else {
   6:             final ColorSpace cs = cm.getColorSpace();
   7: 
   8:         ...
   9:             } else {
  10:                 final int type = cs.getType();
  11:                 switch (type) {
  12:         ...
  13:                 case ColorSpace.CS_GRAY:

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5:         } else {
   6:             final ColorSpace cs = cm.getColorSpace();
   7: 
   8:         ...
   9:             } else {
  10:                 final int type = cs.getType();
  11:                 switch (type) {
  12:         ...
  13:                 case ColorSpace.CS_GRAY:

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.font.FontRenderContext;
   4:         ...
   5:         (xform == null 
   6:          || xform.getType() == AffineTransform.TYPE_IDENTITY 
   7:         ...
   8:          || xform.getType() == AffineTransform.TYPE_TRANSLATION)
   9:         ) 
  10:         ...
  11:     
  12:     ColorSpace cs = cm.getColorSpace ();

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.color.ColorSpace;
   3: import java.awt.image.BufferedImage;
   4:         ...
   5: 
   6:             ColorSpace colorSpace = colorModel.getColorSpace();
   7: 
   8:         ...
   9:             switch(colorSpace.getType()) {
  10:             case ColorSpace.TYPE_CMYK:
  11:         ...
  12:                    colorModel != null &&
  13:                    colorModel.getColorSpace().getType() ==

View Full Code Here

isCS_sRGB

public boolean isCS_sRGB()
Returns true if the ColorSpace is CS_sRGB.
Returns:
true if this is a CS_sRGB color space, false if it is not

toCIEXYZ

public abstract float[] toCIEXYZ(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into the CS_CIEXYZ conversion color space.

This method transforms color values using relative colorimetry, as defined by the International Color Consortium standard. This means that the XYZ values returned by this method are represented relative to the D50 white point of the CS_CIEXYZ color space. This representation is useful in a two-step color conversion process in which colors are transformed from an input color space to CS_CIEXYZ and then to an output color space. This representation is not the same as the XYZ values that would be measured from the given color value by a colorimeter. A further transformation is necessary to compute the XYZ values that would be measured using current CIE recommended practices. See the toCIEXYZ method of ICC_ColorSpace for further information.

Parameters:
colorvalue - a float array with length of at least the number of components in this ColorSpace
Returns:
a float array of length 3
Throws:
ArrayIndexOutOfBoundsException - if array length is not at least the number of components in this ColorSpace.
Usages and Demos :

View More Examples of toCIEXYZ(float[] colorvalue)
   1: import java.awt.Color;
   2: import java.awt.color.ColorSpace;
   3: 
   4:         ...
   5: 
   6: public class ColorSpaceSeparation extends ColorSpace {
   7:         ...
   8:   private static final ColorSpace Gray = ColorSpace.getInstance(ColorSpace.CS_GRAY);
   9: 
  10:         ...
  11:   public float[] toCIEXYZ(float[] colorvalue) {
  12:     return Gray.toCIEXYZ(invert(colorvalue));

View Full Code Here
   1: 
   2: import java.awt.color.ColorSpace;
   3: 
   4:         ...
   5: public final class SimpleYBRColorSpace extends ColorSpace {
   6:     private static double[] TO_YBR_FULL = {
   7:         ...
   8:     
   9:     private static ColorSpace csRGB = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
  10: 
  11:         ...
  12:     public float[] toCIEXYZ(float[] colorvalue) {
  13:         return csRGB.toCIEXYZ(toRGB(colorvalue));

View Full Code Here

toRGB

public abstract float[] toRGB(float[] colorvalue)
Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space.

This method transforms color values using algorithms designed to produce the best perceptual match between input and output colors. In order to do colorimetric conversion of color values, you should use the toCIEXYZ method of this color space to first convert from the input color space to the CS_CIEXYZ color space, and then use the fromCIEXYZ method of the CS_sRGB color space to convert from CS_CIEXYZ to the output color space. See toCIEXYZ and fromCIEXYZ for further information.

Parameters:
colorvalue - a float array with length of at least the number of components in this ColorSpace
Returns:
a float array of length 3
Throws:
ArrayIndexOutOfBoundsException - if array length is not at least the number of components in this ColorSpace