Get color at specific hue angle - Android Graphics

Android examples for Graphics:Color Hue

Description

Get color at specific hue angle

Demo Code


import android.graphics.Color;

public class Main{
    /**//from  ww w  .  j av  a  2 s  . c om
     * Get color at specific hue angle
     * @param angle angle in degrees
     * @return color at specific hue angle
     */
    public static int getColorFromHue(float angle) {
        return getColorFromHSV(angle, 1, 1);
    }
    /**
     * Get color at specific hue angle, saturation and value
     * @param angle angle in degrees
     * @param saturation color saturation
     * @param value color value
     * @return color at specific hue angle, saturation and value
     */
    public static int getColorFromHSV(float angle, float saturation,
            float value) {
        angle = Utils.normalizeAngle(angle);
        return Color.HSVToColor(new float[] { angle, saturation, value });
    }
}

Related Tutorials