How can we manipulate parts of an image selectively. For example, I
have a canvas based on bitmap of image I am working on. I would like
to change a circular region on this image to black & white while the
rest of the image remains the same. I am able to get the complete
image in black & white by

Bitmap myBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.myImage);
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.setSaturation(0);
paint = new Paint();
ColorMatrixColorFilter cmcf = new ColorMatrixColorFilter(colorMatrix);
paint.setColorFilter(cmcf);

Bitmap blackAndWhiteBitmap = Bitmap.createBitmap(myBitmap.getWidth(),
myBitmap.getHeight(), Bitmap.Config.ARGB_8888);

Canvas drawingCanvas = new Canvas(blackAndWhiteBitmap );
drawingCanvas.drawBitmap(myBitmap, 0, 0, paint);

-Gaurav

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to