void spiro_to_bpath0(const spiro_cp *src, const spiro_seg *s, double *dm, int ncq, int n, bezctx *bc) { int i, j, nsegs; double x0, y0, x1, y1; #ifdef VERBOSE printf("spiro_to_bpath0 n=%d s=%d bc=%d\n",n,s==NULL ? 0:1,bc==NULL ? 0:1); #endif if (s==NULL || n <= 0 || bc==NULL) return; nsegs = s[n - 1].ty == '}' ? \ s[n - 2].ty == 'a' ? n - 2 : n - 1 : n; for (i=j=0; i < nsegs; i++,j++) { x0 = s[i].x; y0 = s[i].y; if (i == 0) { if (src != NULL) { bezctx_moveto(bc, src[0].x, src[0].y, s[0].ty == '{'); } else { bezctx_moveto(bc, (x0 * dm[0] + dm[1]), (y0 * dm[0] + dm[2]), s[0].ty == '{'); } if (nsegs > 1 && s[1].ty == 'h') ++i; } else if (s[i].ty == 'a') ++i; x1 = s[i + 1].x; y1 = s[i + 1].y; if (src != NULL) { dm[3] = src[i + 1].x; dm[4] = src[i + 1].y; } else { dm[3] = (x1 * dm[0] + dm[1]); dm[4] = (y1 * dm[0] + dm[2]); } bezctx_mark_knot(bc, j); spiro_seg_to_bpath0(s[i].ks, dm, x0, y0, x1, y1, bc, ncq, 0); } }
void spiro_to_bpath(const spiro_seg *s, int n, bezctx *bc) { int i; int nsegs = s[n - 1].ty == '}' ? n - 1 : n; for (i = 0; i < nsegs; i++) { double x0 = s[i].x; double y0 = s[i].y; double x1 = s[i + 1].x; double y1 = s[i + 1].y; if (i == 0) bezctx_moveto(bc, x0, y0, s[0].ty == '{'); bezctx_mark_knot(bc, i); spiro_seg_to_bpath(s[i].ks, x0, y0, x1, y1, bc, 0); } }
void spiro_to_bpath(const spiro_seg *s, int n, bezctx *bc) { int i, nsegs; double x0, y0, x1, y1; if (s==NULL || n <= 0 || bc==NULL) return; nsegs = s[n - 1].ty == '}' ? n - 1 : n; for (i = 0; i < nsegs; i++) { x0 = s[i].x; x1 = s[i + 1].x; y0 = s[i].y; y1 = s[i + 1].y; if (i == 0) bezctx_moveto(bc, x0, y0, s[0].ty == '{'); bezctx_mark_knot(bc, i); spiro_seg_to_bpath(s[i].ks, x0, y0, x1, y1, bc, 0); } }