void gdispFillRoundedBox(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t radius, color_t color) { coord_t radius2; radius2 = radius*2; if (radius2 > cx || radius2 > cy) { gdispFillArea(x, y, cx, cy, color); return; } gdispFillArc(x+radius, y+radius, radius, 90, 180, color); gdispFillArea(x+radius+1, y, cx-radius2, radius, color); gdispFillArc(x+cx-1-radius, y+radius, radius, 0, 90, color); gdispFillArc(x+cx-1-radius, y+cy-1-radius, radius, 270, 360, color); gdispFillArea(x+radius+1, y+cy-radius, cx-radius2, radius, color); gdispFillArc(x+radius, y+cy-1-radius, radius, 180, 270, color); gdispFillArea(x, y+radius, cx, cy-radius2, 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 gwinFillArc(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 gdispFillArc(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); } }