Interface NativeScreen

All Known Implementing Classes:
AndroidScreen, EGLScreen

public interface NativeScreen
NativeScreen provides access to a device's screen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Object
    An Object to lock against when swapping screen buffers.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the bit depth of the screen/
    int
    Returns the number of pixels per inch in the screen.
    int
    Returns the pixel height of the screen.
    int
    Returns the native format of the screen, as a constant from the Pixels class.
    long
    Returns a native handle for the screen.
    default int
    Returns the horizontal start position of this screen relative to the total combined screen size.
    default int
    Returns the vertical start position of this screen relative to the total combined screen size.
    float
    Return the scale factor between the physical pixels and the logical pixels e.g.
    Returns a read-only ByteBuffer in the native pixel format containing the screen contents.
    int
    Returns the pixel width of the screen.
    void
    Called during JavaFX shutdown to release the screen.
    void
    Called on the JavaFX application thread when pixel data for all windows has been uploaded.
    void
    uploadPixels(Buffer b, int x, int y, int width, int height, float alpha)
    Uploads a pixel buffer to the screen.
  • Field Details

    • framebufferSwapLock

      static final Object framebufferSwapLock
      An Object to lock against when swapping screen buffers.
  • Method Details

    • getDepth

      int getDepth()
      Returns the bit depth of the screen/
    • getNativeFormat

      int getNativeFormat()
      Returns the native format of the screen, as a constant from the Pixels class.
    • getWidth

      int getWidth()
      Returns the pixel width of the screen.
    • getHeight

      int getHeight()
      Returns the pixel height of the screen.
    • getOffsetX

      default int getOffsetX()
      Returns the horizontal start position of this screen relative to the total combined screen size.
    • getOffsetY

      default int getOffsetY()
      Returns the vertical start position of this screen relative to the total combined screen size.
    • getDPI

      int getDPI()
      Returns the number of pixels per inch in the screen.
    • getNativeHandle

      long getNativeHandle()
      Returns a native handle for the screen. The handle is platform-specific.
    • shutdown

      void shutdown()
      Called during JavaFX shutdown to release the screen. Called only once.
    • uploadPixels

      void uploadPixels(Buffer b, int x, int y, int width, int height, float alpha)
      Uploads a pixel buffer to the screen. Called on the JavaFX application thread.
      Parameters:
      b - Pixel data, in BYTE_BGRA_PRE format. The byte stride of the data is equal to width * 4.
      x - The X offset of the pixel data on the screen
      y - The Y offset of the pixel data on the screen
      width - The pixel width of the data
      height - The pixel height of the data
      alpha - The alpha level to use to compose the data over existing pixels
    • swapBuffers

      void swapBuffers()
      Called on the JavaFX application thread when pixel data for all windows has been uploaded.
    • getScreenCapture

      ByteBuffer getScreenCapture()
      Returns a read-only ByteBuffer in the native pixel format containing the screen contents.
      Returns:
      ByteBuffer a read-only ByteBuffer containing the screen contents
    • getScale

      float getScale()
      Return the scale factor between the physical pixels and the logical pixels e.g. hdpi = 1.5, xhdpi = 2.0