getFromWindow

Transfers image data from a gdk.Window and converts it to an RGB(A) representation inside a gdk.Pixbuf In other words, copies image data from a server-side drawable to a client-side RGB(A) buffer. This allows you to efficiently read individual pixels on the client side.

This function will create an RGB pixbuf with 8 bits per channel with the size specified by the width and height arguments scaled by the scale factor of window. The pixbuf will contain an alpha channel if the window contains one.

If the window is off the screen, then there is no image data in the obscured/offscreen regions to be placed in the pixbuf. The contents of portions of the pixbuf corresponding to the offscreen region are undefined.

If the window you’re obtaining data from is partially obscured by other windows, then the contents of the pixbuf areas corresponding to the obscured regions are undefined.

If the window is not mapped (typically because it’s iconified/minimized or not on the current workspace), then NULL will be returned.

If memory can’t be allocated for the return value, NULL will be returned instead.

(In short, there are several ways this function can fail, and if it fails it returns NULL; so check the return value.)

getFromWindow
(,
int srcX
,
int srcY
,
int width
,
int height
)

Parameters

window Window

Source window

srcX int

Source X coordinate within window

srcY int

Source Y coordinate within window

width int

Width in pixels of region to get

height int

Height in pixels of region to get

Return Value

Type: Pixbuf

A newly-created pixbuf with a reference count of 1, or NULL on error