public class CachingPainter
extends java.lang.Object
Constructor and Description |
---|
CachingPainter() |
Modifier and Type | Method and Description |
---|---|
static void |
paint(java.awt.Graphics2D g,
float x,
float y,
float width,
float height,
java.util.function.Consumer<java.awt.Graphics2D> painter,
java.lang.Object key,
java.lang.Object... parameters)
Performs painting of frequently used pattern, using image cache.
|
public static void paint(java.awt.Graphics2D g, float x, float y, float width, float height, java.util.function.Consumer<java.awt.Graphics2D> painter, java.lang.Object key, java.lang.Object... parameters)
x
, y
, width
, height
define the region
where painting is done, painter
performs the actual drawing, it's called with graphics origin set to the origin or the painting
region. Painter logic shouldn't depend on anything except the size of the region and values of parameters
. Result of painting
will be cached with key
as a key, and used for subsequent painting requests with the same region size and parameter values.
Subpixel-antialiased text shouldn't be rendered using this procedure, as the result depends on the target surface's background color, and it cannot be determined when cached image is produced.