forked from cameramanben/LUTCalc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlutmessage.js
677 lines (677 loc) · 18.8 KB
/
lutmessage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
/* lutmessage.js
* messaging object between UI and calculations / web workers for LUTCalc Web App.
* 28th December 2014
*
* LUTCalc generates 1D and 3D Lookup Tables (LUTs) for video cameras that shoot log gammas,
* principally the Sony CineAlta line.
*
* By Ben Turley, http://turley.tv
* First License: GPLv2
* Github: https://github.com/cameramanben/LUTCalc
*/
function LUTMessage(inputs) {
this.inputs = inputs;
this.ui = []; // Links to UI objects for function returns
this.ui[0] = this;
this.go = false;
// 1 - camerabox
// 2 - gammabox
// 3 - tweaksbox
// 4 - lutbox
// 5 - generatebox
// 6 - infobox
// 7 - LUTAnalyst
// 8 - preview
// 9 - twkHG
// 10 - twkLA
// 11 - formats
// 12 - twkWHITE
// 13 - twkCS
// 14 - twkMulti
this.gas = []; // Array of gamma web workers
this.gaT = 2; // Gamma threads
this.gaN = 0; // Next web worker to send data to
this.gaV = 0; // Counter keeping tabs on 'freshness' of returned data
this.gaU = 0; // Counter keeping tabs on how many of the threads are up-to-date
this.gaL = 0;
this.gaPQ = 0;
this.startGaThreads();
this.gts = []; // Array of gamma web workers
this.gtT = 2; // Gamut threads
this.gtN = 0; // Next web worker to send data to
this.gtV = 0; // Counter keeping tabs on 'freshness' of returned data
this.gtU = 0; // Counter keeping tabs on how many of the threads are up-to-date
this.gtL = 0;
this.startGtThreads();
}
LUTMessage.prototype.addUI = function(code,ui) {
this.ui[code] = ui;
};
LUTMessage.prototype.getGammaThreads = function() {
return this.gaT;
};
LUTMessage.prototype.getGamutThreads = function() {
return this.gtT;
};
LUTMessage.prototype.getWorker = function() {
return this.gas[0];
};
LUTMessage.prototype.setReady = function() {
this.go = true;
};
// Gamma Message Handling
LUTMessage.prototype.startGaThreads = function() {
var max = this.gaT;
for (var i=0; i<max; i++) {
var _this = this;
this.gas[i] = new Worker('gamma.js');
this.gas[i].onmessage = function(e) {
_this.gaRx(e.data);
};
}
};
LUTMessage.prototype.stopGaThreads = function() {
var max = this.gas.length;
for (var i=0; i<max; i++) {
this.gas[i].terminate();
}
this.gas = [];
};
LUTMessage.prototype.changeGaThreads = function(T) {
if (typeof T==='number' && (T%1)===0) {
this.gaT = T;
var max = this.gas.length;
if (T > max) {
for (var i=max; i<T; i++) {
var _this = this;
this.gas[i] = new Worker('gamma.js');
this.gas[i].onmessage = function(e) {
_this.gaRx(e.data);
};
}
} else if (T < max) {
for (var i=T-1; i<max; i++) {
this.gas[i].terminate();
}
this.gas = this.gas.slice(0,T);
this.gaN = 0;
this.gaU = 0;
}
}
};
LUTMessage.prototype.gaSetParams = function() {
if (this.go) {
this.gaV++;
var d = {
v: this.gaV,
inGamma: parseInt(this.inputs.inGamma.options[this.inputs.inGamma.options.selectedIndex].value),
inLinGamma: parseInt(this.inputs.inLinGamma.options[this.inputs.inLinGamma.options.selectedIndex].value),
pqNits: this.inputs.inPQNits,
outGamma: parseInt(this.inputs.outGamma.options[this.inputs.outGamma.options.selectedIndex].value),
outLinGamma: parseInt(this.inputs.outLinGamma.options[this.inputs.outLinGamma.options.selectedIndex].value),
defGamma: this.inputs.defGammaIn,
newISO: parseFloat(this.inputs.cineEI.value),
natISO: parseFloat(this.inputs.nativeISO.innerHTML),
camType: parseInt(this.inputs.cameraType.value),
stopShift: parseFloat(this.inputs.stopShift.value),
clip: this.inputs.clipCheck.checked,
isTrans: this.inputs.isTrans
};
if (this.inputs.inRange[0].checked) {
d.inL = true;
} else {
d.inL = false;
}
if (this.inputs.outRange[0].checked) {
d.outL = true;
} else {
d.outL = false;
}
if (typeof this.inputs.bClip !== 'undefined') {
d.bClip = this.inputs.bClip;
d.wClip = this.inputs.wClip;
}
if (typeof this.inputs.scaleMin.value !== 'undefined') {
d.scaleMin = parseFloat(this.inputs.scaleMin.value);
d.scaleMax = parseFloat(this.inputs.scaleMax.value);
}
this.ui[3].getTFParams(d);
var max = this.gas.length;
for (var i=0; i<max; i++) {
this.gas[i].postMessage({t: 0, d: d});
}
}
};
LUTMessage.prototype.gaTx = function(p,t,d) { // parent (sender), type, data
if (typeof p !== 'undefined') {
if (this.inputs.isTrans && d !== null && typeof d.to !== 'undefined') {
var max = d.to.length;
var objArray = [];
for (var j=0; j < max; j++) {
objArray.push(d[d.to[j]]);
}
this.gas[this.gaN].postMessage({p: p, t: t, v: this.gaV, d: d},objArray);
this.gaN = (this.gaN + 1) % this.gaT;
} else {
this.gas[this.gaN].postMessage({p: p, t: t, v: this.gaV, d: d});
this.gaN = (this.gaN + 1) % this.gaT;
}
}
};
LUTMessage.prototype.gaTxAll = function(p,t,d) { // parent (sender), type, data
if (typeof p !== 'undefined') {
if (this.inputs.isTrans && d !== null && typeof d.to !== 'undefined') {
var max = d.to.length;
var objArray = [];
for (var j=0; j < max; j++) {
objArray.push(d[d.to[j]]);
}
max = this.gas.length;
for (var j=0; j<max; j++) {
this.gas[j].postMessage({p: p, t: t, v: this.gaV, d: d}, objArray);
}
} else {
var max = this.gas.length;
for (var j=0; j<max; j++) {
this.gas[j].postMessage({p: p, t: t, v: this.gaV, d: d});
}
}
}
};
LUTMessage.prototype.gaRx = function(d) {
if (d.msg) {
console.log(d.details);
} else if (d.err) {
console.log(d.details);
} else if (d.resend) {
console.log('Resending gamma - ' + d.t + ' to ' + d.p);
this.gaTx(d.p,d.t,d.d);
} else if (d.v === this.gaV) {
switch(d.t) {
case 20: // Set Parameters
this.gammaParamsSet(d);
break;
case 21: // 1D input to output
this.ui[5].got1D(d);
break;
case 22: // LUTAnalyst SL3 input to linear
this.gtTx(d.p,2,d);
break;
case 23: // RGB input to linear
this.gtTx(d.p,1,d);
break;
case 24: // RGB linear to output
this.ui[5].got3D(d);
break;
case 25: // Get lists of gammas
this.gotGammaLists(d);
break;
case 26: // Set LA LUT
this.gaL++;
if (this.gaL === this.gaT) {
this.gaL = 0;
this.ui[10].doneStuff();
this.ui[6].updateGamma();
}
break;
case 27: // Set LA Title
break;
case 28: // LUTAnalyst SLog3 data value from given transfer function
this.ui[d.p].gotInputVals(d.o,d.dim);
break;
case 29: // LUTAnalyst Slog3/S-Gamut3.cine values to LUT input colourspace
this.ui[d.p].gotInputVals(d.o,d.dim);
break;
case 30: // Get IRE values for output from a list of linear values
this.gotIOGammaNames(d);
break;
case 31: // Get IRE values for output from a list of linear values
this.gotChartVals(d);
break;
case 32: // Get 8-bit corrected values for preview image
this.ui[d.p].gotLine(d);
break;
case 34: // Get linear / S-Gamut3.cine value for preview image
this.gtTx(d.p,14,d);
break;
case 35: // Get primaries of current colour space for preview
this.ui[d.p].updatePrimaries(d.o);
break;
case 36: // Get PSST-CDL colours
this.ui[3].psstColours(d);
break;
case 37: // Get Multi Colours
this.ui[3].multiColours(d);
break;
case 38: // Get LUT in to LUT out values for primaries
this.ui[6].updateRGBChart(d);
break;
case 39: // Update PQ LMax level
this.gaPQ++;
if (this.gaPQ === this.gaT) {
this.gaPQ = 0;
this.gaSetParams();
}
break;
}
}
};
LUTMessage.prototype.showArray = function(o,dim) {
var temp = new Float64Array(o);
var max = Math.round(temp.length/3);
var R = new Float64Array(max);
var G = new Float64Array(max);
var B = new Float64Array(max);
for (var j=0; j<max; j++) {
R[j] = temp[j*3];
G[j] = temp[(j*3)+1];
B[j] = temp[(j*3)+2];
}
console.log(max);
console.log(R);
console.log(G);
console.log(B);
};
LUTMessage.prototype.gammaParamsSet = function(d) {
this.gaU++;
if (this.gaU === this.gaT) {
this.gaU = 0;
this.gtTx(3,16,{});
this.gtTx(8,15,{});
this.ui[3].setParams(d);
this.ui[6].updateGamma();
this.ui[8].isChanged(d.eiMult);
}
};
LUTMessage.prototype.gotGammaLists = function(d) {
this.inputs.addInput('gammaLA',d.LA);
this.inputs.addInput('gammaPQ',d.PQ);
this.inputs.addInput('gammaInList',d.inList);
this.inputs.addInput('gammaOutList',d.outList);
this.inputs.addInput('gammaLinList',d.linList);
this.inputs.addInput('gammaCatList',d.catList);
this.inputs.addInput('gammaSubNames',d.subNames);
this.inputs.addInput('gammaDataLevel',d.gammaDat);
var subLists = [];
var m = d.subNames.length;
var allIdx = m-1;
for (var j=0; j<m; j++) {
subLists[j] = [];
if (d.subNames[j] === 'All') {
allIdx = j;
}
}
m = d.subList.length;
var m2;
for (var j=0; j<m; j++) {
m2 = d.subList[j].length;
for (var k=0; k<m2; k++) {
subLists[d.subList[j][k]].push(j);
}
}
subLists[allIdx].length = 0;
for (var j=0; j<m; j++) {
subLists[allIdx].push(j);
}
this.inputs.addInput('gammaSubLists',subLists);
this.ui[2].gotGammaLists(); // Gamma Box
this.ui[3].gotGammaLists(); // Tweaks Box
this.ui[4].gotGammaLists(); // LUT Box
this.gaSetParams();
};
LUTMessage.prototype.gotBaseIRE = function(d) {
this.ui[3].gotBaseIRE(d.o); // Tweaks Box
this.ui[5].gotBaseIRE(d.o); // Generate Box
};
LUTMessage.prototype.gotIREs = function(d) {
this.ui[d.p].gotIREs(d.i,d.o);
};
LUTMessage.prototype.gotIOGammaNames = function(d) {
this.ui[d.p].gotIOGammaNames(d.o);
};
LUTMessage.prototype.gotChartVals = function(d) {
// this.gtTx(d.p,11,{ colIn:d.colIn, colOut:d.colOut, eiMult:d.eiMult, to:['colIn','colOut']});
this.ui[d.p].gotChartVals(d);
};
LUTMessage.prototype.gotHighLevelDefault = function(d) {
this.ui[3].gotHighLevelDefault(d.rec,d.map);
};
// Gamut Message Handling
LUTMessage.prototype.startGtThreads = function() {
var max = this.gtT;
for (var i=0; i<max; i++) {
var _this = this;
this.gts[i] = new Worker('colourspace.js');
this.gts[i].onmessage = function(e) {
_this.gtRx(e.data);
};
}
};
LUTMessage.prototype.stopGtThreads = function() {
var max = this.gts.length;
for (var i=0; i<max; i++) {
this.gts[i].terminate();
}
this.gts = [];
};
LUTMessage.prototype.changeGtThreads = function(T) {
if (typeof T==='number' && (T%1)===0) {
this.gtT = T;
var max = this.gts.length;
if (T > max) {
for (var i=max; i<T; i++) {
var _this = this;
this.gts[i] = new Worker('colourspace.js');
this.gts[i].onmessage = function(e) {
_this.gtRx(e.data);
};
}
} else if (T < max) {
for (var i=T-1; i<max; i++) {
this.gts[i].terminate();
}
this.gts = this.gts.slice(0,T);
this.gtN = 0;
this.gtU = 0;
}
}
};
LUTMessage.prototype.gtSetParams = function() {
if (this.go) {
this.gtV++;
var d = {
v: this.gtV,
inGamut: parseInt(this.inputs.inGamut.options[this.inputs.inGamut.selectedIndex].value),
outGamut: parseInt(this.inputs.outGamut.options[this.inputs.outGamut.selectedIndex].value),
isTrans: this.inputs.isTrans
};
this.ui[3].getCSParams(d);
var max = this.gts.length;
for (var i=0; i<max; i++) {
this.gts[i].postMessage({t: 0, d: d});
}
}
};
LUTMessage.prototype.gtTx = function(p,t,d) { // parent (sender), type, data
if (typeof p !== 'undefined') {
if (this.inputs.isTrans && d !== null && typeof d.to !== 'undefined') {
var max = d.to.length;
var objArray = [];
for (var j=0; j < max; j++) {
objArray.push(d[d.to[j]]);
}
this.gts[this.gtN].postMessage({p: p, t: t, v: this.gtV, d: d}, objArray);
this.gtN = (this.gtN + 1) % this.gtT;
} else {
this.gts[this.gtN].postMessage({p: p, t: t, v: this.gtV, d: d});
this.gtN = (this.gtN + 1) % this.gtT;
}
}
};
LUTMessage.prototype.gtTxAll = function(p,t,d) { // parent (sender), type, data
if (typeof p !== 'undefined') {
if (this.inputs.isTrans && d !== null && typeof d.to !== 'undefined') {
var max = d.to.length;
var objArray = [];
for (var j=0; j < max; j++) {
objArray.push(d[d.to[j]]);
}
max = this.gts.length;
for (var j=0; j<max; j++) {
this.gts[j].postMessage({p: p, t: t, v: this.gtV, d: d}, objArray);
}
} else {
var max = this.gts.length;
for (var j=0; j<max; j++) {
this.gts[j].postMessage({p: p, t: t, v: this.gtV, d: d});
}
}
}
};
LUTMessage.prototype.gtRx = function(d) {
if (d.msg) {
console.log(d.details);
} else if (d.err) {
console.log(d.details);
} else if (d.resend) {
console.log('Resending gamut - ' + d.t + ' to ' + d.p);
if (d.t === 1) {
this.gaTx(d.p,d.t,{R:d.d.R,G:d.d.G,B:d.d.B,vals:d.d.vals,dim:d.d.dim,to:d.d.to});
} else {
this.gtTx(d.p,d.t,d.d);
}
} else if (d.v === this.gtV || d.t === 37) {
switch(d.t) {
case 20: // Set params
this.gamutParamsSet(d);
break;
case 21: // RGB input to output
this.gaTx(5,4,d);
break;
case 22: // RGB S-Gamut3.cine to LA input gamut
this.gaTx(d.p,9,d);
break;
case 23: // Recalculated custom matrix for changed colourspace
this.ui[d.p].recalcMatrix(d.idx,d.wcs,d.matrix);
break;
case 25: // Get lists of gamuts
this.gotGamutLists(d);
break;
case 26: // Set LA LUT
this.gtL++;
if (this.gtL === this.gtT) {
this.gtL = 0;
this.ui[8].isChanged();
}
break;
case 27: // Set LA Title
break;
case 28: // Get Colour Square
this.ui[d.p].gotColSqr(d.o,d.tIdx);
break;
case 29: // Get Multi Colours
this.gaTx(d.p,17,{ o: d.o, hs: d.hs, cb:d.cb, to:['o','hs']});
break;
case 30: //
this.gotIOGamutNames(d);
break;
case 31: // Get LUT In / LUT Out values for primaries
if (typeof d.rIn !== 'undefined') {
this.gaTx(d.p,18,{ rIn:d.rIn, gIn:d.gIn, bIn:d.bIn, rOut:d.rOut, gOut:d.gOut, bOut:d.bOut, cb:d.cb, to:['rIn', 'gIn', 'bIn','rOut','gOut','bOut']});
}
break;
case 32: // Get preview colour correction
this.gaTx(d.p,12,d);
break;
case 34: // Get linear / S-Gamut3.cine value for preview image
this.ui[d.p].preppedPreview(d.o);
break;
case 35: // Get primaries of current colour space for preview
this.gaTx(d.p,15,d);
break;
case 36: // Get PSST-CDL colours
this.gaTx(3,16,{b:d.b,a:d.a,cb:d.cb,to:['b','a']});
break;
case 37: // Get Chromatic Adaptation Transform options
this.ui[3].gotCATs(d.o);
break;
case 38: // Get CCT and Dxy for white point dropper
this.ui[12].gotPreCCTDuv(d);
break;
case 39: // Calculate primaries and white point for current output
this.ui[8].updateXY(d.xy);
break;
}
}
};
LUTMessage.prototype.gamutParamsSet = function(d) {
this.gtU++;
if (this.gtU === this.gtT) {
this.gtU = 0;
this.gtTx(3,16,{});
this.gtTx(8,15,{});
this.ui[3].setParams(d);
// this.ui[6].updateGamma();
this.ui[8].isChanged();
this.ui[8].testXY();
}
};
LUTMessage.prototype.gotGamutLists = function(d) {
this.inputs.addInput('gamutPass',d.pass);
this.inputs.addInput('gamutLA',d.LA);
this.inputs.addInput('gamutInList',d.inList);
this.inputs.addInput('gamutOutList',d.outList);
this.inputs.addInput('gamutLAList',d.laList);
this.inputs.addInput('gamutMatrixList',d.matList);
this.inputs.addInput('gamutCATList',d.CATList);
this.inputs.addInput('gamutSubNames',d.subNames);
var inSubs = [];
var outSubs = [];
var laSubs = [];
var m = d.subNames.length;
var allIdx = m-1;
for (var j=0; j<m; j++) {
inSubs[j] = [];
outSubs[j] = [];
laSubs[j] = [];
if (d.subNames[j] === 'All') {
allIdx = j;
}
}
m = d.inSub.length;
var m2;
for (var j=0; j<m; j++) {
m2 = d.inSub[j].length;
for (var k=0; k<m2; k++) {
inSubs[d.inSub[j][k]].push(j);
}
}
inSubs[allIdx].length = 0;
for (var j=0; j<m; j++) {
inSubs[allIdx].push(j);
}
m = d.outSub.length;
var m2;
for (var j=0; j<m; j++) {
m2 = d.outSub[j].length;
for (var k=0; k<m2; k++) {
outSubs[d.outSub[j][k]].push(j);
}
}
outSubs[allIdx].length = 0;
for (var j=0; j<m; j++) {
outSubs[allIdx].push(j);
}
m = d.laSub.length;
var m2;
for (var j=0; j<m; j++) {
m2 = d.laSub[j].length;
for (var k=0; k<m2; k++) {
laSubs[d.laSub[j][k]].push(j);
}
}
laSubs[allIdx].length = 0;
for (var j=0; j<m; j++) {
laSubs[allIdx].push(j);
}
this.inputs.addInput('gamutInSubLists',inSubs);
this.inputs.addInput('gamutOutSubLists',outSubs);
this.inputs.addInput('gamutLASubLists',laSubs);
this.ui[2].gotGamutLists(d.pass,d.LA); // Gamma Box
this.ui[3].gotGamutLists(); // Tweaks Box
this.gtSetParams();
};
LUTMessage.prototype.gotIOGamutNames = function(d) {
this.ui[d.p].gotIOGamutNames(d.inName,d.outName,d.hgName);
};
// Get Info For LUT Generation
LUTMessage.prototype.getInfo = function(info) {
info.version = this.inputs.version;
info.date = this.inputs.date;
this.ui[4].getInfo(info); // LUT Box (Dimensions, MLUTs, etc..)
this.ui[1].getInfo(info); // Camera Box (Stop Correction)
this.ui[2].getInfo(info); // Gamma Box (Gamma In / Out, Gamut In / Out)
this.ui[3].getInfo(info); // Tweaks Box - notes for in the LUT file
};
// Inter-object messages
LUTMessage.prototype.changeCamera = function() {
this.ui[2].defaultGam();
this.gaSetParams();
this.ui[4].changeGamma();
this.gtSetParams();
};
LUTMessage.prototype.updateGammaInList = function() {
this.ui[2].updateGammaInList(false);
};
LUTMessage.prototype.changeGamma = function() {
if (this.go) {
this.ui[4].changeGamma();
this.gaSetParams();
}
};
LUTMessage.prototype.updateGammaIn = function() {
if (this.go) {
this.ui[11].updateGammaIn();
}
}
LUTMessage.prototype.updateGammaOut = function() {
if (this.go) {
this.ui[11].updateGammaOut();
}
}
LUTMessage.prototype.changeGamut = function() {
if (this.go) {
this.ui[3].changeGamut();
this.ui[8].testXY();
}
};
LUTMessage.prototype.changeFormat = function() {
this.ui[2].oneOrThree();
this.ui[3].toggleTweaks();
// this.ui[8].testXY();
this.gaSetParams();
this.gtSetParams();
};
LUTMessage.prototype.oneOrThree = function() {
this.ui[11].oneOrThree();
this.ui[2].oneOrThree();
this.ui[3].toggleTweaks();
this.gtSetParams();
this.gaSetParams();
};
LUTMessage.prototype.showPreview = function() {
this.ui[3].toggleTweaks();
};
LUTMessage.prototype.getPreCCTDuv = function(xcoord,ycoord) {
var rgb = this.ui[8].getCanVal(xcoord, ycoord);
this.gtTx(12,18,{rgb: rgb.buffer, to:['rgb']});
};
LUTMessage.prototype.getSettings = function() {
var data = {};
data.version = this.inputs.version;
this.ui[1].getSettings(data);
this.ui[2].getSettings(data);
this.ui[3].getSettings(data);
this.ui[11].getSettings(data);
this.ui[4].getSettings(data);
return JSON.stringify(data,null,"\t");
};
LUTMessage.prototype.setSettings = function() {
var data = JSON.parse(this.inputs.settingsData.text.join(''));
this.ui[1].setSettings(data);
this.ui[2].setSettings(data);
this.ui[3].setSettings(data);
this.ui[11].setSettings(data);
this.ui[4].setSettings(data);
this.gtSetParams();
this.gaSetParams();
};
LUTMessage.prototype.checkFormat = function() {
this.ui[11].updateGammaOut();
};
LUTMessage.prototype.isCustomGamma = function() {
return this.ui[3].isCustomGamma();
};
LUTMessage.prototype.isCustomGamut = function() {
return this.ui[3].isCustomGamut();
};