Package com.jhlabs.image
Class ShadowFilter
java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.ShadowFilter
- All Implemented Interfaces:
BufferedImageOp
,Cloneable
A filter which draws a drop shadow based on the alpha channel of the image.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a ShadowFilter.ShadowFilter
(float radius, float xOffset, float yOffset, float opacity) Construct a ShadowFilter. -
Method Summary
Modifier and TypeMethodDescriptionfilter
(BufferedImage src, BufferedImage dst) boolean
Get whether to increase the size of the output image to accomodate the shadow.float
getAngle()
Returns the angle of the shadow.getBounds2D
(BufferedImage src) float
Get the distance of the shadow.float
Get the opacity of the shadow.getPoint2D
(Point2D srcPt, Point2D dstPt) float
Get the radius of the kernel.int
Get the color of the shadow.boolean
Get whether to only draw the shadow without the original image.void
setAddMargins
(boolean addMargins) Set whether to increase the size of the output image to accomodate the shadow.void
setAngle
(float angle) Specifies the angle of the shadow.void
setDistance
(float distance) Set the distance of the shadow.void
setOpacity
(float opacity) Set the opacity of the shadow.void
setRadius
(float radius) Set the radius of the kernel, and hence the amount of blur.void
setShadowColor
(int shadowColor) Set the color of the shadow.void
setShadowOnly
(boolean shadowOnly) Set whether to only draw the shadow without the original image.toString()
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getRenderingHints, getRGB, setRGB
-
Constructor Details
-
ShadowFilter
public ShadowFilter()Construct a ShadowFilter. -
ShadowFilter
public ShadowFilter(float radius, float xOffset, float yOffset, float opacity) Construct a ShadowFilter.- Parameters:
radius
- the radius of the shadowxOffset
- the X offset of the shadowyOffset
- the Y offset of the shadowopacity
- the opacity of the shadow
-
-
Method Details
-
setAngle
public void setAngle(float angle) Specifies the angle of the shadow.- Parameters:
angle
- the angle of the shadow.- See Also:
-
getAngle
public float getAngle()Returns the angle of the shadow.- Returns:
- the angle of the shadow.
- See Also:
-
setDistance
public void setDistance(float distance) Set the distance of the shadow.- Parameters:
distance
- the distance.- See Also:
-
getDistance
public float getDistance()Get the distance of the shadow.- Returns:
- the distance.
- See Also:
-
setRadius
public void setRadius(float radius) Set the radius of the kernel, and hence the amount of blur. The bigger the radius, the longer this filter will take.- Parameters:
radius
- the radius of the blur in pixels.- See Also:
-
getRadius
public float getRadius()Get the radius of the kernel.- Returns:
- the radius
- See Also:
-
setOpacity
public void setOpacity(float opacity) Set the opacity of the shadow.- Parameters:
opacity
- the opacity.- See Also:
-
getOpacity
public float getOpacity()Get the opacity of the shadow.- Returns:
- the opacity.
- See Also:
-
setShadowColor
public void setShadowColor(int shadowColor) Set the color of the shadow.- Parameters:
shadowColor
- the color.- See Also:
-
getShadowColor
public int getShadowColor()Get the color of the shadow.- Returns:
- the color.
- See Also:
-
setAddMargins
public void setAddMargins(boolean addMargins) Set whether to increase the size of the output image to accomodate the shadow.- Parameters:
addMargins
- true to add margins.- See Also:
-
getAddMargins
public boolean getAddMargins()Get whether to increase the size of the output image to accomodate the shadow.- Returns:
- true to add margins.
- See Also:
-
setShadowOnly
public void setShadowOnly(boolean shadowOnly) Set whether to only draw the shadow without the original image.- Parameters:
shadowOnly
- true to only draw the shadow.- See Also:
-
getShadowOnly
public boolean getShadowOnly()Get whether to only draw the shadow without the original image.- Returns:
- true to only draw the shadow.
- See Also:
-
getBounds2D
- Specified by:
getBounds2D
in interfaceBufferedImageOp
- Overrides:
getBounds2D
in classAbstractBufferedImageOp
-
getPoint2D
- Specified by:
getPoint2D
in interfaceBufferedImageOp
- Overrides:
getPoint2D
in classAbstractBufferedImageOp
-
filter
-
toString
-