Global

Methods

# checkHDR() → {boolean}

Check if HDR content (like images) are supported using two CSS Media Queries: One for HDR content itself and another one for the rec2020 colorspace

View Source src/hdr-check.ts, line 23

boolean

# checkHDRCanvas() → {boolean}

Check if HDR content is supported in a {HTMLCanvasElement} by tying to get a HDR enabled {CanvasRenderingContext2D}

View Source src/hdr-check.ts, line 52

boolean

# checkHDRVideo() → {boolean}

Check if HDR video is supported using a CSS Media Query.

View Source src/hdr-check.ts, line 7

boolean

# getHdrOptions() → {CanvasRenderingContext2DHDRSettings}

Gets a CanvasRenderingContext2DSettings object configured for HDR. This function detects the browser version to determine the appropriate colorType for HDR support.

View Source src/hdr-canvas.ts, line 10

An options object for creating an HDR canvas context.

CanvasRenderingContext2DHDRSettings

# initHDRCanvas(canvas) → {CanvasRenderingContext2DHDR|null}

Initializes a given HTMLCanvasElement for HDR and returns its 2D rendering context. It first configures the canvas for high dynamic range and then gets the 2D context with HDR options.

Parameters:
Name Type Description
canvas HDRHTMLCanvasElement

The canvas element to initialize.

View Source src/hdr-canvas.ts, line 34

The 2D rendering context, or null if the context cannot be created. Can be cast down to CanvasRenderingContext2D or RenderingContext

CanvasRenderingContext2DHDR | null

Type Definitions

# Float16ImagePixelCallback(red, green, blue, alpha, red, green, blue, alpha) → {Float16Array}

A callback function that receives the red, green, blue, and alpha values of a pixel and returns a new Float16Array with the modified values.

Parameters:
Name Type Description
red number

The red channel value (0-65535).

green number

The green channel value (0-65535).

blue number

The blue channel value (0-65535).

alpha number

The alpha channel value (0-65535).

red number
green number
blue number
alpha number

View Source src/Float16Image.ts, line 265

A new Float16Array containing the four channel values.

Float16Array

# Float16ImagePixelCallback(red, green, blue, alpha, red, green, blue, alpha) → {Float16Array}

A callback function that receives the red, green, blue, and alpha values of a pixel and returns a new Float16Array with the modified values.

Parameters:
Name Type Description
red number

The red channel value (0-65535).

green number

The green channel value (0-65535).

blue number

The blue channel value (0-65535).

alpha number

The alpha channel value (0-65535).

red number
green number
blue number
alpha number

View Source src/Float16Image.ts, line 265

A new Float16Array containing the four channel values.

Float16Array

# Uint16ImagePixelCallback(red, green, blue, alpha, red, green, blue, alpha) → {Uint16Array}

A callback function that receives the red, green, blue, and alpha values of a pixel and returns a new Uint16Array with the modified values.

Parameters:
Name Type Description
red number

The red channel value (0-65535).

green number

The green channel value (0-65535).

blue number

The blue channel value (0-65535).

alpha number

The alpha channel value (0-65535).

red number
green number
blue number
alpha number

View Source src/Uint16Image.ts, line 250

A new Uint16Array containing the four channel values.

Uint16Array

# Uint16ImagePixelCallback(red, green, blue, alpha, red, green, blue, alpha) → {Uint16Array}

A callback function that receives the red, green, blue, and alpha values of a pixel and returns a new Uint16Array with the modified values.

Parameters:
Name Type Description
red number

The red channel value (0-65535).

green number

The green channel value (0-65535).

blue number

The blue channel value (0-65535).

alpha number

The alpha channel value (0-65535).

red number
green number
blue number
alpha number

View Source src/Uint16Image.ts, line 250

A new Uint16Array containing the four channel values.

Uint16Array