Class PanamaGLOffscreenCanvas
java.lang.Object
org.jzy3d.plot3d.rendering.canvas.PanamaGLOffscreenCanvas
- All Implemented Interfaces:
ICanvas
A canvas rendering a chart in an offscreen buffer without any window, e.g. to generate images on
a server or in tests.
The GL context is created and used by a dedicated thread : every rendering is performed by this
thread, and methods triggering a rendering wait for it to complete.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ICanvasListener> protected panamagl.opengl.GLContextprotected ExecutorServiceprotected panamagl.factory.PanamaGLFactoryprotected panamagl.offscreen.FBOprotected panamagl.opengl.GLprotected Threadprotected intprotected BufferedImageThe last rendered imageprotected panamagl.offscreen.FBOReaderprotected Renderer3Dprotected Viewprotected intFields inherited from interface ICanvas
ALLOW_WATCH_PIXEL_SCALE, LAST_RENDER_TIME_UNDEFINED -
Constructor Summary
ConstructorsConstructorDescriptionPanamaGLOffscreenCanvas(IChartFactory chartFactory, Scene scene, Quality quality, panamagl.factory.PanamaGLFactory factory, int width, int height) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCanvasListener(ICanvasListener listener) voidvoidvoiddispose()voiddoubleintintgetView()booleanisNative()voidremoveCanvasListener(ICanvasListener listener) voidvoidprotected voidrender(boolean reshape) Render the chart and keep the rendered image.protected voidrunOnGLThread(Runnable task) Run the task on the thread owning the GL context and wait for its completion.Render the chart and return the image, aBufferedImage.voidscreenshot(File file) voidsetPixelScale(float[] scale) An offscreen canvas has no pixel scale.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ICanvas
setPixelScale
-
Field Details
-
view
-
renderer
-
factory
protected panamagl.factory.PanamaGLFactory factory -
context
protected panamagl.opengl.GLContext context -
gl
protected panamagl.opengl.GL gl -
fbo
protected panamagl.offscreen.FBO fbo -
reader
protected panamagl.offscreen.FBOReader reader -
width
protected int width -
height
protected int height -
executor
-
glThread
-
image
The last rendered image -
canvasListeners
-
-
Constructor Details
-
PanamaGLOffscreenCanvas
public PanamaGLOffscreenCanvas(IChartFactory chartFactory, Scene scene, Quality quality, panamagl.factory.PanamaGLFactory factory, int width, int height)
-
-
Method Details
-
render
protected void render(boolean reshape) Render the chart and keep the rendered image. Must be invoked by the GL thread. -
runOnGLThread
Run the task on the thread owning the GL context and wait for its completion. Run it immediately if called from this thread. -
forceRepaint
public void forceRepaint()- Specified by:
forceRepaintin interfaceICanvas
-
screenshot
Render the chart and return the image, aBufferedImage.- Specified by:
screenshotin interfaceICanvas
-
screenshot
- Specified by:
screenshotin interfaceICanvas- Throws:
IOException
-
dispose
-
getView
-
getRenderer
-
isNative
-
getRendererWidth
public int getRendererWidth()- Specified by:
getRendererWidthin interfaceICanvas
-
getRendererHeight
public int getRendererHeight()- Specified by:
getRendererHeightin interfaceICanvas
-
getDimension
- Specified by:
getDimensionin interfaceICanvas
-
getDebugInfo
- Specified by:
getDebugInfoin interfaceICanvas
-
setPixelScale
public void setPixelScale(float[] scale) An offscreen canvas has no pixel scale.- Specified by:
setPixelScalein interfaceICanvas
-
getPixelScale
- Specified by:
getPixelScalein interfaceICanvas
-
getPixelScaleJVM
- Specified by:
getPixelScaleJVMin interfaceICanvas
-
getLastRenderingTimeMs
public double getLastRenderingTimeMs()- Specified by:
getLastRenderingTimeMsin interfaceICanvas
-
addMouseController
- Specified by:
addMouseControllerin interfaceICanvas
-
addKeyController
- Specified by:
addKeyControllerin interfaceICanvas
-
removeMouseController
- Specified by:
removeMouseControllerin interfaceICanvas
-
removeKeyController
- Specified by:
removeKeyControllerin interfaceICanvas
-
addCanvasListener
- Specified by:
addCanvasListenerin interfaceICanvas
-
removeCanvasListener
- Specified by:
removeCanvasListenerin interfaceICanvas
-
getCanvasListeners
- Specified by:
getCanvasListenersin interfaceICanvas
-