saturate color value - Android Graphics

Android examples for Graphics:Color Value

Description

saturate color value

Demo Code


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

public class Main {
    public static int saturate(int color, float saturation) {
        float[] hsv = new float[3];
        Color.RGBToHSV(Color.red(color), Color.green(color),
                Color.blue(color), hsv);
        hsv[1] = saturation;/*from  w w  w .  j a va2s  .c o  m*/
        return Color.HSVToColor(Color.alpha(color), hsv);
    }
}

Related Tutorials