Am 05.08.2008, 21:54 Uhr, schrieb Christopher Barker  
<[EMAIL PROTECTED]>:

> Christopher Barker wrote:
>> to get it really smooth, I suppose you could render a larger bitmap off
>> screen, so you could just drag that as you moved, and have floatcanvas
>> fill in the missing bits when they are still off screen.
>
> I've just re-factored it a bit more -- it is now a hybrid method. As you
> move the mouse, it immediately redraws the existing buffer as you move.
> It then sets a timer for 30 microseconds -- when that timer goes off,
> the entire image is re-drawn.

I guess you mean 30 *milli*seconds. Otherwise you'd be repainting a lot.

> This makes for a slight delay, which is unnecessary for images that are
> fast to draw, but allows it to work OK with images that take a while to
> draw.
>
> I tested it with the Hexagons Demo -- with 100 hexagons, it's very fast,
> with 10,000, it takes over a second to draw on my machine. The current
> GUIMove code works OK for both of these.
>
> Ideally, there would be a way for FloatCanvas to know how complex the
> drawing is, and adjust the timer delay accordingly, but I don't know how
> I'd do that.

Maybe you could time how long the last Draw took and adjust the timer  
delay based on that number (the longer the draw took the less often you  
want to redraw, the longer the time delay should be).
Another idea is to draw to a bitmap bigger than the visible portion. Then  
you can redraw much less frequently. However, this requires a lot of extra  
work I guess.

-Matthias
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to