Android examples for Graphics:Color Value
Changes the paint color to the specified value.
// Copyright 2009-2011 Google, All Rights reserved //package com.java2s; import android.graphics.Paint; public class Main { /**//from w ww . j a v a2 s .c o m * Changes the paint color to the specified value. * * @param paint the object to mutate with the new color * @param argb a 32-bit integer with eight bits for alpha, red, green, and blue, * respectively */ public static void changePaint(Paint paint, int argb) { // TODO(user): can the following two lines can be replaced by: // paint.setColor(argb)? paint.setColor(argb & 0x00FFFFFF); paint.setAlpha((argb >> 24) & 0xFF); paint.setXfermode(null); } }