Class Gradient

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

public class Gradient extends Object
Gradient class
  • Constructor Details

    • Gradient

      public Gradient()
      Construct a default gradient black to white
    • Gradient

      public Gradient(double[] pos, Color[] colors)
      Construct a gradient from a set of color and position
      Parameters:
      pos - Color positions
      colors - 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

      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 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, 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(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)