[gtk+/gtk-2-22] Deprecated all GdkGC functions
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-22] Deprecated all GdkGC functions
- Date: Sat, 7 Aug 2010 20:24:01 +0000 (UTC)
commit 8a2a736af416844c8e7d0e1eac4faaaf3777efa9
Author: Benjamin Otte <otte redhat com>
Date: Sat Aug 7 22:08:21 2010 +0200
Deprecated all GdkGC functions
gdk/gdkgc.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
gdk/gdkgc.h | 6 +---
gtk/gtkgc.c | 3 ++
3 files changed, 87 insertions(+), 6 deletions(-)
---
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index 42dc712..587c20d 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -99,6 +99,8 @@ gdk_gc_init (GdkGC *gc)
* Create a new graphics context with default values.
*
* Returns: the new graphics context.
+ *
+ * Deprecated: 2.22: Use Cairo for rendering.
**/
GdkGC*
gdk_gc_new (GdkDrawable *drawable)
@@ -119,6 +121,8 @@ gdk_gc_new (GdkDrawable *drawable)
* Create a new GC with the given initial values.
*
* Return value: the new graphics context.
+ *
+ * Deprecated: 2.22: Use Cairo for rendering.
**/
GdkGC*
gdk_gc_new_with_values (GdkDrawable *drawable,
@@ -145,6 +149,8 @@ gdk_gc_new_with_values (GdkDrawable *drawable,
* should be called out of the implementation of
* GdkDrawable.create_gc() immediately after creating the
* #GdkGC object.
+ *
+ * Deprecated: 2.22: Use Cairo for rendering.
**/
void
_gdk_gc_init (GdkGC *gc,
@@ -261,6 +267,8 @@ gdk_gc_unref (GdkGC *gc)
* only the pixel values of the @values->foreground and @values->background
* are filled, use gdk_colormap_query_color() to obtain the rgb values
* if you need them.
+ *
+ * Deprecated: 2.22: Use Cairo for rendering.
**/
void
gdk_gc_get_values (GdkGC *gc,
@@ -283,7 +291,8 @@ gdk_gc_get_values (GdkGC *gc,
* set as the new value for @gc. If you're only setting a few values
* on @gc, calling individual "setter" functions is likely more
* convenient.
- *
+ *
+ * Deprecated: 2.22: Use Cairo for rendering.
**/
void
gdk_gc_set_values (GdkGC *gc,
@@ -372,6 +381,9 @@ gdk_gc_set_values (GdkGC *gc,
* Note that this function uses @color->pixel, use
* gdk_gc_set_rgb_fg_color() to specify the foreground
* color as red, green, blue components.
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_color() to use a #GdkColor
+ * as the source in Cairo.
**/
void
gdk_gc_set_foreground (GdkGC *gc,
@@ -395,6 +407,11 @@ gdk_gc_set_foreground (GdkGC *gc,
* Note that this function uses @color->pixel, use
* gdk_gc_set_rgb_bg_color() to specify the background
* color as red, green, blue components.
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_color() to use a #GdkColor
+ * as the source in Cairo. Note that if you want to draw a background and a
+ * foreground in Cairo, you need to call drawing functions (like cairo_fill())
+ * twice.
**/
void
gdk_gc_set_background (GdkGC *gc,
@@ -440,6 +457,8 @@ gdk_gc_set_font (GdkGC *gc,
* Determines how the current pixel values and the
* pixel values being drawn are combined to produce
* the final pixel values.
+ *
+ * Deprecated: 2.22: Use cairo_set_operator() with Cairo.
**/
void
gdk_gc_set_function (GdkGC *gc,
@@ -459,6 +478,10 @@ gdk_gc_set_function (GdkGC *gc,
* @fill: the new fill mode.
*
* Set the fill mode for a graphics context.
+ *
+ * Deprecated: 2.22: You can achieve tiling in Cairo by using
+ * cairo_pattern_set_extend() on the source. For stippling, see the
+ * deprecation comments on gdk_gc_set_stipple().
**/
void
gdk_gc_set_fill (GdkGC *gc,
@@ -480,6 +503,11 @@ gdk_gc_set_fill (GdkGC *gc,
* Set a tile pixmap for a graphics context.
* This will only be used if the fill mode
* is %GDK_TILED.
+ *
+ * Deprecated: 2.22: The following code snippet sets a tiling #GdkPixmap
+ * as the source in Cairo:
+ * |[gdk_cairo_set_source_pixmap (cr, tile, ts_origin_x, ts_origin_y);
+ * cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);]|
**/
void
gdk_gc_set_tile (GdkGC *gc,
@@ -501,6 +529,12 @@ gdk_gc_set_tile (GdkGC *gc,
* Set the stipple bitmap for a graphics context. The
* stipple will only be used if the fill mode is
* %GDK_STIPPLED or %GDK_OPAQUE_STIPPLED.
+ *
+ * Deprecated: 2.22: Stippling has no direct replacement in Cairo. If you
+ * want to achieve an identical look, you can use the stipple bitmap as a
+ * mask. Most likely, this involves rendering the source to an intermediate
+ * surface using cairo_push_group() first, so that you can then use
+ * cairo_mask() to achieve the stippled look.
**/
void
gdk_gc_set_stipple (GdkGC *gc,
@@ -524,6 +558,11 @@ gdk_gc_set_stipple (GdkGC *gc,
* the GC. The tile or stipple will be aligned such
* that the upper left corner of the tile or stipple
* will coincide with this point.
+ *
+ * Deprecated: 2.22: You can set the origin for tiles and stipples in Cairo
+ * by changing the source's matrix using cairo_pattern_set_matrix(). Or you
+ * can specify it with gdk_cairo_set_source_pixmap() as shown in the example
+ * for gdk_gc_set_tile().
**/
void
gdk_gc_set_ts_origin (GdkGC *gc,
@@ -550,6 +589,9 @@ gdk_gc_set_ts_origin (GdkGC *gc,
* Sets the origin of the clip mask. The coordinates are
* interpreted relative to the upper-left corner of
* the destination drawable of the current operation.
+ *
+ * Deprecated: 2.22: Use cairo_translate() before applying the clip path in
+ * Cairo.
**/
void
gdk_gc_set_clip_origin (GdkGC *gc,
@@ -575,6 +617,8 @@ gdk_gc_set_clip_origin (GdkGC *gc,
* Sets the clip mask for a graphics context from a bitmap.
* The clip mask is interpreted relative to the clip
* origin. (See gdk_gc_set_clip_origin()).
+ *
+ * Deprecated: 2.22: Use cairo_mask() instead.
**/
void
gdk_gc_set_clip_mask (GdkGC *gc,
@@ -752,6 +796,8 @@ _gdk_gc_remove_drawable_clip (GdkGC *gc)
* Sets the clip mask for a graphics context from a
* rectangle. The clip mask is interpreted relative to the clip
* origin. (See gdk_gc_set_clip_origin()).
+ *
+ * Deprecated: 2.22: Use cairo_rectangle() and cairo_clip() in Cairo.
**/
void
gdk_gc_set_clip_rectangle (GdkGC *gc,
@@ -779,6 +825,8 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
* Sets the clip mask for a graphics context from a region structure.
* The clip mask is interpreted relative to the clip origin. (See
* gdk_gc_set_clip_origin()).
+ *
+ * Deprecated: 2.22: Use gdk_cairo_region() and cairo_clip() in Cairo.
**/
void
gdk_gc_set_clip_region (GdkGC *gc,
@@ -935,6 +983,11 @@ _gdk_gc_get_bg_pixel (GdkGC *gc)
*
* Sets how drawing with this GC on a window will affect child
* windows of that window.
+ *
+ * Deprecated: 2.22: There is no replacement. If you need to control
+ * subwindows, you must use drawing operations of the underlying window
+ * system manually. Cairo will always use %GDK_INCLUDE_INFERIORS on sources
+ * and masks and %GDK_CLIP_BY_CHILDREN on targets.
**/
void
gdk_gc_set_subwindow (GdkGC *gc,
@@ -971,6 +1024,11 @@ _gdk_gc_get_subwindow (GdkGC *gc)
* using this graphics context generate exposure events
* for the corresponding regions of the destination
* drawable. (See gdk_draw_drawable()).
+ *
+ * Deprecated: 2.22: There is no replacement. If you need to control
+ * exposures, you must use drawing operations of the underlying window
+ * system or use gdk_window_invalidate_rect(). Cairo will never
+ * generate exposures.
**/
void
gdk_gc_set_exposures (GdkGC *gc,
@@ -995,6 +1053,12 @@ gdk_gc_set_exposures (GdkGC *gc,
* Sets various attributes of how lines are drawn. See
* the corresponding members of #GdkGCValues for full
* explanations of the arguments.
+ *
+ * Deprecated: 2.22: Use the Cairo functions cairo_set_line_width(),
+ * cairo_set_line_join(), cairo_set_line_cap() and cairo_set_dash()
+ * to affect the stroking behavior in Cairo. Keep in mind that the default
+ * attributes of a #cairo_t are different from the default attributes of
+ * a #GdkGC.
**/
void
gdk_gc_set_line_attributes (GdkGC *gc,
@@ -1034,6 +1098,8 @@ gdk_gc_set_line_attributes (GdkGC *gc,
* The @dash_offset defines the phase of the pattern,
* specifying how many pixels into the dash-list the pattern
* should actually begin.
+ *
+ * Deprecated: 2.22: Use cairo_set_dash() to set the dash in Cairo.
**/
void
gdk_gc_set_dashes (GdkGC *gc,
@@ -1057,6 +1123,9 @@ gdk_gc_set_dashes (GdkGC *gc,
* of the GC so that drawing at x - x_offset, y - y_offset with
* the offset GC has the same effect as drawing at x, y with the original
* GC.
+ *
+ * Deprecated: 2.22: There is no direct replacement, as this is just a
+ * convenience function for gdk_gc_set_ts_origin and gdk_gc_set_clip_origin().
**/
void
gdk_gc_offset (GdkGC *gc,
@@ -1087,6 +1156,9 @@ gdk_gc_offset (GdkGC *gc,
*
* Copy the set of values from one graphics context
* onto another graphics context.
+ *
+ * Deprecated: 2.22: Use Cairo for drawing. cairo_save() and cairo_restore()
+ * can be helpful in cases where you'd have copied a #GdkGC.
**/
void
gdk_gc_copy (GdkGC *dst_gc,
@@ -1171,6 +1243,9 @@ gdk_gc_copy (GdkGC *dst_gc,
* Sets the colormap for the GC to the given colormap. The depth
* of the colormap's visual must match the depth of the drawable
* for which the GC was created.
+ *
+ * Deprecated: 2.22: There is no replacement. Cairo handles colormaps
+ * automatically, so there is no need to care about them.
**/
void
gdk_gc_set_colormap (GdkGC *gc,
@@ -1200,6 +1275,9 @@ gdk_gc_set_colormap (GdkGC *gc,
* gdk_gc_set_colormap.
*
* Return value: the colormap of @gc, or %NULL if @gc doesn't have one.
+ *
+ * Deprecated: 2.22: There is no replacement. Cairo handles colormaps
+ * automatically, so there is no need to care about them.
**/
GdkColormap *
gdk_gc_get_colormap (GdkGC *gc)
@@ -1237,6 +1315,8 @@ gdk_gc_get_colormap_warn (GdkGC *gc)
* number of colors), a colorcube will be allocated in the colormap.
*
* Calling this function for a GC without a colormap is an error.
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_color() instead.
**/
void
gdk_gc_set_rgb_fg_color (GdkGC *gc,
@@ -1269,6 +1349,8 @@ gdk_gc_set_rgb_fg_color (GdkGC *gc,
* number of colors), a colorcube will be allocated in the colormap.
*
* Calling this function for a GC without a colormap is an error.
+ *
+ * Deprecated: 2.22: Use gdk_cairo_set_source_color() instead.
**/
void
gdk_gc_set_rgb_bg_color (GdkGC *gc,
diff --git a/gdk/gdkgc.h b/gdk/gdkgc.h
index 6657786..054c8e3 100644
--- a/gdk/gdkgc.h
+++ b/gdk/gdkgc.h
@@ -220,16 +220,15 @@ struct _GdkGCClass
};
+#ifndef GDK_DISABLE_DEPRECATED
GType gdk_gc_get_type (void) G_GNUC_CONST;
GdkGC *gdk_gc_new (GdkDrawable *drawable);
GdkGC *gdk_gc_new_with_values (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
-#ifndef GDK_DISABLE_DEPRECATED
GdkGC *gdk_gc_ref (GdkGC *gc);
void gdk_gc_unref (GdkGC *gc);
-#endif
void gdk_gc_get_values (GdkGC *gc,
GdkGCValues *values);
@@ -240,10 +239,8 @@ void gdk_gc_set_foreground (GdkGC *gc,
const GdkColor *color);
void gdk_gc_set_background (GdkGC *gc,
const GdkColor *color);
-#ifndef GDK_DISABLE_DEPRECATED
void gdk_gc_set_font (GdkGC *gc,
GdkFont *font);
-#endif /* GDK_DISABLE_DEPRECATED */
void gdk_gc_set_function (GdkGC *gc,
GdkFunction function);
void gdk_gc_set_fill (GdkGC *gc,
@@ -293,7 +290,6 @@ void gdk_gc_set_rgb_bg_color (GdkGC *gc,
const GdkColor *color);
GdkScreen * gdk_gc_get_screen (GdkGC *gc);
-#ifndef GDK_DISABLE_DEPRECATED
#define gdk_gc_destroy g_object_unref
#endif /* GDK_DISABLE_DEPRECATED */
diff --git a/gtk/gtkgc.c b/gtk/gtkgc.c
index 15d8636..add6aa5 100644
--- a/gtk/gtkgc.c
+++ b/gtk/gtkgc.c
@@ -25,6 +25,9 @@
*/
#include "config.h"
+
+#undef GDK_DISABLE_DEPRECATED
+
#include "gtkgc.h"
#include "gtkintl.h"
#include "gtkalias.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]