Class DesktopInteractImpl
- java.lang.Object
-
- org.jitsi.impl.neomedia.imgstreaming.DesktopInteractImpl
-
- All Implemented Interfaces:
DesktopInteract
public class DesktopInteractImpl extends Object implements DesktopInteract
Capture desktop screen either via native code (JNI) if available or by using java.awt.Robot.- Author:
- Sebastien Vincent
- See Also:
Robot
-
-
Constructor Summary
Constructors Constructor Description DesktopInteractImpl()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedImagecaptureScreen()Capture the full desktop screen using java.awt.Robot.booleancaptureScreen(int display, byte[] output)Capture the full desktop screen using native grabber.BufferedImagecaptureScreen(int x, int y, int width, int height)Capture a part of the desktop screen using java.awt.Robot.booleancaptureScreen(int display, int x, int y, int width, int height, byte[] output)Capture a part of the desktop screen using native grabber.booleancaptureScreen(int display, int x, int y, int width, int height, long buffer, int bufferLength)Capture a part of the desktop screen using native grabber.booleancaptureScreen(int display, long buffer, int bufferLength)Capture the full desktop screen using native grabber.
-
-
-
Constructor Detail
-
DesktopInteractImpl
public DesktopInteractImpl() throws AWTException, SecurityExceptionConstructor.- Throws:
AWTException- if platform configuration does not allow low-level input controlSecurityException- if Robot creation is not permitted
-
-
Method Detail
-
captureScreen
public boolean captureScreen(int display, byte[] output)Capture the full desktop screen using native grabber. Contrary to other captureScreen method, it only returns raw bytes and not BufferedImage. 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.- Specified by:
captureScreenin interfaceDesktopInteract- Parameters:
display- index of displayoutput- output buffer to store bytes in. Be sure that output length is sufficient- Returns:
- true if success, false if JNI error or output length too short
-
captureScreen
public boolean captureScreen(int display, long buffer, int bufferLength)Capture the full desktop screen using native grabber. Contrary to other captureScreen method, it only returns raw bytes and not BufferedImage. 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.- Specified by:
captureScreenin interfaceDesktopInteract- Parameters:
display- index of displaybuffer- native output buffer to store bytes in. Be sure that output length is sufficientbufferLength- length of native buffer- Returns:
- true if success, false if JNI error or output length too short
-
captureScreen
public boolean captureScreen(int display, int x, int y, int width, int height, byte[] output)Capture a part of the desktop screen using native grabber. Contrary to other captureScreen method, it only returns raw bytes and not BufferedImage. 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.- Specified by:
captureScreenin interfaceDesktopInteract- Parameters:
display- index of displayx- x position to start capturey- y position to start capturewidth- capture widthheight- capture heightoutput- output buffer to store bytes in. Be sure that output length is sufficient- Returns:
- true if success, false if JNI error or output length too short
-
captureScreen
public boolean captureScreen(int display, int x, int y, int width, int height, long buffer, int bufferLength)Capture a part of the desktop screen using native grabber. Contrary to other captureScreen method, it only returns raw bytes and not BufferedImage. 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.- Specified by:
captureScreenin interfaceDesktopInteract- Parameters:
display- index of displayx- x position to start capturey- y position to start capturewidth- capture widthheight- capture heightbuffer- native output buffer to store bytes in. Be sure that output length is sufficientbufferLength- length of native buffer- Returns:
- true if success, false if JNI error or output length too short
-
captureScreen
public BufferedImage captureScreen()
Capture the full desktop screen using java.awt.Robot.- Specified by:
captureScreenin interfaceDesktopInteract- Returns:
- BufferedImage of the desktop screen
-
captureScreen
public BufferedImage captureScreen(int x, int y, int width, int height)
Capture a part of the desktop screen using java.awt.Robot.- Specified by:
captureScreenin interfaceDesktopInteract- Parameters:
x- x position to start capturey- y position to start capturewidth- capture widthheight- capture height- Returns:
- BufferedImage of a part of the desktop screen or null if Robot problem
-
-