Java examples for 2D Graphics:Color
set Alpha Value
//package com.java2s; public class Main { public static int setAlphaValue(int argb, double alpha) { int a = argb >> 24 & 0xFF; // Alpha int r = argb >> 16 & 0xFF; // Red int g = argb >> 8 & 0xFF; // Green int b = argb & 0xFF; // blue a = (int) Math.round(alpha * a); // argb = a << 24 & 0xFF000000 | r << 16 & 0xFF0000 | g << 8 & 0xFF00 | b & 0xFF; argb = ((a << 24) & 0xFF000000) | ((r << 16) & 0x00FF0000) | ((g << 8) & 0x0000FF00) | ((b) & 0x000000FF); return argb; }/* w w w . ja v a 2 s . c o m*/ }