开发者

how to convert a paint image to bitmap

I am able to save the source image but not able save the image with colorfilter: paint.setColorFilter(new ColorMatrixColorFilter(cm));

If this image is c开发者_开发技巧onverted into bitmap it can be saved easily, but I don't know how to do this. Is there anyone to give solution?


  1. Have your original bitmap.
  2. Create a new clean Bitmap that has the same width/height as your original bitmap.
  3. Create a new Canvas using this clean Bitmap.
  4. Set your paint object, etc for this new Canvas.
  5. Draw your original bitmap into this new Canvas.

Since this new Canvas is backed by a Bitmap (point 3.), any drawing you do in this Canvas will become part of the new Bitmap (point 2.). Now just call 'compress' on this Bitmap from point 2. and the bitmap will be saved as a jpg/png.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜