org.jzy3d.plot3d.rendering.canvas
Class OffscreenCanvas
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.canvas.OffscreenCanvas
-
- All Implemented Interfaces:
- ICanvas
public class OffscreenCanvas extends java.lang.Object implements ICanvas
AnICanvasimplementation 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:
Note that thechart.screenshot();GLCapabilitiesare modified while an instance ofOffscreenCanvasis modified.
-
-
Constructor Summary
Constructors Constructor and Description OffscreenCanvas(IChartComponentFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height)OffscreenCanvas(IChartComponentFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height, boolean traceGL, boolean debugGL)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidaddKeyController(java.lang.Object o)A generic interface for mouse listener to remain Windowing toolkit independant.voidaddMouseController(java.lang.Object o)A generic interface for mouse listener to remain Windowing toolkit independant.voiddispose()Performs all required cleanup when destroying a Canvas.voidforceRepaint()Invoked when a user requires the Canvas to be repainted (e.g.com.jogamp.opengl.GLCapabilitiesgetCapabilities()java.lang.StringgetDebugInfo()com.jogamp.opengl.GLOffscreenAutoDrawablegetDrawable()Returns the GLDrawable associated with the canvascom.jogamp.opengl.GLOffscreenAutoDrawablegetGlpBuffer()Deprecated.Renderer3dgetRenderer()intgetRendererHeight()Returns the renderer's height, i.e.intgetRendererWidth()Returns the renderer's width, i.e.ViewgetView()Provide a reference to the View that renders into this canvas.voidinitBuffer(com.jogamp.opengl.GLCapabilities capabilities, int width, int height)Initialize a GLPBuffer with desired capabilities.voidremoveKeyController(java.lang.Object o)A generic interface for key listener to remain Windowing toolkit independant.voidremoveMouseController(java.lang.Object o)A generic interface for key listener to remain Windowing toolkit independant.com.jogamp.opengl.util.texture.TextureDatascreenshot()Returns an image with the current renderer's sizecom.jogamp.opengl.util.texture.TextureDatascreenshot(java.io.File file)voidsetPixelScale(float[] scale)Defines pixel scale.
-
-
-
Constructor Detail
-
OffscreenCanvas
public OffscreenCanvas(IChartComponentFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height)
-
OffscreenCanvas
public OffscreenCanvas(IChartComponentFactory factory, Scene scene, Quality quality, com.jogamp.opengl.GLCapabilities capabilities, int width, int height, boolean traceGL, boolean debugGL)
-
-
Method Detail
-
initBuffer
public void initBuffer(com.jogamp.opengl.GLCapabilities capabilities, int width, int height)Initialize a GLPBuffer with desired capabilities. Can be called several time to reset buffer dimensions.- Parameters:
capabilities-width-height-
-
setPixelScale
public void setPixelScale(float[] scale)
Description copied from interface:ICanvasDefines pixel scale. On MacOS Retina displays, a X*Y chart uses a (X*2)*(Y*2) viewport. This makes some calculation based on viewport (such asCamera.screenToModel(com.jogamp.opengl.GL, com.jogamp.opengl.glu.GLU, org.jzy3d.maths.Coord3d)output wrong result. When running on Retina display, those two options fixed buggy mouse selections on Retina:- setPixelScale(new float[]{0.5f,0.5f})
- setPixelScale(new float[] { ScalableSurface.IDENTITY_PIXELSCALE,
ScalableSurface.IDENTITY_PIXELSCALE })
- Specified by:
setPixelScalein interfaceICanvas- See Also:
ScalableSurface#setSurfaceScale(float[])} in JOGL javadoc for more informations
-
getGlpBuffer
@Deprecated public com.jogamp.opengl.GLOffscreenAutoDrawable getGlpBuffer()
Deprecated.
-
getDrawable
public com.jogamp.opengl.GLOffscreenAutoDrawable getDrawable()
Description copied from interface:ICanvasReturns the GLDrawable associated with the canvas- Specified by:
getDrawablein interfaceICanvas
-
dispose
public void dispose()
Description copied from interface:ICanvasPerforms all required cleanup when destroying a Canvas.
-
forceRepaint
public void forceRepaint()
Description copied from interface:ICanvasInvoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed).- Specified by:
forceRepaintin interfaceICanvas
-
screenshot
public com.jogamp.opengl.util.texture.TextureData screenshot()
Description copied from interface:ICanvasReturns an image with the current renderer's size- Specified by:
screenshotin interfaceICanvas
-
screenshot
public com.jogamp.opengl.util.texture.TextureData screenshot(java.io.File file) throws java.io.IOException- Specified by:
screenshotin interfaceICanvas- Throws:
java.io.IOException
-
getView
public View getView()
Provide a reference to the View that renders into this canvas.
-
getRendererWidth
public int getRendererWidth()
Description copied from interface:ICanvasReturns the renderer's width, i.e. the display width.- Specified by:
getRendererWidthin interfaceICanvas
-
getRendererHeight
public int getRendererHeight()
Description copied from interface:ICanvasReturns the renderer's height, i.e. the display height.- Specified by:
getRendererHeightin interfaceICanvas
-
getRenderer
public Renderer3d getRenderer()
- Specified by:
getRendererin interfaceICanvas
-
getDebugInfo
public java.lang.String getDebugInfo()
- Specified by:
getDebugInfoin interfaceICanvas
-
addMouseController
public void addMouseController(java.lang.Object o)
Description copied from interface:ICanvasA generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.- Specified by:
addMouseControllerin interfaceICanvas
-
addKeyController
public void addKeyController(java.lang.Object o)
Description copied from interface:ICanvasA generic interface for mouse listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible mouse listener.- Specified by:
addKeyControllerin interfaceICanvas
-
removeMouseController
public void removeMouseController(java.lang.Object o)
Description copied from interface:ICanvasA generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.- Specified by:
removeMouseControllerin interfaceICanvas
-
removeKeyController
public void removeKeyController(java.lang.Object o)
Description copied from interface:ICanvasA generic interface for key listener to remain Windowing toolkit independant. * Implementation of this method should simply cast the input assuming it will correspond to canvas-compatible key listener.- Specified by:
removeKeyControllerin interfaceICanvas
-
getCapabilities
public com.jogamp.opengl.GLCapabilities getCapabilities()
-
-
DMelt 3.0 © DataMelt by jWork.ORG