>  Are you suggesting I choose a point in time, for instance, when 500
>  vectors are drawn, then convert them, encode as png file, overlay as
>  another child image, clear the graphics object and let user continue
>  scribbling on newly cleared graphics object?.

Reading through this thread reminded me of a similar performance issue
I encountered. I have a component that allows the user to erase parts
of image. I originally implemented this by creating a mask for the
bitmap and drawing on the mask to erase. I ran into the same problem:
the more the user erased, the slower the app got.

I eventually switched to using a bitmap as the mask, but I lost my
nice soft brushes and easy, smooth resizing that the vectors gave me.
In thinking about Alex's suggestion I had a thought (that would help
you as well).

Instead of "baking" your lines to a bitmap, creating a new shape and
drawing on that, then baking that into your bitmap, repeat... which
has the problem of losing your vectors... could you keep an array (or
rather, a stack) of shape layers, and as the user draws a certain
amount of vectors on that shape (like you said, 500 lines or such),
you push another shape layer on the stack and set the previous shape
layer cacheAsBitmap to true. You'd then get the performance boost of
the bitmap without losing the fidelity of your vectors.

When the user is ready to finalize their drawing, you just start at
the bottom of the stack and draw the shapes into a bitmap at whatever
is the desired final resolution (scaling it up or down as needed).

That should be an excellent trade-off... the only drawback would be if
you were using the vector renderer to draw things that interact with
existing vectors, i.e. using fills with intersections, etc.

Troy.

Reply via email to