void ShZshapeManager::end(const char* content) { if (content == "cube") { end_cube(); } if (content == "cylinder") { end_cylinder(); } if (content == "pipe") { end_pipe(); } if (content == "cone") { end_cone(); } if (content == "circle") { end_circle(); } if (content == "ring") { end_ring(); } if (content == "pyramid") { end_pyramid(); } if (content == "triangle") { end_triangle(); } if (content == "rectangle") { end_rectangle(); } if (content == "polygon") { end_polygon(); } if (content == "multigonalStar") { end_multigonalStar(); } }
static void rect(double x, double y, double w, double h, GR_WINDOW_ID pmap, GR_GC_ID gc) { double r = x + w; double t = y + h; begin_polygon(); vertex(x, y); vertex(r, y); vertex(r, t); vertex(x, t); end_polygon(pmap, gc); }
void draw_clock(int x, int y, int w, int h, GR_WINDOW_ID pmap, GR_GC_ID gc, GR_WINDOW_ID window) { int i; GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_WINDOW)); GrFillRect(pmap, gc, 0, 0, w, h); tick(); push_matrix(); translate(x + w / 2.0 - .5, y + h / 2.0 - .5); scale_xy((w - 1) / 28.0, (h - 1) / 28.0); if (type() == ROUND_CLOCK) { GrSetGCForeground(gc, BLACK); begin_polygon(); circle(0, 0, 14, pmap, gc, w, h); end_polygon(pmap, gc); GrSetGCForeground(gc, BLACK); begin_loop(); circle(0, 0, 14, pmap, gc, w, h); end_loop(pmap, gc); } //draw the shadows push_matrix(); translate(0.60, 0.60); draw_clock_hands(LTGRAY, LTGRAY, pmap, gc); pop_matrix(); //draw the tick marks push_matrix(); GrSetGCForeground(gc, BLACK); for (i = 0; i < 12; i++) { if (6 == i) rect(-0.5, 9, 1, 2, pmap, gc); else if (3 == i || 0 == i || 9 == i) rect(-0.5, 9.5, 1, 1, pmap, gc); else rect(-0.25, 9.5, .5, 1, pmap, gc); rotate(-30); } pop_matrix(); //draw the hands draw_clock_hands(GRAY, BLACK, pmap, gc); pop_matrix(); GrCopyArea(window, gc, 0, 0, w, h, pmap, 0, 0, MWROP_SRCCOPY); }
static void drawhand(double ang, const float v[][2], GR_COLOR fill, GR_COLOR line, GR_WINDOW_ID pmap, GR_GC_ID gc) { int i; push_matrix(); rotate(ang); GrSetGCForeground(gc, fill); begin_polygon(); for (i = 0; i < 4; i++) vertex(v[i][0], v[i][1]); end_polygon(pmap, gc); GrSetGCForeground(gc, line); begin_loop(); for (i = 0; i < 4; i++) vertex(v[i][0], v[i][1]); end_loop(pmap, gc); pop_matrix(); }