How to tint an Android bitmap in White? -


i want colorize bitmap different colors. this se question able tint different colors when draw on canvas.

paint p = new paint(color.red); colorfilter filter = new lightingcolorfilter(color.red, 1); p.setcolorfilter(filter); 

but seems not work color.white (maybe because bitmap colorized in 1 color). want have white shape of original bitmap (only transparent + white)

ok. reply here people might face problem.

in order keep shape of bitmap, , colorize need use porterduffcolorfilter instead of lightingcolorfilter used initially.

 filter = new porterduffcolorfilter(color.white, porterduff.mode.src_atop);  mpaint.setcolorfilter(filter); 

the second parameter porterduff.mode, can find complete list here


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -