Interface GradientEditor

All Superinterfaces:
GuiEditor

public non-sealed interface GradientEditor extends GuiEditor
Edits a gradient: a bar showing its colors, with a stop per color that can be dragged along it, and the gradient's options.
  • Method Details

    • stops

      List<GradientStop> stops()
      Returns:
      The stops in order along the bar, at least one
    • selected

      int selected()
      Returns:
      Index of the selected stop in stops(), or -1 when none is. A stop is selected by opening its color, and stays selected until the color picker closes in view of this editor, or the stop is removed.
    • select

      void select(int index)
    • move

      int move(int index, double position)
      Moves a stop along the bar. A stop moved past another changes places with it in stops(). The selected stop stays selected wherever it ends up.
      Parameters:
      position - 0 to 1
      Returns:
      The stop's index after the move
    • add

      int add(double position)
      Adds a stop in the color the gradient has there.
      Parameters:
      position - 0 to 1
      Returns:
      The new stop's index
    • canRemove

      boolean canRemove()
      Returns:
      Whether a stop can be removed; a gradient keeps two
    • remove

      void remove(int index)
      Removes a stop, if one can be removed. When it was the selected stop, no stop is selected afterwards and its color picker closes.
    • editColor

      void editColor()
      Opens a color picker for the selected stop.
    • hsb

      boolean hsb()
      Returns:
      Whether colors between stops blend their hue, saturation and brightness instead of their red, green and blue, as GuiPaint.hsb(float, float, float, float) paints do
    • controls

      List<EditorControl> controls()
      Returns:
      The gradient's options
    • buttons

      List<EditorButton> buttons()