Color mixing in android

chikka.anddev picture chikka.anddev · May 20, 2011 · Viewed 18.5k times · Source

I am working on application in which i have five colors:Red,Green,Blue,Yellow,purple

I want to implement color mixing from those colors:such that like there are five button for each color.

User touch whichever color button this color mix with previously drawn color.

I have not any clue how to add two color codes and get third color.

EDitED:

I have to also set this color to imageview's bitmap

how can i set this?

Answer

Szymon Grochowiak picture Szymon Grochowiak · Jul 27, 2016

Since April 2015 you can use blendARGB method from v4 support library:

int resultColor = ColorUtils.blendARGB(color1, color2, 0.5F);

Ratio value has to be 0.5 to achive even mix.