de.matthiasmann.twl.model
Class ColorSpaceHSL

java.lang.Object
  extended by de.matthiasmann.twl.model.AbstractColorSpace
      extended by de.matthiasmann.twl.model.ColorSpaceHSL
All Implemented Interfaces:
ColorSpace

public class ColorSpaceHSL
extends AbstractColorSpace

A HSL (Hue, Saturation and Luminance) color space Hue is represented in degree from 0 to 360 Saturation and Luminance in percent from 0 to 100


Constructor Summary
ColorSpaceHSL()
           
 
Method Summary
 float[] fromRGB(int rgb)
          Converts the given RGB value into color values for this color space.
 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.
 int toRGB(float[] color)
          Converts the specified color into a RGB value without alpha part.
 
Methods inherited from class de.matthiasmann.twl.model.AbstractColorSpace
getColorSpaceName, getComponentName, getMinValue, getNumComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorSpaceHSL

public ColorSpaceHSL()
Method Detail

getComponentShortName

public java.lang.String getComponentShortName(int component)
Description copied from interface: ColorSpace
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

getMaxValue

public float getMaxValue(int component)
Description copied from interface: ColorSpace
Returns the maximum allowed value for the specified component.

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

getDefaultValue

public float getDefaultValue(int component)
Description copied from interface: ColorSpace
Returns the default component for the initial color

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

fromRGB

public float[] fromRGB(int rgb)
Description copied from interface: ColorSpace
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:
ColorSpace.toRGB(float[])

toRGB

public int toRGB(float[] color)
Description copied from interface: ColorSpace
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