Package snap.styler

Class GradientStopPicker

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class GradientStopPicker extends ParentView
A multi-stop gradient stop inspector.
  • Field Details

  • Constructor Details

    • GradientStopPicker

      public GradientStopPicker()
      Creates new GradientStopPicker.
  • Method Details

    • getStopCount

      public int getStopCount()
      Returns the number of color stops in the gradient
    • getStop

      public GradientPaint.Stop getStop(int anIndex)
      Returns the individual color stop at given index.
    • getStopColor

      public Color getStopColor(int index)
      Returns the color of the stop at the given index.
    • getStopOffset

      public double getStopOffset(int index)
      Returns the position (in the range {0-1}) for the given stop index.
    • getStops

      public GradientPaint.Stop[] getStops()
      Returns the list of color stops.
    • setStops

      public void setStops(GradientPaint.Stop[] theStops)
      Resets all the stops from the new list.
    • addStop

      public int addStop(double anOffset, Color aColor)
      Adds a new color stop at the given position. Returns the index of the new stop.
    • removeStop

      public void removeStop(int index)
      Removes the stop at the given index.
    • setStop

      public void setStop(int index, double anOffset, Color aColor)
      Sets the color & position of the stop at the given index.
    • addStop

      public int addStop(Point pt, Color aColor)
      Create an explicit stop at the corresponding gradient position.
    • deleteColorStop

      public void deleteColorStop()
      Called when a ColorStop is deleted.
    • reverseStops

      public void reverseStops()
      Reverse the order of the color stops
    • getKnobIndex

      public int getKnobIndex(Point pt)
    • selectStop

      public void selectStop(int anIndex)
    • getStopOffset

      public double getStopOffset(Point pt)
      Given a mouse point within gradient rectangle, returns corresponding position in gradient (0 at left of gradient, 1 at right).
    • adjustColorStop

      public void adjustColorStop(int index, Point pt)
      Move the selected stop to the new position.
    • paintFront

      protected void paintFront(Painter aPntr)
      Paint Component.
      Overrides:
      paintFront in class View
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Handle events.
      Overrides:
      processEvent in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to reset knobs and such.
      Overrides:
      layoutImpl in class ParentView