Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android color overlay - PorterDuff modes

I have a black & white ninepatch drawable as background of a view and I would like to apply a color on it, like a semi-transparent overlay that leaves the drawing visible but applies the desired color on it.

I thought drawable.setColorFilter(color,mode) might do the trick, but I can't figure out what the different modes mean.

Could anyone give me a hint?

like image 295
sdabet Avatar asked Nov 15 '11 16:11

sdabet


1 Answers

I believe this question may help you:

Understanding the Use of ColorMatrix and ColorMatrixColorFilter to Modify a Drawable's Hue

That said, I would suggest using PorterDuff.Mode.MULTIPLYfor what you're needing.

like image 110
Kevin Coppock Avatar answered Sep 24 '22 08:09

Kevin Coppock