void drawround(int x0, int y0, int w, int h, int corner) { draw_roundrect(x0, y0, w, h, corner ,MAKE_COLORREF(r,g,b)); }
void Canvas::run(uint8_t ix, const void_P* tab, uint8_t max) { if (ix >= max) return; const uint8_t* ip = (const uint8_t*) pgm_read_word(tab + ix); uint8_t x, y, r, g, b, w, h, s; int8_t dx, dy; char c; while (1) { switch (pgm_read_byte(ip++)) { case END_SCRIPT: return; case CALL_SCRIPT: ix = pgm_read_byte(ip++); if (ix >= max) return; run(ix, tab, max); break; case SET_CANVAS_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_canvas_color(color(r, b, g)); break; case SET_PEN_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_pen_color(color(r, g, b)); break; case SET_TEXT_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_text_color(color(r, g, b)); break; case SET_TEXT_SCALE: set_text_scale(pgm_read_byte(ip++)); break; case SET_TEXT_FONT: ix = pgm_read_byte(ip++); if (ix >= max) return; set_text_font((Font*) pgm_read_word(tab + ix)); break; case SET_CURSOR: x = pgm_read_byte(ip++); y = pgm_read_byte(ip++); set_cursor(x, y); break; case MOVE_CURSOR: dx = pgm_read_byte(ip++); dy = pgm_read_byte(ip++); move_cursor(dx, dy); break; case DRAW_BITMAP: ix = pgm_read_byte(ip++); if (ix >= max) return; w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); s = pgm_read_byte(ip++); draw_bitmap((const uint8_t*) pgm_read_word(tab + ix), w, h, s); break; case DRAW_ICON: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_icon((const uint8_t*) pgm_read_word(tab + ix), s); break; case DRAW_PIXEL: draw_pixel(); break; case DRAW_LINE: x = pgm_read_byte(ip++); y = pgm_read_byte(ip++); draw_line(x, y); break; case DRAW_POLY: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_poly_P((const int8_t*) pgm_read_word(tab + ix), s); break; case DRAW_STROKE: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_stroke_P((const int8_t*) pgm_read_word(tab + ix), s); break; case DRAW_RECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); draw_rect(w, h); break; case FILL_RECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); fill_rect(w, h); break; case DRAW_ROUNDRECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); r = pgm_read_byte(ip++); draw_roundrect(w, h, r); break; case FILL_ROUNDRECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); r = pgm_read_byte(ip++); fill_roundrect(w, h, r); break; case DRAW_CIRCLE: r = pgm_read_byte(ip++); draw_circle(r); break; case FILL_CIRCLE: r = pgm_read_byte(ip++); fill_circle(r); break; case DRAW_CHAR: c = pgm_read_byte(ip++); draw_char(c); break; case DRAW_STRING: ix = pgm_read_byte(ip++); if (ix >= max) return; draw_string_P((const char*) pgm_read_word(tab + ix)); break; case FILL_SCREEN: fill_screen(); break; default: return; } } }