void gdispDrawRoundedBox(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t radius, color_t color) { if (2*radius > cx || 2*radius > cy) { gdispDrawBox(x, y, cx, cy, color); return; } gdispDrawArc(x+radius, y+radius, radius, 90, 180, color); gdispDrawLine(x+radius+1, y, x+cx-2-radius, y, color); gdispDrawArc(x+cx-1-radius, y+radius, radius, 0, 90, color); gdispDrawLine(x+cx-1, y+radius+1, x+cx-1, y+cy-2-radius, color); gdispDrawArc(x+cx-1-radius, y+cy-1-radius, radius, 270, 360, color); gdispDrawLine(x+radius+1, y+cy-1, x+cx-2-radius, y+cy-1, color); gdispDrawArc(x+radius, y+cy-1-radius, radius, 180, 270, color); gdispDrawLine(x, y+radius+1, x, y+cy-2-radius, color); }
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 gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle) { if (!((gh->flags & GWIN_FLG_VISIBLE))) return; #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif gdispDrawArc(gh->x+x, gh->y+y, radius, startangle, endangle, gh->color); }
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); } }