summaryrefslogtreecommitdiff
path: root/gdk/gdkgc.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-07-18 20:09:28 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-07-18 20:09:28 +0000
commit94239d144e223cacbffceeb804e44ceedbf2f6b1 (patch)
tree2fa88432d1fd763b2650e0b546a732586e96e82b /gdk/gdkgc.c
parent03496763290dfdc11277e8ae8ef065e02b05f7bd (diff)
downloadgdk-pixbuf-94239d144e223cacbffceeb804e44ceedbf2f6b1.tar.gz
Add a function gdk_window_get_internal_paint_info(), so that using X
Fri Jul 13 15:33:32 2001 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.[ch]: Add a function gdk_window_get_internal_paint_info(), so that using X functions on a GdkWindow is possible, if a little hairy. * gdk/gdkgc.c (gdk_gc_offset): Add a function to offset the clip and ts_origin of a GC, so that external parties can offset/restore a GC, when using gdk_window_get_internal_paint_info().
Diffstat (limited to 'gdk/gdkgc.c')
-rw-r--r--gdk/gdkgc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index f87b7b37c..127a692b1 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -367,6 +367,39 @@ gdk_gc_set_dashes (GdkGC *gc,
}
/**
+ * gdk_gc_offset:
+ * @gc: a #GdkGC
+ * @x_offset: amount by which to offset the GC in the X direction
+ * @y_offset: amount by which to offset the GC in the Y direction
+ *
+ * Offset attributes such as the clip and tile-stipple origins
+ * 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.
+ **/
+void
+gdk_gc_offset (GdkGC *gc,
+ gint x_offset,
+ gint y_offset)
+{
+ if (x_offset != 0 || y_offset != 0)
+ {
+ GdkGCValues values;
+
+ values.clip_x_origin = gc->clip_x_origin - x_offset;
+ values.clip_y_origin = gc->clip_y_origin - y_offset;
+ values.ts_x_origin = gc->ts_x_origin - x_offset;
+ values.ts_y_origin = gc->ts_y_origin - y_offset;
+
+ gdk_gc_set_values (gc, &values,
+ GDK_GC_CLIP_X_ORIGIN |
+ GDK_GC_CLIP_Y_ORIGIN |
+ GDK_GC_TS_X_ORIGIN |
+ GDK_GC_TS_Y_ORIGIN);
+ }
+}
+
+/**
* gdk_gc_set_colormap:
* @gc: a #GdkGC
* @colormap: a #GdkColormap