Palettes
public static class Palettes
The colours the SDK's palettes are made of, for drawing a palette yourself.
Setting ThermalCamera.Palette tells the SDK how to colour the picture. This class is the other direction: it hands back the colours so an application can draw the gradient on a temperature slider, the legend beside a camera, or a readout coloured by where its value sits in the range.
None of this needs a camera. A palette is a fixed table, so a palette picker can be drawn before anything is connected.
Palettes: constants
public const int ColorCount = 240
How many entries a palette's colour table has.
240, and the same for every palette. Prefer the length of the span you get back over this constant -- it is here so a buffer can be sized up front, not so the length can be assumed.
Palettes: properties
public static IReadOnlyList<Palette> All { get; }
Every palette this SDK has, in enum order.
Returns: The full set, so a picker can be built without a hard-coded list that goes stale when a palette is added.
Palettes: methods
public static ReadOnlyMemory<Rgb24> GetColors(Palette palette)
The colours of a palette, coldest first.
palette: Which palette.
Returns: Its Palettes.ColorCount entries, in display order. The memory is owned by the SDK binding, is never modified, and is shared between calls -- so reading it every frame to repaint a legend costs nothing after the first call.
- Throws
ArgumentOutOfRangeException:paletteis not a value of the enum.
Every value of Palette returns a full table. The table compiled into the SDK is what this returns, even where a CSV of the same name is installed alongside it.
public static string GetDisplayName(Palette palette)
A name for a palette fit to show a user, in English.
palette: Which palette.
Returns: A caption for a legend or a drop-down entry.
- Throws
ArgumentOutOfRangeException:paletteis not a value of the enum.
Not an identifier: do not parse it and do not persist it. Store the Palette value instead.
public static bool IsAlarm(Palette palette)
Whether a palette is one of the alarm palettes.
palette: Which palette.
Returns: true for Palette.AlarmBlue, Palette.AlarmBlueHi, Palette.AlarmGreen and Palette.AlarmRed.
- Throws
ArgumentOutOfRangeException:paletteis not a value of the enum.
An alarm palette holds most of its range in one flat colour and spends the rest on a narrow band, so it shows that a threshold was crossed rather than the shape of a scene. Group them apart from the measuring palettes in a picker.