REG8 lio_gcircle(GLIO lio) { GCIRCLE dat; SINT16 cx; SINT16 cy; SINT16 rx; SINT16 ry; REG8 pal; SINT16 d1; SINT16 d2; SINT16 d3; lio_updatedraw(lio); MEMR_READS(CPU_DS, CPU_BX, &dat, sizeof(dat)); // チェック if (dat.flag & 0x7f) { TRACEOUT(("LIO GCIRCLE not support flags: %.2x", dat.flag)); } cx = (SINT16)LOADINTELWORD(dat.cx); cy = (SINT16)LOADINTELWORD(dat.cy); rx = (SINT16)LOADINTELWORD(dat.rx); ry = (SINT16)LOADINTELWORD(dat.ry); pal = dat.pal; if (pal == 0xff) { pal = lio->work.fgcolor; } if (rx != ry) { TRACEOUT(("LIO GCIRCLE not support ellipse")); return(LIO_SUCCESS); } // 単純な円の描画 d1 = 0; d2 = ry; d3 = 0 - ry; while(d1 <= d2) { draw4(lio, cx, cy, d1, d2, pal); draw4(lio, cx, cy, d2, d1, pal); lio->wait += 8 * (10 + 10 + 10); d1++; d3 += (d1 * 2) - 1; if (d3 >= 0) { d2--; d3 -= d2 * 2; } } return(LIO_SUCCESS); }
static void draw_open_contour (void) // // draw an open contour using draw3up() at the beginning, // draw3down() at the end and draw4() inbetween. // { point p,p0,p1,p2,p3; // shift start position to first element after a boundary while ( start->p != Outside) start = start->next; start = start->next; p0 = start; do { // one point p1 = p0; if ( p1->p == Outside) break; p2 = p1->next; p3 = p2->next; // two points if ( p3->p == Outside) { draw_line(p1->p,p2->p); p0 = p3->next; // three or more point } else { // interpolate at boundary draw3up(p1,p2,p3); p = p3->next; // more than three point while ( p->p != Outside) { draw4(p1,p2,p3,p); p1 = p2; p2 = p3; p3 = p; p = p->next; } // interpolate at boundary draw3down(p3,p2,p1); // skip to first element after boundary p0 = p->next; } } while (p0 != start); }
static void draw_closed_contour (void) // // draw a closed contour using draw4 // { point p,p1,p2,p3; first = true; p1 = start; p2 = p1->next; p3 = p2->next; p = p3; start = p3; do { p = p->next; draw4(p1,p2,p3,p); p1 = p2; p2 = p3; p3 = p; } while (p != start); }