int Path::ReplacePoint(Geom::Point const &iPt) { if (pts.empty()) { return -1; } int const n = pts.size() - 1; pts[n] = path_lineto(polyline_lineto, iPt); return n; }
int Path::AddForcedPoint(Geom::Point const &iPt) { if (back) { return AddForcedPoint (iPt, -1, 0.0); } if ( pts.empty() || pts.back().isMoveTo != polyline_lineto ) { return -1; } int const n = pts.size(); pts.push_back(path_lineto(polyline_forced, pts[n - 1].p)); return n; }
int Path::AddPoint(Geom::Point const &iPt, int ip, double it, bool mvto) { if (back == false) { return AddPoint (iPt, mvto); } if ( !mvto && pts.empty() == false && pts.back().p == iPt ) { return -1; } int const n = pts.size(); pts.push_back(path_lineto(mvto ? polyline_moveto : polyline_lineto, iPt, ip, it)); return n; }
int Path::AddForcedPoint(Geom::Point const &iPt, int /*ip*/, double /*it*/) { /* FIXME: ip & it aren't used. Is this deliberate? */ if (!back) { return AddForcedPoint (iPt); } if ( pts.empty() || pts.back().isMoveTo != polyline_lineto ) { return -1; } int const n = pts.size(); pts.push_back(path_lineto(polyline_forced, pts[n - 1].p, pts[n - 1].piece, pts[n - 1].t)); return n; }
void path_close(Path* path) { int n; for (n=path->end; n>=0; n--) { if (path->bpath[n].code == ART_MOVETO_OPEN) { path->bpath[n].code = ART_MOVETO; if (path->bpath[path->end-1].x3 != path->bpath[n].x3 || path->bpath[path->end-1].y3 != path->bpath[n].y3) path_lineto (path, path->bpath[n].x3, path->bpath[n].y3); break; } } }