Class ScreenCapture


  • public class ScreenCapture
    extends Object
    This class uses native code to capture desktop screen. It should work for Windows, Mac OS X and X11-based Unix such as Linux and FreeBSD.
    Author:
    Sebastien Vincent
    • Constructor Detail

      • ScreenCapture

        public ScreenCapture()
    • Method Detail

      • grabScreen

        public static boolean grabScreen​(int display,
                                         int x,
                                         int y,
                                         int width,
                                         int height,
                                         byte[] output)
        Grab desktop screen and get raw bytes.
        Parameters:
        display - index of display
        x - x position to start capture
        y - y position to start capture
        width - capture width
        height - capture height
        output - output buffer to store screen bytes
        Returns:
        true if grab success, false otherwise
      • grabScreen

        public static boolean grabScreen​(int display,
                                         int x,
                                         int y,
                                         int width,
                                         int height,
                                         long output,
                                         int outputLength)
        Grab desktop screen and get raw bytes.
        Parameters:
        display - index of display
        x - x position to start capture
        y - y position to start capture
        width - capture width
        height - capture height
        output - native output buffer to store screen bytes
        outputLength - native output length
        Returns:
        true if grab success, false otherwise