X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fswfoutput.cc;h=98701b02c42804abca74fab04270b6bd84682194;hb=f567c3e994871f6e95299f9365b1060f7ee81223;hp=0da570becc5f9370184e7b0b40a15c2b83247961;hpb=6a9c24e4aaa166f49ea31593733b2598de6f78fd;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 0da570b..98701b0 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -996,13 +996,18 @@ SWFFont::SWFFont(char*name, int id, char*filename) int t, outlinepos=0; char*map[256]; + char*null = 0; + if(!a) + a=&null; + t=0; while(a[t]) t++; this->charnum = t; - if(!charnum) - return; + if(!charnum) { + this->standardtablesize = 0; + } msg(" Font %s(%d): Storing %d outlines.\n", FIXNULL(name), id, charnum); this->standardtablesize = 256; @@ -1166,7 +1171,8 @@ SWFFont::~SWFFont() } free(ptr); - free(outline); + if(outline) + free(outline); for(t=0;t initializing swf output for size %d*%d\n", sizex,sizey); @@ -1364,18 +1370,48 @@ void swfoutput_init(struct swfoutput* obj, char*_filename, int _sizex, int _size swf.fileVersion = flashversion; swf.frameRate = 0x0040; // 1 frame per 4 seconds - swf.movieSize.xmax = 20*sizex; - swf.movieSize.ymax = 20*sizey; + swf.movieSize.xmin = 20*x1; + swf.movieSize.ymin = 20*y1; + swf.movieSize.xmax = 20*x2; + swf.movieSize.ymax = 20*y2; + + depth = 1; swf.firstTag = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR); tag = swf.firstTag; - rgb.r = 0xff; - rgb.g = 0xff; - rgb.b = 0xff; + rgb.a = rgb.r = rgb.g = rgb.b = 0xff; swf_SetRGB(tag,&rgb); - if(flag_protected) // good practice! /r + + if(1)/* add white rectangle */ + { + SRECT r; + SHAPE* s; + int ls1=0,fs1=0; + int shapeid = ++currentswfid; + r.xmin = x1*20; + r.ymin = y1*20; + r.xmax = x2*20; + r.ymax = y2*20; + tag = swf_InsertTag(tag, ST_DEFINESHAPE); + swf_ShapeNew(&s); + fs1 = swf_ShapeAddSolidFillStyle(s, &rgb); + swf_SetU16(tag,shapeid); + swf_SetRect(tag,&r); + swf_SetShapeHeader(tag,s); + swf_ShapeSetAll(tag,s,x1*20,y1*20,ls1,fs1,0); + swf_ShapeSetLine(tag,s,20*(x2-x1),0); + swf_ShapeSetLine(tag,s,0,20*(y2-y1)); + swf_ShapeSetLine(tag,s,20*(x1-x2),0); + swf_ShapeSetLine(tag,s,0,20*(y1-y2)); + swf_ShapeSetEnd(tag); + swf_ShapeFree(s); + tag = swf_InsertTag(tag, ST_PLACEOBJECT2); + swf_ObjectPlace(tag,shapeid,depth++,0,0,0); + } + + if(flag_protected) tag = swf_InsertTag(tag, ST_PROTECT); - depth = 1; + startdepth = depth; }