public class FilterComposite extends Object implements Composite
FilterComposite allows the inclusion of arbitrary image filters during the paint
processing of Graphics2D events. By adding a filter composite, the src and
destination images are render using a delegated Composite, then post-processed with the
filters before returning the result back to the graphics context. This process adds overhead to
the painting both is terms of time (the actual processing time) and memory (as a temporary raster
must be created to store the intermediate state). Since it is possible to delegate to a filter
composite from a filter composite, this may result slow or unresponsive painting. If you are
attempting to render with many different filters, it may be better to have one filter composite
with many filters (using a compound filter).
It was decided to use BufferedImageOp as the filter because many of these filters already
exist. This gives high reusability to code.
AbstractFilter| Constructor and Description |
|---|
FilterComposite(Composite composite)
Creates an empty filter composite for the specified composite.
|
FilterComposite(Composite composite,
BufferedImageOp filter)
Creates a filter for the specified composite.
|
| Modifier and Type | Method and Description |
|---|---|
CompositeContext |
createContext(ColorModel srcColorModel,
ColorModel dstColorModel,
RenderingHints hints) |
BufferedImageOp |
getFilter()
The filter to apply to the graphics context.
|
void |
setFilter(BufferedImageOp filter)
Sets the filter for manipulating the graphics composites.
|
public FilterComposite(Composite composite)
composite - the composite operation to perform prior to filteringNullPointerException - if composite is nullpublic FilterComposite(Composite composite, BufferedImageOp filter)
composite - the composite operation to perform prior to filteringfilter - the filter to apply to the composite resultNullPointerException - if composite is nullpublic BufferedImageOp getFilter()
public void setFilter(BufferedImageOp filter)
A null filter will result in no filtering.
filter - the new filterpublic CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
createContext in interface CompositeCopyright © 2017. All Rights Reserved.