/** * Capture a part of the desktop screen using native grabber. * * <p>Contrary to other captureScreen method, it only returns raw bytes and not * <tt>BufferedImage</tt>. It is done in order to limit slow operation such as converting ARGB * images (uint32_t) to bytes especially for big big screen. For example a 1920x1200 desktop * consumes 9 MB of memory for grabbing and another 9 MB array for conversion operation. * * @param display index of display * @param x x position to start capture * @param y y position to start capture * @param width capture width * @param height capture height * @param buffer native output buffer to store bytes in. Be sure that output length is sufficient * @param bufferLength length of native buffer * @return true if success, false if JNI error or output length too short */ public boolean captureScreen( int display, int x, int y, int width, int height, long buffer, int bufferLength) { return (OSUtils.IS_LINUX || OSUtils.IS_MAC || OSUtils.IS_WINDOWS) && ScreenCapture.grabScreen(display, x, y, width, height, buffer, bufferLength); }
/** * Capture a part of the desktop screen using native grabber. * * <p>Contrary to other captureScreen method, it only returns raw bytes and not * <tt>BufferedImage</tt>. It is done in order to limit slow operation such as converting ARGB * images (uint32_t) to bytes especially for big big screen. For example a 1920x1200 desktop * consumes 9 MB of memory for grabbing and another 9 MB array for conversion operation. * * @param display index of display * @param x x position to start capture * @param y y position to start capture * @param width capture width * @param height capture height * @param output output buffer to store bytes in. Be sure that output length is sufficient * @return true if success, false if JNI error or output length too short */ public boolean captureScreen(int display, int x, int y, int width, int height, byte[] output) { return (OSUtils.IS_LINUX || OSUtils.IS_MAC || OSUtils.IS_WINDOWS) && ScreenCapture.grabScreen(display, x, y, width, height, output); }