123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- static double
- sRGB_from_linear(double l)
- {
- if (l <= 0.0031308)
- l *= 12.92;
- else
- l = 1.055 * pow(l, 1/2.4) - 0.055;
- return l;
- }
- static double
- linear_from_sRGB(double s)
- {
- if (s <= 0.04045)
- return s / 12.92;
- else
- return pow((s+0.055)/1.055, 2.4);
- }
- static double
- YfromRGB(double r, double g, double b)
- {
-
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
- }
|