The factory provides two shadow generation algorithms: fast quality blur and high quality blur. You can select your preferred algorithm by setting the appropriate rendering hint:
ShadowFactory factory = new ShadowFactory(); factory.setRenderingHint(ShadowFactory.KEY_BLUR_QUALITY, ShadowFactory.VALUE_BLUR_QUALITY_HIGH);The default rendering algorihtm is
VALUE_BLUR_QUALITY_FAST
. The current implementation should provide the same quality with both algorithms but performances are guaranteed to be better (about 30 times faster) with the fast quality blur.
A shadow is generated as a BufferedImage
from another BufferedImage
. Once the factory is set up, you must call {@link #createShadow} to actually generate the shadow:
ShadowFactory factory = new ShadowFactory(); // factory setup BufferedImage shadow = factory.createShadow(bufferedImage);The resulting image is of type
BufferedImage.TYPE_INT_ARGB
. Both dimensions of this image are larger than original image's: This factory allows to register property change listeners with {@link #addPropertyChangeListener}. Listening to properties changes is very useful when you emebed the factory in a graphical component and give the API user the ability to access the factory. By listening to properties changes, you can easily repaint the component when needed.
ShadowFactory
is not guaranteed to be thread-safe.
|
|
|
|
|
|