Interface ICanvas
-
- All Known Subinterfaces:
IScreenCanvas
- All Known Implementing Classes:
CanvasAWT
,CanvasNewtAwt
,CanvasNewtSWT
,CanvasSwing
,EmulGLCanvas
,OffscreenCanvas
public interface ICanvas
AICanvas
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 imageOffscreenCanvas
.- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ALLOW_WATCH_PIXEL_SCALE
Deprecated.static double
LAST_RENDER_TIME_UNDEFINED
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addCanvasListener(ICanvasListener listener)
void
addKeyController(Object o)
A generic interface for mouse listener to remain Windowing toolkit independant.void
addMouseController(Object o)
A generic interface for mouse listener to remain Windowing toolkit independant.void
dispose()
Performs all required cleanup when destroying a Canvas.void
forceRepaint()
Invoked when a user requires the Canvas to be repainted (e.g. a non 3d layer has changed).List<ICanvasListener>
getCanvasListeners()
String
getDebugInfo()
double
getLastRenderingTimeMs()
Coord2d
getPixelScale()
Provide pixel scale as feasible by the Hardware, OS, and JVM, independently of what was asked bysetPixelScale(float[])
.int
getRendererHeight()
Returns the renderer's height, i.e. the display height.int
getRendererWidth()
Returns the renderer's width, i.e. the display width.View
getView()
Returns a reference to the held view.void
removeCanvasListener(ICanvasListener listener)
void
removeKeyController(Object o)
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.void
removeMouseController(Object o)
A generic interface for key listener to remain Windowing toolkit independant.Object
screenshot()
void
screenshot(File file)
void
setPixelScale(float[] scale)
Defines pixel scale.
-
-
-
Field Detail
-
LAST_RENDER_TIME_UNDEFINED
static final double LAST_RENDER_TIME_UNDEFINED
- See Also:
- Constant Field Values
-
ALLOW_WATCH_PIXEL_SCALE
@Deprecated static final boolean 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:
- Constant Field Values
-
-
Method Detail
-
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.
-
screenshot
void screenshot(File file) throws IOException
- 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
void addMouseController(Object o)
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
void addKeyController(Object o)
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
void removeMouseController(Object o)
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
void removeKeyController(Object o)
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 })
-
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.
-
getLastRenderingTimeMs
double getLastRenderingTimeMs()
-
addCanvasListener
void addCanvasListener(ICanvasListener listener)
-
removeCanvasListener
void removeCanvasListener(ICanvasListener listener)
-
getCanvasListeners
List<ICanvasListener> getCanvasListeners()
-
-