hdr-canvas 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,57 +1,4 @@
1
- import { ColorTypes } from 'colorjs.io';
2
-
3
- // See https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts
4
- /// <reference lib="dom" />
5
-
6
- type HDRHTMLCanvasOptionsType = "mode";
7
- type HDRHTMLCanvasOptions = { [key in HDRHTMLCanvasOptionsType]?: string };
8
-
9
- interface HDRHTMLCanvasElement extends HTMLCanvasElement {
10
- configureHighDynamicRange(options: HDRHTMLCanvasOptions): void;
11
- _getContext(contextId: string, options?: object): RenderingContext | null;
12
- }
13
-
14
- interface HDRImageData {
15
- readonly colorSpace: PredefinedColorSpace;
16
- readonly data: Uint8ClampedArray | Uint16Array;
17
- readonly height: number;
18
- readonly width: number;
19
- }
20
-
21
- // See https://github.com/w3c/ColorWeb-CG/blob/main/hdr_html_canvas_element.md
22
- // "rec2100-display-linear" is left out beacause of mapping issues
23
- type HDRPredefinedColorSpace = "display-p3" | "srgb" | "rec2100-hlg" | "rec2100-pq";
24
-
25
- type Uint16ImagePixelCallback = (red: number, green: number, blue: number, alpha: number) => Uint16Array;
26
- declare class Uint16Image {
27
- height: number;
28
- width: number;
29
- data: Uint16Array;
30
- static DEFAULT_COLORSPACE: HDRPredefinedColorSpace;
31
- static SDR_MULTIPLIER: number;
32
- static COLORSPACES: Record<HDRPredefinedColorSpace, ColorTypes>;
33
- colorSpace: HDRPredefinedColorSpace;
34
- constructor(width: number, height: number, colorspace?: string);
35
- fill(color: number[]): Uint16Image | undefined;
36
- getPixel(w: number, h: number): Uint16Array;
37
- setPixel(w: number, h: number, px: number[]): void;
38
- static scaleUint8ToUint16(val: number): number;
39
- getImageData(): ImageData | null;
40
- static convertPixelToRec2100_hlg(pixel: Uint8ClampedArray): Uint16Array;
41
- static convertArrayToRec2100_hlg(data: Uint8ClampedArray): Uint16Array;
42
- pixelCallback(fn: Uint16ImagePixelCallback): void;
43
- static loadSDRImageData(url: URL): Promise<HDRImageData | undefined>;
44
- static fromImageData(imageData: HDRImageData): Uint16Image;
45
- static fromURL(url: URL): Promise<Uint16Image | undefined>;
46
- setImageData(imageData: HDRImageData): void;
47
- clone(): Uint16Image;
48
- }
49
-
50
- declare function checkHDR(): boolean;
51
- declare function checkHDRCanvas(): boolean;
52
-
53
- declare function initHDRCanvas(canvas: HDRHTMLCanvasElement): RenderingContext | null;
54
- declare function defaultGetContextHDR(): void;
55
- declare function resetGetContext(): void;
56
-
57
- export { Uint16Image, checkHDR, checkHDRCanvas, defaultGetContextHDR, initHDRCanvas, resetGetContext };
1
+ import type { HDRHTMLCanvasElement } from "./types/HDRCanvas.d.ts";
2
+ export declare function initHDRCanvas(canvas: HDRHTMLCanvasElement): RenderingContext | null;
3
+ export declare function defaultGetContextHDR(): void;
4
+ export declare function resetGetContext(): void;
@@ -5937,9 +5937,9 @@ function checkHDRCanvas() {
5937
5937
  }
5938
5938
  }
5939
5939
 
5940
- const hdr_options = { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: 'float16' };
5940
+ const hdr_options = { colorSpace: Uint16Image.DEFAULT_COLORSPACE, pixelFormat: "float16" };
5941
5941
  function initHDRCanvas(canvas) {
5942
- canvas.configureHighDynamicRange({ mode: 'extended' });
5942
+ canvas.configureHighDynamicRange({ mode: "extended" });
5943
5943
  const ctx = canvas.getContext("2d", hdr_options);
5944
5944
  return ctx;
5945
5945
  }