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) booleanGet whether to increase the size of the output image to accomodate the shadow.floatgetAngle()Returns the angle of the shadow.getBounds2D(BufferedImage src) floatGet the distance of the shadow.floatGet the opacity of the shadow.getPoint2D(Point2D srcPt, Point2D dstPt) floatGet the radius of the kernel.intGet the color of the shadow.booleanGet whether to only draw the shadow without the original image.voidsetAddMargins(boolean addMargins) Set whether to increase the size of the output image to accomodate the shadow.voidsetAngle(float angle) Specifies the angle of the shadow.voidsetDistance(float distance) Set the distance of the shadow.voidsetOpacity(float opacity) Set the opacity of the shadow.voidsetRadius(float radius) Set the radius of the kernel, and hence the amount of blur.voidsetShadowColor(int shadowColor) Set the color of the shadow.voidsetShadowOnly(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:
getBounds2Din interfaceBufferedImageOp- Overrides:
getBounds2Din classAbstractBufferedImageOp
-
getPoint2D
- Specified by:
getPoint2Din interfaceBufferedImageOp- Overrides:
getPoint2Din classAbstractBufferedImageOp
-
filter
-
toString
-