desaturation color by rate - Android Graphics

Android examples for Graphics:Color Operation

Description

desaturation color by rate

Demo Code


//package com.java2s;

import android.graphics.Color;

public class Main {
    public static final int desaturation(int color, float rate) {
        float[] hsv = new float[3];
        Color.colorToHSV(color, hsv);
        hsv[1] = hsv[1] * rate;//from  www.ja  v a 2 s . co  m
        return Color.HSVToColor(hsv);
    }

    public static final int desaturation(int color) {
        return desaturation(color, 0.8f);
    }
}

Related Tutorials