turn true color image into gray image. @param image @return gray image, format ARGB_8888 as before.
(Bitmap image)
| 774 | * @return gray image, format ARGB_8888 as before. |
| 775 | */ |
| 776 | public Bitmap gray(Bitmap image) |
| 777 | { |
| 778 | Bitmap result = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.ARGB_8888); |
| 779 | Canvas canvas = new Canvas(result); |
| 780 | Paint paint = new Paint(); |
| 781 | ColorMatrix transform = new ColorMatrix(); |
| 782 | transform.setSaturation(0); |
| 783 | ColorMatrixColorFilter filter = new ColorMatrixColorFilter(transform); |
| 784 | paint.setColorFilter(filter); |
| 785 | canvas.drawBitmap(image, 0, 0, paint); |
| 786 | return result; |
| 787 | } |
| 788 | |
| 789 | // convert View to Bitmap, it can be archived to SD card later. |
| 790 | public static Bitmap getBitmapFromView(View view) |
nothing calls this directly
no test coverage detected