public class AWTComponentRenderer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected byte[] |
byteBuffer
The byte buffer.
|
protected static int |
DISPOSED_STATE
The constant DISPOSED_STATE.
|
protected static int |
DISPOSING_STATE
The constant DISPOSING_STATE.
|
protected FrameBuffer |
frameBuffer
The Frame buffer.
|
protected java.nio.ByteBuffer |
frameByteBuffer
The Frame byte buffer.
|
protected int |
frameCount
How many frames need to write else.
|
protected java.util.concurrent.atomic.AtomicInteger |
frameState
The Frame state.
|
protected int[] |
imageByteBuffer
The image byte buffer.
|
protected java.util.concurrent.atomic.AtomicInteger |
imageState
The Image state.
|
protected java.awt.Graphics |
pixelWriter
The Pixel writer.
|
protected byte[] |
prevImageByteBuffer
The prev image byte buffer.
|
protected static int |
RUNNING_STATE
The constant RUNNING_STATE.
|
protected AWTFrameProcessor.TransferMode |
transferMode
The transfer mode.
|
protected static int |
WAITING_STATE
The constant WAITING_STATE.
|
Constructor and Description |
---|
AWTComponentRenderer(java.awt.Component destination,
AWTFrameProcessor.TransferMode transferMode,
FrameBuffer frameBuffer,
int width,
int height)
Create a new component renderer attached to the given
destination . |
AWTComponentRenderer(java.awt.Component destination,
int width,
int height,
AWTFrameProcessor.TransferMode transferMode)
Create a new component renderer attached to the given
destination . |
Modifier and Type | Method and Description |
---|---|
void |
copyFrameBufferToImage(RenderManager renderManager)
Copy the JMonkey frame buffer that has been rendered by the JMonkey engine and schedule the rendering of the component.
|
void |
dispose()
Dispose this renderer.
|
protected java.awt.Graphics |
getGraphics(java.awt.Component destination)
Get the graphics context of the given component.
|
int |
getHeight()
Get the height of the area to render.
|
protected int[] |
getImageByteBuffer()
Get the image byte buffer.
|
protected byte[] |
getPrevImageByteBuffer()
Get the previous image byte buffer.
|
int |
getWidth()
Get the width of the area to render.
|
void |
init(Renderer renderer,
boolean main)
Initialize the component renderer.
|
protected void |
writeFrame()
Write the current rendered frame to the component graphics contex.
|
protected static final int RUNNING_STATE
protected static final int WAITING_STATE
protected static final int DISPOSING_STATE
protected static final int DISPOSED_STATE
protected final java.util.concurrent.atomic.AtomicInteger frameState
protected final java.util.concurrent.atomic.AtomicInteger imageState
protected final FrameBuffer frameBuffer
protected final java.awt.Graphics pixelWriter
protected final java.nio.ByteBuffer frameByteBuffer
protected final AWTFrameProcessor.TransferMode transferMode
protected final byte[] byteBuffer
protected final int[] imageByteBuffer
protected final byte[] prevImageByteBuffer
protected int frameCount
public AWTComponentRenderer(java.awt.Component destination, int width, int height, AWTFrameProcessor.TransferMode transferMode)
destination
.
The graphics of the destination are updated with the JMonkeyEngine rendering result.destination
- the AWT component to use as target of the JMonkeyEngine rendering.width
- the width of the component in pixels.height
- the height of the component in pixels.transferMode
- the rendering mode that can be AWTFrameProcessor.TransferMode.ALWAYS
if the component has to be rendered at each update
or AWTFrameProcessor.TransferMode.ON_CHANGES
if the component has to be rendered only when changes are occurring.public AWTComponentRenderer(java.awt.Component destination, AWTFrameProcessor.TransferMode transferMode, FrameBuffer frameBuffer, int width, int height)
destination
.
The graphics of the destination are updated with the JMonkeyEngine rendering result.destination
- the AWT component to use as target of the JMonkeyEngine rendering.transferMode
- the rendering mode that can be AWTFrameProcessor.TransferMode.ALWAYS
if the component has to be rendered at each update or AWTFrameProcessor.TransferMode.ON_CHANGES
if the component has to be rendered only when changes are occurring.frameBuffer
- the JMonkey frame buffer to use (if null
is passed, a new default frame buffer is created)width
- the width of the component in pixels.height
- the height of the component in pixels.public void init(Renderer renderer, boolean main)
renderer
- the JMonkey renderer
to use.main
- true
if the attached frame buffer is the main one or false
otherwise.protected java.awt.Graphics getGraphics(java.awt.Component destination)
destination
- the AWT component used for rendering (not null)public int getWidth()
getHeight()
public int getHeight()
getWidth()
public void copyFrameBufferToImage(RenderManager renderManager)
renderManager
- the JMonkey render manager.protected void writeFrame()
protected int[] getImageByteBuffer()
protected byte[] getPrevImageByteBuffer()
public void dispose()