Android Utililty Methods Color Average

List of utility methods to do Color Average

Description

The list of methods to do Color Average are organized into topic(s).

Method

intaverage(int color, int color2)
Returns the a color created by an average between two colors.
final int[] parts1 = getArgb(color);
final int[] parts2 = getArgb(color2);
for (int i = 0; i < parts1.length; i++) {
    parts1[i] = (int) ((float) (parts1[i] + parts2[i]) / 2f);
return getColorFromArgb(parts1);
intaverageBlendTwoColors(int c1, int c2)
Blend of color c1 and c2 by adding the components and dividing the results with 2.
int a1 = Color.alpha(c1);
int r1 = Color.red(c1);
int g1 = Color.green(c1);
int b1 = Color.blue(c1);
int a2 = Color.alpha(c2);
int r2 = Color.red(c2);
int g2 = Color.green(c2);
int b2 = Color.blue(c2);
...
intmultiplyBlendTwoColors(int c1, int c2)
Blend of color c1 and c2 by applying f(c1, c2) = c1 * c2 per channel.
double a1 = Color.alpha(c1) / ((double) CHANNEL_MAX);
double r1 = Color.red(c1) / ((double) CHANNEL_MAX);
double g1 = Color.green(c1) / ((double) CHANNEL_MAX);
double b1 = Color.blue(c1) / ((double) CHANNEL_MAX);
double a2 = Color.alpha(c2) / ((double) CHANNEL_MAX);
double r2 = Color.red(c2) / ((double) CHANNEL_MAX);
double g2 = Color.green(c2) / ((double) CHANNEL_MAX);
double b2 = Color.blue(c2) / ((double) CHANNEL_MAX);
...