Android examples for Graphics:Color RGB Value
convert ARGB Packed Int To Color
public class Main{ public static Color convertARGBPackedIntToColor(final int pARGBPackedInt) { final Color color = new Color(); convertARGBPackedIntToColor(pARGBPackedInt, color); return color; }/* ww w . j av a 2 s . c o m*/ public static void convertARGBPackedIntToColor( final int pARGBPackedInt, final Color pColor) { final float alpha = ColorUtils .extractAlphaFromARGBPackedInt(pARGBPackedInt); final float red = ColorUtils .extractRedFromARGBPackedInt(pARGBPackedInt); final float green = ColorUtils .extractGreenFromARGBPackedInt(pARGBPackedInt); final float blue = ColorUtils .extractBlueFromARGBPackedInt(pARGBPackedInt); pColor.set(red, green, blue, alpha); } public static float extractAlphaFromARGBPackedInt( final int pARGBPackedInt) { return ((pARGBPackedInt >> Color.ARGB_PACKED_ALPHA_SHIFT) & 0xFF) / 255.0f; } public static float extractRedFromARGBPackedInt(final int pARGBPackedInt) { return ((pARGBPackedInt >> Color.ARGB_PACKED_RED_SHIFT) & 0xFF) / 255.0f; } public static float extractGreenFromARGBPackedInt( final int pARGBPackedInt) { return ((pARGBPackedInt >> Color.ARGB_PACKED_GREEN_SHIFT) & 0xFF) / 255.0f; } public static float extractBlueFromARGBPackedInt( final int pARGBPackedInt) { return ((pARGBPackedInt >> Color.ARGB_PACKED_BLUE_SHIFT) & 0xFF) / 255.0f; } }