Use a ColorFilter on the Paint :) On Thu, Jan 15, 2009 at 4:33 PM, Patrick <[email protected]> wrote: > > To draw a bitmap more transparent then normal, I do the following : > > Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); > paint.setAlpha(0x7F); > canvas.drawBitmap(bitmap, matrix, paint); > > This works great. The bitmap is half opaque... > > However, I also want to draw a bitmap with a red tint. One would > think : > > Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); > paint.setColor(0xFFFF0000); > canvas.drawBitmap(bitmap, matrix, paint); > > would achieve that. But no. The bitmap is rendered normally. However, > if I change it to : > > Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG); > paint.setColor(0x7FFF0000); > canvas.drawBitmap(bitmap, matrix, paint); > > The alpha component of the color is indeed taken into account, but not > the color channels. The bitmap shows up as half-opaque, but not red. > In fact, I tried a number of colors, and the alpha is the only thing > taken into account no matter what I pass in. > > So how can I go about applying a color multiplier to a bitmap when I > draw it ? > > > >
-- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

