86 {
87
88 u16 n =
static_cast<u16
>(colors.
size());
89 if (out_colors.
size() < n) n =
static_cast<u16
>(out_colors.
size());
90 if (out_power_5bit.
size() < n) n =
static_cast<u16
>(out_power_5bit.
size());
91
92
93 if (global_brightness == 0) {
94 for (u16 i = 0; i < n; ++i) {
95 out_colors[i] =
CRGB(0, 0, 0);
96 out_power_5bit[i] = 0;
97 }
98 return;
99 }
100
102
103
104 const bool apply_r_scale = (colors_scale.r != 0xff);
105 const bool apply_g_scale = (colors_scale.g != 0xff);
106 const bool apply_b_scale = (colors_scale.b != 0xff);
107 const u16 rscale_p1 = 1u + static_cast<u16>(colors_scale.r);
108 const u16 gscale_p1 = 1u + static_cast<u16>(colors_scale.g);
109 const u16 bscale_p1 = 1u + static_cast<u16>(colors_scale.b);
110
111
112 const bool apply_brightness = (global_brightness != 0xff);
113 const u16 bright_p1 = 1u + static_cast<u16>(global_brightness);
114
115 for (u16 i = 0; i < n; ++i) {
116 const CRGB &c = colors[i];
117
118 u16 r16 = five_bit_impl::gamma_lut_read(glut, c.r);
119 u16 g16 = five_bit_impl::gamma_lut_read(glut, c.g);
120 u16 b16 = five_bit_impl::gamma_lut_read(glut, c.b);
121
122
123 if (apply_r_scale) r16 = five_bit_impl::scale16by8_nozero(r16, rscale_p1);
124 if (apply_g_scale) g16 = five_bit_impl::scale16by8_nozero(g16, gscale_p1);
125 if (apply_b_scale) b16 = five_bit_impl::scale16by8_nozero(b16, bscale_p1);
126
127 five_bit_impl::five_bit_pixel(r16, g16, b16, global_brightness,
128 bright_p1, apply_brightness,
129 &out_colors[i], &out_power_5bit[i]);
130 }
131}
constexpr fl::size size() const FL_NO_EXCEPT
const u16 GAMMA_2_8_LUT[256]
Representation of an 8-bit RGB pixel (Red, Green, Blue)