FastLED 3.9.15
Loading...
Searching...
No Matches

◆ ColorFromPaletteHDImpl()

template<fl::u8 PaletteBits, typename Reader>
CRGB16 fl::anonymous_namespace{colorutils.cpp.hpp}::ColorFromPaletteHDImpl ( const Reader & reader,
fl::u16 index,
fl::u8x8 brightness,
TBlendType blendType )

Definition at line 305 of file colorutils.cpp.hpp.

307 {
308 const fl::u8 frac_bits = 16 - PaletteBits;
309 const fl::u8 palette_last = (fl::u8(1) << PaletteBits) - 1;
310 const fl::u32 segment_size = fl::u32(1) << frac_bits;
311 const fl::u8 entry_index = static_cast<fl::u8>(index >> frac_bits);
312 const fl::u16 frac =
313 static_cast<fl::u16>(index & (segment_size - fl::u32(1)));
314
315 const CRGB rgb1 = reader.read(entry_index);
316 CRGB16 out;
317 if (frac && blendType != NOBLEND) {
318 CRGB rgb2;
319 if (entry_index == palette_last) {
320 rgb2 = blendType == LINEARBLEND_NOWRAP ? rgb1 : reader.read(0);
321 } else {
322 rgb2 = reader.read(entry_index + 1);
323 }
325 rgb1.red, rgb2.red, frac, segment_size)),
327 rgb1.green, rgb2.green, frac, segment_size)),
329 rgb1.blue, rgb2.blue, frac, segment_size)));
330 } else {
331 out = promote_rgb_to_hd(rgb1);
332 }
333
335 return out;
336}
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
static constexpr FASTLED_FORCE_INLINE u8x8 from_raw(u16 raw) FL_NOEXCEPT
Definition u8x8.h:53
void scale_rgb_hd(CRGB16 &rgb, fl::u8x8 brightness)
fl::u16 lerp_channel_to_hd(fl::u8 a, fl::u8 b, fl::u16 frac, fl::u32 segment_size)
unsigned char u8
Definition s16x16x4.h:132
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

References brightness, ColorFromPaletteHDImpl(), fl::u8x8::from_raw(), lerp_channel_to_hd(), promote_rgb_to_hd(), and scale_rgb_hd().

Referenced by ColorFromPaletteHDImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: