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?
- Have your original bitmap.
- Create a new clean Bitmap that has the same width/height as your original bitmap.
- Create a new Canvas using this clean Bitmap.
- Set your paint object, etc for this new Canvas.
- 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.
精彩评论