Convert HUE color to RGB
| 46 | |
| 47 | // Convert HUE color to RGB |
| 48 | inline float hue2rgb(float p, float q, float t) |
| 49 | { |
| 50 | if (t < 0) |
| 51 | t += 1; |
| 52 | if (t > 1) |
| 53 | t -= 1; |
| 54 | if (t < 1.f / 6.f) |
| 55 | return p + (q - p) * 6.f * t; |
| 56 | if (t < 1.f / 2.f) |
| 57 | return q; |
| 58 | if (t < 2.f / 3.f) |
| 59 | return p + (q - p) * (2.f / 3.f - t) * 6.f; |
| 60 | return p; |
| 61 | } |
| 62 | |
| 63 | // Converts an HSL color value to RGB. Conversion formula |
| 64 | // adapted from http://en.wikipedia.org/wiki/HSL_color_space. |