Android : Create Bitmap From Droid.graphics.Path?Oct 5, 2009
I am banging my head against the wall trying to create a Bitmap from a Path object (android.graphics.Path). Is there any way to do this? I've browsed through most of the classes now but can't seem to find any way to do it.
Actually, what I have is a Path that consists of many cubic Bezier curves. It is really expensive to draw with canvas.drawPath(). So I figured that I could perhaps "cache" the Bitmap of this Path by converting the Path to a Bitmap once and then just drawing the Bitmap every time instead of calling canvas.drawPath().
Is there any way to create a Bitmap from this Path?
Or is there a smarter way to draw tha Path multiple times without having to recalculate all of the Beziers? For example, if I created a ShapeDrawable from PathShape from the Path, and just draw the ShapeDrawable objects every time, would that be more efficient than drawing the Path every time?