Re: can't get GDK_XOR to work, help wanted
- From: Owen Taylor <otaylor redhat com>
- To: Paul Barton-Davis <pbd Op Net>
- Cc: gtk-list redhat com
- Subject: Re: can't get GDK_XOR to work, help wanted
- Date: 05 Apr 1999 15:52:33 -0400
Paul Barton-Davis <pbd@Op.Net> writes:
> Below is a very simple test case of GDK_XOR. I don't think it can get
> much easier. If you run the program with an argument, it will attempt
> to use the XOR function for the GC used to draw rectangles. If you run
> it with no argument, it will use the default function (COPY).
First, my comments about XGrabServer were intended to refer
to the exotic case of XOR'ing on the root window. If you
are working within your own window, I would try to avoid
grabbing the server. There are a couple of things you can
do:
- XOR on a backing store, copy the results onto the screen
- Use the GNOME canvas, which will make something
nicer looking than XOR easy to do
- Simply ignore the problem and refresh your window when
you get done. The chance that another window will move
above your stuff while you are drawing is miniscule
since the pointer will be grabbed. Accepting a few
temporary visual artifacts in this circumstance should
be OK.
> With XOR, nothing is ever drawn. With the default function, rectangles
> are drawn all over the drawing area.
>
> I'm sure I am doing something wrong, since the gdk code path through
> the use of GDK_XOR is so close the X one that its hard to see where
> there could be a bug. Can anyone tell me what might be wrong ?
I believe that the problem is that the default foreground
color is black, which happens to have a pixel value of
0 on your system, so XOR'ing does nothing.
Either you should use GDK_INVERT (the simple case - but
not guaranteed to switch black and white on pseudocolor
displays), or you should check which of gdk_white()
and gdk_black() has a non-zero pixel value and use
that for the foreground color.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]