Skip to content

Commit bbce672

Browse files
committed
fix(gainmap): return readonly tuples
1 parent 7db8278 commit bbce672

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/gainmap.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ export class GainMap {
7171
__useBaseColorSpace__!: boolean;
7272

7373
/** log2 of the boost of the map's value 0, per channel (red, green, blue; a copy: assign to change it) */
74-
get min(): number[] { return this.__min__.slice(); }
74+
get min(): readonly [red: number, green: number, blue: number] { return [this.__min__[0], this.__min__[1], this.__min__[2]]; }
7575
/**
7676
* Replaces the value (checked: an invalid one throws and the old one stays)
7777
* @param value One number for all channels or [r, g, b]
7878
*/
7979
set min(value: GainMapChannelValues) { this.__min__ = perChannel(value, 'min'); }
8080
/** log2 of the boost of the map's value 255, per channel (a copy: assign to change it) */
81-
get max(): number[] { return this.__max__.slice(); }
81+
get max(): readonly [red: number, green: number, blue: number] { return [this.__max__[0], this.__max__[1], this.__max__[2]]; }
8282
/**
8383
* Replaces the value (checked: an invalid one throws and the old one stays)
8484
* @param value One number for all channels or [r, g, b]
8585
*/
8686
set max(value: GainMapChannelValues) { this.__max__ = perChannel(value, 'max'); }
8787
/** The gamma the map's values are stored with, per channel (a copy: assign to change it) */
88-
get gamma(): number[] { return this.__gamma__.slice(); }
88+
get gamma(): readonly [red: number, green: number, blue: number] { return [this.__gamma__[0], this.__gamma__[1], this.__gamma__[2]]; }
8989
/**
9090
* Replaces the value (checked: an invalid one throws and the old one stays)
9191
* @param value One number above 0 for all channels or [r, g, b]
@@ -96,14 +96,14 @@ export class GainMap {
9696
this.__gamma__ = gamma;
9797
}
9898
/** Added to the SDR image's linear values before the boost, per channel (a copy: assign to change it) */
99-
get offsetSDR(): number[] { return this.__offsetSDR__.slice(); }
99+
get offsetSDR(): readonly [red: number, green: number, blue: number] { return [this.__offsetSDR__[0], this.__offsetSDR__[1], this.__offsetSDR__[2]]; }
100100
/**
101101
* Replaces the value (checked: an invalid one throws and the old one stays)
102102
* @param value One number for all channels or [r, g, b]
103103
*/
104104
set offsetSDR(value: GainMapChannelValues) { this.__offsetSDR__ = perChannel(value, 'offsetSDR'); }
105105
/** Subtracted from the HDR result, per channel (a copy: assign to change it) */
106-
get offsetHDR(): number[] { return this.__offsetHDR__.slice(); }
106+
get offsetHDR(): readonly [red: number, green: number, blue: number] { return [this.__offsetHDR__[0], this.__offsetHDR__[1], this.__offsetHDR__[2]]; }
107107
/**
108108
* Replaces the value (checked: an invalid one throws and the old one stays)
109109
* @param value One number for all channels or [r, g, b]

0 commit comments

Comments
 (0)