166 {
167
169
170 for (int i = 0; i < led_column_table_length; ++i) {
171 const Key& key = keyboard.
keys_[i];
172
173
174
175 bool black_key = false;
176 switch (key.
idx_ % 12) {
177 case 1:
178 case 4:
179 case 6:
180 case 9:
181 case 11:
182 black_key = true;
183 break;
184 }
185
186 const int pixel_count = led_column_table[i];
187 const int draw_pixel_count = ceil(pixel_count * sqrt(key.
curr_color_.
v_));
188
189 const int black_pixel_count = pixel_count - draw_pixel_count;
191
192
193 const bool reverse_correct = black_key == (key.
idx_ % 2);
194
195 if (reverse_correct) {
196 for (int j = 0; j < draw_pixel_count; ++j) {
197 if (j < draw_pixel_count - 1) {
199 } else {
200
201 ColorHSV hsv(random(512) / 512.f, random(512) / 512.f, 1.0);
203 }
204 }
205
206 for (int j = 0; j < black_pixel_count; ++j) {
208 }
209 } else {
210 for (int j = 0; j < black_pixel_count; ++j) {
212 }
213
214 for (int j = draw_pixel_count - 1; j >= 0; --j) {
215 if (j < draw_pixel_count - 1) {
217 } else {
218
219 ColorHSV hsv(random(512) / 512.f, random(512) / 512.f, 1.0);
221 }
222 }
223 }
224 }
226}
virtual void RawDrawPixel(const Color3i &c)=0
virtual void RawCommitDraw()=0
virtual void RawBeginDraw()=0
virtual Color3i * GetIterator(int i)=0