public static int multiplyColorAlpha ( int color , int alpha ) { if ( alpha == 255 ) { return color ; } if ( alpha == 0 ) { return color & 0x00FFFFFF ; } alpha = alpha + ( alpha >> 7 ) ; // make it 0..256 int colorAlpha = color >>> 24 ; int multipliedAlpha = colorAlpha * alpha >> 8 ; return ( multipliedAlpha << 24 ) | ( color & 0x00FFFFFF ) ; }
Multiplies the color with the given alpha .