31 if (
UNLIKELY(scale > 100)) scale = 100;
32 res.
red = (scale * color.
red) / 100;
34 res.
blue = (scale * color.
blue) / 100;
70 uint16_t width, uint16_t height,
74 for (uint16_t i = 0; i < height; i += 8) {
75 for (uint16_t j = 0; j < width; j++) {
76 uint8_t bits = pgm_read_byte(bp++);
81 for (uint8_t k = 0; k < 8; k++) {
91 for (uint16_t i = 0; i < height; i += 8) {
92 for (uint16_t j = 0; j < width; j++) {
93 uint8_t bits = pgm_read_byte(bp++);
94 for (uint8_t k = 0; k < 8; k++) {
96 if (bits & 1)
fill_rect(x + j*scale, y + (k+i)*scale, scale, scale);
106 uint16_t width, uint16_t height,
115 uint16_t width = pgm_read_byte(bp++);
116 uint16_t height = pgm_read_byte(bp++);
117 draw_icon(x, y, bp, width, height, scale);
124 uint16_t width = image->
WIDTH;
125 uint16_t height = image->
HEIGHT;
126 for (uint16_t i = 0; i < height; i++) {
129 for (uint16_t j = 0; j < width; j += count) {
132 for (uint8_t k = 0; k < count; k++) {
153 if (width > height) {
154 for (uint16_t h = 0; h < height; h++)
158 for (uint16_t w = 0; w < width; w++)
163 #define dist(x, y) ((x > y) ? (x - y) : (y - x)) 164 #define swap(a, b) { uint16_t t = a; a = b; b = t; } 169 bool steep = (
dist(y0, y1) >
dist(x0, x1));
181 int16_t err = dx / 2;
182 int8_t ystep = (y0 < y1) ? 1 : -1;
183 for (; x0 <= x1; x0++) {
214 int8_t dx = pgm_read_byte(poly++);
215 int8_t dy = pgm_read_byte(poly++);
216 if (
UNLIKELY(dx == 0 && dy == 0))
return;
230 int8_t dx = pgm_read_byte(stroke++);
231 int8_t dy = pgm_read_byte(stroke++);
232 if (
UNLIKELY(dx == 0 && dy == 0))
return;
233 if (dx <= 0 && dy <= 0) {
249 int16_t f = 1 - radius;
251 int16_t dy = -2 * radius;
282 int16_t dx = 0, dy = radius;
283 int16_t p = 1 - radius;
292 p = p + (dx << 1) + 1;
295 p = p + ((dx - dy) << 1) + 1;
302 uint16_t width, uint16_t height,
305 uint16_t diameter = 2 * radius;
306 int16_t f = 1 - radius;
308 int16_t dy = -diameter;
347 uint16_t width, uint16_t height,
350 int16_t dx = 0, dy = radius;
351 int16_t p = 1 - radius;
352 uint16_t diameter = 2 * radius;
369 p = p + (dx << 1) + 1;
372 p = p + ((dx - dy) << 1) + 1;
383 font->
draw(
this, c, x, y, scale);
392 while ((c = *s++) != 0)
399 const char* sp = (
const char*) s;
401 while ((c = pgm_read_byte(sp++)) != 0)
417 const uint8_t* ip = (
const uint8_t*) pgm_read_word(tab + ix);
418 uint8_t x, y, r, g, b, w, h, s;
422 switch (pgm_read_byte(ip++)) {
426 ix = pgm_read_byte(ip++);
431 r = pgm_read_byte(ip++);
432 g = pgm_read_byte(ip++);
433 b = pgm_read_byte(ip++);
437 r = pgm_read_byte(ip++);
438 g = pgm_read_byte(ip++);
439 b = pgm_read_byte(ip++);
443 r = pgm_read_byte(ip++);
444 g = pgm_read_byte(ip++);
445 b = pgm_read_byte(ip++);
452 ix = pgm_read_byte(ip++);
457 x = pgm_read_byte(ip++);
458 y = pgm_read_byte(ip++);
462 dx = pgm_read_byte(ip++);
463 dy = pgm_read_byte(ip++);
467 ix = pgm_read_byte(ip++);
469 w = pgm_read_byte(ip++);
470 h = pgm_read_byte(ip++);
471 s = pgm_read_byte(ip++);
472 draw_bitmap((
const uint8_t*) pgm_read_word(tab + ix), w, h, s);
475 ix = pgm_read_byte(ip++);
477 s = pgm_read_byte(ip++);
478 draw_icon((
const uint8_t*) pgm_read_word(tab + ix), s);
484 x = pgm_read_byte(ip++);
485 y = pgm_read_byte(ip++);
489 ix = pgm_read_byte(ip++);
491 s = pgm_read_byte(ip++);
492 draw_poly_P((
const int8_t*) pgm_read_word(tab + ix), s);
495 ix = pgm_read_byte(ip++);
497 s = pgm_read_byte(ip++);
501 w = pgm_read_byte(ip++);
502 h = pgm_read_byte(ip++);
506 w = pgm_read_byte(ip++);
507 h = pgm_read_byte(ip++);
511 w = pgm_read_byte(ip++);
512 h = pgm_read_byte(ip++);
513 r = pgm_read_byte(ip++);
517 w = pgm_read_byte(ip++);
518 h = pgm_read_byte(ip++);
519 r = pgm_read_byte(ip++);
523 r = pgm_read_byte(ip++);
527 r = pgm_read_byte(ip++);
531 c = pgm_read_byte(ip++);
535 ix = pgm_read_byte(ip++);
color16_t set_text_color(color16_t color)
virtual uint8_t set_orientation(uint8_t direction)
void set_cursor(uint16_t x, uint16_t y)
virtual uint8_t get_orientation()
virtual void draw_char(uint16_t x, uint16_t y, char c)
static const size_t BUFFER_MAX
virtual void draw_circle(uint16_t x, uint16_t y, uint16_t radius)
virtual void draw_image(uint16_t x, uint16_t y, Image *image)
color16_t color(uint8_t red, uint8_t green, uint8_t blue)
color16_t set_pen_color(color16_t color)
IOStream & tab(IOStream &outs)
color16_t set_canvas_color(color16_t color)
color16_t get_canvas_color() const
virtual void draw_icon(uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1)
void run(uint8_t ix, const void_P *tab, uint8_t max)
Font * set_text_font(Font *font)
uint8_t get_text_scale() const
uint8_t set_text_scale(uint8_t scale)
void move_cursor(int16_t dx, int16_t dy)
virtual void fill_circle(uint16_t x, uint16_t y, uint16_t radius)
virtual void fill_rect(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
color16_t get_text_color() const
const class prog_str * str_P
void get_cursor(uint16_t &x, uint16_t &y) const
Font * get_text_font() const
virtual void fill_roundrect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius)
virtual void fill_screen()
virtual void draw_string(char *s)
static color16_t shade(color16_t color, uint8_t scale)
virtual bool read(color16_t *buf, size_t count)=0
virtual void draw_poly_P(const int8_t *poly, uint8_t scale=1)
virtual void draw_line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
virtual void draw_vertical_line(uint16_t x, uint16_t y, uint16_t length)
virtual void draw_roundrect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius)
virtual void draw(Canvas *canvas, char c, uint16_t x, uint16_t y, uint8_t scale)
virtual void draw_bitmap(uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1)
virtual void draw_stroke_P(const int8_t *stroke, uint8_t scale=1)
virtual void draw_horizontal_line(uint16_t x, uint16_t y, uint16_t length)
static color16_t blend(color16_t c1, color16_t c2)
virtual void draw_rect(uint16_t x, uint16_t y, uint16_t width, uint16_t height)