fr.esrf.tangoatk.widget.util
Class Gradient

java.lang.Object
  extended by fr.esrf.tangoatk.widget.util.Gradient

public class Gradient
extends java.lang.Object

Gradient class


Constructor Summary
Gradient()
          Construct a default gradient black to white
 
Method Summary
 int addEntry(java.awt.Color c, double pos)
          Adds a color,pos entry to the gradient Note that you have by default 2 entries at 0.0 and 1.0
 void buidColorGradient()
          Deprecated.  
 int[] buildColorMap(int nb)
          Build a color map for this gradient.
 void buildRainbowGradient()
          Construct a rainbow gradient.
 Gradient cloneMe()
          Returns a copy of this gradient
 java.awt.Color getColorAt(int id)
          Returns color information for the specified entry
 int getEntryNumber()
          Returns number of color entry.
 double getPosAt(int id)
          Returns the specified pos for the specified entry
 void invertGradient()
          Invert color entries.
 void removeEntry(int id)
          Removes a color entry
 void setColorAt(int id, java.awt.Color c)
          Sets the color for a specified entry.
 void setPosAt(int id, double pos)
          Sets the position for a specified id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gradient

public Gradient()
Construct a default gradient black to white

Method Detail

buidColorGradient

public void buidColorGradient()
Deprecated. 

Please use buildRainbowGradient() instead.


buildRainbowGradient

public void buildRainbowGradient()
Construct a rainbow gradient.


invertGradient

public void invertGradient()
Invert color entries.


cloneMe

public Gradient cloneMe()
Returns a copy of this gradient

Returns:
New gradient object

buildColorMap

public int[] buildColorMap(int nb)
Build a color map for this gradient.

Parameters:
nb - Number of color for the colormap
Returns:
a nb 32Bit [ARGB] array, null if fails

getEntryNumber

public int getEntryNumber()
Returns number of color entry.

Returns:
Number of entry

getColorAt

public java.awt.Color getColorAt(int id)
Returns color information for the specified entry

Parameters:
id - Entry id
Returns:
Color value

getPosAt

public double getPosAt(int id)
Returns the specified pos for the specified entry

Parameters:
id - Entry id
Returns:
A floating point between 0.0 and 1.0

setColorAt

public void setColorAt(int id,
                       java.awt.Color c)
Sets the color for a specified entry.

Parameters:
id - Entry id
c - New color value

setPosAt

public void setPosAt(int id,
                     double pos)
Sets the position for a specified id. Position value must be greater that the previous pos and lower than the next pos. It must also be in the range 0.0 => 1.0. If those conditions are not validated , no change happens.

Parameters:
id - Entry id
pos - New position value

addEntry

public int addEntry(java.awt.Color c,
                    double pos)
Adds a color,pos entry to the gradient Note that you have by default 2 entries at 0.0 and 1.0

Parameters:
c - Color value
pos - Position [0.0 => 1.0]
Returns:
Entry id (-1 when fails)

removeEntry

public void removeEntry(int id)
Removes a color entry

Parameters:
id - Entry id (Cannot be fisrt or last value)