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 Details

    • LAST_RENDER_TIME_UNDEFINED

      static final double LAST_RENDER_TIME_UNDEFINED
      See Also:
    • 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:
  • 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

      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 as Camera.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

        default void setPixelScale(Coord2d scale)
      • getPixelScale

        Coord2d getPixelScale()
        Provide pixel scale as feasible by the Hardware, OS, and JVM, independently of what was asked by setPixelScale(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

        void addCanvasListener(ICanvasListener listener)
      • removeCanvasListener

        void removeCanvasListener(ICanvasListener listener)
      • getCanvasListeners

        List<ICanvasListener> getCanvasListeners()