Class AndroidScreen

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.Object framebufferSwapLock
      An Object to lock against when swapping screen buffers.
    • Constructor Summary

      Constructors 
      Constructor Description
      AndroidScreen()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDepth()
      Returns the bit depth of the screen/
      int getDPI()
      Returns the number of pixels per inch in the screen.
      int getHeight()
      Returns the pixel height of the screen.
      int getNativeFormat()
      Returns the native format of the screen, as a constant from the Pixels class.
      long getNativeHandle()
      Returns a native handle for the screen.
      float getScale()
      Return the scale factor between the physical pixels and the logical pixels e.g.
      java.nio.ByteBuffer getScreenCapture()
      Returns a read-only ByteBuffer in the native pixel format containing the screen contents.
      int getWidth()
      Returns the pixel width of the screen.
      void shutdown()
      Called during JavaFX shutdown to release the screen.
      void swapBuffers()
      Called on the JavaFX application thread when pixel data for all windows has been uploaded.
      void uploadPixels​(java.nio.Buffer b, int x, int y, int width, int height, float alpha)
      Uploads a pixel buffer to the screen.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • framebufferSwapLock

        public static final java.lang.Object framebufferSwapLock
        An Object to lock against when swapping screen buffers.
    • Constructor Detail

      • AndroidScreen

        public AndroidScreen()
    • Method Detail

      • getDepth

        public int getDepth()
        Description copied from interface: NativeScreen
        Returns the bit depth of the screen/
        Specified by:
        getDepth in interface NativeScreen
      • getNativeFormat

        public int getNativeFormat()
        Returns the native format of the screen, as a constant from the Pixels class.
        Specified by:
        getNativeFormat in interface NativeScreen
      • getWidth

        public int getWidth()
        Returns the pixel width of the screen.
        Specified by:
        getWidth in interface NativeScreen
      • getHeight

        public int getHeight()
        Returns the pixel height of the screen.
        Specified by:
        getHeight in interface NativeScreen
      • getDPI

        public int getDPI()
        Returns the number of pixels per inch in the screen.
        Specified by:
        getDPI in interface NativeScreen
      • getScale

        public float getScale()
        Description copied from interface: NativeScreen
        Return the scale factor between the physical pixels and the logical pixels e.g. hdpi = 1.5, xhdpi = 2.0
        Specified by:
        getScale in interface NativeScreen
      • getNativeHandle

        public long getNativeHandle()
        Returns a native handle for the screen. The handle is platform-specific.
        Specified by:
        getNativeHandle in interface NativeScreen
      • shutdown

        public void shutdown()
        Called during JavaFX shutdown to release the screen. Called only once.
        Specified by:
        shutdown in interface NativeScreen
      • uploadPixels

        public void uploadPixels​(java.nio.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.
        Specified by:
        uploadPixels in interface NativeScreen
        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

        public void swapBuffers()
        Called on the JavaFX application thread when pixel data for all windows has been uploaded.
        Specified by:
        swapBuffers in interface NativeScreen
      • getScreenCapture

        public java.nio.ByteBuffer getScreenCapture()
        Returns a read-only ByteBuffer in the native pixel format containing the screen contents.
        Specified by:
        getScreenCapture in interface NativeScreen
        Returns:
        ByteBuffer a read-only ByteBuffer containing the screen contents