The RenderedDynamicImageResource subclass is designed for images that can be regenerated when the component is deserialized (the image data is transient). A good example of a RenderedDynamicImageResource is the DefaultButtonImageResource class, which can regenerate a given button image at any time. This makes it very lightweight when clustered. The BufferedDynamicImageResource class, on the other hand, is designed for images that cannot be regenerated on demand. It buffers its image data in a non-transient way, which means that the entire image will be serialized and copied when the resource is replicated in a cluster!
The helper method toImageData(BufferedImage) is provided so that subclasses can easily turn a BufferedImage into a suitable return value when implementing getImageData().
The format of the image (and therefore the resource's extension) can be specified with setFormat(String). The default format is "PNG" because JPEG is lossy and makes generated images look bad and GIF has patent issues. @author Jonathan Locke @author Gili Tzabari @author Johan Compagner
|
|
|
|
|
|