MCPcopy Create free account
hub / github.com/benfry/processing4 / xyzToLab

Method xyzToLab

app/src/processing/app/ui/Theme.java:284–303  ·  view source on GitHub ↗
(double[] xyz)

Source from the content-addressed store, hash-verified

282
283
284 static private double[] xyzToLab(double[] xyz) {
285 double var_X = xyz[0] / REF_X; // Observer= 2°, Illuminant= D65
286 double var_Y = xyz[1] / REF_Y;
287 double var_Z = xyz[2] / REF_Z;
288
289 var_X = (var_X > 0.008856) ?
290 Math.pow(var_X, 1/3.0) : (7.787*var_X + 16/116.0);
291
292 var_Y = (var_Y > 0.008856) ?
293 Math.pow(var_Y, 1/3.0) : (7.787*var_Y + 16/116.0);
294
295 var_Z = (var_Z > 0.008856) ?
296 Math.pow(var_Z, 1/3.0) : (7.787*var_Z + 16/116.0);
297
298 return new double[] {
299 (116 * var_Y) - 16,
300 500 * (var_X - var_Y),
301 200 * (var_Y - var_Z)
302 };
303 }
304
305// static private double[] labToXyz(double[] lab) {
306// double var_Y = (lab[0] + 16) / 116.0;

Callers 1

makeGradientLabMethod · 0.95

Calls 1

powMethod · 0.80

Tested by

no test coverage detected