org.apache.pivot.wtk.effects
Class DropShadowDecorator

java.lang.Object
  extended by org.apache.pivot.wtk.effects.DropShadowDecorator
All Implemented Interfaces:
Decorator

public class DropShadowDecorator
extends Object
implements Decorator

Decorator that adds a drop shadows to a component.


Field Summary
static float DEFAULT_SHADOW_OPACITY
           
 
Constructor Summary
DropShadowDecorator()
           
DropShadowDecorator(int blurRadius, int xOffset, int yOffset)
           
 
Method Summary
 int getBlurRadius()
          Returns the blur radius used to draw the shadow.
 Bounds getBounds(Component component)
          Returns the bounding area of the decorator.
 Color getShadowColor()
          Returns the color used to draw the shadow.
 float getShadowOpacity()
          Returns the opacity used to draw the shadow.
 AffineTransform getTransform(Component component)
          Returns the transformation the decorator applies to the component's coordinate space.
 int getXOffset()
          Returns the amount that the drop shadow will be offset along the x axis.
 int getYOffset()
          Returns the amount that the drop shadow will be offset along the y axis.
 Graphics2D prepare(Component component, Graphics2D graphics)
          Prepares the graphics context into which the component or prior decorator will paint.
 void setBlurRadius(int blurRadius)
          Sets the blur radius used to draw the shadow.
 void setShadowColor(Color shadowColor)
          Sets the color used to draw the shadow.
 void setShadowColor(String shadowColor)
          Sets the color used to draw the shadow.
 void setShadowOpacity(float shadowOpacity)
          Sets the opacity used to draw the shadow.
 void setXOffset(int xOffset)
          Sets the amount that the drop shadow will be offset along the x axis.
 void setYOffset(int yOffset)
          Sets the amount that the drop shadow will be offset along the y axis.
 void update()
          Updates the graphics context into which the component or prior decorator was painted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SHADOW_OPACITY

public static final float DEFAULT_SHADOW_OPACITY
See Also:
Constant Field Values
Constructor Detail

DropShadowDecorator

public DropShadowDecorator()

DropShadowDecorator

public DropShadowDecorator(int blurRadius,
                           int xOffset,
                           int yOffset)
Method Detail

getShadowColor

public Color getShadowColor()
Returns the color used to draw the shadow.

Returns:
The color used to draw the shadow.

setShadowColor

public void setShadowColor(Color shadowColor)
Sets the color used to draw the shadow.

Parameters:
shadowColor - The color used to draw the shadow.

setShadowColor

public final void setShadowColor(String shadowColor)
Sets the color used to draw the shadow.

Parameters:
shadowColor - The color used to draw the shadow, which can be any of the color values recognized by Pivot.

getShadowOpacity

public float getShadowOpacity()
Returns the opacity used to draw the shadow.

Returns:
The color used to draw the shadow.

setShadowOpacity

public void setShadowOpacity(float shadowOpacity)
Sets the opacity used to draw the shadow.

Parameters:
shadowOpacity - The opacity used to draw the shadow.

getBlurRadius

public int getBlurRadius()
Returns the blur radius used to draw the shadow.

Returns:
The blur radius used to draw the shadow.

setBlurRadius

public void setBlurRadius(int blurRadius)
Sets the blur radius used to draw the shadow.

Parameters:
blurRadius - The blur radius used to draw the shadow.

getXOffset

public int getXOffset()
Returns the amount that the drop shadow will be offset along the x axis.

Returns:
The x offset used to draw the shadow

setXOffset

public void setXOffset(int xOffset)
Sets the amount that the drop shadow will be offset along the x axis.

Parameters:
xOffset - The x offset used to draw the shadow

getYOffset

public int getYOffset()
Returns the amount that the drop shadow will be offset along the y axis.

Returns:
The y offset used to draw the shadow

setYOffset

public void setYOffset(int yOffset)
Sets the amount that the drop shadow will be offset along the y axis.

Parameters:
yOffset - The y offset used to draw the shadow

prepare

public Graphics2D prepare(Component component,
                          Graphics2D graphics)
Description copied from interface: Decorator
Prepares the graphics context into which the component or prior decorator will paint. This method is called immediately prior to Component.paint(Graphics2D); decorators are called in descending order.

Specified by:
prepare in interface Decorator
Returns:
The graphics context that should be used by the component or prior decorators.

update

public void update()
Description copied from interface: Decorator
Updates the graphics context into which the component or prior decorator was painted. This method is called immediately after Component.paint(Graphics2D); decorators are called in ascending order.

Specified by:
update in interface Decorator

getBounds

public Bounds getBounds(Component component)
Description copied from interface: Decorator
Returns the bounding area of the decorator.

Specified by:
getBounds in interface Decorator
Returns:
The decorator's bounds, relative to the component's origin.

getTransform

public AffineTransform getTransform(Component component)
Description copied from interface: Decorator
Returns the transformation the decorator applies to the component's coordinate space.

Specified by:
getTransform in interface Decorator
Returns:
The decorator's transform.