Package: gdk

Function gdk-pixbuf-from-window

Lambda List

gdk-pixbuf-from-window (window src-x src-y width height)

Arguments

window -- a gdk-window source window
src-x -- an integer with the source x coordinate within window
src-y -- an integer with the source y coordinate within window
width -- an integer with the width in pixels of region to get
height -- an integer with the height in pixels of region to get

Return Value

A newly-created gdk-pixbuf object, or nil on error.

Details

Transfers image data from a gdk-window object and converts it to an RGB(A) representation inside a gdk-pixbuf object. 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 same size specified by the width and height arguments. 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 are 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 is iconified/minimized or not on the current workspace), then nil will be returned.

If memory cannot be allocated for the return value, nil will be returned instead.

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

See also

2020-11-10