API: gdk_pixbuf_get_from_drawable() => gdk_pixbuf_get_from_window()
The Colormap argument needed to be removed, so the renaming is just a side effect.
This commit is contained in:
@ -112,7 +112,7 @@ main (int argc, char **argv)
|
|||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
root = gdk_get_default_root_window ();
|
root = gdk_get_default_root_window ();
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
pixbuf = gdk_pixbuf_get_from_window (NULL, root,
|
||||||
0, 0, 0, 0, 150, 160);
|
0, 0, 0, 0, 150, 160);
|
||||||
|
|
||||||
/* PASS */
|
/* PASS */
|
||||||
|
|||||||
@ -340,7 +340,7 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
|||||||
GdkPixbuf *new_pixbuf;
|
GdkPixbuf *new_pixbuf;
|
||||||
|
|
||||||
root = gdk_get_default_root_window ();
|
root = gdk_get_default_root_window ();
|
||||||
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
new_pixbuf = gdk_pixbuf_get_from_window (NULL, root,
|
||||||
0, 0, 0, 0, evt->width, evt->height);
|
0, 0, 0, 0, evt->width, evt->height);
|
||||||
g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", new_pixbuf,
|
g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", new_pixbuf,
|
||||||
(GDestroyNotify) g_object_unref);
|
(GDestroyNotify) g_object_unref);
|
||||||
@ -361,7 +361,7 @@ main (int argc, char **argv)
|
|||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
root = gdk_get_default_root_window ();
|
root = gdk_get_default_root_window ();
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
pixbuf = gdk_pixbuf_get_from_window (NULL, root,
|
||||||
0, 0, 0, 0, 150, 160);
|
0, 0, 0, 0, 150, 160);
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
|||||||
@ -243,7 +243,7 @@ gdk_screen_get_type
|
|||||||
<SECTION>
|
<SECTION>
|
||||||
<TITLE>Pixbufs</TITLE>
|
<TITLE>Pixbufs</TITLE>
|
||||||
<FILE>pixbufs</FILE>
|
<FILE>pixbufs</FILE>
|
||||||
gdk_pixbuf_get_from_drawable
|
gdk_pixbuf_get_from_window
|
||||||
gdk_pixbuf_get_from_surface
|
gdk_pixbuf_get_from_surface
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
|||||||
@ -163,7 +163,7 @@ take_window_shot (Window child,
|
|||||||
if (y_orig + height > gdk_screen_height ())
|
if (y_orig + height > gdk_screen_height ())
|
||||||
height = gdk_screen_height () - y_orig;
|
height = gdk_screen_height () - y_orig;
|
||||||
|
|
||||||
tmp = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
|
tmp = gdk_pixbuf_get_from_window (NULL, window,
|
||||||
x, y, 0, 0, width, height);
|
x, y, 0, 0, width, height);
|
||||||
|
|
||||||
if (include_decoration)
|
if (include_decoration)
|
||||||
|
|||||||
@ -802,7 +802,7 @@ gdk_pango_layout_line_get_clip_region
|
|||||||
|
|
||||||
#if IN_HEADER(__GDK_PIXBUF_H__)
|
#if IN_HEADER(__GDK_PIXBUF_H__)
|
||||||
#if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
|
#if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
|
||||||
gdk_pixbuf_get_from_drawable
|
gdk_pixbuf_get_from_window
|
||||||
gdk_pixbuf_get_from_surface
|
gdk_pixbuf_get_from_surface
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -34,10 +34,9 @@
|
|||||||
/* Exported functions */
|
/* Exported functions */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_pixbuf_get_from_drawable:
|
* gdk_pixbuf_get_from_window:
|
||||||
* @dest: (allow-none): Destination pixbuf, or %NULL if a new pixbuf should be created.
|
* @dest: (allow-none): Destination pixbuf, or %NULL if a new pixbuf should be created.
|
||||||
* @src: Source drawable.
|
* @src: Source drawable.
|
||||||
* @cmap: A colormap if @src doesn't have one set.
|
|
||||||
* @src_x: Source X coordinate within drawable.
|
* @src_x: Source X coordinate within drawable.
|
||||||
* @src_y: Source Y coordinate within drawable.
|
* @src_y: Source Y coordinate within drawable.
|
||||||
* @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
|
* @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
|
||||||
@ -50,11 +49,6 @@
|
|||||||
* image data from a server-side drawable to a client-side RGB(A) buffer.
|
* 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 allows you to efficiently read individual pixels on the client side.
|
||||||
*
|
*
|
||||||
* If the drawable @src has no colormap (gdk_drawable_get_colormap()
|
|
||||||
* returns %NULL), then a suitable colormap must be specified.
|
|
||||||
* If the drawable has a colormap, the @cmap argument will be
|
|
||||||
* ignored.
|
|
||||||
*
|
|
||||||
* If the specified destination pixbuf @dest is %NULL, then this
|
* If the specified destination pixbuf @dest is %NULL, then this
|
||||||
* function will create an RGB pixbuf with 8 bits per channel and no
|
* function will create an RGB pixbuf with 8 bits per channel and no
|
||||||
* alpha, with the same size specified by the @width and @height
|
* alpha, with the same size specified by the @width and @height
|
||||||
@ -86,26 +80,15 @@
|
|||||||
* pixbuf with a reference count of 1 if no destination pixbuf was specified, or %NULL on error
|
* pixbuf with a reference count of 1 if no destination pixbuf was specified, or %NULL on error
|
||||||
**/
|
**/
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
gdk_pixbuf_get_from_window (GdkPixbuf *dest,
|
||||||
GdkDrawable *src,
|
GdkWindow *src,
|
||||||
GdkColormap *cmap,
|
|
||||||
int src_x, int src_y,
|
int src_x, int src_y,
|
||||||
int dest_x, int dest_y,
|
int dest_x, int dest_y,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
int depth;
|
|
||||||
|
|
||||||
/* General sanity checks */
|
g_return_val_if_fail (GDK_IS_WINDOW (src), NULL);
|
||||||
|
|
||||||
g_return_val_if_fail (src != NULL, NULL);
|
|
||||||
|
|
||||||
if (GDK_IS_WINDOW (src))
|
|
||||||
/* FIXME: this is not perfect, since is_viewable() only tests
|
|
||||||
* recursively up the Gdk parent window tree, but stops at
|
|
||||||
* foreign windows or Gdk toplevels. I.e. if a window manager
|
|
||||||
* unmapped one of its own windows, this won't work.
|
|
||||||
*/
|
|
||||||
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
|
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
|
||||||
|
|
||||||
if (!dest)
|
if (!dest)
|
||||||
@ -118,29 +101,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
|||||||
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
|
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmap == NULL)
|
|
||||||
cmap = gdk_drawable_get_colormap (src);
|
|
||||||
|
|
||||||
depth = gdk_drawable_get_depth (src);
|
|
||||||
|
|
||||||
if (depth != 1 && cmap == NULL)
|
|
||||||
{
|
|
||||||
g_warning ("%s: Source drawable has no colormap; either pass "
|
|
||||||
"in a colormap, or set the colormap on the drawable "
|
|
||||||
"with gdk_drawable_set_colormap()", G_STRLOC);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmap != NULL && depth != cmap->visual->depth)
|
|
||||||
{
|
|
||||||
g_warning ("%s: Depth of the source drawable is %d where as "
|
|
||||||
"the visual depth of the colormap passed is %d",
|
|
||||||
G_STRLOC, depth, cmap->visual->depth);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Coordinate sanity checks */
|
|
||||||
|
|
||||||
surface = _gdk_drawable_ref_cairo_surface (src);
|
surface = _gdk_drawable_ref_cairo_surface (src);
|
||||||
dest = gdk_pixbuf_get_from_surface (dest,
|
dest = gdk_pixbuf_get_from_surface (dest,
|
||||||
surface,
|
surface,
|
||||||
|
|||||||
@ -38,9 +38,8 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* Fetching a region from a drawable */
|
/* Fetching a region from a drawable */
|
||||||
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
GdkPixbuf *gdk_pixbuf_get_from_window (GdkPixbuf *dest,
|
||||||
GdkDrawable *src,
|
GdkWindow *window,
|
||||||
GdkColormap *cmap,
|
|
||||||
int src_x,
|
int src_x,
|
||||||
int src_y,
|
int src_y,
|
||||||
int dest_x,
|
int dest_x,
|
||||||
|
|||||||
@ -1687,7 +1687,7 @@ grab_color_at_pointer (GdkScreen *screen,
|
|||||||
|
|
||||||
priv = colorsel->private_data;
|
priv = colorsel->private_data;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
|
pixbuf = gdk_pixbuf_get_from_window (NULL, root_window,
|
||||||
x_root, y_root,
|
x_root, y_root,
|
||||||
0, 0,
|
0, 0,
|
||||||
1, 1);
|
1, 1);
|
||||||
@ -1698,7 +1698,7 @@ grab_color_at_pointer (GdkScreen *screen,
|
|||||||
GdkWindow *window = gdk_display_get_window_at_device_position (display, device, &x, &y);
|
GdkWindow *window = gdk_display_get_window_at_device_position (display, device, &x, &y);
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
|
pixbuf = gdk_pixbuf_get_from_window (NULL, window,
|
||||||
x, y,
|
x, y,
|
||||||
0, 0,
|
0, 0,
|
||||||
1, 1);
|
1, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user