Re: Introducing a small delay



On Tue, 10 Dec 2002, Havoc Pennington wrote:

[snip]

You can't fix a race condition by lengthening the time delay; it just
hides the race condition in a larger percentage of instances.

Thanks, you've just added a new term to my vocabulary :-)

The right fix is to draw to a GdkPixmap (which is always present), and
have your drawing area just be a way to display the pixmap. i.e. drawing
area expose_event handler just copies from the pixmap to the drawing
area. Or you can even use a GtkImage as the pixmap-display widget.

That's what the program does, but I used the image so I can get the color
of a set of pixels, then make the necessary changes to the pixmap (via the
drawing functions) based on the color(s) of those pixels.

I went with the image approach because I couldn't find a GTK 1.2 function
that would return the color of a pixel in a pixmap.  That's all I really
want/need, the color of a pixel.  There are image-based functions to do
that, as I found from reading Havoc's book.

Plus I need to get the pixel colors from somewhere that doesn't have the
afterimage of the dialog.

Have I overlooked something?  Is there another way to get the color of a
pixel without having to access individual bytes in the pixmap (thereby
making the code platform dependent)?

Bryan


*---------------------------------------------------------------
* Bryan Brown      <*>              bbrown radix net
* http://www.radix.net/~bbrown
*---------------------------------------------------------------




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