diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt index ae83d8fa74..e7ea98dd82 100644 --- a/docs/reference/gdk/gdk-sections.txt +++ b/docs/reference/gdk/gdk-sections.txt @@ -947,6 +947,7 @@ gdk_cairo_create gdk_cairo_set_source_color gdk_cairo_set_source_pixbuf gdk_cairo_set_source_pixmap +gdk_cairo_set_source_window gdk_cairo_rectangle gdk_cairo_region gdk_cairo_reset_clip diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index cab5073d65..b3a5fbb31b 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -307,6 +307,7 @@ gdk_cairo_reset_clip gdk_cairo_set_source_color gdk_cairo_set_source_pixbuf gdk_cairo_set_source_pixmap +gdk_cairo_set_source_window gdk_cairo_rectangle gdk_cairo_region #endif diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c index e1d0dafb54..c423871fbc 100644 --- a/gdk/gdkcairo.c +++ b/gdk/gdkcairo.c @@ -290,6 +290,10 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr, * so that the origin of @pixmap is @pixmap_x, @pixmap_y * * Since: 2.10 + * + * Deprecated: 2.24: This function is being removed in GTK+ 3 (together + * with #GdkPixmap). Instead, use gdk_cairo_set_source_window() where + * appropriate. **/ void gdk_cairo_set_source_pixmap (cairo_t *cr, @@ -304,6 +308,39 @@ gdk_cairo_set_source_pixmap (cairo_t *cr, cairo_surface_destroy (surface); } +/** + * gdk_cairo_set_source_window: + * @cr: a #Cairo context + * @window: a #GdkWindow + * @x: X coordinate of location to place upper left corner of @window + * @y: Y coordinate of location to place upper left corner of @window + * + * Sets the given window as the source pattern for the Cairo context. + * The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned + * so that the origin of @window is @x, @y. The window contains all its + * subwindows when rendering. + * + * Note that the contents of @window are undefined outside of the + * visible part of @window, so use this function with care. + * + * Since: 2.24 + **/ +void +gdk_cairo_set_source_window (cairo_t *cr, + GdkWindow *window, + double x, + double y) +{ + cairo_surface_t *surface; + + g_return_if_fail (cr != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); + + surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (window)); + cairo_set_source_surface (cr, surface, x, y); + cairo_surface_destroy (surface); +} + #define __GDK_CAIRO_C__ #include "gdkaliasdef.c" diff --git a/gdk/gdkcairo.h b/gdk/gdkcairo.h index 8bddd48c2a..31f37472cc 100644 --- a/gdk/gdkcairo.h +++ b/gdk/gdkcairo.h @@ -44,6 +44,10 @@ void gdk_cairo_set_source_pixmap (cairo_t *cr, GdkPixmap *pixmap, double pixmap_x, double pixmap_y); +void gdk_cairo_set_source_window (cairo_t *cr, + GdkWindow *window, + double x, + double y); void gdk_cairo_rectangle (cairo_t *cr, const GdkRectangle *rectangle);