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?
Paleto is able to extract the colors you like from your photos and the tinting function that mixes colors to create new ones. It also provides a library of 1400 colors and a palette that lets you store and share your colors.
Optical color mixing is a phenomenon that happens when a viewer perceives color in an image as a result of two or more colors that are positioned next to, or near each other. The perceived color is not actually on the surface.
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.
SlidingTabStrip has really useful method for blending colors, looks great when used with ViewPager:
private static int blendColors(int color1, int color2, float ratio) {
final float inverseRation = 1f - ratio;
float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation);
float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation);
float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation);
return Color.rgb((int) r, (int) g, (int) b);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With