I get the color of the pixel
int color = image.getRGB(x,y);
then I want to purchase the red, green, blue components separately. How to do it? Maybe with some bitmask?
int green = color&0x00ff00;
obviously does not work ...: (
To get the color components, you can use:
import android.graphics.Color; int r = Color.red(intColor); int g = Color.green(intColor); int b = Color.blue(intColor); int a = Color.alpha(intColor);
int value = image.getRGB(x,y); R = (byte)(value & 0x000000FF); G = (byte)((value & 0x0000FF00) >> 8); B = (byte)((value & 0x00FF0000) >> 16); A = (byte)((value & 0xFF000000) >> 24);
You may need to flip R, A, or B around.
:
int green = (color & 0x00ff00) >> 8;
Color hasalpha=true:
Color
hasalpha=true
Color color = new Color(image.getRGB(x,y), true);
getRGB TYPE_INT_ARGB, , -.