Re: Graphic Contexts. Help!
- From: Owen Taylor <owt1 cornell edu>
- To: gtk-list redhat com
- Subject: Re: Graphic Contexts. Help!
- Date: 16 Feb 1998 17:53:08 -0500
Sergei Naumov <serge@astro.unc.edu> writes:
> Hi!
> I was wondering whethere there is any doc on graphic contexts. I need
> to use them because I am writing an application where a cross-hair should
> run over a drawing area, so the cross-hair has to be XOR'ed.
GDK's GCs are fairly similar to X's GCs, so
man XCreateGC
may be of some help. If you don't mind looking at GTK's internals,
you can look at the source code for gtk[hv]paned to see a real-life
example of drawing with an XOR GC.
Another approach to the problem if you are using a Pixmap to
back up your drawing area, is simply to draw your crosshair to
the screen (not the pixmap) in copy mode, then call gdk_widget_draw()
to refresh that area of the screen when moving the cursor. This
is done in gtk/testinput.c (with a block, not a crosshair).
In theory, somebody has a patent on drawing with an XOR'd cursor,
though I very much doubt you would get sued. (And expect it might not
hold up to a sustained legal challenge...)
Finally, you could just set the cursor for the drawing area with:
void gdk_window_set_cursor (GdkWindow *window,
GdkCursor *cursor);
to gdk_cursor_new(GDK_CROSS), if that would fit your needs.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]