public class BufferedImageOverlayRenderer extends Object implements OverlayRenderer, RenderTarget<BufferedImageRenderResult>
OverlayRenderer
drawing a BufferedImage
, scaled to fill the
canvas. It can be used as a RenderTarget
, such that the
BufferedImageRenderResult
to draw is set by a renderer.Constructor and Description |
---|
BufferedImageOverlayRenderer() |
Modifier and Type | Method and Description |
---|---|
BufferedImageRenderResult |
createRenderResult()
Returns a new
RenderResult . |
void |
drawOverlays(Graphics g)
Render overlays.
|
int |
getHeight()
Get the current canvas height.
|
BufferedImageRenderResult |
getReusableRenderResult()
Returns a
RenderResult for rendering to. |
int |
getWidth()
Get the current canvas width.
|
void |
kill()
DON'T USE THIS.
|
void |
setCanvasSize(int width,
int height)
This is called, when the screen size of the canvas (the component
displaying the image and generating mouse events) changes.
|
void |
setRenderResult(BufferedImageRenderResult result)
Set the
RenderResult that is to be drawn on the canvas. |
org.scijava.listeners.Listeners<TransformListener<AffineTransform3D>> |
transformListeners()
Add/remove
TransformListener s to notify about viewer transformation
changes. |
public BufferedImageRenderResult getReusableRenderResult()
RenderTarget
RenderResult
for rendering to.
This may be a new RenderResult
or a previously set RenderResult
that is no longer needed for display.
Note that consecutive getReusableRenderResult()
calls without intermediate
setRenderResult()
may return the same RenderResult
.getReusableRenderResult
in interface RenderTarget<BufferedImageRenderResult>
public BufferedImageRenderResult createRenderResult()
RenderTarget
RenderResult
.createRenderResult
in interface RenderTarget<BufferedImageRenderResult>
public void setRenderResult(BufferedImageRenderResult result)
RenderResult
that is to be drawn on the canvas.setRenderResult
in interface RenderTarget<BufferedImageRenderResult>
result
- image to draw (may be null).public int getWidth()
RenderTarget
getWidth
in interface RenderTarget<BufferedImageRenderResult>
public int getHeight()
RenderTarget
getHeight
in interface RenderTarget<BufferedImageRenderResult>
public void drawOverlays(Graphics g)
OverlayRenderer
drawOverlays
in interface OverlayRenderer
public void setCanvasSize(int width, int height)
OverlayRenderer
setCanvasSize
in interface OverlayRenderer
width
- the new canvas width.height
- the new canvas height.public org.scijava.listeners.Listeners<TransformListener<AffineTransform3D>> transformListeners()
TransformListener
s to notify about viewer transformation
changes. Listeners will be notified when a new image has been rendered
(immediately before that image is displayed) with the viewer transform
used to render that image.public void kill()
This is a work around for JDK bug https://bugs.openjdk.java.net/browse/JDK-8029147 which leads to ViewerPanel not being garbage-collected when ViewerFrame is closed. So instead we need to manually let go of resources...
Copyright © 2015–2021 Fiji. All rights reserved.