Class OffscreenCanvas
java.lang.Object
org.jzy3d.plot3d.rendering.canvas.OffscreenCanvas
- All Implemented Interfaces:
ICanvas, INativeCanvas
An
ICanvas implementation able to render the chart in an offscreen canvas, meaning no
frame or GUI is needed to get a chart.
Subsequently, one will wish to generate chart images by calling:
chart.screenshot();
Note that the GLCapabilities are modified while an instance of OffscreenCanvas is
modified.- Author:
- Nils Hoffman, Martin Pernollet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ICanvasListener> protected com.jogamp.opengl.GLCapabilitiesprotected com.jogamp.opengl.GLOffscreenAutoDrawableprotected Renderer3dprotected ViewFields inherited from interface ICanvas
ALLOW_WATCH_PIXEL_SCALE, LAST_RENDER_TIME_UNDEFINED -
Constructor Summary
ConstructorsConstructorDescriptionOffscreenCanvas(IChartFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCanvasListener(ICanvasListener listener) voidvoidvoiddispose()protected voidfirePixelScaleChanged(double pixelScaleX, double pixelScaleY) voidcom.jogamp.opengl.GLCapabilitiescom.jogamp.opengl.GLOffscreenAutoDrawableReturns the GLDrawable associated with the canvasdoubleintintgetView()Provide a reference to the View that renders into this canvas.voidinitBuffer(com.jogamp.opengl.GLCapabilities capabilities, int width, int height) Initialize aGLOffscreenAutoDrawableto the desired dimensions Might be aGLPixelBufferorGLFBODrawabledepending on the providedGLCapabilities(} to enable PBuffer).invalid @link
{@link GLCapabilities#setPBuffer(true)booleanisNative()voidremoveCanvasListener(ICanvasListener listener) voidvoidvoidresize(int width, int height) com.jogamp.opengl.util.texture.TextureDataReturns an image with the current renderer's sizevoidscreenshot(File file) voidsetPixelScale(float[] 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
-
offscreenDrawable
protected com.jogamp.opengl.GLOffscreenAutoDrawable offscreenDrawable -
capabilities
protected com.jogamp.opengl.GLCapabilities capabilities -
canvasListeners
-
-
Constructor Details
-
OffscreenCanvas
public OffscreenCanvas(IChartFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height)
-
-
Method Details
-
initBuffer
public void initBuffer(com.jogamp.opengl.GLCapabilities capabilities, int width, int height) Initialize aGLOffscreenAutoDrawableto the desired dimensions Might be aGLPixelBufferorGLFBODrawabledepending on the providedGLCapabilities(} to enable PBuffer). Can be called several time to reset buffer dimensions.invalid @link
{@link GLCapabilities#setPBuffer(true)- Parameters:
capabilities- with a setOnscreen flag set to true, otherwise forced to true.width- image widthheight- image width
-
resize
public void resize(int width, int height) -
getCapabilities
public com.jogamp.opengl.GLCapabilities getCapabilities() -
getLastRenderingTimeMs
public double getLastRenderingTimeMs()- Specified by:
getLastRenderingTimeMsin interfaceICanvas
-
setPixelScale
public void setPixelScale(float[] scale) - Specified by:
setPixelScalein interfaceICanvas
-
getPixelScale
- Specified by:
getPixelScalein interfaceICanvas
-
getPixelScaleJVM
- Specified by:
getPixelScaleJVMin interfaceICanvas
-
getDrawable
public com.jogamp.opengl.GLOffscreenAutoDrawable getDrawable()Description copied from interface:INativeCanvasReturns the GLDrawable associated with the canvas- Specified by:
getDrawablein interfaceINativeCanvas
-
dispose
-
forceRepaint
public void forceRepaint()- Specified by:
forceRepaintin interfaceICanvas
-
screenshot
public com.jogamp.opengl.util.texture.TextureData screenshot()Description copied from interface:INativeCanvasReturns an image with the current renderer's size- Specified by:
screenshotin interfaceICanvas- Specified by:
screenshotin interfaceINativeCanvas
-
screenshot
- Specified by:
screenshotin interfaceICanvas- Throws:
IOException
-
getView
-
getRendererWidth
public int getRendererWidth()- Specified by:
getRendererWidthin interfaceICanvas
-
getRendererHeight
public int getRendererHeight()- Specified by:
getRendererHeightin interfaceICanvas
-
getRenderer
- Specified by:
getRendererin interfaceINativeCanvas
-
getDimension
- Specified by:
getDimensionin interfaceICanvas
-
getDebugInfo
- Specified by:
getDebugInfoin 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
-
firePixelScaleChanged
protected void firePixelScaleChanged(double pixelScaleX, double pixelScaleY) -
isNative
-