Hi folks,

I'm looking for a bit of inspiration to help me out with the drawing API.

I've got a feature that's sort of like a painting tool -
- User clicks the mouse
- on mouse move, a filled circle is drawn on the canvas (using
beginFill/curveTo/endFill)
- User releases the mouse

So essentially the user is drawing a trail of circles. (Just as a side note,
it's actually a mask that's being drawn rather than a clip - probably makes
no odds).

I'd much prefer it if the effect stays as overlapping circles rather than as
'paint strokes'.

The problem I have is simply a performance issue - when the user has drawn
lots of circles the app slows down significantly. It's nothing to do with
extra code on my part - it's just Flash (presumably) redrawing all those
curves all the time.

Flash appears to be redrawing each circle, rather than draw the 'union of
the curves' of all the circles. By which I mean - if you completely paint
over the whole paint area, Flash could get away with drawing a filled square
- but clearly it isn't, it's drawing every single curve on top of each
other. (It doesn't do the merging that it would if we were just drawing
overlapping circles in the IDE).

So an obvious optimisation would be to do some maths, merge each new circle
into an existing list of curves, and throw away the unnecessary curves -
then clear the canvas and redraw. I'm sure I could work that out eventually
(with the help of Google!), but I suspect the maths to do this may actually
be too slow to be of much use.

So - any ideas/similar experiences/solutions?

(This is MX04, rather than Flash 8, otherwise I'd be looking at drawing into
bitmaps to solve the problem.)

TIA,

Ian
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to