After trying and failing to figure this out myself, I have scavenged some code which should combine two colors (integers) by a specified fraction from another thread, but I am just simply not crafty enough to get it working with ARGB integers. Does anyone know how to convert this function from combining RGB to combining ARGB?
public static int mixColors(int a, int b, float fractionB){
int mask1 = 0xff00ff;
int mask2 = 0x00ff00;
int f2 = (int)(256 * fractionB);
int f1 = 256 - f2;
return ((((( a & mask1 ) * f1 ) + ( ( b & mask1 ) * f2 )) >>> 8 ) & mask1 )
| ((((( a & mask2 ) * f1 ) + ( ( b & mask2 ) * f2 )) >>> 8 ) & mask2 );
}
I have tried setting the masks to mask1 = 0x00ff00ff; mask2 = 0xff00ff00;
but the function still only outputs a 3 byte number.