OptrisOptrisDocumentation

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

ColorWindow

pub struct ColorWindow<'a>

A temperature band drawn in colour over a grayscale base.

For showing where something is in range without losing the rest of the scene. Display only: it changes no measurement.

A note on struct_size

Filled in by optris_sdk_color_window_init, like every other versioned struct in this header.

This note used to say that initialiser did not exist, and that this type therefore wrote the field itself. That was false: it is declared at sdk_c.h:3675 and the Python binding has been calling it. The consequence was not only a wrong comment -- a hand-written struct_size is right only for the fields this crate knows about, so a field appended to the struct with a non-zero default would have arrived as zero here, silently, where every other binding got the SDK's answer.

ColorWindow — fields

min_c: f32

Lower edge of the band, in the SDK's temperature unit (Celsius unless crate::set_temperature_unit chose Fahrenheit).

max_c: f32

Upper edge of the band, in the SDK's temperature unit.

palette: Palette

The colour map for the band, used when ColorWindow::colors is ColorSource::Palette.

opacity: f32

How strongly it is drawn, 0 to 1.

motion_only: bool

Colour only where motion was detected.

colors: ColorSource<'a>

Where the band's colours come from.

ColorWindow — methods

pub fn new(min_c: f32, max_c: f32, palette: Palette) -> Self

A band between two temperatures in the SDK's temperature unit, drawn with a palette, with the SDK's own defaults for everything else.

Read out of optris_sdk_color_window_init rather than written here, for the reason on this type: the crate used to write both the struct_size and the defaults itself, on the mistaken belief that no initialiser existed, and that is how MotionZone's drifted from every other binding's.

pub fn defaults() -> Self

The SDK's own defaults, with a zero band and no palette chosen. The band is read in the SDK's temperature unit, so it is 32 to 32 once crate::set_temperature_unit has chosen Fahrenheit.

Infallible by design, as MotionZone::defaults: the initialiser fails only on a NULL pointer, which cannot happen here, so a Result would be a case no caller can hit standing in front of a builder chain.

pub fn with_colors(mut self, colors: &'a [Rgb24]) -> Self

Draw the band with an explicit colour table rather than a palette.

The slice is read during crate::Camera::set_color_window and not retained, which is why it only has to outlive the call.

pub fn keeping_colors(mut self) -> Self

Keep whatever table the band already has.

See ColorSource::Keep.

pub fn with_opacity(mut self, opacity: f32) -> Self

How strongly the band is drawn.

pub fn motion_only(mut self, yes: bool) -> Self

Colour only where motion was detected.