Re: Fast ways to draw brush outlines on a DrawingArea



On 9/30/07, Keith Feesh <gummybassist gmail com> wrote:
The way that I do things now includes redrawing the entire canvas every time
the mouse is moved, in order to clear the old
outline's drawing, and then to redraw the outline once again. This brings my
system to it's knees and I figure there must be
a better method, just I can't think of any method. Any hints would be great.

I do something like this in my app:

  http://www.vips.ecs.soton.ac.uk

Load an image, doubleclick the thumbnail to get an image view window,
hold down CTRL and left-button drag down and right to mark a region.
Drag on the region label to move it around, drag on the edges to
resize.

The animation is done with gtk_widget_queue_draw_area().

  http://library.gnome.org/devel/gtk/unstable/GtkWidget.html#gtk-widget-queue-draw-area

When I see a mouse movement, I queue a draw for the current position
and size of the region, I update the region to the new position, and
queue a draw at the new position.

When gtk is next in the idle loop, it will calculate the minimum
number of exposes to repaint the damaged area and ask my drawingarea
to repaint just those parts. Because I've moved my region model, this
will cause the old position to be undrawn and the new position to be
drawn.

John



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