xmlgraphics-commons 2.3

org.apache.xmlgraphics.java2d.color
Class NamedColorSpace

java.lang.Object
  extended by java.awt.color.ColorSpace
      extended by org.apache.xmlgraphics.java2d.color.NamedColorSpace
All Implemented Interfaces:
java.io.Serializable, ColorSpaceOrigin

public class NamedColorSpace
extends java.awt.color.ColorSpace
implements ColorSpaceOrigin

Implements a pseudo color space for a named color which is defined in the CIE XYZ color space. At the moment, this color space always returns the fully opaque color regardless of the single component value (tint) given to its conversion methods.

See Also:
Serialized Form

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
NamedColorSpace(java.lang.String name, java.awt.Color color)
          Creates a new named color.
NamedColorSpace(java.lang.String name, java.awt.Color color, java.lang.String profileName, java.lang.String profileURI)
          Creates a new named color.
NamedColorSpace(java.lang.String name, float[] xyz)
          Creates a new named color.
NamedColorSpace(java.lang.String name, float[] xyz, java.lang.String profileName, java.lang.String profileURI)
          Creates a new named color.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 float[] fromCIEXYZ(float[] colorvalue)
          
 float[] fromRGB(float[] rgbvalue)
          
 java.lang.String getColorName()
          Returns the color name.
 float getMaxValue(int component)
          
 float getMinValue(int component)
          
 java.lang.String getName(int component)
          
 java.lang.String getProfileName()
          Returns the name of the profile used to identify the color space in a particular context.
 java.lang.String getProfileURI()
          Returns the URI identifying the associate color profile.
 java.awt.Color getRGBColor()
          Returns an sRGB-based color representing the full-tint color defined by this named color space.
 float[] getXYZ()
          Returns the XYZ coordinates of the named color.
 int hashCode()
          
 float[] toCIEXYZ(float[] colorvalue)
          
 float[] toRGB(float[] colorvalue)
          
 java.lang.String toString()
          
 
Methods inherited from class java.awt.color.ColorSpace
getInstance, getNumComponents, getType, isCS_sRGB
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamedColorSpace

public NamedColorSpace(java.lang.String name,
                       float[] xyz)
Creates a new named color.

Parameters:
name - the color name
xyz - the CIE XYZ coordinates (valid values: 0.0f to 1.0f, although values slightly larger than 1.0f are common)

NamedColorSpace

public NamedColorSpace(java.lang.String name,
                       float[] xyz,
                       java.lang.String profileName,
                       java.lang.String profileURI)
Creates a new named color.

Parameters:
name - the color name
xyz - the CIE XYZ coordinates (valid values: 0.0f to 1.0f, although values slightly larger than 1.0f are common)
profileName - Optional profile name associated with this color space
profileURI - Optional profile URI associated with this color space

NamedColorSpace

public NamedColorSpace(java.lang.String name,
                       java.awt.Color color,
                       java.lang.String profileName,
                       java.lang.String profileURI)
Creates a new named color.

Parameters:
name - the color name
color - the color to use when the named color's specific color properties are not available.
profileName - Optional profile name associated with this color space
profileURI - Optional profile URI associated with this color space

NamedColorSpace

public NamedColorSpace(java.lang.String name,
                       java.awt.Color color)
Creates a new named color.

Parameters:
name - the color name
color - the color to use when the named color's specific color properties are not available.
Method Detail

getColorName

public java.lang.String getColorName()
Returns the color name.

Returns:
the color name

getProfileName

public java.lang.String getProfileName()
Returns the name of the profile used to identify the color space in a particular context.

Specified by:
getProfileName in interface ColorSpaceOrigin
Returns:
the profile name

getProfileURI

public java.lang.String getProfileURI()
Returns the URI identifying the associate color profile.

Specified by:
getProfileURI in interface ColorSpaceOrigin
Returns:
the profile URI

getXYZ

public float[] getXYZ()
Returns the XYZ coordinates of the named color.

Returns:
the XYZ coordinates of the named color

getRGBColor

public java.awt.Color getRGBColor()
Returns an sRGB-based color representing the full-tint color defined by this named color space.

Returns:
the sRGB color

getMinValue

public float getMinValue(int component)

Overrides:
getMinValue in class java.awt.color.ColorSpace

getMaxValue

public float getMaxValue(int component)

Overrides:
getMaxValue in class java.awt.color.ColorSpace

getName

public java.lang.String getName(int component)

Overrides:
getName in class java.awt.color.ColorSpace

fromCIEXYZ

public float[] fromCIEXYZ(float[] colorvalue)

Specified by:
fromCIEXYZ in class java.awt.color.ColorSpace

fromRGB

public float[] fromRGB(float[] rgbvalue)

Specified by:
fromRGB in class java.awt.color.ColorSpace

toCIEXYZ

public float[] toCIEXYZ(float[] colorvalue)

Specified by:
toCIEXYZ in class java.awt.color.ColorSpace

toRGB

public float[] toRGB(float[] colorvalue)

Specified by:
toRGB in class java.awt.color.ColorSpace

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

xmlgraphics-commons 2.3

Copyright 1999-2018 The Apache Software Foundation. All Rights Reserved.