OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

Canvas

pub struct Canvas

A view space, the placements in it, and the colour of the rest.

Canvas — methods

pub fn new(width: u32, height: u32) -> Result<Self>

A canvas of that size.

(0, 0) means "follow the camera", which is the default and a pass-through.

pub fn size(&self) -> Result<(u32, u32)>

The size this canvas was asked for.

(0, 0) means "follow the camera". Canvas::extent is the resolved answer: it substitutes the frame's size for a zero.

pub fn void_color(&self) -> Result<(f32, f32, f32, f32)>

The colour of space no placement covers, as (r, g, b, a).

pub fn set_void_color(&mut self, r: f32, g: f32, b: f32, a: f32) -> Result<()>

Set the colour of space no placement covers.

pub fn add_placement(&mut self, placement: &Placement) -> Result<()>

Append a placement.

pub fn placement_count(&self) -> Result<usize>

How many placements this canvas holds.

pub fn placement(&self, index: usize) -> Result<Placement>

The placement at index, as a copy.

Reading past the end does not fail: it answers the identity, because an unplaced camera sits exactly where it always did. That asymmetry with Canvas::set_placement is the ABI's and is deliberate.

pub fn set_placement(&mut self, index: usize, placement: &Placement) -> Result<()>

Replace the placement at index.

Errors

Status::NotFound past the end. Unlike Canvas::placement this refuses, because writing past the end would silently drop the edit: a caller that meant to move a camera would see no error and no movement.

pub fn extent(&self, frame_width: u32, frame_height: u32) -> Result<(u32, u32)>

The size the placed frames actually occupy.

pub fn space_height(&self, frame_width: u32, frame_height: u32) -> Result<f32>

The canvas's height in view-space units.

pub fn is_pass_through(&self, frame_width: u32, frame_height: u32) -> Result<bool>

Whether this canvas would leave the frame untouched.

True for an empty canvas, which is the documented default: nothing changes before a canvas is placed. Also true for a single identity placement of a frame exactly the canvas's size, where compositing would copy every pixel to itself. False for a zoom, and false for an identity on a canvas of a different size.