8#include "roo_io/memory/load.h"
42 return color.asArgb();
56 return Color(
in >> 8 | (
in & 0xFF) << 24);
60 return color.asArgb() << 8 |
color.asArgb() >> 24;
71 return (
c - (
c >> 5)) >> 4;
75 return (
c - (
c >> 6)) >> 3;
79 return (
c - (
c >> 7)) >> 2;
94 return color.asArgb() & 0x00FFFFFF;
113 return Color(((
in >> 16) & 0xFC) | (
in >> 22),
114 ((
in >> 10) & 0xFC) | ((
in >> 16) & 0x03),
115 ((
in >> 4) & 0xFC) | ((
in >> 10) & 0x03),
116 ((
in << 2) & 0xFC) | ((
in >> 4) & 0x03));
146 return Color(((
in >> 8) & 0xF0) | (
in >> 12),
147 ((
in >> 4) & 0xF0) | ((
in >> 8) & 0x0F),
148 ((
in >> 0) & 0xF0) | ((
in >> 4) & 0x0F),
149 ((
in << 4) & 0xF0) | ((
in >> 0) & 0x0F));
179 return Color(((
in >> 8) & 0xF8) | (
in >> 13),
180 ((
in >> 3) & 0xFC) | ((
in >> 9) & 0x03),
181 ((
in << 3) & 0xF8) | ((
in >> 2) & 0x07));
200template <roo_io::ByteOrder
byte_order>
220 return c ==
t ?
c ^ 0x40 :
c;
238 return in == transparency_ ?
Color(0)
240 ((
in >> 3) & 0xFC) | ((
in >> 9) & 0x03),
241 ((
in << 3) & 0xF8) | ((
in >> 2) & 0x07));
245 return color.a() <= 127 ? transparency_
263template <roo_io::ByteOrder
byte_order>
271 io.store(src, dst, mode);
284 return Color(0xFF000000 |
in * 0x010101);
299template <roo_io::ByteOrder
byte_order>
306 *dst =
static_cast<roo::byte
>(
311template <roo_io::ByteOrder
byte_order>
319 *dst =
static_cast<roo::byte
>(
339 return Color(
in << 24 | (
in >> 8) * 0x010101);
345 return color.a() >> 24 |
361 return Color(0xFF000000 |
in * 0x111111);
431template <roo_io::ByteOrder
byte_order>
437 *dst =
static_cast<roo::byte
>(0xFF);
449 const Alpha8& mode)
const {
460 : color_(0xFF000000 | (
color.asArgb() & 0x00FFFFFF)) {}
499 const Alpha4& mode)
const {
512 : fg_(
fg), bg_(
bg) {}
517 return in == 0 ? bg_ : fg_;
521 return (
color == bg_ ||
color.a() == 0) ? 0 : 1;
534 :
bg().a() == 0x00 ? (
fg().a() == 0x00 ||
fg().a() == 0xFF
541 return bg().a() != 0xFF ||
fg().a() != 0xFF;
constexpr uint8_t fromArgbColor(Color color) const
void setColor(Color color)
constexpr TransparencyMode transparency() const
constexpr Alpha4(Color color)
constexpr Color color() const
static const int8_t bits_per_pixel
constexpr Color toArgbColor(uint8_t in) const
constexpr uint8_t fromArgbColor(Color color) const
static const int8_t bits_per_pixel
constexpr Color toArgbColor(uint8_t in) const
constexpr Alpha8(Color color)
constexpr TransparencyMode transparency() const
constexpr Color color() const
16-bit ARGB 4-4-4-4 color mode.
static const int8_t bits_per_pixel
constexpr Color toArgbColor(uint16_t in) const
constexpr TransparencyMode transparency() const
constexpr uint16_t fromArgbColor(Color color) const
24-bit ARGB 6-6-6-6 color mode.
constexpr TransparencyMode transparency() const
constexpr Color toArgbColor(uint32_t in) const
static const int8_t bits_per_pixel
constexpr uint32_t fromArgbColor(Color color) const
ColorMode template contract.
static const int8_t bits_per_pixel
constexpr uint32_t fromArgbColor(Color color) const
constexpr Color toArgbColor(uint32_t in) const
constexpr TransparencyMode transparency() const
ARGB8888 color stored as a 32-bit unsigned integer.
constexpr uint8_t a() const
Alpha channel.
constexpr uint32_t asArgb() const
Return packed ARGB value.
constexpr Color toArgbColor(uint16_t in) const
constexpr TransparencyMode transparency() const
static const int8_t bits_per_pixel
constexpr uint16_t fromArgbColor(Color color) const
constexpr TransparencyMode transparency() const
static const int8_t bits_per_pixel
constexpr Color toArgbColor(uint8_t in) const
constexpr uint8_t fromArgbColor(Color color) const
constexpr uint8_t fromArgbColor(Color color) const
constexpr TransparencyMode transparency() const
constexpr Color toArgbColor(uint8_t in) const
static const int8_t bits_per_pixel
constexpr uint8_t fromArgbColor(Color color) const
constexpr Color toArgbColor(uint8_t in) const
constexpr Color fg() const
constexpr TransparencyMode transparency() const
constexpr Monochrome(Color fg, Color bg=Color(0x00000000))
constexpr bool hasTransparency() const
constexpr Color bg() const
static const int8_t bits_per_pixel
RGB565 with a reserved value representing transparency.
constexpr uint16_t fromArgbColor(Color color) const
uint16_t raw_transparency_color() const
constexpr Color toArgbColor(uint16_t in) const
constexpr Rgb565WithTransparency(uint16_t transparent_background_rgb565)
constexpr TransparencyMode transparency() const
static const int8_t bits_per_pixel
16-bit RGB565 color mode (opaque).
static const int8_t bits_per_pixel
constexpr Color toArgbColor(uint16_t in) const __attribute__((always_inline))
constexpr uint16_t fromArgbColor(Color color) const __attribute__((always_inline))
constexpr TransparencyMode transparency() const
24-bit RGB color mode (opaque).
constexpr Color toArgbColor(uint32_t in) const
constexpr uint32_t fromArgbColor(Color color) const
constexpr TransparencyMode transparency() const
static const int8_t bits_per_pixel
constexpr TransparencyMode transparency() const
constexpr Color toArgbColor(uint32_t in) const
static const int8_t bits_per_pixel
constexpr uint32_t fromArgbColor(Color color) const
constexpr uint8_t __div_255_rounded(uint16_t arg)
static constexpr uint32_t TruncTo4bit(uint8_t c)
static constexpr uint32_t TruncTo5bit(uint8_t c)
static constexpr uint32_t TruncTo6bit(uint8_t c)
constexpr uint16_t Resolve565Transparency(uint16_t c, uint16_t t)
Defines 140 opaque HTML named colors.
BlendingMode
Porter-Duff style blending modes.
@ kSourceOverOpaque
Similar to kSourceOver, but assumes that the destination is opaque.
@ kSourceOver
Source is placed (alpha-blended) over the destination. This is the default blending mode.
TransparencyMode
Transparency information for a stream or color mode.
@ kNone
All colors are fully opaque.
@ kCrude
Colors are either fully opaque or fully transparent.
@ kFull
Colors may include partial transparency (alpha channel).
Color AlphaBlendOverOpaque(Color bgc, Color fgc)
Color operator()(uint8_t c1, uint8_t c2, uint16_t fraction, const Alpha4 &mode) const
Color operator()(uint8_t c1, uint8_t c2, uint16_t fraction, const Alpha8 &mode) const
Color operator()(uint8_t c1, uint8_t c2, uint16_t fraction, const Grayscale4 &mode) const
Color operator()(uint8_t c1, uint8_t c2, uint16_t fraction, const Grayscale8 &mode) const
Default raw color interpolator (specialized in color_modes.h).
void operator()(roo::byte *dst, Color src, const Alpha8 &mode) const
void operator()(roo::byte *dst, Color src, const Grayscale8 &mode) const
void operator()(roo::byte *dst, Color src, const Grayscale8 &mode) const
void operator()(roo::byte *dst, Color src, const Rgb565WithTransparency &mode) const
void operator()(roo::byte *dst, Color src, const Rgb565 &mode) const
uint8_t operator()(uint8_t bg, Color color, const Alpha4 &mode) const
uint8_t operator()(uint8_t bg, Color color, const Grayscale4 &mode) const
uint8_t operator()(uint8_t bg, Color color, const Grayscale4 &mode) const
uint8_t operator()(uint8_t bg, Color color, const Monochrome &mode) const