35 if(color >= HSI_H_STEPS * HSI_SI_VALUES)
38 float loc1 = 0, loc2 = 0, loc3 = 0;
39 if(color % HSI_H_STEPS != 0) {
40 loc1 = color % HSI_H_STEPS * 1.0/18.0;
44 switch(
int(color / HSI_H_STEPS)) {
78 loc3 = 1 - (float)color / HSI_H_STEPS / (
float)HSI_SI_VALUES;
82 return Color(0, 0, 0);
85 int loc7 = int(loc3 * 255);
86 return Color(loc7, loc7, loc7);
89 float red = 0, green = 0, blue = 0;
93 blue = loc3 * (1 - loc2);
94 green = blue + (loc3 - blue) * 6 * loc1;
96 else if(loc1 < 2.0/6.0) {
98 blue = loc3 * (1 - loc2);
99 red = green - (loc3 - blue) * (6 * loc1 - 1);
101 else if(loc1 < 3.0/6.0) {
103 red = loc3 * (1 - loc2);
104 blue = red + (loc3 - red) * (6 * loc1 - 2);
106 else if(loc1 < 4.0/6.0) {
108 red = loc3 * (1 - loc2);
109 green = blue - (loc3 - red) * (6 * loc1 - 3);
111 else if(loc1 < 5.0/6.0) {
113 green = loc3 * (1 - loc2);
114 red = green + (loc3 - green) * (6 * loc1 - 4);
118 green = loc3 * (1 - loc2);
119 blue = red - (loc3 - green) * (6 * loc1 - 5);
121 return Color(
int(red * 255),
int(green * 255),
int(blue * 255));