de.matthiasmann.twl.model
Interface ColorSpace

All Known Implementing Classes:
AbstractColorSpace, ColorSpaceHSL

public interface ColorSpace

A color space used by the color selector widget. It supports a variable number of color components. It does not include an alpha channel.


Method Summary
 float[] fromRGB(int rgb)
          Converts the given RGB value into color values for this color space.
 java.lang.String getColorSpaceName()
           
 java.lang.String getComponentName(int component)
          Returns the name of the specified color component.
 java.lang.String getComponentShortName(int component)
          A short version of the component name for use in UIs.
 float getDefaultValue(int component)
          Returns the default component for the initial color
 float getMaxValue(int component)
          Returns the maximum allowed value for the specified component.
 float getMinValue(int component)
          Returns the minimum allowed value for the specified component.
 int getNumComponents()
          Returns the number of component for this model.
 int toRGB(float[] color)
          Converts the specified color into a RGB value without alpha part.
 

Method Detail

getColorSpaceName

java.lang.String getColorSpaceName()

getNumComponents

int getNumComponents()
Returns the number of component for this model. Must be >= 3.

Returns:
the number of component for this model. Must be >= 3.

getComponentName

java.lang.String getComponentName(int component)
Returns the name of the specified color component.

Parameters:
component - the color component index
Returns:
the name of the color component

getComponentShortName

java.lang.String getComponentShortName(int component)
A short version of the component name for use in UIs. For best results all short names should have the same length.

Parameters:
component - the color component index
Returns:
the name of the color component

getMinValue

float getMinValue(int component)
Returns the minimum allowed value for the specified component.

Parameters:
component - the color component index
Returns:
the minimum value

getMaxValue

float getMaxValue(int component)
Returns the maximum allowed value for the specified component.

Parameters:
component - the color component index
Returns:
the maximum value

getDefaultValue

float getDefaultValue(int component)
Returns the default component for the initial color

Parameters:
component - the color component index
Returns:
the default value

toRGB

int toRGB(float[] color)
Converts the specified color into a RGB value without alpha part. This convertion is not exact. bits 0- 7 are blue bits 8-15 are green bits 16-23 are red bits 24-31 must be 0

Parameters:
color - the color values
Returns:
the RGB value

fromRGB

float[] fromRGB(int rgb)
Converts the given RGB value into color values for this color space.

Parameters:
rgb - the RGB value
Returns:
the color values corespondig to the RGB value
See Also:
toRGB(float[])