Package com.jme3.system
Class AWTComponentRenderer
java.lang.Object
com.jme3.system.AWTComponentRenderer
-
Field Summary
Modifier and TypeFieldDescriptionprotected final byte[]
The byte buffer.protected static final int
The constant DISPOSED_STATE.protected static final int
The constant DISPOSING_STATE.protected final FrameBuffer
The Frame buffer.protected final ByteBuffer
The Frame byte buffer.protected int
How many frames need to write else.protected final AtomicInteger
The Frame state.protected final int[]
The image byte buffer.protected final AtomicInteger
The Image state.protected final Graphics
The Pixel writer.protected final byte[]
The prev image byte buffer.protected static final int
The constant RUNNING_STATE.protected final AWTFrameProcessor.TransferMode
The transfer mode.protected static final int
The constant WAITING_STATE. -
Constructor Summary
ConstructorDescriptionAWTComponentRenderer
(Component destination, int width, int height, AWTFrameProcessor.TransferMode transferMode) Create a new component renderer attached to the givendestination
.AWTComponentRenderer
(Component destination, AWTFrameProcessor.TransferMode transferMode, FrameBuffer frameBuffer, int width, int height) Create a new component renderer attached to the givendestination
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Graphics
getGraphics
(Component destination) Get the graphics context of the given component.int
Get the height of the area to render.protected int[]
Get the image byte buffer.protected byte[]
Get the previous image byte buffer.int
getWidth()
Get the width of the area to render.void
Initialize the component renderer.protected void
Write the current rendered frame to the component graphics context.
-
Field Details
-
RUNNING_STATE
protected static final int RUNNING_STATEThe constant RUNNING_STATE.- See Also:
-
WAITING_STATE
protected static final int WAITING_STATEThe constant WAITING_STATE.- See Also:
-
DISPOSING_STATE
protected static final int DISPOSING_STATEThe constant DISPOSING_STATE.- See Also:
-
DISPOSED_STATE
protected static final int DISPOSED_STATEThe constant DISPOSED_STATE.- See Also:
-
frameState
The Frame state. -
imageState
The Image state. -
frameBuffer
The Frame buffer. -
pixelWriter
The Pixel writer. -
frameByteBuffer
The Frame byte buffer. -
transferMode
The transfer mode. -
byteBuffer
protected final byte[] byteBufferThe byte buffer. -
imageByteBuffer
protected final int[] imageByteBufferThe image byte buffer. -
prevImageByteBuffer
protected final byte[] prevImageByteBufferThe prev image byte buffer. -
frameCount
protected int frameCountHow many frames need to write else.
-
-
Constructor Details
-
AWTComponentRenderer
public AWTComponentRenderer(Component destination, int width, int height, AWTFrameProcessor.TransferMode transferMode) Create a new component renderer attached to the givendestination
. The graphics of the destination are updated with the JMonkeyEngine rendering result.- Parameters:
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 beAWTFrameProcessor.TransferMode.ALWAYS
if the component has to be rendered at each update orAWTFrameProcessor.TransferMode.ON_CHANGES
if the component has to be rendered only when changes are occurring.
-
AWTComponentRenderer
public AWTComponentRenderer(Component destination, AWTFrameProcessor.TransferMode transferMode, FrameBuffer frameBuffer, int width, int height) Create a new component renderer attached to the givendestination
. The graphics of the destination are updated with the JMonkeyEngine rendering result.- Parameters:
destination
- the AWT component to use as target of the JMonkeyEngine rendering.transferMode
- the rendering mode that can beAWTFrameProcessor.TransferMode.ALWAYS
if the component has to be rendered at each update orAWTFrameProcessor.TransferMode.ON_CHANGES
if the component has to be rendered only when changes are occurring.frameBuffer
- the JMonkey frame buffer to use (ifnull
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.
-
-
Method Details
-
init
Initialize the component renderer.- Parameters:
renderer
- the JMonkeyrenderer
to use.main
-true
if the attached frame buffer is the main one orfalse
otherwise.
-
getGraphics
Get the graphics context of the given component.- Parameters:
destination
- the AWT component used for rendering (not null)- Returns:
- the graphics context of the given component.
-
getWidth
public int getWidth()Get the width of the area to render.- Returns:
- the width of the area to render.
- See Also:
-
getHeight
public int getHeight()Get the height of the area to render.- Returns:
- the height of the area to render.
- See Also:
-
copyFrameBufferToImage
Copy the JMonkey frame buffer that has been rendered by the JMonkey engine and schedule the rendering of the component.- Parameters:
renderManager
- the JMonkey render manager.
-
writeFrame
protected void writeFrame()Write the current rendered frame to the component graphics context. -
getImageByteBuffer
protected int[] getImageByteBuffer()Get the image byte buffer.- Returns:
- the image byte buffer.
-
getPrevImageByteBuffer
protected byte[] getPrevImageByteBuffer()Get the previous image byte buffer.- Returns:
- the previous image byte buffer.
-
dispose
public void dispose()Dispose this renderer. The underlying frame buffer is also disposed.
-