I am develop my writing application on my phone. I need to draw the stroke on the canvas. I need to save all the points in order to redraw. I found that as the number of points grow. It gets slow. How ever i need all the points to redraw. Is there a way to save the previous drawing and restore the background for canvas?
Asked
Active
Viewed 812 times
1 Answers
1
Your canvas you are drawing in should be part of a view. Then you should be able to use getDrawingCache.
You need to enable caching too... check this.
Hope that helps.
-
Do you mean, each time i save the canvas as a picture, then post it back? Then i dont need to record all the stroke points from the start right? – user958274 Sep 28 '11 at 00:25
-
Correct. You can do that periodically... every time you have 50 or 100 points, create that bitmap, use it for the background of your View and flush it out of your list of points to redraw every time. – Matthieu Sep 28 '11 at 17:14
-
To make sure all this is smooth, allocate all the structure you need beforehand to make sure the user cannot feel it when drawing... – Matthieu Sep 28 '11 at 17:14