- 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 <[email protected]> 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 <[email protected]>wrote:
>
>
>
> > You can do this more efficiently by using a Paint and a ColorFilter.
>
> > On Mon, Apr 20, 2009 at 3:59 PM, sm12 <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to