int main(void) { coord_t width, height; halInit(); chSysInit(); /* Initialize and clear the display */ gdispInit(); gdispClear(Black); // Get the screen size width = gdispGetWidth(); height = gdispGetHeight(); // Code Here gdispDrawCircle(width/2, height/2, 20, Yellow); gdispFillCircle (width/4, height/4, 50, Blue); gdispFillEllipse (width-100, height-100, 30, 60, Red); gdispDrawEllipse (width-100, height-100, 50, 20, Yellow); gdispDrawArc(width-width/8, height/8, 30, 10, 70, Gray); gdispFillArc(width/8, height/8, 30, 10, 70, Gray); while(TRUE) { chThdSleepMilliseconds(500); } }
void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b) { if (!((gh->flags & GWIN_FLG_VISIBLE))) return; #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif gdispDrawEllipse(gh->x+x, gh->y+y, a, b, gh->color); }
/// \method ellipse(x1, y1, a, b, colour) /// /// Draw a ellipse having a centre point at (x1,y1), lengths a,b, using the given colour. /// Option to round the ends /// STATIC mp_obj_t pyb_ugfx_ellipse(mp_uint_t n_args, const mp_obj_t *args) { // extract arguments //pyb_ugfx_obj_t *self = args[0]; int x0 = mp_obj_get_int(args[1]); int y0 = mp_obj_get_int(args[2]); int a = mp_obj_get_int(args[3]); int b = mp_obj_get_int(args[4]); int col = mp_obj_get_int(args[5]); gdispDrawEllipse(x0, y0, a, b, col); return mp_const_none; }
int main(void) { coord_t width, height; /* Initialize and clear the display */ gfxInit(); // Get the screen size width = gdispGetWidth(); height = gdispGetHeight(); // Code Here gdispFillArc(width/2, height/2, width/4, -10, -45, White); gdispDrawCircle(width/2+width/8, height/2-height/8, 13, Green); gdispFillCircle (width/2+width/8, height/2-height/8, 10, Red); gdispDrawArc(width/2+width/8, height/2-height/8, 20, 25, 115, Gray); gdispFillEllipse (width-width/6, height-height/6, width/8, height/16, Blue); gdispDrawEllipse (width-width/6, height-height/6, width/16, height/8, Yellow); while(TRUE) { gfxSleepMilliseconds(500); } }