maspack.render.color
Class HueColorMap

java.lang.Object
  extended by maspack.render.color.ColorMapBase
      extended by maspack.render.color.HueColorMap
All Implemented Interfaces:
java.lang.Cloneable, CompositeProperty, HasProperties, ColorMap, Clonable, Scannable

public class HueColorMap
extends ColorMapBase

Interpolates color values by varying the hue

Author:
Antonio

Field Summary
static double defaultBrightness
           
static double defaultMaxHue
           
static double defaultMinHue
           
static double defaultSaturation
           
static PropertyList myProps
           
 
Constructor Summary
HueColorMap()
          Creates a default Hue-varying colormap
HueColorMap(double minHue, double maxHue)
          Creates a hue map, setting the min and max hues
 
Method Summary
 ColorMapBase clone()
          Returns a clone of this composite property.
 HueColorMap copy()
           
 PropertyList getAllPropertyInfo()
          Returns a list giving static information about all properties exported by this object.
 double getBrightness()
          Constant brightness used by map
 java.awt.Color getColor(double a)
          Returns an interpolated color
 void getHSV(double a, double[] hsv)
          Fills an array with the interpolated color values in HSV format
 void getHSV(double a, float[] hsv)
          Fills an array with the interpolated color values in HSV format
 double getHue(double a)
          Computes the interpolated hue with a in [0,1]
 DoubleInterval getHueRange()
          Gets the range of hue values
 void getRGB(double a, double[] rgb)
          Fills an array with the interpolated color values in RGB format
 void getRGB(double a, float[] rgb)
          Fills an array with the interpolated color values in RGB format
 double getSaturation()
          Constant saturation used by map
 void setBrightness(double v)
          Brightness value to use for interpolation
 void setHueRange(double minHue, double maxHue)
          Sets the hue range.
 void setHueRange(DoubleInterval range)
          Sets the hue range.
 void setSaturation(double s)
          Saturation to use for interpolation
 
Methods inherited from class maspack.render.color.ColorMapBase
getColor3Value, getColor4Value, getProperty, getPropertyHost, getPropertyInfo, getSubClasses, isWritable, scan, setPropertyHost, setPropertyInfo, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultMinHue

public static double defaultMinHue

defaultMaxHue

public static double defaultMaxHue

defaultSaturation

public static double defaultSaturation

defaultBrightness

public static double defaultBrightness

myProps

public static PropertyList myProps
Constructor Detail

HueColorMap

public HueColorMap()
Creates a default Hue-varying colormap


HueColorMap

public HueColorMap(double minHue,
                   double maxHue)
Creates a hue map, setting the min and max hues

See Also:
setHueRange(double, double)
Method Detail

getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ColorMapBase
Returns:
static information for all exported properties

setHueRange

public void setHueRange(double minHue,
                        double maxHue)
Sets the hue range. Normally, these values are in the range [0, 1]; however, the hues support wrapping. If maxHue is less than minHue, colors will be interpolated backwards.

Examples:
[0, 1/6] will interpolate from red to yellow
[1/6, 0] will interpolate from yellow to red
[5/6, 7/6] will interpolate from violet to yellow


setSaturation

public void setSaturation(double s)
Saturation to use for interpolation


getSaturation

public double getSaturation()
Constant saturation used by map


setBrightness

public void setBrightness(double v)
Brightness value to use for interpolation


getBrightness

public double getBrightness()
Constant brightness used by map


getColor

public java.awt.Color getColor(double a)
Description copied from interface: ColorMap
Returns an interpolated color

Parameters:
a - input, usually in the range [0,1]
Returns:
the color

getRGB

public void getRGB(double a,
                   double[] rgb)
Description copied from interface: ColorMap
Fills an array with the interpolated color values in RGB format

Parameters:
a - input, usually in the range [0,1]
rgb - output color

getRGB

public void getRGB(double a,
                   float[] rgb)
Description copied from interface: ColorMap
Fills an array with the interpolated color values in RGB format

Parameters:
a - input, usually in the range [0,1]
rgb - output color

getHSV

public void getHSV(double a,
                   double[] hsv)
Description copied from interface: ColorMap
Fills an array with the interpolated color values in HSV format

Parameters:
a - input, usually in the range [0,1]
hsv - output color

getHue

public double getHue(double a)
Computes the interpolated hue with a in [0,1]


getHSV

public void getHSV(double a,
                   float[] hsv)
Description copied from interface: ColorMap
Fills an array with the interpolated color values in HSV format

Parameters:
a - input, usually in the range [0,1]
hsv - output color

getHueRange

public DoubleInterval getHueRange()
Gets the range of hue values

See Also:
setHueRange(double, double)

setHueRange

public void setHueRange(DoubleInterval range)
Sets the hue range. Normally, these values are in the range [0, 1]; however, the hues support wrapping. If maxHue is less than minHue, colors will be interpolated backwards.

Examples:
[0, 1/6] will interpolate from red to yellow
[1/6, 0] will interpolate from yellow to red
[5/6, 7/6] will interpolate from violet to yellow


copy

public HueColorMap copy()
Specified by:
copy in class ColorMapBase

clone

public ColorMapBase clone()
                   throws java.lang.CloneNotSupportedException
Description copied from interface: CompositeProperty
Returns a clone of this composite property.

Specified by:
clone in interface CompositeProperty
Specified by:
clone in interface Clonable
Overrides:
clone in class ColorMapBase
Returns:
clone of this property
Throws:
java.lang.CloneNotSupportedException