2 void swf_DrawerInit(SWFSHAPEDRAWER*draw, TAG*tag)
6 tag = swf_InsertTag(0, ST_DEFINESHAPE);
10 swf_ShapeNew(&draw->shape);
13 swf_SetU8(draw->tag,0);
14 draw->shape->bits.fill = 1;
15 draw->shape->bits.line = 0;
16 swf_ShapeSetStyle(draw->tag,draw->shape,0,1,0);
18 void swf_DrawerMoveTo(SWFSHAPEDRAWER*draw, FPOINT * to)
20 swf_ShapeSetMove(draw->tag,draw->shape,(int)(to->x*20), (int)(to->y*20));
23 void swf_DrawerLineTo(SWFSHAPEDRAWER*draw, FPOINT * to)
25 swf_ShapeSetMove(draw->tag,draw->shape,(int)(to->x*20), (int)(to->y*20));
28 void swf_DrawerSplineTo(SWFSHAPEDRAWER*draw, FPOINT * c1, FPOINT* to)
30 swf_ShapeSetSpline(draw->tag,draw->shape,
31 (int)(c1->x*20), (int)(c1->y*20),
32 (int)(to->x*20), (int)(to->y*20),
36 void swf_DrawerCubicTo(SWFSHAPEDRAWER*draw, FPOINT* c1, FPOINT* c2, FPOINT* to)
40 void swf_DrawerConicTo(SWFSHAPEDRAWER*draw, FPOINT* c, FPOINT* to)
42 FPOINT* pos = draw->pos;
44 c1.x = (pos->x + 2 * c->x) / 3;
45 c1.y = (pos->y + 2 * c->y) / 3;
46 c2.x = (2 * c->x + to->x) / 3;
47 c2.y = (2 * c->y + to->y) / 3;
48 swf_DrawerCubicTo(draw, &c1,&c2,to);
52 void swf_DrawerFinish(SWFSHAPEDRAWER*draw)
54 swf_ShapeSetEnd(draw->tag);
56 void swf_Drawer2Shape(SWFSHAPEDRAWER*draw, SHAPE*shape)
58 memset(shape, 0, sizeof(SHAPE));
59 shape->bitlen = (draw->tag->len-1)*8;
60 shape->data = (U8*)malloc(draw->tag->len-1);
61 memcpy(shape->data, &draw->tag->data[1], draw->tag->len-1);
63 void swf_DrawerFree(SWFSHAPEDRAWER*draw)
69 swf_ShapeFree(draw->s);