Package paintingcanvas.canvas
Interface RenderLifecycle
-
- All Known Implementing Classes:
FrameCounter
,InfoDisplay
,Recorder
,RenderLifecycle.AntiAliasingLifecycle
,RenderLifecycle.CenteringLifecycle
public interface RenderLifecycle
Allows other classes to run code at different points during the rendering process. This is mainly useful for extensions / little widgets and things, but I'm sure you can find other uses.
Here's exactly how it works (sort of). First the
image
is created, and the background is drawn. Next,preRender(Graphics)
is called, and all theDrawables
get drawn. ThenpostRender(Graphics)
is called,renderStart(Graphics)
is called, and finally, the image is copied over to the screen, andrenderEnd(Graphics)
is called.Note that
preRender
/postRender
are called on a different graphics context compared torenderStart
/renderEnd
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RenderLifecycle.AntiAliasingLifecycle
static class
RenderLifecycle.CenteringLifecycle
static class
RenderLifecycle.ResizeListener
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
onResize(CanvasPanel canvas, java.awt.event.ComponentEvent e)
default void
postRender(java.awt.Graphics g)
Runs after everything else; theimage
inCanvasPanel
will reflect your changes.default void
preRender(java.awt.Graphics g)
Runs before everything else; theimage
inCanvasPanel
will reflect your changes.default void
renderEnd(java.awt.Graphics g)
Runs after everything else; theimage
inCanvasPanel
will not reflect your changes.default void
renderStart(java.awt.Graphics g)
Runs before everything else; theimage
inCanvasPanel
will not reflect your changes.
-
-
-
Method Detail
-
preRender
default void preRender(java.awt.Graphics g)
Runs before everything else; theimage
inCanvasPanel
will reflect your changes.- Parameters:
g
- The graphics context
-
postRender
default void postRender(java.awt.Graphics g)
Runs after everything else; theimage
inCanvasPanel
will reflect your changes.- Parameters:
g
- The graphics context
-
renderEnd
default void renderEnd(java.awt.Graphics g)
Runs after everything else; theimage
inCanvasPanel
will not reflect your changes.- Parameters:
g
- The graphics context
-
renderStart
default void renderStart(java.awt.Graphics g)
Runs before everything else; theimage
inCanvasPanel
will not reflect your changes.- Parameters:
g
- The graphics context
-
onResize
default void onResize(CanvasPanel canvas, java.awt.event.ComponentEvent e)
-
-