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