Interface ICanvas
- All Known Subinterfaces:
IScreenCanvas
- All Known Implementing Classes:
CanvasAWT,CanvasNewtAwt,CanvasNewtSWT,CanvasSwing,EmulGLCanvas,OffscreenCanvas
public interface ICanvas
A
ICanvas represent the target component for rendering OpenGL.
It might be displayed on the screen in a GUI (IScreenCanvas), or simply be an offscreen
component able to export an image OffscreenCanvas.- Author:
- Martin Pernollet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanDeprecated.static final double -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCanvasListener(ICanvasListener listener) voidA generic interface for mouse listener to remain Windowing toolkit independant.voidA generic interface for mouse listener to remain Windowing toolkit independant.voiddispose()Performs all required cleanup when destroying a Canvas.voidInvoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed).doubleProvide pixel scale as feasible by the Hardware, OS, and JVM, independently of what was asked bysetPixelScale(float[]).Provide pixel scale as considered feasible by the JVM.intReturns the renderer's height, i.e. the display height.intReturns the renderer's width, i.e. the display width.getView()Returns a reference to the held view.booleanisNative()Return true if the canvas renders GL with GPU, false if renders GL using CPU executed Java code.voidremoveCanvasListener(ICanvasListener listener) voidA 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.voidA generic interface for key listener to remain Windowing toolkit independant.voidscreenshot(File file) voidsetPixelScale(float[] scale) Defines pixel scale.default voidsetPixelScale(Coord2d scale)
-
Field Details
-
LAST_RENDER_TIME_UNDEFINED
static final double LAST_RENDER_TIME_UNDEFINED- See Also:
-
ALLOW_WATCH_PIXEL_SCALE
Deprecated.Temporary way of enabling/disabling a thread watching pixel scale change of a native canvas. Set to false if you encounter threading issues with a native Canvas.- See Also:
-
-
Method Details
-
isNative
boolean isNative()Return true if the canvas renders GL with GPU, false if renders GL using CPU executed Java code. -
getView
View getView()Returns a reference to the held view. -
getRendererWidth
int getRendererWidth()Returns the renderer's width, i.e. the display width. -
getRendererHeight
int getRendererHeight()Returns the renderer's height, i.e. the display height. -
getDimension
Dimension getDimension() -
screenshot
- Throws:
IOException
-
screenshot
Object screenshot() -
forceRepaint
void forceRepaint()Invoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed). -
dispose
void dispose()Performs all required cleanup when destroying a Canvas. -
addMouseController
A 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. -
addKeyController
A 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. -
removeMouseController
A 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. -
removeKeyController
A 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. -
getDebugInfo
String getDebugInfo() -
setPixelScale
void setPixelScale(float[] scale) Defines 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(IPainter, 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 })
-
setPixelScale
-
getPixelScale
Coord2d getPixelScale()Provide pixel scale as feasible by the Hardware, OS, and JVM, independently of what was asked bysetPixelScale(float[]). Hence the two functions may not be consistent together. -
getPixelScaleJVM
Coord2d getPixelScaleJVM()Provide pixel scale as considered feasible by the JVM. -
getLastRenderingTimeMs
double getLastRenderingTimeMs() -
addCanvasListener
-
removeCanvasListener
-
getCanvasListeners
List<ICanvasListener> getCanvasListeners()
-