Logo Search packages:      
Sourcecode: ardour version File versions

Glib::RefPtr< Image > Gdk::Drawable::get_image ( int  x,
int  y,
int  width,
int  height 
) const [inherited]

A Gdk::Image stores client-side image data (pixels). In contrast, Gdk::Pixmap and Gdk::Window are server-side objects. get_image() obtains the pixels from a server-side drawable as a client-side Gdk::Image. The format of a Gdk::Image depends on the Gdk::Visual of the current display, which makes manipulating Gdk::Image extremely difficult; therefore, in most cases you should use Gdk::Pixbuf::get_from_drawable() instead of this lower-level function. A Gdk::Pixbuf contains image data in a canonicalized RGB format, rather than a display-dependent format. Of course, there's a convenience vs. speed tradeoff here, so you'll want to think about what makes sense for your application.

x , y , width , and height define the region of drawable to obtain as an image.

You would usually copy image data to the client side if you intend to examine the values of individual pixels, for example to darken an image or add a red tint. It would be prohibitively slow to make a round-trip request to the windowing system for each pixel, so instead you get all of them at once, modify them, then copy them all back at once.

If the X server or other windowing system backend is on the local machine, this function may use shared memory to avoid copying the image data.

If the source drawable is a Gdk::Window and partially offscreen or obscured, then the obscured portions of the returned image will contain undefined data.

Parameters:
x X coordinate on drawable .
y Y coordinate on drawable .
width Width of region to get.
height Height or region to get.
Returns:
A Gdk::Image containing the contents of drawable .

Definition at line 281 of file drawable.cc.

References Gdk::Drawable::gobj().

{
  return Glib::wrap(gdk_drawable_get_image(const_cast<GdkDrawable*>(gobj()), x, y, width, height));
}


Generated by  Doxygen 1.6.0   Back to index