Changeset 2189
 Timestamp:
 Jan 1, 2013, 6:43:27 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/lol/image/color.h
r2188 r2189 97 97 return vec4(CIEXYZToLinearRGB(c.rgb), c.a); 98 98 } 99 100 /* 101 * Convert CIE XYZ to CIE L*a*b* 102 */ 103 static vec3 CIEXYZToCIELab(vec3 col) 104 { 105 using std::pow; 106 107 float const a = 8.85645167903563081e3; /* (6/29)^3 */ 108 float const b = 7.78703703703703703; /* 1/3 (29/6)^2 */ 109 float const c = 1.37931034482758620e1; /* 4/29 */ 110 111 vec3 f = b * col + vec3(c); 112 if (col.x > a) 113 f.x = pow(col.x, 1.0 / 3.0); 114 if (col.y > a) 115 f.y = pow(col.y, 1.0 / 3.0); 116 if (col.z > a) 117 f.z = pow(col.z, 1.0 / 3.0); 118 119 return vec3(116.0 * f.y  16.0, 120 500.0 * (f.x  f.y), 121 200.0 * (f.y  f.z)); 122 } 123 124 static vec4 CIEXYZToCIELab(vec4 c) 125 { 126 return vec4(CIEXYZToLinearRGB(c.rgb), c.a); 127 } 99 128 }; 100 129
Note: See TracChangeset
for help on using the changeset viewer.