Window
without involving the operating
system's window manager.-
Method Summary
Modifier and TypeMethodDescriptiongetWindowBackbufferArea
(Window window, int x, int y, int width, int height) Returns a snapshot of the window's client area from its backbuffer, if any.getWindowSurfaceArea
(Window window, int x, int y, int width, int height) Captures the specified area of the client region of a givenwindow
from its underlying pixel representation, and returns it as an image.
-
Method Details
-
getWindowBackbufferArea
Returns a snapshot of the window's client area from its backbuffer, if any. If
window
has no associated backbuffer,null
is returned.Note: the use of the backbuffer is primarily controlled by the
swing.bufferPerWindow
system property (true
by default).The coordinates and size are given in the window's client area coordinate system, which is the area of a window not covered by the window's decorations such as the system title bar. The pixel with the coordinates
(x, y)
of the window's client area will be at(0, 0)
in the returned image.width
andheight
are clipped to the window's client area, soInteger.MAX_VALUE
can be used safely.IllegalArgumentException
is thrown if either of the following holds:width
orheight
is negative or zero.x
ory
are outside the window's client area.
- Parameters:
window
- window to take a screenshot of; must not benull
x
- x coordinate within the window's client areay
- y coordinate within the window's client areawidth
- width of the screenshot; clipped to the window's client areaheight
- height of the screenshot; clipped to the window's client area- Returns:
- a snapshot of the window's client area from the window's backbuffer, if any.
null
if the window has no backbuffer or if the window is not visible. The returned image is a copy of the image in the buffer strategy, so the caller can modify it.
-
getWindowSurfaceArea
Captures the specified area of the client region of a given
window
from its underlying pixel representation, and returns it as an image.The coordinates and size are given in the window's client area coordinate system, which is the area of a window not covered by the window's decorations such as the system title bar. The pixel with the coordinates
(x, y)
of the window's client area will be at(0, 0)
in the returned image.IllegalArgumentException
is thrown if either of the following holds:width
orheight
is negative or zero.x
ory
are outside the window's client area.
Note: Currently available only on Linux with WLToolkit.
- Parameters:
window
- window to take a screenshot of; must not benull
x
- x coordinate within the window's client areay
- y coordinate within the window's client areawidth
- width of the area to screenshot; clipped to the window's client areaheight
- height of the area to screenshot; clipped to the window's client area- Returns:
- a snapshot of the window's client area from its underlying graphics subsystem representation.
null
if the window is not visible. Since the actual pixels of the window may be scaled depending on Java or operating system settings, the size of the returned image may differ fromwidth
andheight
. The returned image is a copy, so the caller can modify it.
-