Package snap.gfx
Class ShadowEffect
java.lang.Object
snap.props.PropObject
snap.gfx.Effect
snap.gfx.ShadowEffect
- All Implemented Interfaces:
PropChange.DoChange
,XMLArchiver.Archivable
An Effect subclass to represent a drop shadow.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final Color
static final double
static final String
static final String
static final String
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
ConstructorDescriptionConstructor.ShadowEffect
(double aRadius, Color aColor, double aDX, double aDY) Constructor for given radius, color and offset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyEffect
(PainterDVR aPDVR, Painter aPntr, Rect aRect) Performs the ShadowEffect with given PainterDVR.void
applyEffectShadowOnly
(PainterDVR aPDVR, Painter aPntr, Rect aRect) Performs the ShadowEffect with given PainterDVR.copyForColor
(Color aColor) Returns a copy of this shadow with given color.copyForOffset
(double aDX, double aDY) Returns a copy of this shadow with given offset.copyForRadius
(double aRad) Returns a copy of this shadow with given radius.Returns a copy of this shadow with given color.boolean
Standard equals implementation.fromXML
(XMLArchiver anArchiver, XMLElement anElement) XML unarchival.Override to account for blur radius and shadow offset.getColor()
Returns the color associated with this fill.double
getDX()
Returns the X offset of the shadow.double
getDY()
Returns the Y offset of the shadow.getPropValue
(String aPropName) Override to support props for this class.double
Returns the radius of the blur.static Image
getShadowImage
(Rect aRect, double aRad, Color aColor) Returns the effect image for an opaque rect by making a small shadow and blitting over the 8 pieces.getShadowImage
(PainterDVR aPDVR, Rect aRect) Returns the effect image.protected void
Override to configure props for this class.boolean
isSimple()
Returns whether this shadow should just be rect.void
setPropValue
(String aPropName, Object aValue) Override to support props for this class.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
-
Radius_Prop
- See Also:
-
DX_Prop
- See Also:
-
DY_Prop
- See Also:
-
Color_Prop
- See Also:
-
DEFAULT_RADIUS
public static final double DEFAULT_RADIUS- See Also:
-
DEFAULT_COLOR
-
-
Constructor Details
-
ShadowEffect
public ShadowEffect()Constructor. -
ShadowEffect
Constructor for given radius, color and offset.
-
-
Method Details
-
getRadius
public double getRadius()Returns the radius of the blur. -
getDX
public double getDX()Returns the X offset of the shadow. -
getDY
public double getDY()Returns the Y offset of the shadow. -
getColor
Returns the color associated with this fill. -
isSimple
public boolean isSimple()Returns whether this shadow should just be rect. -
getBounds
Override to account for blur radius and shadow offset. -
applyEffect
Performs the ShadowEffect with given PainterDVR.- Overrides:
applyEffect
in classEffect
-
applyEffectShadowOnly
Performs the ShadowEffect with given PainterDVR. -
getShadowImage
Returns the effect image. -
copyForRadius
Returns a copy of this shadow with given radius. -
copyForOffset
Returns a copy of this shadow with given offset. -
copyForColor
Returns a copy of this shadow with given color. -
copySimple
Returns a copy of this shadow with given color. -
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
-
getShadowImage
Returns the effect image for an opaque rect by making a small shadow and blitting over the 8 pieces.
-