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 ?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to