Class AlphaPainter<T>

All Implemented Interfaces:
Painter<T>

@JavaBean public class AlphaPainter<T> extends CompoundPainter<T>
Applies an alpha value to an entire stack of painters.
  • Field Details

    • alpha

      private float alpha
  • Constructor Details

    • AlphaPainter

      public AlphaPainter()
  • Method Details

    • doPaint

      protected void doPaint(Graphics2D g, T component, int width, int height)
      Subclasses must implement this method and perform custom painting operations here.
      Overrides:
      doPaint in class CompoundPainter<T>
      Parameters:
      g - The Graphics2D object in which to paint
      component -
      width -
      height -
    • getAlpha

      public float getAlpha()
      Returns the current alpha value for this painter. This is the alpha value that will be applied to all painters set inside this painter. Alpha values will be multiplied. This means if you set an alpha of 0.5 on this painter and you nest a painter inside which uses an alpha of 0.5 then the final pixels drawn will have an alpha of 0.25.
      Returns:
      the current value of alpha property
    • setAlpha

      public void setAlpha(float alpha)
      Sets the current alpha value for this painter. This is the alpha value that will be applied to all painters set inside this painter. Alpha values will be multiplied. This means if you set an alpha of 0.5 on this painter and you nest a painter inside which uses an alpha of 0.5 then the final pixels drawn will have an alpha of 0.25.
      Parameters:
      alpha - the new value of the alpha property