roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
interpolation.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace roo_display {
8
9/// Interpolate between two colors with `fraction` in [0, 256].
10///
11/// 0 means result = c1; 256 means result = c2; 128 means 50/50.
12Color InterpolateColors(Color c1, Color c2, int16_t fraction);
13
14/// Interpolate between two opaque colors with `fraction` in [0, 256].
15Color InterpolateOpaqueColors(Color c1, Color c2, int16_t fraction);
16
17/// Equivalent to InterpolateColors(Transparent, c, fraction_color).
18Color InterpolateColorWithTransparency(Color c, int16_t fraction_color);
19
20/// Equivalent to InterpolateColors(Transparent, c, fraction_color) for opaque
21/// c.
26
27/// Default raw color interpolator (specialized in color_modes.h).
28///
29/// Uses the color mode transparency to choose an appropriate interpolation.
30template <typename ColorMode>
34 const ColorMode& color_mode) const {
35 Color c1_argb = color_mode.toArgbColor(c1);
36 Color c2_argb = color_mode.toArgbColor(c2);
37 return color_mode.transparency() == TransparencyMode::kNone
40 }
41};
42
43} // namespace roo_display
ARGB8888 color stored as a 32-bit unsigned integer.
Definition color.h:16
Defines 140 opaque HTML named colors.
@ kNone
All colors are fully opaque.
Color InterpolateColorWithTransparency(Color c, int16_t fraction_color)
Equivalent to InterpolateColors(Transparent, c, fraction_color).
Color InterpolateOpaqueColorWithTransparency(Color c, int16_t fraction_color)
Equivalent to InterpolateColors(Transparent, c, fraction_color) for opaque c.
Color InterpolateColors(Color c1, Color c2, int16_t fraction)
Interpolate between two colors with fraction in [0, 256].
Color InterpolateOpaqueColors(Color c1, Color c2, int16_t fraction)
Interpolate between two opaque colors with fraction in [0, 256].
Default raw color interpolator (specialized in color_modes.h).
Color operator()(ColorStorageType< ColorMode > c1, ColorStorageType< ColorMode > c2, uint16_t fraction, const ColorMode &color_mode) const