[gtk+/gtk-2-24] Add gdk_cairo_set_source_window



commit 2e5251b4058d635da699ac34644aa3cc6d78e7bc
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 27 19:00:10 2010 -0400

    Add gdk_cairo_set_source_window
    
    And deprecate gdk_cairo_set_source_pixmap.

 docs/reference/gdk/gdk-sections.txt |    1 +
 gdk/gdk.symbols                     |    1 +
 gdk/gdkcairo.c                      |   37 +++++++++++++++++++++++++++++++++++
 gdk/gdkcairo.h                      |    4 +++
 4 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt
index ae83d8f..e7ea98d 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 cab5073..b3a5fbb 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 e1d0daf..c423871 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 8bddd48..31f3747 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]