Re: Fast ways to draw brush outlines on a DrawingArea



Well actually it depends.

when you move the cursor you just blit the
buffer with no cursor to the topmost buffer, and repaint the cursor.
Bliting the buffer should be quite fast, so if your image is like lots of
shape objects you render every time this is many times faster.

If this is analogous to what you are already doing (ie your image renders
fast), you could do this (as you were thinking):
have a small buffer the size of the cursor
contain what is under the outline, and just blit that back and make a new
one in the right position before repainting the outline.

Another method is to paint the outline using the 'XOR' method instead of
'REPLACE', which means you just have to paint the cursor again in the same
place to erase it and return the picure to it's original state; and te paint
it in the new position.
just in case:
XOR is exclusive OR; 0xor0 = 0, 0xor1/1xor0 = 1; 1xor1 = 0
so b xor c xor c = b (paint c twice on b yields b : cool )

HTH,
Jonathan

On 9/30/07, Keith Feesh <gummybassist gmail com> wrote:

Hmm, so no matter what you do, you end up redrawing the whole image again.
I guess with some time you could make it only redraw the last place you were
at instead of the whole image, but if that's the only method then luckily
I've been doing it right. Cheers Jonathan.

On 30/09/2007, Jonathan Winterflood <jonathan winterflood gmail com>
wrote:

There is indeed a method.

One would probably call it double buffering (anthough when you're done
with your program you might have moe like quad buffering...

The idea is to render everything in layers:

bottom layer = your image (data, etc)
above: rulers, marks, selection box, etc (semi-static stuff)
above: brush outline

these are hopefully in the order of least to most often
changing, and what is painted on top of what.

the data is held in a pixbuf
you paint that pixbuf and the selection etc into another pixbuf
you paint that pixbuf and the outline into the topmost buffer

then that pixbuf is painted onto the screen.

HTH,
Jonathan

On 9/30/07, Keith Feesh < gummybassist gmail com> wrote:

Hello, I have been developing a drawing application for quite some
time now
and I have implemented an outline system
which shows where your next drawing operation will go (just load up
the
gimp, go on the paintbrush tool and select a size 11
brush if you don't quite get what I mean).

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.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






-- 
<Morpheus> linux, c'est une question de VI ou de MORE



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