Magnum::DebugTools::ColorMap namespace new in 2020.06

Color maps.

Contents

A collection of predefined color maps for visualization of gradient data.

This library is built if WITH_DEBUGTOOLS is enabled when building Magnum. To use this library with CMake, request the DebugTools component of the Magnum package and link to the Magnum::DebugTools target:

find_package(Magnum REQUIRED DebugTools)

# ...
target_link_libraries(your-app PRIVATE Magnum::DebugTools)

See Downloading and building, Usage with CMake and Debugging helpers for more information.

For all color maps the returned data is the sRGB colorspace. Desired usage is by uploading to a texture with linear filtering, depending on the use case with either clamp or repeat wrapping. For a sRGB workflow don't forget to set the texture format to sRGB, to ensure the values are interpreted and interpolated done correctly.

const auto map = DebugTools::ColorMap::turbo();
const Vector2i size{Int(map.size()), 1};

GL::Texture2D colorMapTexture;
colorMapTexture
    .setMinificationFilter(SamplerFilter::Linear)
    .setMagnificationFilter(SamplerFilter::Linear)
    .setWrapping(SamplerWrapping::ClampToEdge) // or Repeat
    .setStorage(1, GL::TextureFormat::RGB8, size) // or SRGB8
    .setSubImage(0, {}, ImageView2D{PixelFormat::RGB8Srgb, size, map});

Functions

auto turbo() -> Containers::StaticArrayView<256, const Vector3ub> new in 2020.06
Turbo colormap.
auto magma() -> Containers::StaticArrayView<256, const Vector3ub> new in 2020.06
Magma colormap.
auto plasma() -> Containers::StaticArrayView<256, const Vector3ub> new in 2020.06
Plasma colormap.
auto inferno() -> Containers::StaticArrayView<256, const Vector3ub> new in 2020.06
Inferno colormap.
auto viridis() -> Containers::StaticArrayView<256, const Vector3ub> new in 2020.06
Viridis colormap.

Function documentation

Containers::StaticArrayView<256, const Vector3ub> Magnum::DebugTools::ColorMap::turbo() new in 2020.06

Turbo colormap.

Image

Containers::StaticArrayView<256, const Vector3ub> Magnum::DebugTools::ColorMap::magma() new in 2020.06

Magma colormap.

Image

Containers::StaticArrayView<256, const Vector3ub> Magnum::DebugTools::ColorMap::plasma() new in 2020.06

Plasma colormap.

Image

Containers::StaticArrayView<256, const Vector3ub> Magnum::DebugTools::ColorMap::inferno() new in 2020.06

Inferno colormap.

Image

Containers::StaticArrayView<256, const Vector3ub> Magnum::DebugTools::ColorMap::viridis() new in 2020.06

Viridis colormap.

Image