Sorry, I misunderstood. You could try stroking the path but set a BitmapShader first (using a copy of the bitmap) combined with your ColorMatrixColorFilter(). You might have problems with alignment though. One heavyweight solution (I can't think of any lightweight ones to be honest) would be to maintain a scratch canvas which is blank (erased with 0x00000000) stroke your path in white onto that, then draw your bitmap onto it using a MULTIPLY transfer mode. Then take that scratch canvas, draw it onto the original using your ColorFilter. Blank the scratch canvas ready for the next stroke; of course multiple strokes could be accumulated on the scratch canvas.
I haven't paused to fully think through whether that would work, but I think it should. Tom. 2009/4/22 Gaurav <[email protected]> > > Tom, thanks a lot. This works if I want to selectively turn a circular > region Black and White. Can you also suggest what to do if I want to > turn only a stroked path (Just like the finger paint sample) to Black > & White. > > -Gaurav > > Can you also suggest what can I do if I want to > > On Apr 22, 11:26 pm, Tom Gibara <[email protected]> wrote: > > Try copying the original bitmap, creating a canvas over the copy, setting > a > > circular clip path on it, then drawing the original bitmap with the color > > matrix you've defined into the canvas. That should work. > > Tom. > > > > 2009/4/22 Gaurav <[email protected]> > > > > > > > > > Just to explain my problem a little more, 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); > > > > > Can someone please suggest a solution. > > > > > On Apr 21, 4:05 pm, Gaurav <[email protected]> wrote: > > > > Can someone please respond to this. I would like to make some > > > > modifications in the existing pixels represented by a path, this is a > > > > little different from FingerPaint Sample where we draw a fresh path > > > > overwriting the existing pixels. > > > > > > On Apr 21, 2:05 am, Gaurav <[email protected]> wrote: > > > > > > > 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 the brightness of a path on this canvas while the rest of > > > > > the image remains the same. > > > > > > > -Gaurav > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---

