Package com.jme3.system
Class AWTComponentRenderer
java.lang.Object
com.jme3.system.AWTComponentRenderer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byte[]The byte buffer.protected static final intThe constant DISPOSED_STATE.protected static final intThe constant DISPOSING_STATE.protected final FrameBufferThe Frame buffer.protected final ByteBufferThe Frame byte buffer.protected intHow many frames need to write else.protected final AtomicIntegerThe Frame state.protected final int[]The image byte buffer.protected final AtomicIntegerThe Image state.protected final GraphicsThe Pixel writer.protected final byte[]The prev image byte buffer.protected static final intThe constant RUNNING_STATE.protected final AWTFrameProcessor.TransferModeThe transfer mode.protected static final intThe constant WAITING_STATE. -
Constructor Summary
ConstructorsConstructorDescriptionAWTComponentRenderer(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 TypeMethodDescriptionvoidcopyFrameBufferToImage(RenderManager renderManager) Copy the JMonkey frame buffer that has been rendered by the JMonkey engine and schedule the rendering of the component.voiddispose()Dispose this renderer.protected GraphicsgetGraphics(Component destination) Get the graphics context of the given component.intGet the height of the area to render.protected int[]Get the image byte buffer.protected byte[]Get the previous image byte buffer.intgetWidth()Get the width of the area to render.voidInitialize the component renderer.protected voidWrite 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.ALWAYSif the component has to be rendered at each update orAWTFrameProcessor.TransferMode.ON_CHANGESif 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.ALWAYSif the component has to be rendered at each update orAWTFrameProcessor.TransferMode.ON_CHANGESif the component has to be rendered only when changes are occurring.frameBuffer- the JMonkey frame buffer to use (ifnullis 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 JMonkeyrendererto use.main-trueif the attached frame buffer is the main one orfalseotherwise.
-
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.
-