roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
buffered_drawing.h
Go to the documentation of this file.
1#pragma once
2
3/// Utilities for buffering pixel writes before sending to device drivers.
4///
5/// Buffering has a large performance impact:
6/// - Hardware drivers (e.g., SPI displays) can batch and optimize transfers.
7/// - In-memory buffers avoid per-pixel virtual calls.
8///
9/// Utility classes cover common patterns:
10/// - random pixels, sequences, lines, rectangles
11/// - per-pixel colors (*Writer) vs single color (*Filler)
12/// - optional pre-clipping (Clipping* variants)
13
14#include <memory>
15
18
19namespace roo_display {
20
21#ifndef ROO_DISPLAY_TESTING
23
24// Smaller, to conserve stack memory.
26
27#else
28// Use a small and 'weird' buffer size to challenge unit tests better.
29static const uint8_t kPixelWritingBufferSize = 5;
30static const uint8_t kRectWritingBufferSize = 5;
31#endif
32
33/// Buffered writer for arbitrary pixels with per-pixel colors.
35 public:
36 /// Construct a writer targeting `device` using `blending_mode`.
38 : device_(device), blending_mode_(blending_mode), buffer_size_(0) {}
39
42
45
46 /// Write a single pixel (buffered).
47 void writePixel(int16_t x, int16_t y, Color color) {
48 if (buffer_size_ == kPixelWritingBufferSize) flush();
49 if (color.asArgb() == 0 &&
50 (blending_mode_ == BlendingMode::kSourceOver ||
51 blending_mode_ == BlendingMode::kSourceOverOpaque))
52 return;
53 x_buffer_[buffer_size_] = x;
54 y_buffer_[buffer_size_] = y;
55 color_buffer_[buffer_size_] = color;
56 ++buffer_size_;
57 }
58
60
61 /// Flush any buffered pixels.
62 void flush() {
63 if (buffer_size_ == 0) return;
64 device_.writePixels(blending_mode_, color_buffer_, x_buffer_, y_buffer_,
65 buffer_size_);
66 buffer_size_ = 0;
67 }
68
69 private:
70 DisplayOutput& device_;
71 BlendingMode blending_mode_;
72 int16_t buffer_size_;
73 Color color_buffer_[kPixelWritingBufferSize];
76};
77
78template <typename PixelWriter>
79/// Adapter that turns a pixel writer into a single-color filler.
81 public:
84
85 /// Fill a pixel using the configured color.
86 void fillPixel(int16_t x, int16_t y) { writer_.writePixel(x, y, color_); }
87
88 private:
89 PixelWriter& writer_;
90 Color color_;
91};
92
93/// Buffered pixel writer with a clipping box.
95 public:
99
102
103 /// Write a pixel if it lies within `clip_box()`.
104 void writePixel(int16_t x, int16_t y, Color color) {
105 if (clip_box_.contains(x, y)) {
106 writer_.writePixel(x, y, color);
107 }
108 }
109
110 /// Flush any buffered pixels.
111 void flush() { writer_.flush(); }
112
113 const Box& clip_box() const { return clip_box_; }
114
115 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
116
117 private:
118 BufferedPixelWriter writer_;
119 Box clip_box_;
120};
121
122/// Default pixel writer type (with clipping).
124
125/// Buffered filler for arbitrary pixels using a single color.
127 public:
130 : device_(device),
131 color_(color),
132 blending_mode_(blending_mode),
133 buffer_size_(0) {}
134
135 /// Fill a pixel (buffered).
137 if (buffer_size_ == kPixelWritingBufferSize) flush();
138 x_buffer_[buffer_size_] = x;
139 y_buffer_[buffer_size_] = y;
140 ++buffer_size_;
141 }
142
144
145 /// Flush any buffered pixels.
146 void flush() {
147 if (buffer_size_ == 0) return;
148 device_.fillPixels(blending_mode_, color_, x_buffer_, y_buffer_,
149 buffer_size_);
150 buffer_size_ = 0;
151 }
152
153 private:
154 DisplayOutput& device_;
155 Color color_;
156 BlendingMode blending_mode_;
157 int16_t buffer_size_;
160};
161
162/// Buffered pixel filler with a clipping box.
164 public:
167 : filler_(device, color, blending_mode), clip_box_(std::move(clip_box)) {}
168
169 /// Fill a pixel if it lies within `clip_box()`.
171 if (clip_box_.contains(x, y)) {
172 filler_.fillPixel(x, y);
173 }
174 }
175
176 /// Flush any buffered pixels.
177 void flush() { filler_.flush(); }
178
179 const Box& clip_box() const { return clip_box_; }
180
181 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
182
183 private:
184 BufferedPixelFiller filler_;
185 Box clip_box_;
186};
187
188/// Buffered writer for sequential color values (used with `setAddress()`).
190 public:
192 : device_(device), buffer_size_(0) {}
193
194 /// Write a single color value.
195 void writeColor(Color color) {
196 color_buffer_[buffer_size_] = color;
197 ++buffer_size_;
198 if (buffer_size_ == kPixelWritingBufferSize) flush();
199 }
200
201 /// Write `count` pixels with the same color.
202 void writeColorN(Color color, uint16_t count) {
203 uint16_t batch = kPixelWritingBufferSize - buffer_size_;
204 if (count < batch) {
205 FillColor(color_buffer_ + buffer_size_, count, color);
206 buffer_size_ += count;
207 return;
208 }
209 FillColor(color_buffer_ + buffer_size_, batch, color);
210 device_.write(color_buffer_, kPixelWritingBufferSize);
211 count -= batch;
212 while (true) {
213 if (count < kPixelWritingBufferSize) {
214 FillColor(color_buffer_, count, color);
215 buffer_size_ = count;
216 return;
217 }
218 FillColor(color_buffer_, kPixelWritingBufferSize, color);
219 device_.write(color_buffer_, kPixelWritingBufferSize);
221 }
222 }
223
224 /// Write `count` pixels with distinct colors.
225 void writeColors(Color* colors, uint16_t count) {
226 uint16_t batch = kPixelWritingBufferSize - buffer_size_;
227 if (count < batch) {
228 memcpy(color_buffer_ + buffer_size_, colors, count * sizeof(Color));
229 buffer_size_ += count;
230 return;
231 }
232 if (buffer_size_ != 0) {
233 memcpy(color_buffer_ + buffer_size_, colors, batch * sizeof(Color));
234 device_.write(color_buffer_, kPixelWritingBufferSize);
235 count -= batch;
236 colors += batch;
237 }
238 while (true) {
239 if (count < kPixelWritingBufferSize) {
240 memcpy(color_buffer_, colors, count * sizeof(Color));
241 buffer_size_ = count;
242 return;
243 }
244 // For large enough number of pixels, we can skip the buffer entirely.
245 device_.write(colors, kPixelWritingBufferSize);
247 colors += kPixelWritingBufferSize;
248 }
249 }
250
251 /// Return remaining buffer capacity before a flush is needed.
253 return kPixelWritingBufferSize - buffer_size_;
254 }
255
256 /// Return raw access to the buffer at the current write position.
257 Color* buffer_ptr() { return color_buffer_ + buffer_size_; }
258
259 /// Advance the buffer after direct writes via `buffer_ptr()`.
261 buffer_size_ += count;
262 if (buffer_size_ >= kPixelWritingBufferSize) {
263 device_.write(color_buffer_, buffer_size_);
264 buffer_size_ = 0;
265 }
266 }
267
268 /// Write up to the remaining buffer space and return count written.
269 // written.
271 uint16_t batch = kPixelWritingBufferSize - buffer_size_;
272 if (count < batch) {
273 memcpy(color_buffer_ + buffer_size_, colors, count * sizeof(Color));
274 buffer_size_ += count;
275 return count;
276 }
277 if (buffer_size_ != 0) {
278 memcpy(color_buffer_ + buffer_size_, colors, batch * sizeof(Color));
279 device_.write(color_buffer_, kPixelWritingBufferSize);
280 buffer_size_ = 0;
281 return batch;
282 }
283 device_.write(colors, kPixelWritingBufferSize);
285 }
286
287 ~BufferedColorWriter() { flush(); }
288
289 private:
290 void flush() {
291 if (buffer_size_ == 0) return;
292 device_.write(color_buffer_, buffer_size_);
293 buffer_size_ = 0;
294 }
295
296 DisplayOutput& device_;
297 Color color_buffer_[kPixelWritingBufferSize];
298 int16_t buffer_size_;
299};
300
302 public:
305 : device_(device),
306 blending_mode_(blending_mode),
307 color_(color),
308 buffer_size_(0) {}
309
310 void fillHLine(int16_t x0, int16_t y0, int16_t x1) {
311 if (buffer_size_ == kPixelWritingBufferSize) flush();
312 x0_buffer_[buffer_size_] = x0;
313 y0_buffer_[buffer_size_] = y0;
314 x1_buffer_[buffer_size_] = x1;
315 ++buffer_size_;
316 }
317
319
320 void flush() {
321 if (buffer_size_ == 0) return;
322 device_.fillRects(blending_mode_, color_, x0_buffer_, y0_buffer_,
323 x1_buffer_, y0_buffer_, buffer_size_);
324 buffer_size_ = 0;
325 }
326
327 private:
328 DisplayOutput& device_;
329 BlendingMode blending_mode_;
330 Color color_;
331 int16_t buffer_size_;
335};
336
338 public:
341 : filler_(device, color, blending_mode), clip_box_(std::move(clip_box)) {}
342
343 void fillHLine(int16_t x0, int16_t y0, int16_t x1) {
344 if (x0 > clip_box_.xMax() || x1 < clip_box_.xMin() ||
345 y0 > clip_box_.yMax() || y0 < clip_box_.yMin() || x1 < x0) {
346 return;
347 }
348
349 if (x0 < clip_box_.xMin()) x0 = clip_box_.xMin();
350 if (x1 > clip_box_.xMax()) x1 = clip_box_.xMax();
351 filler_.fillHLine(x0, y0, x1);
352 }
353
354 void flush() { filler_.flush(); }
355
356 const Box& clip_box() const { return clip_box_; }
357
358 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
359
360 private:
361 BufferedHLineFiller filler_;
362 Box clip_box_;
363};
364
366 public:
369 : device_(device),
370 blending_mode_(blending_mode),
371 color_(color),
372 buffer_size_(0) {}
373
374 void fillVLine(int16_t x0, int16_t y0, int16_t y1) {
375 if (buffer_size_ == kPixelWritingBufferSize) flush();
376 x0_buffer_[buffer_size_] = x0;
377 y0_buffer_[buffer_size_] = y0;
378 y1_buffer_[buffer_size_] = y1;
379 ++buffer_size_;
380 }
381
383
384 void flush() {
385 if (buffer_size_ == 0) return;
386 device_.fillRects(blending_mode_, color_, x0_buffer_, y0_buffer_,
387 x0_buffer_, y1_buffer_, buffer_size_);
388 buffer_size_ = 0;
389 }
390
391 private:
392 DisplayOutput& device_;
393 BlendingMode blending_mode_;
394 Color color_;
395 int16_t buffer_size_;
399};
400
402 public:
405 : filler_(device, color, blending_mode), clip_box_(std::move(clip_box)) {}
406
407 void fillVLine(int16_t x0, int16_t y0, int16_t y1) {
408 if (x0 > clip_box_.xMax() || x0 < clip_box_.xMin() ||
409 y0 > clip_box_.yMax() || y1 < clip_box_.yMin() || y1 < y0) {
410 return;
411 }
412
413 if (y0 < clip_box_.yMin()) y0 = clip_box_.yMin();
414 if (y1 > clip_box_.yMax()) y1 = clip_box_.yMax();
415 filler_.fillVLine(x0, y0, y1);
416 }
417
418 void flush() { filler_.flush(); }
419
420 const Box& clip_box() const { return clip_box_; }
421
422 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
423
424 private:
425 BufferedVLineFiller filler_;
426 Box clip_box_;
427};
428
430 public:
432 : device_(device), blending_mode_(blending_mode), buffer_size_(0) {}
433
434 inline void writePixel(int16_t x, int16_t y, Color color) {
435 writeRect(x, y, x, y, color);
436 }
437
438 inline void writeHLine(int16_t x0, int16_t y0, int16_t x1, Color color) {
439 writeRect(x0, y0, x1, y0, color);
440 }
441
442 inline void writeVLine(int16_t x0, int16_t y0, int16_t y1, Color color) {
443 writeRect(x0, y0, x0, y1, color);
444 }
445
446 void writeRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color) {
447 if (buffer_size_ == kRectWritingBufferSize) flush();
448 color_[buffer_size_] = color;
449 x0_buffer_[buffer_size_] = x0;
450 y0_buffer_[buffer_size_] = y0;
451 x1_buffer_[buffer_size_] = x1;
452 y1_buffer_[buffer_size_] = y1;
453 ++buffer_size_;
454 }
455
457
458 void flush() {
459 if (buffer_size_ == 0) return;
460 device_.writeRects(blending_mode_, color_, x0_buffer_, y0_buffer_,
461 x1_buffer_, y1_buffer_, buffer_size_);
462 buffer_size_ = 0;
463 }
464
465 private:
466 DisplayOutput& device_;
467 BlendingMode blending_mode_;
468 int16_t buffer_size_;
474};
475
476template <typename RectWriter>
478 public:
481
482 inline void fillPixel(int16_t x, int16_t y) {
483 writer_.writePixel(x, y, color_);
484 }
485
486 inline void fillHLine(int16_t x0, int16_t y0, int16_t x1) {
487 writer_.fillHLine(x0, y0, x1, color_);
488 }
489
490 inline void fillVLine(int16_t x0, int16_t y0, int16_t y1) {
491 writer_.fillVLine(x0, y0, y1, color_);
492 }
493
494 void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
495 writer_.writeRect(x0, y0, x1, y1, color_);
496 }
497
498 private:
499 RectWriter& writer_;
500 Color color_;
501};
502
504 public:
508
509 inline void writePixel(int16_t x, int16_t y, Color color) {
510 writeRect(x, y, x, y, color);
511 }
512
513 inline void writeHLine(int16_t x0, int16_t y0, int16_t x1, Color color) {
514 writeRect(x0, y0, x1, y0, color);
515 }
516
517 inline void writeVLine(int16_t x0, int16_t y0, int16_t y1, Color color) {
518 writeRect(x0, y0, x0, y1, color);
519 }
520
521 void writeRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color) {
522 if (x0 > clip_box_.xMax() || x1 < clip_box_.xMin() ||
523 y0 > clip_box_.yMax() || y1 < clip_box_.yMin() || y1 < y0 || x1 < x0) {
524 return;
525 }
526
527 if (x0 < clip_box_.xMin()) x0 = clip_box_.xMin();
528 if (x1 > clip_box_.xMax()) x1 = clip_box_.xMax();
529 if (y0 < clip_box_.yMin()) y0 = clip_box_.yMin();
530 if (y1 > clip_box_.yMax()) y1 = clip_box_.yMax();
531
532 writer_.writeRect(x0, y0, x1, y1, color);
533 }
534
535 void flush() { writer_.flush(); }
536
537 const Box& clip_box() const { return clip_box_; }
538
539 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
540
541 private:
542 BufferedRectWriter writer_;
543 Box clip_box_;
544};
545
547 public:
550 : device_(device),
551 blending_mode_(blending_mode),
552 color_(color),
553 buffer_size_(0) {}
554
555 inline void fillPixel(int16_t x, int16_t y) { fillRect(x, y, x, y); }
556
557 inline void fillHLine(int16_t x0, int16_t y0, int16_t x1) {
558 fillRect(x0, y0, x1, y0);
559 }
560
561 inline void fillVLine(int16_t x0, int16_t y0, int16_t y1) {
562 fillRect(x0, y0, x0, y1);
563 }
564
565 void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
566 if (buffer_size_ == kRectWritingBufferSize) flush();
567 x0_buffer_[buffer_size_] = x0;
568 y0_buffer_[buffer_size_] = y0;
569 x1_buffer_[buffer_size_] = x1;
570 y1_buffer_[buffer_size_] = y1;
571 ++buffer_size_;
572 }
573
575
576 void flush() {
577 if (buffer_size_ == 0) return;
578 device_.fillRects(blending_mode_, color_, x0_buffer_, y0_buffer_,
579 x1_buffer_, y1_buffer_, buffer_size_);
580 buffer_size_ = 0;
581 }
582
583 private:
584 DisplayOutput& device_;
585 BlendingMode blending_mode_;
586 Color color_;
587 int16_t buffer_size_;
592};
593
595 public:
598 : filler_(device, color, blending_mode), clip_box_(std::move(clip_box)) {}
599
600 inline void fillPixel(int16_t x, int16_t y) { fillRect(x, y, x, y); }
601
602 inline void fillHLine(int16_t x0, int16_t y0, int16_t x1) {
603 fillRect(x0, y0, x1, y0);
604 }
605
606 inline void fillVLine(int16_t x0, int16_t y0, int16_t y1) {
607 fillRect(x0, y0, x0, y1);
608 }
609
610 void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
611 if (x0 > clip_box_.xMax() || x1 < clip_box_.xMin() ||
612 y0 > clip_box_.yMax() || y1 < clip_box_.yMin() || y1 < y0 || x1 < x0) {
613 return;
614 }
615
616 if (x0 < clip_box_.xMin()) x0 = clip_box_.xMin();
617 if (x1 > clip_box_.xMax()) x1 = clip_box_.xMax();
618 if (y0 < clip_box_.yMin()) y0 = clip_box_.yMin();
619 if (y1 > clip_box_.yMax()) y1 = clip_box_.yMax();
620
621 filler_.fillRect(x0, y0, x1, y1);
622 }
623
624 void flush() { filler_.flush(); }
625
626 const Box& clip_box() const { return clip_box_; }
627
628 // void set_clip_box(Box clip_box) { clip_box_ = std::move(clip_box); }
629
630 private:
631 BufferedRectFiller filler_;
632 Box clip_box_;
633};
634
635} // namespace roo_display
BufferedRectWriter & writer
Axis-aligned integer rectangle.
Definition box.h:12
int16_t xMin() const
Minimum x (inclusive).
Definition box.h:65
int16_t xMax() const
Maximum x (inclusive).
Definition box.h:71
bool contains(int16_t x, int16_t y) const
Return whether the point (x, y) lies within the box.
Definition box.h:86
int16_t yMax() const
Maximum y (inclusive).
Definition box.h:74
int16_t yMin() const
Minimum y (inclusive).
Definition box.h:68
Buffered writer for sequential color values (used with setAddress()).
uint16_t writeColorsAligned(Color *colors, uint16_t count)
Write up to the remaining buffer space and return count written.
void writeColor(Color color)
Write a single color value.
void writeColors(Color *colors, uint16_t count)
Write count pixels with distinct colors.
BufferedColorWriter(DisplayOutput &device)
void writeColorN(Color color, uint16_t count)
Write count pixels with the same color.
uint16_t remaining_buffer_space() const
Return remaining buffer capacity before a flush is needed.
void advance_buffer_ptr(uint16_t count)
Advance the buffer after direct writes via buffer_ptr().
Color * buffer_ptr()
Return raw access to the buffer at the current write position.
void fillHLine(int16_t x0, int16_t y0, int16_t x1)
BufferedHLineFiller(DisplayOutput &device, Color color, BlendingMode blending_mode)
Buffered filler for arbitrary pixels using a single color.
void flush()
Flush any buffered pixels.
BufferedPixelFiller(DisplayOutput &device, Color color, BlendingMode blending_mode)
void fillPixel(int16_t x, int16_t y)
Fill a pixel (buffered).
Adapter that turns a pixel writer into a single-color filler.
void fillPixel(int16_t x, int16_t y)
Fill a pixel using the configured color.
BufferedPixelWriterFillAdapter(PixelWriter &writer, Color color)
Buffered writer for arbitrary pixels with per-pixel colors.
BufferedPixelWriter(DisplayOutput &device, BlendingMode blending_mode)
Construct a writer targeting device using blending_mode.
BufferedPixelWriter & operator=(const BufferedPixelWriter &)=delete
BufferedPixelWriter(BufferedPixelWriter &)=delete
BufferedPixelWriter & operator=(BufferedPixelWriter &&)=delete
BufferedPixelWriter(const BufferedPixelWriter &)=delete
void flush()
Flush any buffered pixels.
void writePixel(int16_t x, int16_t y, Color color)
Write a single pixel (buffered).
void fillPixel(int16_t x, int16_t y)
void fillHLine(int16_t x0, int16_t y0, int16_t x1)
void fillVLine(int16_t x0, int16_t y0, int16_t y1)
BufferedRectFiller(DisplayOutput &device, Color color, BlendingMode blending_mode)
void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
BufferedRectWriterFillAdapter(RectWriter &writer, Color color)
void fillHLine(int16_t x0, int16_t y0, int16_t x1)
void fillVLine(int16_t x0, int16_t y0, int16_t y1)
void writeRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
void writePixel(int16_t x, int16_t y, Color color)
BufferedRectWriter(DisplayOutput &device, BlendingMode blending_mode)
void writeVLine(int16_t x0, int16_t y0, int16_t y1, Color color)
void writeHLine(int16_t x0, int16_t y0, int16_t x1, Color color)
void fillVLine(int16_t x0, int16_t y0, int16_t y1)
BufferedVLineFiller(DisplayOutput &device, Color color, BlendingMode blending_mode)
void fillHLine(int16_t x0, int16_t y0, int16_t x1)
ClippingBufferedHLineFiller(DisplayOutput &device, Color color, Box clip_box, BlendingMode blending_mode)
Buffered pixel filler with a clipping box.
ClippingBufferedPixelFiller(DisplayOutput &device, Color color, Box clip_box, BlendingMode blending_mode)
void flush()
Flush any buffered pixels.
void fillPixel(int16_t x, int16_t y)
Fill a pixel if it lies within clip_box().
Buffered pixel writer with a clipping box.
void writePixel(int16_t x, int16_t y, Color color)
Write a pixel if it lies within clip_box().
void flush()
Flush any buffered pixels.
ClippingBufferedPixelWriter(ClippingBufferedPixelWriter &)=delete
ClippingBufferedPixelWriter(const ClippingBufferedPixelWriter &)=delete
ClippingBufferedPixelWriter(DisplayOutput &device, Box clip_box, BlendingMode blending_mode)
void fillVLine(int16_t x0, int16_t y0, int16_t y1)
void fillHLine(int16_t x0, int16_t y0, int16_t x1)
void fillRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
ClippingBufferedRectFiller(DisplayOutput &device, Color color, Box clip_box, BlendingMode blending_mode)
ClippingBufferedRectWriter(DisplayOutput &device, Box clip_box, BlendingMode blending_mode)
void writeRect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, Color color)
void writeHLine(int16_t x0, int16_t y0, int16_t x1, Color color)
void writeVLine(int16_t x0, int16_t y0, int16_t y1, Color color)
void writePixel(int16_t x, int16_t y, Color color)
void fillVLine(int16_t x0, int16_t y0, int16_t y1)
ClippingBufferedVLineFiller(DisplayOutput &device, Color color, Box clip_box, BlendingMode blending_mode)
ARGB8888 color stored as a 32-bit unsigned integer.
Definition color.h:16
The abstraction for drawing to a display.
Definition device.h:15
virtual void writeRects(BlendingMode blending_mode, Color *color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count)=0
Draw the specified rectangles (per-rectangle colors). Invalidates the address window.
virtual void write(Color *color, uint32_t pixel_count)=0
Write pixels into the current address window.
virtual void fillPixels(BlendingMode blending_mode, Color color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
Draw the specified pixels using the same color. Invalidates the address window.
virtual void writePixels(BlendingMode blending_mode, Color *color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
Draw the specified pixels (per-pixel colors). Invalidates the address window.
virtual void fillRects(BlendingMode blending_mode, Color color, int16_t *x0, int16_t *y0, int16_t *x1, int16_t *y1, uint16_t count)=0
Draw the specified rectangles using the same color. Invalidates the address window.
Defines 140 opaque HTML named colors.
BlendingMode
Porter-Duff style blending modes.
Definition blending.h:17
@ kSourceOverOpaque
Similar to kSourceOver, but assumes that the destination is opaque.
@ kSourceOver
Source is placed (alpha-blended) over the destination. This is the default blending mode.
static const uint8_t kPixelWritingBufferSize
static const uint8_t kRectWritingBufferSize
void FillColor(Color *buf, uint32_t count, Color color)
Fill an array with a single color.
Definition color.h:109
BlendingMode blending_mode
Definition smooth.cpp:888