Package snap.gfx
Class ReflectEffect
java.lang.Object
snap.props.PropObject
snap.gfx.Effect
snap.gfx.ReflectEffect
- All Implemented Interfaces:
PropChange.DoChange
,XMLArchiver.Archivable
An Effect subclass to render a reflection.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
static final double
static final double
static final String
static final String
static final String
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
ConstructorDescriptionCreates a new ReflectEffect.ReflectEffect
(double aRefHt, double aFadeHt, double aGap) Creates a new ReflectEffect for given reflect height, fade height and gap. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyEffect
(PainterDVR aPDVR, Painter aPntr, Rect aRect) Performs the ReflectEffect with given PainterDVR.copyForFadeHeight
(double aFH) Returns a reflection for given fade height.copyForGap
(double aGap) Returns a reflection for given gap.copyForReflectHeight
(double aRH) Returns a reflection for given reflect height.boolean
Standard equals implementation.fromXML
(XMLArchiver anArchiver, XMLElement anElement) XML unarchival.Override to extend height by gap and reflection fade height.double
Returns the height of the faded region as a fraction of reflection height (defaults to .5).double
getGap()
Returns the height of the gap between the shape and the reflection in points (defaults to 0).getPropValue
(String aPropName) Override to support props for this class.double
Returns the height of the reflected image as fraction of shape height (defaults to 1).getReflectImage
(PainterDVR aPDVR, Rect aRect) Returns the effect image.protected void
Override to configure props for this class.protected void
setFadeHeight
(double aValue) Sets the height of the faded region as a fraction of reflection height.protected void
setGap
(double aValue) Sets the height of the gap between the shape and the reflection in points.void
setPropValue
(String aPropName, Object aValue) Override to support props for this class.protected void
setReflectHeight
(double aValue) Sets the height of the reflected image as fraction of shape height.toXML
(XMLArchiver anArchiver) XML archival.Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, clone, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString, toStringProps
-
Field Details
-
ReflectHeight_Prop
- See Also:
-
FadeHeight_Prop
- See Also:
-
Gap_Prop
- See Also:
-
DEFAULT_REFLECT_HEIGHT
public static final double DEFAULT_REFLECT_HEIGHT- See Also:
-
DEFAULT_FADE_HEIGHT
public static final double DEFAULT_FADE_HEIGHT- See Also:
-
DEFAULT_GAP
public static final double DEFAULT_GAP- See Also:
-
-
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
Override to extend height by gap and reflection fade height. -
applyEffect
Performs the ReflectEffect with given PainterDVR.- Overrides:
applyEffect
in classEffect
-
getReflectImage
Returns the effect image. -
copyForReflectHeight
Returns a reflection for given reflect height. -
copyForFadeHeight
Returns a reflection for given fade height. -
copyForGap
Returns a reflection for given gap. -
equals
Standard equals implementation. -
initProps
Override to configure props for this class.- Overrides:
initProps
in classPropObject
-
getPropValue
Override to support props for this class.- Overrides:
getPropValue
in classPropObject
-
setPropValue
Override to support props for this class.- Overrides:
setPropValue
in classPropObject
-
toXML
XML archival.- Specified by:
toXML
in interfaceXMLArchiver.Archivable
- Overrides:
toXML
in classEffect
-
fromXML
XML unarchival.- Specified by:
fromXML
in interfaceXMLArchiver.Archivable
- Overrides:
fromXML
in classEffect
-