Shifts the hue color value by the offset specified - Android Graphics

Android examples for Graphics:Color Value

Description

Shifts the hue color value by the offset specified

Demo Code


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

public class Main {
    /**//from   ww w  .  j a v  a  2  s .c  o m
     * Shifts the hue by the offset specified
     * @param color
     * @param offset
     * @return shifted color
     */
    public static int shiftColorHue(int color, float offset) {
        float[] colorShiftHSV = new float[3];
        Color.colorToHSV(color, colorShiftHSV);
        colorShiftHSV[0] = (colorShiftHSV[0] + offset) % 360;

        return Color.HSVToColor(colorShiftHSV);
    }
}

Related Tutorials