darker color by factor - Android Graphics

Android examples for Graphics:Color Darken

Description

darker color by factor

Demo Code


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

public class Main {
    public static int darker(int color, float factor) {
        return Color.argb(Color.alpha(color),
                Math.max((int) (Color.red(color) * factor), 0),
                Math.max((int) (Color.green(color) * factor), 0),
                Math.max((int) (Color.blue(color) * factor), 0));
    }// w  w w  .  j  av a  2 s. c o m
}

Related Tutorials