git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added "scale" attribute to swf_Render_Init().
[swftools.git]
/
lib
/
drawer.c
diff --git
a/lib/drawer.c
b/lib/drawer.c
index
1b4f7e9
..
bcab2eb
100644
(file)
--- a/
lib/drawer.c
+++ b/
lib/drawer.c
@@
-64,13
+64,17
@@
void draw_string(drawer_t*draw, const char*string)
char*token = getToken(&p);
if(!token || !*token)
break;
char*token = getToken(&p);
if(!token || !*token)
break;
- if(!strncmp(token, "moveTo", 6)) {
+ if(!strncmp(token, "moveTo", 6) ||
+ !strncmp(token, "M", 1) //svg
+ ) {
FPOINT to;
to.x = atoi(getToken(&p));
to.y = atoi(getToken(&p));
draw->moveTo(draw, &to);
}
FPOINT to;
to.x = atoi(getToken(&p));
to.y = atoi(getToken(&p));
draw->moveTo(draw, &to);
}
- else if(!strncmp(token, "lineTo", 6)) {
+ else if(!strncmp(token, "lineTo", 6) ||
+ !strncmp(token, "L", 1) //svg
+ ) {
FPOINT to;
to.x = atoi(getToken(&p));
to.y = atoi(getToken(&p));
FPOINT to;
to.x = atoi(getToken(&p));
to.y = atoi(getToken(&p));
@@
-92,7
+96,9
@@
void draw_string(drawer_t*draw, const char*string)
to.y = atoi(getToken(&p));
draw_conicTo(draw, &mid, &to);
}
to.y = atoi(getToken(&p));
draw_conicTo(draw, &mid, &to);
}
- else if(!strncmp(token, "cubicTo", 5)) {
+ else if(!strncmp(token, "cubicTo", 5) ||
+ !strncmp(token, "C", 1) //svg
+ ) {
FPOINT mid1,mid2,to;
mid1.x = atoi(getToken(&p));
mid1.y = atoi(getToken(&p));
FPOINT mid1,mid2,to;
mid1.x = atoi(getToken(&p));
mid1.y = atoi(getToken(&p));
@@
-102,7
+108,12
@@
void draw_string(drawer_t*draw, const char*string)
to.y = atoi(getToken(&p));
draw_cubicTo(draw, &mid1, &mid2, &to);
}
to.y = atoi(getToken(&p));
draw_cubicTo(draw, &mid1, &mid2, &to);
}
- else fprintf(stderr, "drawer: Warning: unknown primitive '%s'\n", token);
+ else if(!strncmp(token, "z", 1) //svg
+ ) {
+ // ignore
+ }
+ else
+ fprintf(stderr, "drawer: Warning: unknown primitive '%s'\n", token);
free(token);
}
free(token);
}
@@
-236,6
+247,9
@@
static int approximate3(const struct cspline*s, struct qspline*q, int size, doub
/* convert control point representation to
d*x^3 + c*x^2 + b*x + a */
/* convert control point representation to
d*x^3 + c*x^2 + b*x + a */
+
+ /* FIXME: we need to do this for the subspline between [start,end],
+ not [0,1] */
dx= s->end.x - s->control2.x*3 + s->control1.x*3 - s->start.x;
dy= s->end.y - s->control2.y*3 + s->control1.y*3 - s->start.y;
dx= s->end.x - s->control2.x*3 + s->control1.x*3 - s->start.x;
dy= s->end.y - s->control2.y*3 + s->control1.y*3 - s->start.y;