I have an ImageView with bitmap in it. This bitmap has alpha channel and transparent pixels.
When i try to use ColorFiter with Mode.OVERLAY (since honeycomb) – provided color overlay the whole imageview (whole rect), but i want only to overlay non transparent pixels. How can i clip the imageview’s canvas to perform filter where i want ?
UPDATED
I have grey image in png:

When i try to use MODE_ATOP i get:

When i use OVERLAY i get:

And what i want to get:

There’s probably a more efficient way to do this (maybe by creating a
ColorMatrixColorFilterto approximate it), but sinceMode.OVERLAYappear to be hard to simplify otherwise, here’s some sample code that should implement what you want:In short, we draw the source bitmap and color using the
OVERLAYmode, and then using a secondary bitmap (composited usingSRC_ATOPmode), we combine it usingAvoidXfermodeto not draw over the transparent pixels.Original image:
Result: