How to tint an Android bitmap in White?
android, bitmap
Solution
Ok. I reply here for people who might face this problem.
In order to keep the shape of a bitmap, and colorize it you need to use a `PorterDuffColorFilter` instead of the `LightingColorFilter` i used initially.
filter = new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
mPaint.setColorFilter(filter);
The second parameter is a `PorterDuff.Mode`, you can find the complete list here
Problem
I want to colorize a bitmap into different colors. Thanks to this SE question i am able to tint my it into different colors when i draw it on my canvas. ``` Paint p = new Paint(Color.RED); ColorFilter filter = new LightingColorFilter(Color.RED, 1); p.setColorFilter(filter); ``` But this seems to not work with `Color.WHITE` (maybe because my bitmap is colorized in only 1 color). I want to have a white shape of the original bitmap (only transparent + white)