libepaper 2.0.0
A C++23 library for controlling Waveshare e-paper displays on Raspberry Pi, featuring transparent sleep/wake management and a fluent builder API.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
epaper::ColorManager Class Reference

#include <color_manager.hpp>

Public Member Functions

 ColorManager ()=default
 

Static Public Member Functions

static constexpr auto to_rgb (Color color) noexcept -> RGB
 Convert Color enum to RGB.
 
static constexpr auto convert_to_bw (const RGB &color) noexcept -> DeviceColor< DisplayMode::BlackWhite >
 Convert RGB color to 1-bit black/white.
 
static constexpr auto convert_to_gray4 (const RGB &color) noexcept -> DeviceColor< DisplayMode::Grayscale4 >
 
static constexpr auto convert_to_bwr (const RGB &color) noexcept -> DeviceColor< DisplayMode::BWR >
 
static constexpr auto convert_to_bwy (const RGB &color) noexcept -> DeviceColor< DisplayMode::BWY >
 
static constexpr auto convert_to_spectra6 (const RGB &color) noexcept -> DeviceColor< DisplayMode::Spectra6 >
 
static constexpr auto convert_to_bw (const RGBA &color, const RGB &background=colors::White) noexcept -> DeviceColor< DisplayMode::BlackWhite >
 Convert RGBA color to 1-bit black/white with alpha blending.
 
static constexpr auto convert_to_gray4 (const RGBA &color, const RGB &background=colors::White) noexcept -> DeviceColor< DisplayMode::Grayscale4 >
 Convert RGBA color to 2-bit grayscale with alpha blending.
 
template<DisplayMode Mode>
static constexpr auto convert (const RGB &color) noexcept -> DeviceColor< Mode >
 Generic conversion based on display mode template parameter.
 
template<DisplayMode Mode>
static constexpr auto convert (const RGBA &color, const RGB &background=colors::White) noexcept -> DeviceColor< Mode >
 Generic conversion based on display mode template parameter with alpha.
 
template<DisplayMode Mode, typename SetPixelFunc >
static void dither_image (std::span< const std::uint8_t > rgb_data, std::size_t width, std::size_t height, SetPixelFunc set_pixel)
 Dither an RGB image to device colors using Floyd-Steinberg.
 

Constructor & Destructor Documentation

◆ ColorManager()

epaper::ColorManager::ColorManager ( )
default

Member Function Documentation

◆ convert() [1/2]

template<DisplayMode Mode>
static constexpr auto epaper::ColorManager::convert ( const RGB color) -> DeviceColor<Mode>
inlinestaticconstexprnoexcept

Generic conversion based on display mode template parameter.

Template Parameters
ModeTarget display mode
Parameters
colorRGB color to convert
Returns
Device color in specified format
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert() [2/2]

template<DisplayMode Mode>
static constexpr auto epaper::ColorManager::convert ( const RGBA color,
const RGB background = colors::White 
) -> DeviceColor<Mode>
inlinestaticconstexprnoexcept

Generic conversion based on display mode template parameter with alpha.

Template Parameters
ModeTarget display mode
Parameters
colorRGBA color to convert
backgroundBackground color for alpha blending
Returns
Device color in specified format
Here is the call graph for this function:

◆ convert_to_bw() [1/2]

static constexpr auto epaper::ColorManager::convert_to_bw ( const RGB color) -> DeviceColor<DisplayMode::BlackWhite>
inlinestaticconstexprnoexcept

Convert RGB color to 1-bit black/white.

Parameters
colorRGB color to convert
Returns
Device color in 1-bit format
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_to_bw() [2/2]

static constexpr auto epaper::ColorManager::convert_to_bw ( const RGBA color,
const RGB background = colors::White 
) -> DeviceColor<DisplayMode::BlackWhite>
inlinestaticconstexprnoexcept

Convert RGBA color to 1-bit black/white with alpha blending.

Parameters
colorRGBA color to convert
backgroundBackground color for alpha blending
Returns
Device color in 1-bit format
Here is the call graph for this function:

◆ convert_to_bwr()

static constexpr auto epaper::ColorManager::convert_to_bwr ( const RGB color) -> DeviceColor<DisplayMode::BWR>
inlinestaticconstexprnoexcept
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_to_bwy()

static constexpr auto epaper::ColorManager::convert_to_bwy ( const RGB color) -> DeviceColor<DisplayMode::BWY>
inlinestaticconstexprnoexcept
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_to_gray4() [1/2]

static constexpr auto epaper::ColorManager::convert_to_gray4 ( const RGB color) -> DeviceColor<DisplayMode::Grayscale4>
inlinestaticconstexprnoexcept
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_to_gray4() [2/2]

static constexpr auto epaper::ColorManager::convert_to_gray4 ( const RGBA color,
const RGB background = colors::White 
) -> DeviceColor<DisplayMode::Grayscale4>
inlinestaticconstexprnoexcept

Convert RGBA color to 2-bit grayscale with alpha blending.

Parameters
colorRGBA color to convert
backgroundBackground color for alpha blending
Returns
Device color in 2-bit format
Here is the call graph for this function:

◆ convert_to_spectra6()

static constexpr auto epaper::ColorManager::convert_to_spectra6 ( const RGB color) -> DeviceColor<DisplayMode::Spectra6>
inlinestaticconstexprnoexcept
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dither_image()

template<DisplayMode Mode, typename SetPixelFunc >
static void epaper::ColorManager::dither_image ( std::span< const std::uint8_t >  rgb_data,
std::size_t  width,
std::size_t  height,
SetPixelFunc  set_pixel 
)
inlinestatic

Dither an RGB image to device colors using Floyd-Steinberg.

Template Parameters
ModeTarget display mode
SetPixelFuncFunction type for setting pixels (x, y, DeviceColor<Mode>)
Parameters
rgb_dataPacked RGB data (R, G, B, R, G, B...)
widthImage width
heightImage height
set_pixelCallback to set quantized pixel
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp.
Here is the call graph for this function:

◆ to_rgb()

static constexpr auto epaper::ColorManager::to_rgb ( Color  color) -> RGB
inlinestaticconstexprnoexcept

Convert Color enum to RGB.

Parameters
colorColor enum value
Returns
Corresponding RGB color
Examples
/mnt/nas/libepaper/include/epaper/color/color_manager.hpp, and /mnt/nas/libepaper/include/epaper/io/image_io.hpp.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: