public class DefaultShadowGenerator extends java.lang.Object implements ShadowGenerator, java.io.Serializable
ShadowGenerator interface, based on
code in a
blog
post by Romain Guy.| Constructor and Description |
|---|
DefaultShadowGenerator()
Creates a new instance with default attributes.
|
DefaultShadowGenerator(int size,
java.awt.Color color,
float opacity,
int distance,
double angle)
Creates a new instance with the specified attributes.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyShadow(java.awt.image.BufferedImage image)
Applies a shadow to the image.
|
int |
calculateOffsetX()
Calculates the x-offset for drawing the shadow image relative to the
source.
|
int |
calculateOffsetY()
Calculates the y-offset for drawing the shadow image relative to the
source.
|
java.awt.image.BufferedImage |
createDropShadow(java.awt.image.BufferedImage source)
Creates and returns an image containing the drop shadow for the
specified source image.
|
boolean |
equals(java.lang.Object obj)
Tests this object for equality with an arbitrary object.
|
double |
getAngle()
Returns the shadow offset angle (in radians).
|
int |
getDistance()
Returns the shadow offset distance.
|
java.awt.Color |
getShadowColor()
Returns the shadow color.
|
float |
getShadowOpacity()
Returns the shadow opacity.
|
int |
getShadowSize()
Returns the shadow size.
|
int |
hashCode()
Returns a hash code for this instance.
|
public DefaultShadowGenerator()
public DefaultShadowGenerator(int size,
java.awt.Color color,
float opacity,
int distance,
double angle)
size - the shadow size.color - the shadow color.opacity - the shadow opacity.distance - the shadow offset distance.angle - the shadow offset angle (in radians).public int getShadowSize()
public java.awt.Color getShadowColor()
null).public float getShadowOpacity()
public int getDistance()
public double getAngle()
public int calculateOffsetX()
calculateOffsetX in interface ShadowGeneratorpublic int calculateOffsetY()
calculateOffsetY in interface ShadowGeneratorpublic java.awt.image.BufferedImage createDropShadow(java.awt.image.BufferedImage source)
createDropShadow in interface ShadowGeneratorsource - the source image.protected void applyShadow(java.awt.image.BufferedImage image)
image - the image.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object (null permitted).public int hashCode()
hashCode in class java.lang.Object