[gtk+/gtk-2-22] gdk: Deprecate all drawing functions



commit 3d506df2344e7499fbe3946683647ea53f871b1b
Author: Benjamin Otte <otte redhat com>
Date:   Sat Aug 7 04:27:24 2010 +0200

    gdk: Deprecate all drawing functions
    
    These functions will be gone in Gtk 3.0 and be replaced by Cairo
    functions.
    
    Includes not disabling deprecated functions in old widgets that aren't
    going to be ported.

 gdk/gdkdraw.c        |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gdk/gdkdrawable.h    |    9 +------
 gtk/gtkclist.c       |    1 +
 gtk/gtkctree.c       |    1 +
 gtk/gtkcurve.c       |    1 +
 gtk/gtkimage.c       |    2 +
 gtk/gtkpixmap.c      |    1 +
 gtk/gtkprogress.c    |    1 +
 gtk/gtkstyle.c       |    1 +
 gtk/gtktextdisplay.c |    2 +
 gtk/gtktreeitem.c    |    1 +
 tests/testtext.c     |    1 +
 12 files changed, 72 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 53c1ff4..b44b1f0 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -320,6 +320,9 @@ gdk_drawable_unref (GdkDrawable *drawable)
  * 
  * Draws a point, using the foreground color and other attributes of 
  * the #GdkGC.
+ *
+ * Deprecated: 2.22: Use cairo_rectangle() and cairo_fill() or 
+ * cairo_move_to() and cairo_stroke() instead.
  **/
 void
 gdk_draw_point (GdkDrawable *drawable,
@@ -349,6 +352,18 @@ gdk_draw_point (GdkDrawable *drawable,
  * 
  * Draws a line, using the foreground color and other attributes of 
  * the #GdkGC.
+ *
+ * Deprecated: 2.22: Use cairo_line_to() and cairo_stroke() instead.
+ * Be aware that the default line width in Cairo is 2 pixels and that your
+ * coordinates need to describe the center of the line. To draw a single
+ * pixel wide pixel-aligned line, you would use:
+ * |[cairo_set_line_width (cr, 1.0);
+ * cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
+ * cairo_move_to (cr, 0.5, 0.5);
+ * cairo_line_to (cr, 9.5, 0.5);
+ * cairo_stroke (cr);]|
+ * See also <ulink url="http://cairographics.org/FAQ/#sharp_lines";>the Cairo
+ * FAQ</ulink> on this topic.
  **/
 void
 gdk_draw_line (GdkDrawable *drawable,
@@ -390,6 +405,10 @@ gdk_draw_line (GdkDrawable *drawable,
  * <literal>gdk_draw_rectangle (window, gc, FALSE, 0, 0, 20, 20)</literal> 
  * results in an outlined rectangle with corners at (0, 0), (0, 20), (20, 20),
  * and (20, 0), which makes it 21 pixels wide and 21 pixels high.
+ *
+ * Deprecated: 2.22: Use cairo_rectangle() and cairo_fill() or cairo_stroke()
+ * instead. For stroking, the same caveats for converting code apply as for
+ * gdk_draw_line().
  **/
 void
 gdk_draw_rectangle (GdkDrawable *drawable,
@@ -437,6 +456,10 @@ gdk_draw_rectangle (GdkDrawable *drawable,
  * Draws an arc or a filled 'pie slice'. The arc is defined by the bounding
  * rectangle of the entire ellipse, and the start and end angles of the part 
  * of the ellipse to be drawn.
+ *
+ * Deprecated: 2.22: Use cairo_arc() and cairo_fill() or cairo_stroke()
+ * instead. Note that arcs just like any drawing operation in Cairo are
+ * antialiased unless you call cairo_set_antialias().
  **/
 void
 gdk_draw_arc (GdkDrawable *drawable,
@@ -481,6 +504,9 @@ gdk_draw_arc (GdkDrawable *drawable,
  * @n_points: the number of points.
  * 
  * Draws an outlined or filled polygon.
+ *
+ * Deprecated: 2.22: Use cairo_line_to() or cairo_append_path() and
+ * cairo_fill() or cairo_stroke() instead.
  **/
 void
 gdk_draw_polygon (GdkDrawable    *drawable,
@@ -624,6 +650,10 @@ gdk_draw_text_wc (GdkDrawable	 *drawable,
  * a color drawable. The way to draw a bitmap is to set the bitmap as 
  * the stipple on the #GdkGC, set the fill mode to %GDK_STIPPLED, and 
  * then draw the rectangle.
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_pixmap(), cairo_rectangle()
+ * and cairo_fill() to draw pixmap on top of other drawables. Also keep
+ * in mind that the limitations on allowed sources do not apply to Cairo.
  **/
 void
 gdk_draw_drawable (GdkDrawable *drawable,
@@ -704,6 +734,9 @@ gdk_draw_drawable (GdkDrawable *drawable,
  * 
  * Draws a #GdkImage onto a drawable.
  * The depth of the #GdkImage must match the depth of the #GdkDrawable.
+ *
+ * Deprecated: 2.22: Do not use #GdkImage anymore, instead use Cairo image
+ * surfaces.
  **/
 void
 gdk_draw_image (GdkDrawable *drawable,
@@ -760,6 +793,9 @@ gdk_draw_image (GdkDrawable *drawable,
  * variable.
  *
  * Since: 2.2
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_pixbuf() and cairo_paint() or
+ * cairo_rectangle() and cairo_fill() instead.
  **/
 void
 gdk_draw_pixbuf (GdkDrawable     *drawable,
@@ -803,6 +839,9 @@ gdk_draw_pixbuf (GdkDrawable     *drawable,
  * 
  * Draws a number of points, using the foreground color and other 
  * attributes of the #GdkGC.
+ *
+ * Deprecated: 2.22: Use @n_points calls to cairo_rectangle() and
+ * cairo_fill() instead.
  **/
 void
 gdk_draw_points (GdkDrawable    *drawable,
@@ -832,6 +871,10 @@ gdk_draw_points (GdkDrawable    *drawable,
  *   @segs array.
  * 
  * Draws a number of unconnected lines.
+ *
+ * Deprecated: 2.22: Use cairo_move_to(), cairo_line_to() and cairo_stroke()
+ * instead. See the documentation of gdk_draw_line() for notes on line drawing
+ * with Cairo.
  **/
 void
 gdk_draw_segments (GdkDrawable      *drawable,
@@ -863,6 +906,9 @@ gdk_draw_segments (GdkDrawable      *drawable,
  * The way in which joins between lines are draw is determined by the
  * #GdkCapStyle value in the #GdkGC. This can be set with
  * gdk_gc_set_line_attributes().
+ *
+ * Deprecated: 2.22: Use cairo_line_to() and cairo_stroke() instead. See the
+ * documentation of gdk_draw_line() for notes on line drawing with Cairo.
  **/
 void
 gdk_draw_lines (GdkDrawable    *drawable,
@@ -934,6 +980,7 @@ real_draw_glyphs (GdkDrawable       *drawable,
  * understand; thus, use gdk_draw_layout() instead of this function,
  * gdk_draw_layout() handles the details.
  * 
+ * Deprecated: 2.22: Use pango_cairo_show_glyphs() instead.
  **/
 void
 gdk_draw_glyphs (GdkDrawable      *drawable,
@@ -972,6 +1019,8 @@ gdk_draw_glyphs (GdkDrawable      *drawable,
  * See also gdk_draw_glyphs(), gdk_draw_layout().
  *
  * Since: 2.6
+ * 
+ * Deprecated: 2.22: Use pango_cairo_show_glyphs() instead.
  **/
 void
 gdk_draw_glyphs_transformed (GdkDrawable       *drawable,
@@ -1003,6 +1052,9 @@ gdk_draw_glyphs_transformed (GdkDrawable       *drawable,
  * likely not useful for applications.
  *
  * Since: 2.6
+ *
+ * Deprecated: 2.22: Use Cairo path contruction functions and cairo_fill()
+ * instead.
  **/
 void
 gdk_draw_trapezoids (GdkDrawable        *drawable,
@@ -1053,6 +1105,9 @@ gdk_draw_trapezoids (GdkDrawable        *drawable,
  *               of @drawable
  * 
  * Since: 2.4
+ *
+ * Deprecated: 2.22: Use @drawable as the source and draw to a Cairo image
+ * surface if you want to download contents to the client.
  **/
 GdkImage*
 gdk_drawable_copy_to_image (GdkDrawable *drawable,
@@ -1149,6 +1204,9 @@ gdk_drawable_copy_to_image (GdkDrawable *drawable,
  * will contain undefined data.
  * 
  * Return value: a #GdkImage containing the contents of @drawable
+ *
+ * Deprecated: 2.22: Use @drawable as the source and draw to a Cairo image
+ * surface if you want to download contents to the client.
  **/
 GdkImage*
 gdk_drawable_get_image (GdkDrawable *drawable,
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index 264deee..9d0d329 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -268,6 +268,7 @@ void            gdk_drawable_unref        (GdkDrawable    *drawable);
 
 /* Drawing
  */
+#ifndef GDK_DISABLE_DEPRECATED
 void gdk_draw_point     (GdkDrawable      *drawable,
 			 GdkGC            *gc,
 			 gint              x,
@@ -299,15 +300,12 @@ void gdk_draw_polygon   (GdkDrawable      *drawable,
 			 gboolean          filled,
 			 const GdkPoint   *points,
 			 gint              n_points);
-#ifndef GDK_DISABLE_DEPRECATED
-/* Used by gtk_default_draw_string () */
 void gdk_draw_string    (GdkDrawable      *drawable,
 			 GdkFont          *font,
 			 GdkGC            *gc,
 			 gint              x,
 			 gint              y,
 			 const gchar      *string);
-/* Used by gdk_pixmap_draw_text (), gdk_window_draw_text() */
 void gdk_draw_text      (GdkDrawable      *drawable,
 			 GdkFont          *font,
 			 GdkGC            *gc,
@@ -315,7 +313,6 @@ void gdk_draw_text      (GdkDrawable      *drawable,
 			 gint              y,
 			 const gchar      *text,
 			 gint              text_length);
-/* Used by gdk_pixmap_draw_text_wc (), gdk_window_draw_text_wc () */
 void gdk_draw_text_wc   (GdkDrawable      *drawable,
 			 GdkFont          *font,
 			 GdkGC            *gc,
@@ -323,7 +320,6 @@ void gdk_draw_text_wc   (GdkDrawable      *drawable,
 			 gint              y,
 			 const GdkWChar   *text,
 			 gint              text_length);
-#endif /* !GDK_DISABLE_DEPRECATED */
 void gdk_draw_drawable  (GdkDrawable      *drawable,
 			 GdkGC            *gc,
 			 GdkDrawable      *src,
@@ -411,10 +407,8 @@ void gdk_draw_trapezoids         (GdkDrawable        *drawable,
 				  const GdkTrapezoid *trapezoids,
 				  gint                n_trapezoids);
 
-#ifndef GDK_DISABLE_DEPRECATED
 #define gdk_draw_pixmap                gdk_draw_drawable
 #define gdk_draw_bitmap                gdk_draw_drawable
-#endif /* GDK_DISABLE_DEPRECATED */
 
 GdkImage* gdk_drawable_get_image      (GdkDrawable *drawable,
                                        gint         x,
@@ -429,6 +423,7 @@ GdkImage *gdk_drawable_copy_to_image (GdkDrawable  *drawable,
 				      gint          dest_y,
 				      gint          width,
 				      gint          height);
+#endif /* GDK_DISABLE_DEPRECATED */
 
 GdkRegion *gdk_drawable_get_clip_region    (GdkDrawable *drawable);
 GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable);
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index eb37434..3c45277 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_CLIST_C__
 
diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c
index bd4175c..b3d80f2 100644
--- a/gtk/gtkctree.c
+++ b/gtk/gtkctree.c
@@ -31,6 +31,7 @@
 #include "config.h"
 #include <stdlib.h>
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_CTREE_C__
 
diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c
index e1304db..6b83ea6 100644
--- a/gtk/gtkcurve.c
+++ b/gtk/gtkcurve.c
@@ -24,6 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 
 #include "config.h"
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 6654f0d..7dc0aad 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -28,6 +28,8 @@
 #include <math.h>
 #include <string.h>
 
+#undef GDK_DISABLE_DEPRECATED
+
 #include "gtkcontainer.h"
 #include "gtkimage.h"
 #include "gtkiconfactory.h"
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
index e22e5ed..a818d33 100644
--- a/gtk/gtkpixmap.c
+++ b/gtk/gtkpixmap.c
@@ -30,6 +30,7 @@
 #include "config.h"
 #include <math.h>
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_PIXMAP_C__
 
diff --git a/gtk/gtkprogress.c b/gtk/gtkprogress.c
index 8f46de4..999eb8c 100644
--- a/gtk/gtkprogress.c
+++ b/gtk/gtkprogress.c
@@ -28,6 +28,7 @@
 #include <math.h>
 #include <string.h>
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 #define __GTK_PROGRESS_C__
 
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index f18d76a..fce7ddf 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <gobject/gvaluecollector.h>
+#undef GDK_DISABLE_DEPRECATED
 #include "gtkgc.h"
 #include "gtkmarshalers.h"
 #undef GTK_DISABLE_DEPRECATED
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 1b9a7f2..a0f866c 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -75,6 +75,8 @@
  */
 
 #define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
+#undef GDK_DISABLE_DEPRECATED
+
 #include "config.h"
 #include "gtktextdisplay.h"
 #include "gtkintl.h"
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index a6ca505..4096b52 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -24,6 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 
 #include "config.h"
diff --git a/tests/testtext.c b/tests/testtext.c
index e717c4e..1e0161d 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#undef GDK_DISABLE_DEPRECATED
 #undef GTK_DISABLE_DEPRECATED
 
 #include <gtk/gtk.h>



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