pos = 0;
l2 = line;
+ int lastmove=-1;
while(l2) {
if(l2->type == gfx_moveTo) {
vec[pos].code = ART_MOVETO_OPEN;
vec[pos].x = l2->x;
vec[pos].y = l2->y;
+ lastmove=pos;
pos++;
assert(pos<=len);
} else if(l2->type == gfx_lineTo) {
}
x = l2->x;
y = l2->y;
+
+ /* let closed line segments start w/ MOVETO instead of MOVETO_OPEN */
+ if(lastmove>=0 && l2->type!=gfx_moveTo && (!l2->next || l2->next->type == gfx_moveTo)) {
+ if(vec[lastmove].x == l2->x &&
+ vec[lastmove].y == l2->y) {
+ assert(vec[lastmove].code == ART_MOVETO_OPEN);
+ vec[lastmove].code = ART_MOVETO;
+ }
+ }
+
l2 = l2->next;
}
vec[pos++].code = ART_END;
}
}
+void gfxPath_dump(GfxPath*path)
+{
+ int num = path->getNumSubpaths();
+ int t;
+ int cpos=0;
+ for(t = 0; t < num; t++) {
+ GfxSubpath *subpath = path->getSubpath(t);
+ int subnum = subpath->getNumPoints();
+ int s;
+ for(s=0;s<subnum;s++) {
+ double x=subpath->getX(s);
+ double y=subpath->getY(s);
+ if(s==0 && !subpath->getCurve(s)) {
+ printf("M %f %f\n", x, y);
+ } else if(s==0 && subpath->getCurve(s)) {
+ printf("E %f %f\n", x, y);
+ } else if(subpath->getCurve(s)) {
+ printf("C %f %f\n", x, y);
+ } else {
+ printf("T %f %f\n", x, y);
+ }
+ }
+ }
+}
+
gfxline_t* GFXOutputDev::gfxPath_to_gfxline(GfxState*state, GfxPath*path, int closed, int user_movex, int user_movey)
{
int num = path->getNumSubpaths();