Interface ScalableSurface

All Known Subinterfaces:
Window
All Known Implementing Classes:
GLCanvas, GLJPanel, GLWindow, JAWTWindow

public interface ScalableSurface
Adding mutable surface pixel scale property to implementing class, usually to a NativeSurface implementation, see setSurfaceScale(float[]).
  • Field Details

    • IDENTITY_PIXELSCALE

      static final float IDENTITY_PIXELSCALE
      Setting surface-pixel-scale of 1.0f, results in same pixel- and window-units.
      See Also:
    • AUTOMAX_PIXELSCALE

      static final float AUTOMAX_PIXELSCALE
      Setting surface-pixel-scale of 0.0f, results in maximum platform dependent pixel-scale, i.e. pixel-units >> window-units where available.
      See Also:
  • Method Details

    • setSurfaceScale

      boolean setSurfaceScale(float[] pixelScale)
      Request a pixel scale in x- and y-direction for the associated NativeSurface, where size_in_pixel_units = pixel_scale * size_in_window_units.

      Default pixel scale request for both directions is AUTOMAX_PIXELSCALE.

      In case platform only supports uniform pixel scale, i.e. one scale for both directions, either AUTOMAX_PIXELSCALE or the maximum requested pixel scale component is used.

      The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to IDENTITY_PIXELSCALE if not supported or clipped to the platform maximum. It can be queried via getRequestedSurfaceScale(float[]).

      The actual realized pixel scale values of the NativeSurface can be queried via getCurrentSurfaceScale(float[]) or computed via surface.convertToPixelUnits(new int[] { 1, 1 })

      Parameters:
      pixelScale - requested surface pixel scale float[2] values for x- and y-direction.
      Returns:
      true if the current pixel scale has changed, otherwise false.
      See Also:
    • getRequestedSurfaceScale

      float[] getRequestedSurfaceScale(float[] result)
      Returns the requested pixel scale of the associated NativeSurface.
      Parameters:
      result - float[2] storage for the result
      Returns:
      the passed storage containing the current pixelScale for chaining
      See Also:
    • getCurrentSurfaceScale

      float[] getCurrentSurfaceScale(float[] result)
      Returns the current pixel scale of the associated NativeSurface.
      Parameters:
      result - float[2] storage for the result
      Returns:
      the passed storage containing the current pixelScale for chaining
    • getMinimumSurfaceScale

      float[] getMinimumSurfaceScale(float[] result)
      Returns the minimum pixel scale of the associated NativeSurface.
      Parameters:
      result - float[2] storage for the result
      Returns:
      the passed storage containing the minimum pixelScale for chaining
    • getMaximumSurfaceScale

      float[] getMaximumSurfaceScale(float[] result)
      Returns the maximum pixel scale of the associated NativeSurface.

      The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this NativeSurface.

          surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale,
          with PpMM == pixel per millimeter
       

      Parameters:
      result - float[2] storage for the result
      Returns:
      the passed storage containing the maximum pixelScale for chaining