darker Color 2 times - Android Graphics

Android examples for Graphics:Color Darken

Description

darker Color 2 times

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {
    public static int darker2times(final int color) {
        final int a = Color.alpha(color);
        int r = Color.red(color);
        int g = Color.green(color);
        int b = Color.blue(color);

        r -= 64;//from w w w  .j a  v  a2  s  .c o  m
        if (r < 0) {
            r = 0;
        }
        g -= 64;
        if (g < 0) {
            g = 0;
        }
        b -= 64;
        if (b < 0) {
            b = 0;
        }
        return Color.argb(a, r, g, b);
    }
}

Related Tutorials