@bb-studio/exr 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -33,6 +33,16 @@ interface ExrWindow {
33
33
  xMax: number;
34
34
  yMax: number;
35
35
  }
36
+ interface ExrChromaticities {
37
+ redX: number;
38
+ redY: number;
39
+ greenX: number;
40
+ greenY: number;
41
+ blueX: number;
42
+ blueY: number;
43
+ whiteX: number;
44
+ whiteY: number;
45
+ }
36
46
  interface ExrPart {
37
47
  id: number;
38
48
  attributes: Record<string, unknown>;
@@ -79,6 +89,19 @@ interface WriteExrChannelInput {
79
89
  xSampling?: number;
80
90
  ySampling?: number;
81
91
  }
92
+ type WriteExrAttribute = {
93
+ type: 'string';
94
+ value: string;
95
+ } | {
96
+ type: 'int';
97
+ value: number;
98
+ } | {
99
+ type: 'float';
100
+ value: number;
101
+ } | {
102
+ type: 'chromaticities';
103
+ value: ExrChromaticities;
104
+ };
82
105
  interface WriteExrPartInput {
83
106
  channels: WriteExrChannelInput[];
84
107
  compression: ExrCompression | number;
@@ -86,6 +109,7 @@ interface WriteExrPartInput {
86
109
  displayWindow?: ExrWindow;
87
110
  name?: string;
88
111
  type?: string;
112
+ attributes?: Readonly<Record<string, WriteExrAttribute>>;
89
113
  }
90
114
  interface WriteExrInput {
91
115
  parts: WriteExrPartInput[];
@@ -116,6 +140,62 @@ interface ReadExrResult {
116
140
  }
117
141
  declare function readExr(buffer: ExrBinaryInput, options?: ReadExrOptions): ReadExrResult;
118
142
 
143
+ interface ExrImageInfo {
144
+ structure: ExrStructure;
145
+ part: ExrPart;
146
+ partId: number;
147
+ width: number;
148
+ height: number;
149
+ dataWindow: ExrWindow;
150
+ displayWindow?: ExrWindow;
151
+ }
152
+ interface InspectExrImageOptions extends ParseExrOptions {
153
+ partId?: number;
154
+ }
155
+ declare function inspectExrImage(buffer: ExrBinaryInput, options?: InspectExrImageOptions): ExrImageInfo;
156
+
157
+ declare function expandSampledChannel(width: number, height: number, xMin: number, yMin: number, channel: DecodedChannel): Float32Array;
158
+ declare function expandDecodedPartChannels(decoded: DecodedPart, dataWindow: ExrWindow): Record<string, Float32Array>;
159
+
160
+ interface DecodeExrRgbaOptions extends ParseExrOptions {
161
+ partId?: number;
162
+ decode?: Omit<DecodeExrPartOptions, 'partId' | 'onEvent'>;
163
+ }
164
+ interface DecodedExrRgbaImage {
165
+ width: number;
166
+ height: number;
167
+ rgba: Float32Array;
168
+ partId: number;
169
+ dataWindow: ExrWindow;
170
+ displayWindow?: ExrWindow;
171
+ channels: readonly ExrChannel[];
172
+ attributes: Readonly<Record<string, unknown>>;
173
+ }
174
+ declare function decodeExrRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrRgbaImage;
175
+
119
176
  declare function writeExr(input: WriteExrInput, options?: WriteExrOptions): Uint8Array;
120
177
 
121
- export { type DecodeExrPartOptions, type DecodedChannel, type DecodedPart, EXR_EVENT_CODES, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrCompression, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrPart, type ExrPixelType, type ExrStructure, type ExrWindow, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, decodeExrPart, isExrError, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
178
+ type ExrRgbaPrecision = 'half' | 'float';
179
+ interface ExrRgbaNamedChannel {
180
+ name: string;
181
+ data: Float32Array;
182
+ precision?: ExrRgbaPrecision;
183
+ }
184
+ interface EncodeExrRgbaImage {
185
+ width: number;
186
+ height: number;
187
+ rgba: Float32Array;
188
+ namedChannels?: readonly ExrRgbaNamedChannel[];
189
+ dataWindow?: ExrWindow;
190
+ displayWindow?: ExrWindow;
191
+ }
192
+ interface EncodeExrRgbaOptions {
193
+ precision: ExrRgbaPrecision;
194
+ includeAlpha: boolean;
195
+ includeColorChannels?: boolean;
196
+ compression?: ExrCompression | number;
197
+ attributes?: Readonly<Record<string, WriteExrAttribute>>;
198
+ }
199
+ declare function encodeExrRgba(image: EncodeExrRgbaImage, options: EncodeExrRgbaOptions): Uint8Array;
200
+
201
+ export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrCompression, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrPart, type ExrPixelType, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, inspectExrImage, isExrError, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,16 @@ interface ExrWindow {
33
33
  xMax: number;
34
34
  yMax: number;
35
35
  }
36
+ interface ExrChromaticities {
37
+ redX: number;
38
+ redY: number;
39
+ greenX: number;
40
+ greenY: number;
41
+ blueX: number;
42
+ blueY: number;
43
+ whiteX: number;
44
+ whiteY: number;
45
+ }
36
46
  interface ExrPart {
37
47
  id: number;
38
48
  attributes: Record<string, unknown>;
@@ -79,6 +89,19 @@ interface WriteExrChannelInput {
79
89
  xSampling?: number;
80
90
  ySampling?: number;
81
91
  }
92
+ type WriteExrAttribute = {
93
+ type: 'string';
94
+ value: string;
95
+ } | {
96
+ type: 'int';
97
+ value: number;
98
+ } | {
99
+ type: 'float';
100
+ value: number;
101
+ } | {
102
+ type: 'chromaticities';
103
+ value: ExrChromaticities;
104
+ };
82
105
  interface WriteExrPartInput {
83
106
  channels: WriteExrChannelInput[];
84
107
  compression: ExrCompression | number;
@@ -86,6 +109,7 @@ interface WriteExrPartInput {
86
109
  displayWindow?: ExrWindow;
87
110
  name?: string;
88
111
  type?: string;
112
+ attributes?: Readonly<Record<string, WriteExrAttribute>>;
89
113
  }
90
114
  interface WriteExrInput {
91
115
  parts: WriteExrPartInput[];
@@ -116,6 +140,62 @@ interface ReadExrResult {
116
140
  }
117
141
  declare function readExr(buffer: ExrBinaryInput, options?: ReadExrOptions): ReadExrResult;
118
142
 
143
+ interface ExrImageInfo {
144
+ structure: ExrStructure;
145
+ part: ExrPart;
146
+ partId: number;
147
+ width: number;
148
+ height: number;
149
+ dataWindow: ExrWindow;
150
+ displayWindow?: ExrWindow;
151
+ }
152
+ interface InspectExrImageOptions extends ParseExrOptions {
153
+ partId?: number;
154
+ }
155
+ declare function inspectExrImage(buffer: ExrBinaryInput, options?: InspectExrImageOptions): ExrImageInfo;
156
+
157
+ declare function expandSampledChannel(width: number, height: number, xMin: number, yMin: number, channel: DecodedChannel): Float32Array;
158
+ declare function expandDecodedPartChannels(decoded: DecodedPart, dataWindow: ExrWindow): Record<string, Float32Array>;
159
+
160
+ interface DecodeExrRgbaOptions extends ParseExrOptions {
161
+ partId?: number;
162
+ decode?: Omit<DecodeExrPartOptions, 'partId' | 'onEvent'>;
163
+ }
164
+ interface DecodedExrRgbaImage {
165
+ width: number;
166
+ height: number;
167
+ rgba: Float32Array;
168
+ partId: number;
169
+ dataWindow: ExrWindow;
170
+ displayWindow?: ExrWindow;
171
+ channels: readonly ExrChannel[];
172
+ attributes: Readonly<Record<string, unknown>>;
173
+ }
174
+ declare function decodeExrRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrRgbaImage;
175
+
119
176
  declare function writeExr(input: WriteExrInput, options?: WriteExrOptions): Uint8Array;
120
177
 
121
- export { type DecodeExrPartOptions, type DecodedChannel, type DecodedPart, EXR_EVENT_CODES, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrCompression, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrPart, type ExrPixelType, type ExrStructure, type ExrWindow, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, decodeExrPart, isExrError, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
178
+ type ExrRgbaPrecision = 'half' | 'float';
179
+ interface ExrRgbaNamedChannel {
180
+ name: string;
181
+ data: Float32Array;
182
+ precision?: ExrRgbaPrecision;
183
+ }
184
+ interface EncodeExrRgbaImage {
185
+ width: number;
186
+ height: number;
187
+ rgba: Float32Array;
188
+ namedChannels?: readonly ExrRgbaNamedChannel[];
189
+ dataWindow?: ExrWindow;
190
+ displayWindow?: ExrWindow;
191
+ }
192
+ interface EncodeExrRgbaOptions {
193
+ precision: ExrRgbaPrecision;
194
+ includeAlpha: boolean;
195
+ includeColorChannels?: boolean;
196
+ compression?: ExrCompression | number;
197
+ attributes?: Readonly<Record<string, WriteExrAttribute>>;
198
+ }
199
+ declare function encodeExrRgba(image: EncodeExrRgbaImage, options: EncodeExrRgbaOptions): Uint8Array;
200
+
201
+ export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrCompression, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrPart, type ExrPixelType, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, inspectExrImage, isExrError, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };