Package com.github.weisj.jsvg.util
Class BlittableImage
- java.lang.Object
-
- com.github.weisj.jsvg.util.BlittableImage
-
public final class BlittableImage extends java.lang.Object
Class that encapsulates rendering to an offscreen image. The image is aligned to the pixel boundary of the root image surface. Rendering to the image behaves and the blitting it behaves as if it was rendered directly to the root surface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BlittableImage.BufferSurfaceSupplier
-
Field Summary
Fields Modifier and Type Field Description private @NotNull java.awt.geom.Rectangle2D
boundsInDeviceSpace
private @NotNull RenderContext
context
private @NotNull java.awt.image.BufferedImage
image
private @NotNull java.awt.geom.Rectangle2D
userBoundsInRootSpace
-
Constructor Summary
Constructors Modifier Constructor Description private
BlittableImage(@NotNull java.awt.image.BufferedImage image, @NotNull RenderContext context, @NotNull java.awt.geom.Rectangle2D boundsInDeviceSpace, @NotNull java.awt.geom.Rectangle2D userBoundsInRootSpace)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
blitTo(@NotNull Output output)
void
clearBackground(@NotNull java.awt.Color color)
@NotNull RenderContext
context()
static @Nullable BlittableImage
create(@NotNull BlittableImage.BufferSurfaceSupplier bufferSurfaceSupplier, @NotNull RenderContext context, @Nullable java.awt.geom.Rectangle2D clipBounds, @NotNull java.awt.geom.Rectangle2D bounds, @NotNull java.awt.geom.Rectangle2D objectBounds, @NotNull UnitType contentUnits)
static @Nullable BlittableImage
create(@NotNull BlittableImage.BufferSurfaceSupplier bufferSurfaceSupplier, @NotNull RenderContext context, @Nullable java.awt.geom.Rectangle2D clipBounds, @NotNull java.awt.geom.Rectangle2D bounds, @NotNull java.awt.geom.Rectangle2D objectBounds, @NotNull UnitType contentUnits, @NotNull RenderContext imageContext)
@NotNull java.awt.Graphics2D
createGraphics()
void
debug(@NotNull Output output)
void
debug(@NotNull Output output, boolean drawImage)
@NotNull java.awt.image.BufferedImage
image()
@NotNull java.awt.geom.Rectangle2D
imageBoundsInDeviceSpace()
void
prepareForBlitting(@NotNull Output output)
void
render(@NotNull Output output, @NotNull java.util.function.BiConsumer<Output,RenderContext> painter)
void
render(@NotNull Output output, @NotNull java.util.function.Consumer<java.awt.Graphics2D> painter)
void
renderNode(@NotNull Output parentOutput, @NotNull SVGNode node, @NotNull Instantiator instantiator)
@NotNull java.awt.geom.Rectangle2D
userBoundsInRootSpace()
-
-
-
Field Detail
-
image
@NotNull private final @NotNull java.awt.image.BufferedImage image
-
context
@NotNull private final @NotNull RenderContext context
-
boundsInDeviceSpace
@NotNull private final @NotNull java.awt.geom.Rectangle2D boundsInDeviceSpace
-
userBoundsInRootSpace
@NotNull private final @NotNull java.awt.geom.Rectangle2D userBoundsInRootSpace
-
-
Constructor Detail
-
BlittableImage
private BlittableImage(@NotNull @NotNull java.awt.image.BufferedImage image, @NotNull @NotNull RenderContext context, @NotNull @NotNull java.awt.geom.Rectangle2D boundsInDeviceSpace, @NotNull @NotNull java.awt.geom.Rectangle2D userBoundsInRootSpace)
-
-
Method Detail
-
create
@Nullable public static @Nullable BlittableImage create(@NotNull @NotNull BlittableImage.BufferSurfaceSupplier bufferSurfaceSupplier, @NotNull @NotNull RenderContext context, @Nullable @Nullable java.awt.geom.Rectangle2D clipBounds, @NotNull @NotNull java.awt.geom.Rectangle2D bounds, @NotNull @NotNull java.awt.geom.Rectangle2D objectBounds, @NotNull @NotNull UnitType contentUnits)
-
create
@Nullable public static @Nullable BlittableImage create(@NotNull @NotNull BlittableImage.BufferSurfaceSupplier bufferSurfaceSupplier, @NotNull @NotNull RenderContext context, @Nullable @Nullable java.awt.geom.Rectangle2D clipBounds, @NotNull @NotNull java.awt.geom.Rectangle2D bounds, @NotNull @NotNull java.awt.geom.Rectangle2D objectBounds, @NotNull @NotNull UnitType contentUnits, @NotNull @NotNull RenderContext imageContext)
-
context
@NotNull public @NotNull RenderContext context()
-
imageBoundsInDeviceSpace
@NotNull public @NotNull java.awt.geom.Rectangle2D imageBoundsInDeviceSpace()
-
userBoundsInRootSpace
@NotNull public @NotNull java.awt.geom.Rectangle2D userBoundsInRootSpace()
-
image
@NotNull public @NotNull java.awt.image.BufferedImage image()
-
createGraphics
@NotNull public @NotNull java.awt.Graphics2D createGraphics()
-
renderNode
public void renderNode(@NotNull @NotNull Output parentOutput, @NotNull @NotNull SVGNode node, @NotNull @NotNull Instantiator instantiator)
-
clearBackground
public void clearBackground(@NotNull @NotNull java.awt.Color color)
-
render
public void render(@NotNull @NotNull Output output, @NotNull @NotNull java.util.function.Consumer<java.awt.Graphics2D> painter)
-
render
public void render(@NotNull @NotNull Output output, @NotNull @NotNull java.util.function.BiConsumer<Output,RenderContext> painter)
-
prepareForBlitting
public void prepareForBlitting(@NotNull @NotNull Output output)
-
blitTo
public void blitTo(@NotNull @NotNull Output output)
-
debug
public void debug(@NotNull @NotNull Output output)
-
debug
public void debug(@NotNull @NotNull Output output, boolean drawImage)
-
-