FastLED 3.10.8
Loading...
Searching...
No Matches

◆ loadAndScaleRGBW()

void fl::PixelIterator::loadAndScaleRGBW ( u8 * b0_out,
u8 * b1_out,
u8 * b2_out,
u8 * w_out )
inline

Definition at line 337 of file pixel_iterator.h.

337 {
338 if (mLoadRawPremixed != nullptr) {
339 // Type-erased RGBW: the conversion is installed by active Rgbw
340 // construction / setRgbw(), so RGB-only programs never link it
341 // (#4795). Cached at construction (the Rgbw already exists then).
342 u8 raw[3];
343 u8 premix[3];
345 if (mRgbwConvert != nullptr) {
346 mRgbwConvert(mRgbw, raw, premix, mWireOrder, b0_out, b1_out, b2_out, w_out);
347 return;
348 }
349 // Not installed: only an inactive Rgbw can reach here. Exactly what
350 // rgb_2_rgbw(kRGBWInvalid) produced: premix-scaled RGB, white off,
351 // then the W placement.
352 u8 c[3];
353 u8 w = 0;
354 rgb_2_rgbw_null_white_pixel(mRgbw.white_color_temp, raw[0], raw[1], raw[2],
355 premix[0], premix[1], premix[2],
356 &c[0], &c[1], &c[2], &w);
357 rgbw_partial_reorder(mRgbw.w_placement, c[mWireOrder[0]], c[mWireOrder[1]],
358 c[mWireOrder[2]], w, b0_out, b1_out, b2_out, w_out);
359 return;
360 }
361#if defined(FL_IS_AVR)
362 // AVR keeps the order-free thunk (no type-erased conversion there).
363 if (mLoadAndScaleRGBWUnordered != nullptr) {
364 // Source-order RGB plus W, then the same two steps the templated
365 // `loadAndScaleRGBW` takes: permute RGB, place W.
366 u8 c[3];
367 u8 w = 0;
368 mLoadAndScaleRGBWUnordered(mPixelController, mRgbw, &c[0], &c[1], &c[2], &w);
369 rgbw_partial_reorder(mRgbw.w_placement, c[mOrder[0]], c[mOrder[1]], c[mOrder[2]], w,
370 b0_out, b1_out, b2_out, w_out);
371 return;
372 }
373#endif
374 mLoadAndScaleRGBW(mPixelController, mRgbw, b0_out, b1_out, b2_out, w_out);
375 }
detail::RgbwConvertFn mRgbwConvert
loadAndScaleRGBWUnorderedFunction mLoadAndScaleRGBWUnordered
loadRawPremixedFunction mLoadRawPremixed
loadAndScaleRGBWFunction mLoadAndScaleRGBW
unsigned char u8
Definition stdint.h:131
void rgb_2_rgbw_null_white_pixel(u16 w_color_temperature, u8 r, u8 g, u8 b, u8 r_scale, u8 g_scale, u8 b_scale, u8 *out_r, u8 *out_g, u8 *out_b, u8 *out_w) FL_NO_EXCEPT
Converts RGB to RGBW with the W channel set to black, always.
Definition rgbw.cpp.hpp:110
void rgbw_partial_reorder(EOrderW w_placement, u8 b0, u8 b1, u8 b2, u8 w, u8 *out_b0, u8 *out_b1, u8 *out_b2, u8 *out_b3) FL_NO_EXCEPT
Definition rgbw.cpp.hpp:679

References fl::FL_NO_EXCEPT, mLoadAndScaleRGBW, mLoadAndScaleRGBWUnordered, mLoadRawPremixed, mOrder, mPixelController, mRgbw, mRgbwConvert, mWireOrder, fl::rgb_2_rgbw_null_white_pixel(), and fl::rgbw_partial_reorder().

+ Here is the call graph for this function: