5 Extension module for the rfxswf library.
6 Part of the swftools package.
8 Copyright (c) 2001 Rainer Böhme <rfxswf@reflex-studio.de>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 #define SF_MOVETO 0x01
28 #define SF_NEWSTYLE 0x10
30 #define FILL_SOLID 0x00
31 #define FILL_LINEAR 0x10 // Gradient
32 #define FILL_RADIAL 0x12
33 #define FILL_TILED 0x40 // Bitmap
34 #define FILL_CLIPPED 0x41
36 void swf_ShapeFree(SHAPE * s)
40 if (s->linestyle.data) free(s->linestyle.data);
41 s->linestyle.data = NULL;
43 if (s->fillstyle.data) free(s->fillstyle.data);
44 s->fillstyle.data = NULL;
46 if (s->data) free(s->data);
51 int swf_ShapeNew(SHAPE * * s)
55 sh = (SHAPE *)malloc(sizeof(SHAPE));
57 memset(sh,0,sizeof(SHAPE));
61 int swf_GetSimpleShape(TAG * t,SHAPE * * s) // without Linestyle/Fillstyle Record
67 if (FAILED(swf_ShapeNew(s))) return -1;
71 sh->bits.fill = (U16)swf_GetBits(t,4);
72 sh->bits.line = (U16)swf_GetBits(t,4);
73 bitl = 0; end = 0; pos = swf_GetTagPos(t);
76 { int edge = swf_GetBits(t,1); bitl+=1;
79 if (swf_GetBits(t,1)) // Line
80 { U16 nbits = swf_GetBits(t,4)+2;
83 if (swf_GetBits(t,1)) // x/y Line
84 { swf_GetBits(t,nbits);
89 { swf_GetBits(t,nbits+1);
94 { U16 nbits = swf_GetBits(t,4)+2;
100 swf_GetBits(t,nbits);
106 { U16 flags = swf_GetBits(t,5); bitl+=5;
110 { U16 nbits = swf_GetBits(t,5); bitl+=5;
111 swf_GetBits(t,nbits);
112 swf_GetBits(t,nbits);
117 { swf_GetBits(t,sh->bits.fill);
122 { swf_GetBits(t,sh->bits.fill);
127 { swf_GetBits(t,sh->bits.line);
131 if (flags&SF_NEWSTYLE)
132 { fprintf(stderr,"RFXSWF: Can't process extended styles in shape.\n");
138 swf_SetTagPos(t,pos);
141 if (sh->data) free(sh->data);
142 sh->data = (U8*)malloc(len);
146 swf_GetBlock(t,sh->data,len);
153 int swf_SetSimpleShape(TAG * t,SHAPE * s) // without Linestyle/Fillstyle Record
160 { swf_ResetWriteBits(t);
162 swf_SetBits(t,s->bits.fill,4);
163 swf_SetBits(t,s->bits.line,4);
164 swf_SetBlock(t,s->data,l);
166 swf_ResetWriteBits(t);
171 int swf_SetFillStyle(TAG * t,FILLSTYLE * f)
172 { if ((!t)||(!f)) return -1;
173 swf_SetU8(t,f->type);
177 if (swf_GetTagID(t)!=ST_DEFINESHAPE3) swf_SetRGB(t,&f->color);
178 else swf_SetRGBA(t,&f->color);
183 swf_SetU16(t,f->id_bitmap);
184 swf_SetMatrix(t,&f->m);
188 swf_SetMatrix(t,&f->m);
189 swf_SetGradient(t,&f->gradient,/*alpha?*/t->id==ST_DEFINESHAPE3?1:0);
196 int swf_SetLineStyle(TAG * t,LINESTYLE * l)
197 { if ((!l)||(!t)) return -1;
198 swf_SetU16(t,l->width);
200 if (swf_GetTagID(t)!=ST_DEFINESHAPE3) swf_SetRGB(t,&l->color);
201 else swf_SetRGBA(t,&l->color);
206 int swf_SetShapeStyleCount(TAG * t,U16 n)
218 int swf_SetShapeStyles(TAG * t,SHAPE * s)
223 l += swf_SetShapeStyleCount(t,s->fillstyle.n);
225 for (i=0;i<s->fillstyle.n;i++)
226 l+=swf_SetFillStyle(t,&s->fillstyle.data[i]);
228 l += swf_SetShapeStyleCount(t,s->linestyle.n);
230 for (i=0;i<s->linestyle.n;i++)
231 l+=swf_SetLineStyle(t,&s->linestyle.data[i]);
236 int swf_ShapeCountBits(SHAPE * s,U8 * fbits,U8 * lbits)
238 s->bits.fill = swf_CountUBits(s->fillstyle.n, 0);
239 s->bits.line = swf_CountUBits(s->linestyle.n, 0);
240 if (fbits) fbits[0] = s->bits.fill;
241 if (lbits) lbits[0] = s->bits.line;
245 int swf_SetShapeBits(TAG * t,SHAPE * s)
246 { if ((!t)||(!s)) return -1;
247 swf_ResetWriteBits(t);
248 swf_SetBits(t,s->bits.fill,4);
249 swf_SetBits(t,s->bits.line,4);
253 int swf_SetShapeHeader(TAG * t,SHAPE * s)
255 res = swf_SetShapeStyles(t,s);
256 if (res>=0) res = swf_ShapeCountBits(s,NULL,NULL);
257 if (res>=0) res = swf_SetShapeBits(t,s);
261 int swf_ShapeAddFillStyle(SHAPE * s,U8 type,MATRIX * m,RGBA * color,U16 id_bitmap, GRADIENT*gradient)
272 def_c.r = def_c.g = def_c.b = 0;
276 swf_GetMatrix(NULL,m);
281 swf_GetGradient(NULL, gradient, 1);
286 if (s->fillstyle.data)
287 { FILLSTYLE * new = (FILLSTYLE *)realloc(s->fillstyle.data,(s->fillstyle.n+1)*sizeof(FILLSTYLE));
289 s->fillstyle.data = new;
292 { s->fillstyle.data = (FILLSTYLE *)malloc(sizeof(FILLSTYLE));
294 if (!s->fillstyle.data) return -1;
299 s->fillstyle.data[s->fillstyle.n].type = type;
300 s->fillstyle.data[s->fillstyle.n].id_bitmap = id_bitmap;
301 memcpy(&s->fillstyle.data[s->fillstyle.n].m,m,sizeof(MATRIX));
302 memcpy(&s->fillstyle.data[s->fillstyle.n].color,color,sizeof(RGBA));
303 memcpy(&s->fillstyle.data[s->fillstyle.n].gradient,gradient,sizeof(GRADIENT));
305 return (++s->fillstyle.n);
308 int swf_ShapeAddSolidFillStyle(SHAPE * s,RGBA * color)
309 { return swf_ShapeAddFillStyle(s,FILL_SOLID,NULL,color,0,0);
312 int swf_ShapeAddBitmapFillStyle(SHAPE * s,MATRIX * m,U16 id_bitmap,int clip)
313 { return swf_ShapeAddFillStyle(s,clip?FILL_CLIPPED:FILL_TILED,m,NULL,id_bitmap,0);
316 int swf_ShapeAddGradientFillStyle(SHAPE * s,MATRIX * m,GRADIENT* gradient,int radial)
317 { return swf_ShapeAddFillStyle(s,radial?FILL_RADIAL:FILL_LINEAR,m,NULL,0,gradient);
320 int swf_ShapeAddLineStyle(SHAPE * s,U16 width,RGBA * color)
326 def.r = def.g = def.b = 0;
328 if (s->linestyle.data)
329 { LINESTYLE * new = (LINESTYLE *)realloc(s->linestyle.data,(s->linestyle.n+1)*sizeof(LINESTYLE));
331 s->linestyle.data = new;
334 { s->linestyle.data = (LINESTYLE *)malloc(sizeof(LINESTYLE));
336 if (!s->linestyle.data) return -1;
339 s->linestyle.data[s->linestyle.n].width = width;
340 memcpy(&s->linestyle.data[s->linestyle.n].color,color,sizeof(RGBA));
342 return (++s->linestyle.n);
345 int swf_ShapeSetMove(TAG * t,SHAPE * s,S32 x,S32 y)
349 swf_SetBits(t,SF_MOVETO,5);
351 b = swf_CountBits(x,0);
352 b = swf_CountBits(y,b);
361 int swf_ShapeSetStyle(TAG * t,SHAPE * s,int line,int fill0,int fill1)
362 { if ((!t)||(!s)) return -1;
365 swf_SetBits(t,(line?SF_LINE:0)|(fill0?SF_FILL0:0)|(fill1?SF_FILL1:0),5);
367 if (fill0) swf_SetBits(t,fill0,s->bits.fill);
368 if (fill1) swf_SetBits(t,fill1,s->bits.fill);
369 if (line) swf_SetBits(t,line ,s->bits.line);
374 /* TODO: sometimes we want to set fillstyle 0, as that's the empty fill
375 used for line drawings. At the moment, we can't, as 0 fill be considered
376 nonexistent and therefore not set.
377 these defines are a workaround (they also reduce the maximal number of
378 fill styles to 32768)
380 #define UNDEFINED_COORD 0x7fffffff
382 int swf_ShapeSetAll(TAG * t,SHAPE * s,S32 x,S32 y,int line,int fill0,int fill1)
385 if ((!t)||(!s)) return -1;
387 if(x!=UNDEFINED_COORD || y!=UNDEFINED_COORD)
391 swf_SetBits(t,(hasmove?SF_MOVETO:0)|(line?SF_LINE:0)|(fill0?SF_FILL0:0)|(fill1?SF_FILL1:0),5);
394 b = swf_CountBits(x,0);
395 b = swf_CountBits(y,b);
401 if (fill0) swf_SetBits(t,fill0,s->bits.fill);
402 if (fill1) swf_SetBits(t,fill1,s->bits.fill);
403 if (line) swf_SetBits(t,line ,s->bits.line);
408 int swf_ShapeSetEnd(TAG * t)
411 swf_ResetWriteBits(t);
415 int swf_ShapeSetLine(TAG * t,SHAPE * s,S32 x,S32 y)
420 b = swf_CountBits(x,2);
421 b = swf_CountBits(y,b);
425 /* do not split into more than 16 segments. If the line is *that* long, something's broken */
426 fprintf(stderr, "Warning: Line to %.2f,%.2f is too long", (double)x,(double)y);
431 if(x>=0) { x1 = x/2;x2 = (x+1)/2;}
432 else { x1 = x/2;x2 = (x-1)/2;}
433 if(y>=0) { y1 = y/2;y2 = (y+1)/2;}
434 else { y1 = y/2;y2 = (y-1)/2;}
435 swf_ShapeSetLine(t, s, x1,y1);
436 swf_ShapeSetLine(t, s, x2,y2);
441 if(x!=0 && y!=0) { //(!s)||((x!=0)&&(y!=0)))
442 swf_SetBits(t,3,2); // Straight Edge
443 swf_SetBits(t, b-2, 4); //Number of Bits in x/y
444 swf_SetBits(t,1,1); // Diagonal
448 swf_SetBits(t,3,2); // Straight Edge
449 swf_SetBits(t, b-2, 4); //Number of Bits in y
450 swf_SetBits(t,1,2); // Vertical
453 swf_SetBits(t,3,2); // Straight Edge
454 swf_SetBits(t, b-2, 4); //Number of Bits in x
455 swf_SetBits(t,0,2); // Horizontal
461 int swf_ShapeSetCurve(TAG * t,SHAPE * s,S32 x,S32 y,S32 ax,S32 ay)
466 b = swf_CountBits(ax,2);
467 b = swf_CountBits(ay,b);
468 b = swf_CountBits(x,b);
469 b = swf_CountBits(y,b);
472 fprintf(stderr, "Bit overflow in swf_ShapeSetCurve- %d (%d,%d,%d,%d)\n", b, ax,ay,x,y);
477 swf_SetBits(t,b-2,4);
485 int swf_ShapeSetCircle(TAG * t,SHAPE * s,S32 x,S32 y,S32 rx,S32 ry)
486 { double C1 = 0.2930;
488 double begin = 0.7070;
492 swf_ShapeSetMove(t,s,x+begin*rx,y+begin*ry);
493 swf_ShapeSetCurve(t,s, -C1*rx, C1*ry, -C2*rx, 0);
494 swf_ShapeSetCurve(t,s, -C2*rx, 0, -C1*rx, -C1*ry);
495 swf_ShapeSetCurve(t,s, -C1*rx, -C1*ry, 0, -C2*ry);
496 swf_ShapeSetCurve(t,s, 0, -C2*ry, C1*rx, -C1*ry);
497 swf_ShapeSetCurve(t,s, C1*rx, -C1*ry, C2*rx, 0);
498 swf_ShapeSetCurve(t,s, C2*rx, 0, C1*rx, C1*ry);
499 swf_ShapeSetCurve(t,s, C1*rx, C1*ry, 0, C2*ry);
500 swf_ShapeSetCurve(t,s, 0, C2*ry, -C1*rx, C1*ry);
505 /* todo: merge this with swf_GetSimpleShape */
506 SHAPELINE* swf_ParseShapeData(U8*data, int bits, int fillbits, int linebits)
509 SHAPELINE*lines = &_lines;
518 memset(tag, 0, sizeof(TAG));
520 tag->len = tag->memsize = (bits+7)/8;
526 flags = swf_GetBits(tag, 1);
527 if(!flags) { //style change
528 flags = swf_GetBits(tag, 5);
532 int n = swf_GetBits(tag, 5);
533 x = swf_GetSBits(tag, n); //x
534 y = swf_GetSBits(tag, n); //y
537 fill0 = swf_GetBits(tag, fillbits);
539 fill1 = swf_GetBits(tag, fillbits);
541 line = swf_GetBits(tag, linebits);
543 fprintf(stderr, "Additional file styles style change not yet supported\n");
545 //enumerateUsedIDs_styles(tag, callback, callback_data, num);
546 fillbits = swf_GetBits(tag, 4);
547 linebits = swf_GetBits(tag, 4);
550 lines->next = (SHAPELINE*)malloc(sizeof(SHAPELINE));
552 lines->type = moveTo;
555 lines->sx = lines->sy = 0;
556 lines->fillstyle0 = fill0;
557 lines->fillstyle1 = fill1;
558 lines->linestyle = line;
562 flags = swf_GetBits(tag, 1);
563 if(flags) { //straight edge
564 int n = swf_GetBits(tag, 4) + 2;
565 if(swf_GetBits(tag, 1)) { //line flag
566 x += swf_GetSBits(tag, n); //delta x
567 y += swf_GetSBits(tag, n); //delta y
569 int v=swf_GetBits(tag, 1);
571 d = swf_GetSBits(tag, n); //vert/horz
575 lines->next = (SHAPELINE*)malloc(sizeof(SHAPELINE));
577 lines->type = lineTo;
580 lines->sx = lines->sy = 0;
581 lines->fillstyle0 = fill0;
582 lines->fillstyle1 = fill1;
583 lines->linestyle = line;
585 } else { //curved edge
586 int n = swf_GetBits(tag, 4) + 2;
588 x += swf_GetSBits(tag, n);
589 y += swf_GetSBits(tag, n);
592 x += swf_GetSBits(tag, n);
593 y += swf_GetSBits(tag, n);
595 lines->next = (SHAPELINE*)malloc(sizeof(SHAPELINE));
597 lines->type = splineTo;
602 lines->fillstyle0 = fill0;
603 lines->fillstyle1 = fill1;
604 lines->linestyle = line;
612 SRECT swf_GetShapeBoundingBox(SHAPE2*shape2)
615 SHAPELINE*l = shape2->lines;
618 r.xmin = r.ymin = SCOORD_MAX;
619 r.xmax = r.ymax = SCOORD_MIN;
624 t1 = shape2->linestyles[l->linestyle - 1].width*3/2;
629 if(l->type == lineTo || l->type == splineTo)
632 if(lastx - t1 < r.xmin) r.xmin = lastx - t1;
633 if(lasty - t1 < r.ymin) r.ymin = lasty - t1;
634 if(lastx + t1 > r.xmax) r.xmax = lastx + t1;
635 if(lasty + t1 > r.ymax) r.ymax = lasty + t1;
636 if(l->x - t1 < r.xmin) r.xmin = l->x - t1;
637 if(l->y - t1 < r.ymin) r.ymin = l->y - t1;
638 if(l->x + t1 > r.xmax) r.xmax = l->x + t1;
639 if(l->y + t1 > r.ymax) r.ymax = l->y + t1;
640 if(l->type == splineTo) {
641 if(l->sx - t1 < r.xmin) r.xmin = l->sx - t1;
642 if(l->sy - t1 < r.ymin) r.ymin = l->sy - t1;
643 if(l->sx + t1 > r.xmax) r.xmax = l->sx + t1;
644 if(l->sy + t1 > r.ymax) r.ymax = l->sy + t1;
651 if(!valid) memset(&r, 0, sizeof(SRECT));
655 void swf_Shape2Free(SHAPE2 * s)
657 SHAPELINE*line = s->lines;
659 SHAPELINE*next = line->next;
671 SHAPE2* swf_ShapeToShape2(SHAPE*shape) {
673 SHAPE2*shape2 = (SHAPE2*)malloc(sizeof(SHAPE2));
675 shape2->numlinestyles = shape->linestyle.n;
676 shape2->linestyles = (LINESTYLE*)malloc(sizeof(LINESTYLE)*shape->linestyle.n);
677 memcpy(shape2->linestyles, shape->linestyle.data, sizeof(LINESTYLE)*shape->linestyle.n);
679 shape2->numfillstyles = shape->fillstyle.n;
680 shape2->fillstyles = (FILLSTYLE*)malloc(sizeof(FILLSTYLE)*shape->fillstyle.n);
681 memcpy(shape2->fillstyles, shape->fillstyle.data, sizeof(FILLSTYLE)*shape->fillstyle.n);
683 shape2->lines = swf_ParseShapeData(shape->data, shape->bitlen, shape->bits.fill, shape->bits.line);
688 void swf_ShapeSetBitmapRect(TAG*tag, U16 gfxid, int width, int height)
696 swf_ShapeNew(&shape);
697 rgb.b = rgb.g = rgb.r = 0xff;
699 ls = swf_ShapeAddLineStyle(shape,20,&rgb);
700 swf_GetMatrix(NULL,&m);
704 fs = swf_ShapeAddBitmapFillStyle(shape,&m,gfxid,0);
711 swf_SetShapeStyles(tag,shape);
712 swf_ShapeCountBits(shape,NULL,NULL);
713 swf_SetShapeBits(tag,shape);
715 swf_ShapeSetAll(tag,shape,0,0,lines?ls:0,fs,0);
717 swf_ShapeSetLine(tag,shape,width*20,0);
718 swf_ShapeSetLine(tag,shape,0,height*20);
719 swf_ShapeSetLine(tag,shape,-width*20,0);
720 swf_ShapeSetLine(tag,shape,0,-height*20);
721 swf_ShapeSetEnd(tag);
722 swf_ShapeFree(shape);
725 void swf_Shape2ToShape(SHAPE2*shape2, SHAPE*shape)
727 TAG*tag = swf_InsertTag(0,0);
729 int newx=0,newy=0,lastx=0,lasty=0,oldls=0,oldfs0=0,oldfs1=0;
731 memset(shape, 0, sizeof(SHAPE));
733 shape->linestyle.n = shape2->numlinestyles;
734 shape->linestyle.data = (LINESTYLE*)malloc(sizeof(LINESTYLE)*shape->linestyle.n);
735 memcpy(shape->linestyle.data, shape2->linestyles, sizeof(LINESTYLE)*shape->linestyle.n);
737 shape->fillstyle.n = shape2->numfillstyles;
738 shape->fillstyle.data = (FILLSTYLE*)malloc(sizeof(FILLSTYLE)*shape->fillstyle.n);
739 memcpy(shape->fillstyle.data, shape2->fillstyles, sizeof(FILLSTYLE)*shape->fillstyle.n);
741 swf_ShapeCountBits(shape,NULL,NULL);
746 int ls=0,fs0=0,fs1=0;
748 if(l->type != moveTo) {
749 if(oldls != l->linestyle) {oldls = ls = l->linestyle;if(!ls) ls=0x8000;}
750 if(oldfs0 != l->fillstyle0) {oldfs0 = fs0 = l->fillstyle0;if(!fs0) fs0=0x8000;}
751 if(oldfs1 != l->fillstyle1) {oldfs1 = fs1 = l->fillstyle1;if(!fs1) fs1=0x8000;}
753 if(ls || fs0 || fs1 || newx!=0x7fffffff || newy!=0x7fffffff) {
754 swf_ShapeSetAll(tag,shape,newx,newy,ls,fs0,fs1);
760 if(l->type == lineTo) {
761 swf_ShapeSetLine(tag,shape,l->x-lastx,l->y-lasty);
762 } else if(l->type == splineTo) {
763 swf_ShapeSetCurve(tag,shape, l->sx-lastx,l->sy-lasty, l->x-l->sx,l->y-l->sy);
765 if(l->type == moveTo) {
774 swf_ShapeSetEnd(tag);
775 shape->data = tag->data;
776 shape->bitlen = tag->len*8;
779 void swf_SetShape2(TAG*tag, SHAPE2*shape2)
782 swf_Shape2ToShape(shape2, &shape);
784 swf_SetRect(tag,shape2->bbox);
785 swf_SetShapeStyles(tag, &shape);
786 swf_ShapeCountBits(&shape,NULL,NULL);
787 swf_SetShapeBits(tag,&shape);
789 swf_SetBlock(tag, shape.data, (shape.bitlen+7)/8);
792 static void parseFillStyleArray(TAG*tag, SHAPE2*shape)
797 if(tag->id == ST_DEFINESHAPE)
799 else if(tag->id == ST_DEFINESHAPE2)
801 else if(tag->id == ST_DEFINESHAPE3)
804 count = swf_GetU8(tag);
805 if(count == 0xff && num>1) // defineshape2,3 only
806 count = swf_GetU16(tag);
808 shape->numfillstyles = count;
809 shape->fillstyles = malloc(sizeof(FILLSTYLE)*count);
815 FILLSTYLE*dest = &shape->fillstyles[t];
816 type = swf_GetU8(tag); //type
817 shape->fillstyles[t].type = type;
821 swf_GetRGBA(tag, &dest->color);
823 swf_GetRGB(tag, &dest->color);
825 else if(type == 0x10 || type == 0x12)
827 /* linear/radial gradient fill */
828 swf_ResetReadBits(tag);
829 swf_GetMatrix(tag, &dest->m);
830 swf_ResetReadBits(tag);
831 swf_GetGradient(tag, &dest->gradient, num>=3?1:0);
833 else if(type == 0x40 || type == 0x41)
836 swf_ResetReadBits(tag);
837 dest->id_bitmap = swf_GetU16(tag); //id
838 swf_ResetReadBits(tag); //?
839 swf_GetMatrix(tag, &dest->m);
842 fprintf(stderr, "rfxswf:swftools.c Unknown fillstyle:0x%02x\n",type);
845 swf_ResetReadBits(tag);
846 count = swf_GetU8(tag); // line style array
848 count = swf_GetU16(tag);
850 //if(verbose) printf("lnum: %d\n", count);
852 shape->numlinestyles = count;
853 shape->linestyles = malloc(sizeof(LINESTYLE)*count);
854 /* TODO: should we start with 1 and insert a correct definition of the
855 "built in" linestyle 0? */
858 shape->linestyles[t].width = swf_GetU16(tag);
860 swf_GetRGBA(tag, &shape->linestyles[t].color);
862 swf_GetRGB(tag, &shape->linestyles[t].color);
867 void swf_ParseDefineShape(TAG*tag, SHAPE2*shape)
874 if(tag->id == ST_DEFINESHAPE)
876 else if(tag->id == ST_DEFINESHAPE2)
878 else if(tag->id == ST_DEFINESHAPE3)
881 fprintf(stderr, "parseDefineShape must be called with a shape tag");
884 id = swf_GetU16(tag); //id
885 memset(shape, 0, sizeof(SHAPE2));
886 shape->bbox = malloc(sizeof(SRECT));
887 swf_GetRect(tag, &r);
889 memcpy(shape->bbox, &r, sizeof(SRECT));
890 parseFillStyleArray(tag, shape);
892 swf_ResetReadBits(tag);
893 fill = (U16)swf_GetBits(tag,4);
894 line = (U16)swf_GetBits(tag,4);
896 shape->lines = swf_ParseShapeData(&tag->data[tag->pos], (tag->len - tag->pos)*8, fill, line);