Here you can find the source of HSVtoRGB(float[] hsv, float[] rgb)
public static void HSVtoRGB(float[] hsv, float[] rgb)
//package com.java2s; //License from project: BSD License public class Main { /** // w w w . j a va2 s . co m * Convert an HSV color to RGB representation. It is assumed that all RBG * and HSV values are in the range 0-1 (as opposed to the typical HSV ranges * of [0-360], [0-100], [0-100]). */ public static void HSVtoRGB(float[] hsv, float[] rgb) { float f, p, q, t, hRound; int hIndex; float h, s, v; h = hsv[0]; s = hsv[1]; v = hsv[2]; if (h < 0) { h = 0; } else if (h >= 1) { h = 0; } hRound = (int) (h * 6.0); hIndex = ((int) hRound) % 6; f = (h * 6.0f) - hRound; p = v * (1.0f - s); q = v * (1.0f - f * s); t = v * (1.0f - (1.0f - f) * s); switch (hIndex) { case 0: rgb[0] = v; rgb[1] = t; rgb[2] = p; break; case 1: rgb[0] = q; rgb[1] = v; rgb[2] = p; break; case 2: rgb[0] = p; rgb[1] = v; rgb[2] = t; break; case 3: rgb[0] = p; rgb[1] = q; rgb[2] = v; break; case 4: rgb[0] = t; rgb[1] = p; rgb[2] = v; break; case 5: rgb[0] = v; rgb[1] = p; rgb[2] = q; break; } } }