Top Description Fields Constructors Methods
com.sun.jna.platform.win32

public Class GDI32Util

extends Object
Class Inheritance
Imports
java.awt.Rectangle, java.awt.image.BufferedImage, .DataBuffer, .DataBufferInt, .DirectColorModel, .Raster, .WritableRaster, com.sun.jna.Memory, .Native, com.sun.jna.platform.win32.GDI32, .User32, .Win32Exception, .WinDef.HBITMAP, .WinDef.HDC, .WinDef.HWND, .WinDef.RECT, .WinError, .WinGDI, .WinGDI.BITMAPINFO, .WinNT.HANDLE

GDI32 utility API.
Author
mlfreeman[at]gmail.com

Field Summary

Modifier and TypeField and Description
private static final int[]
private static final DirectColorModel

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static BufferedImage

Returns:

the window captured as a screenshot, or null if the BufferedImage doesn't construct properly
getScreenshot
(WinDef.HWND
The window to target
target
)

Takes a screenshot of the given window

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SCREENSHOT_BAND_MASKSback to summary
private static final int[] SCREENSHOT_BAND_MASKS
SCREENSHOT_COLOR_MODELback to summary
private static final DirectColorModel SCREENSHOT_COLOR_MODEL

Constructor Detail

GDI32Utilback to summary
public GDI32Util()

Method Detail

getScreenshotback to summary
public static BufferedImage getScreenshot(WinDef.HWND target)

Takes a screenshot of the given window

Parameters
target:WinDef.HWND

The window to target

Returns:BufferedImage

the window captured as a screenshot, or null if the BufferedImage doesn't construct properly

Exceptions
IllegalStateException:
if the rectangle from GetWindowRect has a width and/or height of 0.
if the device context acquired from the original HWND doesn't release properly