Java examples for 2D Graphics:Color RGB
Transform color c into a 32 bit ARGB value
//package com.java2s; import java.awt.Color; public class Main { /**//from www .j a v a 2 s . co m * Transform color c into a 32 bit ARGB value * * @param c * @return */ public static int getARGBInt(Color c) { return (c.getAlpha() << 24) + (c.getRed() << 16) + (c.getGreen() << 8) + c.getBlue(); } /** * Get the alpha value of a 32-bit ARGB color * * @param rgb * @return */ public static int getAlpha(int argb) { return argb >> 24; } }