Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR 216 (Maintenance Release)

java.awt.color
Class ColorSpace

java.lang.Object
  extended byjava.awt.color.ColorSpace
All Implemented Interfaces:
Serializable

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.

Note: In this Profile, the ColorSpace class only supports the sRGB color space.

sRGB is a proposed standard RGB color space. For more information, see http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .

See Also:
Serialized Form

Field Summary
static int CS_sRGB
          The sRGB color space defined at http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .
static int TYPE_RGB
          Any of the family of RGB color spaces.
 
Constructor Summary
protected ColorSpace(int type, int numcomponents)
          Constructs a ColorSpace object given a color space type and the number of components.
 
Method Summary
static ColorSpace getInstance(int colorspace)
          Returns a ColorSpace representing one of the specific predefined color spaces.
 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.
 boolean isCS_sRGB()
          Returns true if the ColorSpace is CS_sRGB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_RGB

public static final int TYPE_RGB
Any of the family of RGB color spaces.

See Also:
Constant Field Values

CS_sRGB

public static final int CS_sRGB
The sRGB color space defined at http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html .

See Also:
Constant Field Values
Constructor Detail

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 Detail

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
Returns:
The requested ColorSpace object.

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.

getType

public int getType()
Returns the color space type of this ColorSpace. 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.

getNumComponents

public int getNumComponents()
Returns the number of components of this ColorSpace.

Returns:
The number of components in this ColorSpace.

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.

JSR 216 (Maintenance Release)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 216 specification.