Class NamedColorSpace

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

public class NamedColorSpace extends 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:
  • Constructor Details

    • NamedColorSpace

      public NamedColorSpace(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(String name, float[] xyz, String profileName, 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(String name, Color color, String profileName, 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(String name, 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 Details

    • getColorName

      public String getColorName()
      Returns the color name.
      Returns:
      the color name
    • getProfileName

      public 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 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 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 ColorSpace
    • getMaxValue

      public float getMaxValue(int component)
      Overrides:
      getMaxValue in class ColorSpace
    • getName

      public String getName(int component)
      Overrides:
      getName in class ColorSpace
    • fromCIEXYZ

      public float[] fromCIEXYZ(float[] colorvalue)
      Specified by:
      fromCIEXYZ in class ColorSpace
    • fromRGB

      public float[] fromRGB(float[] rgbvalue)
      Specified by:
      fromRGB in class ColorSpace
    • toCIEXYZ

      public float[] toCIEXYZ(float[] colorvalue)
      Specified by:
      toCIEXYZ in class ColorSpace
    • toRGB

      public float[] toRGB(float[] colorvalue)
      Specified by:
      toRGB in class ColorSpace
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object