Example #1
0
File: graph.c Project: bunnie/uGFX
static void pointto(GGraphObject *gg, coord_t x, coord_t y, const GGraphPointStyle *style) {
	if (style->type == GGRAPH_POINT_NONE)
		return;

	// Convert to device space. Note the y-axis is inverted.
	x += gg->g.x + gg->xorigin;
	y = gg->g.y + gg->g.height - 1 - gg->yorigin - y;

	if (style->size <= 1) {
		gdispDrawPixel(x, y, style->color);
		return;
	}

	switch(style->type) {
	case GGRAPH_POINT_SQUARE:
		gdispDrawBox(x-style->size, y-style->size, 2*style->size, 2*style->size, style->color);
		break;
#if GDISP_NEED_CIRCLE
	case GGRAPH_POINT_CIRCLE:
		gdispDrawCircle(x, y, style->size, style->color);
		break;
#endif
	case GGRAPH_POINT_DOT:
	default:
		gdispDrawPixel(x, y, style->color);
		break;
	}
}
Example #2
0
File: main.c Project: GottZ/olvfw
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);
    }   
}
Example #3
0
File: gwin.c Project: bunnie/uGFX
	void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius) {
		if (!((gh->flags & GWIN_FLG_VISIBLE)))
			return;

		#if GDISP_NEED_CLIP
			gdispSetClip(gh->x, gh->y, gh->width, gh->height);
		#endif
		gdispDrawCircle(gh->x+x, gh->y+y, radius, gh->color);
	}
Example #4
0
/// \method circle(x1, y1, r, colour)
///
/// Draw a circle having a centre point at (x1,y1), radius r, using the given colour.
/// Option to round the ends
///
STATIC mp_obj_t pyb_ugfx_circle(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 r = mp_obj_get_int(args[3]);
    int col = mp_obj_get_int(args[4]);


	gdispDrawCircle(x0, y0, r, col);	

    return mp_const_none;
}
Example #5
0
File: main.c Project: DaviWei/uGFX
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);
    }   
}