Package snap.gfx

Class ReflectEffect

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class ReflectEffect extends Effect
An Effect subclass to render a reflection.
  • Field Details

  • Constructor Details

    • ReflectEffect

      public ReflectEffect()
      Creates a new ReflectEffect.
    • ReflectEffect

      public ReflectEffect(double aRefHt, double aFadeHt, double aGap)
      Creates a new ReflectEffect for given reflect height, fade height and gap.
  • Method Details

    • getReflectHeight

      public double getReflectHeight()
      Returns the height of the reflected image as fraction of shape height (defaults to 1).
    • setReflectHeight

      protected void setReflectHeight(double aValue)
      Sets the height of the reflected image as fraction of shape height.
    • getFadeHeight

      public double getFadeHeight()
      Returns the height of the faded region as a fraction of reflection height (defaults to .5).
    • setFadeHeight

      protected void setFadeHeight(double aValue)
      Sets the height of the faded region as a fraction of reflection height.
    • getGap

      public double getGap()
      Returns the height of the gap between the shape and the reflection in points (defaults to 0).
    • setGap

      protected void setGap(double aValue)
      Sets the height of the gap between the shape and the reflection in points.
    • getBounds

      public Rect getBounds(Rect aRect)
      Override to extend height by gap and reflection fade height.
      Overrides:
      getBounds in class Effect
    • applyEffect

      public void applyEffect(PainterDVR aPDVR, Painter aPntr, Rect aRect)
      Performs the ReflectEffect with given PainterDVR.
      Overrides:
      applyEffect in class Effect
    • getReflectImage

      public Image getReflectImage(PainterDVR aPDVR, Rect aRect)
      Returns the effect image.
    • copyForReflectHeight

      public ReflectEffect copyForReflectHeight(double aRH)
      Returns a reflection for given reflect height.
    • copyForFadeHeight

      public ReflectEffect copyForFadeHeight(double aFH)
      Returns a reflection for given fade height.
    • copyForGap

      public ReflectEffect copyForGap(double aGap)
      Returns a reflection for given gap.
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • initProps

      protected void initProps(PropSet aPropSet)
      Override to configure props for this class.
      Overrides:
      initProps in class PropObject
    • getPropValue

      public Object getPropValue(String aPropName)
      Override to support props for this class.
      Overrides:
      getPropValue in class PropObject
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override to support props for this class.
      Overrides:
      setPropValue in class PropObject
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class Effect
    • fromXML

      public Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class Effect