Thanks for the fast response. I can't seem to saw the changes made by the canvas in the original bitmap, my code is as follows;
int old = input.getPixel(0, 0); Canvas c = new Canvas(input); c.drawARGB(a, r, g, b); int n = input.getPixel(0, 0); if(old==n) Log.e(TAG, "Values didn't change!"); // Fires return input; 'input' is mutable but the returned bitmap retains it's old values. The 'clip' Rect is the size of the bitmap. Do you know why this is the case? I'm looking for a finalize or save on the canvas but they don't seem to do the job. Kind regards, Gav On Thu, May 28, 2009 at 5:19 PM, Streets Of Boston <flyingdutc...@gmail.com>wrote: > > - Create a mutable bitmap from immutable. But instead of a copy, just > create an empty one with the same width and height as the original > one. > - Create a canvas from this mutable bitmap (new Canvas(mutable)); > - Create a ColorFilter object. Set its saturation to 0 (this is one > way of doing this). > (ColorMatrixColorFilter with a ColorMatrix whose saturation is set > to 0). > - Create a new Paint object and set its color-filter to the > ColorMatrixColorFilter (bwPaint). > - Draw the original bitmap onto the new canvas: > mutableCanvas.drawBitmap(immutable, 0, 0, bwPaint); > - After this drawBitmap call, the mutable bitmap contains a b&w > version of your original mutable bitmap. > > On May 28, 12:00 pm, Gavin Aiken <gavin.ai...@imperial.ac.uk> wrote: > > Hi Marco, > > > > Would you mind giving a brief code snippet of how this might work? I've > been > > trying to get a similar function to run faster but when I use the bitmap > the > > values I thought were written by the canvas aren't there. > > > > Kind regards, > > > > Gav > > > > On Tue, Apr 21, 2009 at 12:21 AM, Marco Nelissen <marc...@android.com > >wrote: > > > > > > > > > You can do this more efficiently by using a Paint and a ColorFilter. > > > > > On Mon, Apr 20, 2009 at 3:59 PM, sm12 <mata...@gmail.com> wrote: > > > > >> Solved. The problem was in the parameters of Color.rgb.- Hide quoted > text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---