Canvas
class optris_sdk.canvas.Canvas
A view space, the placements in it, and the colour of the rest.
A context manager. Closing twice is a no-op.
Canvas — properties
size
The size this canvas was asked for, as (width, height).
(0, 0) means "follow the camera", which is the default and
a pass-through. extent is the resolved answer -- it
substitutes the frame's size for a zero. Read size to find
out what was requested; read extent to find out how big the
composite will be.
void_color
The colour of space no placement covers, as (r, g, b, a).
Canvas — methods
add_placement(placement)
Append a placement. Returns its index.
__len__()
How many placements this canvas holds.
__getitem__(index)
The placement at index, as a copy.
Reading past the end does not raise: it answers the
identity, because an unplaced camera sits exactly where it
always did. That asymmetry with canvas[i] = ... is the
ABI's and is deliberate -- see __setitem__.
__setitem__(index, placement)
Replace the placement at index.
- Raises
NotFoundError— past the end. Unlike the getter 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.
extent(frame_width, frame_height)
The size the placed frames actually occupy, (width, height).
space_height(frame_width, frame_height)
The canvas's height in view-space units.
is_pass_through(frame_width, frame_height)
Whether this canvas would leave the frame untouched.
True for the one case worth special-casing: a single identity placement of a frame exactly the canvas's size, where compositing would copy every pixel to itself.
close()
Release the handle. Closing twice is a no-op.