Skip to content

openrv-web / ViewAPI

Class: ViewAPI ​

Defined in: api/ViewAPI.ts:38

Extends ​

  • DisposableAPI

Constructors ​

Constructor ​

new ViewAPI(viewer, pixelProbe?): ViewAPI

Defined in: api/ViewAPI.ts:42

Parameters ​

viewer ​

ViewerProvider

pixelProbe? ​

PixelProbeProvider

Returns ​

ViewAPI

Overrides ​

DisposableAPI.constructor

Methods ​

clearMatte() ​

clearMatte(): void

Defined in: api/ViewAPI.ts:352

Disable the matte overlay.

Returns ​

void

Example ​

ts
openrv.view.clearMatte();

disableProbe() ​

disableProbe(): void

Defined in: api/ViewAPI.ts:413

Disable the pixel probe overlay.

Returns ​

void

Throws ​

If the pixel probe provider is not available.

Example ​

ts
openrv.view.disableProbe();

dispose() ​

dispose(): void

Defined in: api/Disposable.ts:19

Mark this sub-API as disposed. After this call, assertNotDisposed() will throw on every subsequent invocation.

Returns ​

void

Inherited from ​

DisposableAPI.dispose


enableProbe() ​

enableProbe(): void

Defined in: api/ViewAPI.ts:398

Enable the pixel probe overlay.

Returns ​

void

Throws ​

If the pixel probe provider is not available.

Example ​

ts
openrv.view.enableProbe();

fitToHeight() ​

fitToHeight(): void

Defined in: api/ViewAPI.ts:118

Fit the image height to the container height. The image fills the viewport height; user can pan horizontally.

Returns ​

void

Example ​

ts
openrv.view.fitToHeight();

fitToWidth() ​

fitToWidth(): void

Defined in: api/ViewAPI.ts:104

Fit the image width to the container width. The image fills the viewport width; user can pan vertically.

Returns ​

void

Example ​

ts
openrv.view.fitToWidth();

fitToWindow() ​

fitToWindow(): void

Defined in: api/ViewAPI.ts:90

Fit the image to the current window/viewport dimensions.

Returns ​

void

Example ​

ts
openrv.view.fitToWindow();

getBackgroundPattern() ​

getBackgroundPattern(): BackgroundPatternState

Defined in: api/ViewAPI.ts:274

Get the current background pattern state.

Returns ​

BackgroundPatternState

The current background pattern state.

Example ​

ts
const bg = openrv.view.getBackgroundPattern();

getChannel() ​

getChannel(): string

Defined in: api/ViewAPI.ts:210

Get the current channel isolation mode.

Returns ​

string

The active channel mode string (e.g., 'rgb', 'red', 'alpha').

Example ​

ts
const channel = openrv.view.getChannel(); // e.g. 'rgb'

getFitMode() ​

getFitMode(): string | null

Defined in: api/ViewAPI.ts:133

Get the current fit mode.

Returns ​

string | null

The active fit mode ('all', 'width', 'height') or null if no fit mode is active.

Example ​

ts
const mode = openrv.view.getFitMode(); // e.g. 'width'

getMatte() ​

getMatte(): MatteSettings

Defined in: api/ViewAPI.ts:368

Get the current matte overlay settings.

Returns ​

MatteSettings

The matte settings including show, aspect, opacity, heightVisible, and centerPoint.

Example ​

ts
const matte = openrv.view.getMatte();
if (matte.show) console.log(`Matte active at ${matte.aspect}:1`);

getPan() ​

getPan(): object

Defined in: api/ViewAPI.ts:168

Get the current pan offset.

Returns ​

object

An object with x and y pixel offsets.

x ​

x: number

y ​

y: number

Example ​

ts
const { x, y } = openrv.view.getPan();

getProbeSampleSize() ​

getProbeSampleSize(): SampleSize

Defined in: api/ViewAPI.ts:540

Get the current sample size for area averaging.

Returns ​

SampleSize

The current sample size (1, 3, 5, or 9).

Throws ​

If the pixel probe provider is not available.

Example ​

ts
const size = openrv.view.getProbeSampleSize(); // e.g. 1

getProbeSourceMode() ​

getProbeSourceMode(): SourceMode

Defined in: api/ViewAPI.ts:578

Get the current source mode for pixel probe values.

Returns ​

SourceMode

'rendered' or 'source'.

Throws ​

If the pixel probe provider is not available.

Example ​

ts
const mode = openrv.view.getProbeSourceMode(); // e.g. 'rendered'

getProbeState() ​

getProbeState(): PixelProbeState

Defined in: api/ViewAPI.ts:480

Get the current pixel probe state including position, color values, and settings.

Returns ​

PixelProbeState

A deep copy of the current probe state.

Throws ​

If the pixel probe provider is not available.

Example ​

ts
const state = openrv.view.getProbeState();
console.log(`Pixel at (${state.x}, ${state.y}): rgb(${state.rgb.r}, ${state.rgb.g}, ${state.rgb.b})`);

getTextureFilterMode() ​

getTextureFilterMode(): TextureFilterMode

Defined in: api/ViewAPI.ts:244

Get the current texture filtering mode.

Returns ​

TextureFilterMode

'nearest' or 'linear'.

Example ​

ts
const mode = openrv.view.getTextureFilterMode(); // e.g. 'linear'

getViewportSize() ​

getViewportSize(): object

Defined in: api/ViewAPI.ts:289

Get the current viewport size in CSS pixels.

Returns ​

object

An object with width and height representing the viewer's display dimensions.

height ​

height: number

width ​

width: number

Example ​

ts
const { width, height } = openrv.view.getViewportSize();

getZoom() ​

getZoom(): number

Defined in: api/ViewAPI.ts:77

Get the current zoom level.

Returns ​

number

The current zoom level (e.g., 1.0 = 100%).

Example ​

ts
const zoom = openrv.view.getZoom();

isProbeEnabled() ​

isProbeEnabled(): boolean

Defined in: api/ViewAPI.ts:429

Check whether the pixel probe is currently enabled.

Returns ​

boolean

true if the probe overlay is visible, false otherwise.

Throws ​

If the pixel probe provider is not available.

Example ​

ts
if (openrv.view.isProbeEnabled()) { ... }

isProbeLocked() ​

isProbeLocked(): boolean

Defined in: api/ViewAPI.ts:463

Check whether the pixel probe position is locked.

Returns ​

boolean

true if the probe position is locked, false otherwise.

Throws ​

If the pixel probe provider is not available.

Example ​

ts
const locked = openrv.view.isProbeLocked();

setBackgroundPattern() ​

setBackgroundPattern(state): void

Defined in: api/ViewAPI.ts:259

Set the background pattern state.

Parameters ​

state ​

BackgroundPatternState

The full background pattern state including pattern type, checker size, and custom color.

Returns ​

void

Example ​

ts
openrv.view.setBackgroundPattern({ pattern: 'checker', checkerSize: 'medium', customColor: '#1a1a1a' });

setChannel() ​

setChannel(mode): void

Defined in: api/ViewAPI.ts:186

Set the channel isolation mode for viewing.

Parameters ​

mode ​

string

Channel mode: 'rgb', 'red', 'green', 'blue', 'alpha', 'luminance'. Also accepts shorthand aliases: 'r', 'g', 'b', 'a', 'luma', 'l'. The value is case-insensitive.

Returns ​

void

Throws ​

If mode is not a string or is not a recognized channel name.

Example ​

ts
openrv.view.setChannel('alpha');

setMatte() ​

setMatte(options?): void

Defined in: api/ViewAPI.ts:308

Enable the matte overlay and optionally configure it.

Parameters ​

options? ​

Partial<Pick<MatteSettings, "opacity" | "aspect" | "centerPoint">>

Optional partial matte settings to apply. Supported keys: aspect (target aspect ratio, 0.1–10), opacity (0–1), centerPoint ([x, y] normalized offsets).

Returns ​

void

Throws ​

If aspect is not a positive number, opacity is out of range, or centerPoint is not a two-element numeric array.

Example ​

ts
openrv.view.setMatte({ aspect: 2.39, opacity: 0.8 });

setPan() ​

setPan(x, y): void

Defined in: api/ViewAPI.ts:150

Set the pan offset in pixels.

Parameters ​

x ​

number

Horizontal pan offset in pixels (positive = right).

y ​

number

Vertical pan offset in pixels (positive = down).

Returns ​

void

Throws ​

If x or y is not a finite number.

Example ​

ts
openrv.view.setPan(100, -50);

setProbeFormat() ​

setProbeFormat(format): void

Defined in: api/ViewAPI.ts:496

Set the display format for the pixel probe overlay.

Parameters ​

format ​

string

One of 'rgb', 'rgb01', 'hsl', 'hex', 'ire'.

Returns ​

void

Throws ​

If format is not a valid format string.

Example ​

ts
openrv.view.setProbeFormat('hsl');

setProbeSampleSize() ​

setProbeSampleSize(size): void

Defined in: api/ViewAPI.ts:518

Set the sample size for area averaging in the pixel probe.

Parameters ​

size ​

number

One of 1, 3, 5, 9 (NxN pixel area).

Returns ​

void

Throws ​

If size is not a valid sample size.

Example ​

ts
openrv.view.setProbeSampleSize(3); // 3x3 area average

setProbeSourceMode() ​

setProbeSourceMode(mode): void

Defined in: api/ViewAPI.ts:556

Set the source mode for pixel probe values.

Parameters ​

mode ​

string

'rendered' for post-pipeline values or 'source' for original source values.

Returns ​

void

Throws ​

If mode is not 'rendered' or 'source'.

Example ​

ts
openrv.view.setProbeSourceMode('source'); // show original values before grading

setTextureFilterMode() ​

setTextureFilterMode(mode): void

Defined in: api/ViewAPI.ts:226

Set the texture filtering mode.

Parameters ​

mode ​

TextureFilterMode

'nearest' for pixel-perfect (nearest-neighbor) or 'linear' for smooth (bilinear).

Returns ​

void

Throws ​

If mode is not 'nearest' or 'linear'.

Example ​

ts
openrv.view.setTextureFilterMode('nearest');

setZoom() ​

setZoom(level): void

Defined in: api/ViewAPI.ts:59

Set the zoom level of the viewport.

Parameters ​

level ​

number

Zoom level as a positive number (e.g., 1.0 = 100%, 2.0 = 200%).

Returns ​

void

Throws ​

If level is not a finite positive number.

Example ​

ts
openrv.view.setZoom(2.0); // zoom to 200%

toggleProbeLock() ​

toggleProbeLock(): void

Defined in: api/ViewAPI.ts:447

Lock or unlock the pixel probe position.

When locked, the probe values remain fixed at the current position and mouse movement does not update them.

Returns ​

void

Throws ​

If the pixel probe provider is not available.

Example ​

ts
openrv.view.toggleProbeLock();

Released under the MIT License.