Package fr.esrf.tangoatk.widget.util
Class Gradient
java.lang.Object
fr.esrf.tangoatk.widget.util.Gradient
Gradient class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAdds a color,pos entry to the gradient Note that you have by default 2 entries at 0.0 and 1.0voidDeprecated.int[]buildColorMap(int nb) Build a color map for this gradient.voidConstruct a rainbow gradient.cloneMe()Returns a copy of this gradientgetColorAt(int id) Returns color information for the specified entryintReturns number of color entry.doublegetPosAt(int id) Returns the specified pos for the specified entryvoidInvert color entries.voidremoveEntry(int id) Removes a color entryvoidsetColorAt(int id, Color c) Sets the color for a specified entry.voidsetPosAt(int id, double pos) Sets the position for a specified id.
-
Constructor Details
-
Gradient
public Gradient()Construct a default gradient black to white -
Gradient
Construct a gradient from a set of color and position- Parameters:
pos- Color positionscolors- Colors
-
-
Method Details
-
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
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
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
Sets the color for a specified entry.- Parameters:
id- Entry idc- 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 idpos- New position value
-
addEntry
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 valuepos- 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)
-