5 void hsv2rgb(float h, float s, float v, float *r, float *g, float *b)
11 float hp = (h * 180.0 / M_PI) / 60.0;
12 float x = c * (1 - fabs(fmod(hp, 2.0f) - 1.0f));
14 if (hp >= 0 && hp < 1) {
18 } else if (hp >= 1 && hp < 2) {
22 } else if (hp >= 2 && hp < 3) {
26 } else if (hp >= 3 && hp < 4) {
30 } else if (hp >= 4 && hp < 5) {
46 std::string read_file(const std::string &filename)
48 static char buf[131072];
49 FILE *fp = fopen(filename.c_str(), "r");
51 perror(filename.c_str());
55 int len = fread(buf, 1, sizeof(buf), fp);
58 return std::string(buf, len);