X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=pdf2swf%2Fswfoutput.cc;h=0488bf30c39bdfc3a404d05c8be79da14ef1fd8e;hb=48a0d4e20356793d3e244ec1865f01030409e939;hp=1b08b82cf4674612c48909d8406673cd96d8f8c0;hpb=edaf4fc18535763b54c741a12a257700e4aba1f1;p=swftools.git diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 1b08b82..0488bf3 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -61,7 +61,7 @@ struct fontlist_t double config_ppmsubpixels=0; double config_jpegsubpixels=0; -int config_opennewwindow=0; +int config_opennewwindow=1; int config_ignoredraworder=0; int config_drawonlyshapes=0; int config_jpegquality=85; @@ -151,7 +151,7 @@ void swf_endclip(gfxdevice_t*dev); void swf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit); void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color); void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform); -void swf_fillgradient(gfxdevice_t*dev, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix); +void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix); static swfoutput_internal* init_internal_struct() { @@ -793,6 +793,8 @@ static void endtext(swfoutput*obj) swf_GetMatrix(0, &m); /* set unit matrix- the real matrix is in the placeobject */ swf_SetMatrix(i->tag,&m); + msg(" Placing text (%d characters) as ID %d", i->chardatapos, i->textid); + putcharacters(obj, i->tag); swf_SetU8(i->tag,0); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); @@ -916,10 +918,10 @@ void swfoutput_setfont(struct swfoutput*obj, char*fontid, char*filename) if(getScreenLogLevel() >= LOGLEVEL_DEBUG) { // print font information - msg(" Font %s (%s)",swffont->name, filename); + msg(" Font %s (%s)",fontid, filename); msg(" | ID: %d", swffont->id); msg(" | Version: %d", swffont->version); - msg(" | Name: %s", fontid); + msg(" | Name: %s", swffont->name); msg(" | Numchars: %d", swffont->numchars); msg(" | Maxascii: %d", swffont->maxascii); msg(" | Style: %d", swffont->style); @@ -1437,7 +1439,6 @@ int swfoutput_save(struct swfoutput* obj, char*filename) if(filename) close(fi); - msg(" SWF written\n"); return 1; } @@ -1530,7 +1531,7 @@ void swfoutput_linktourl(struct swfoutput*obj, char*url, swfcoord*points) if(i->textid>=0) endtext(obj); - if(config_opennewwindow) + if(!config_opennewwindow) actions = action_GetUrl(0, url, "_parent"); else actions = action_GetUrl(0, url, "_this"); @@ -2096,12 +2097,20 @@ gfxline_t* SVPtogfxline(ArtSVP*svp) } } +/* TODO */ +static int imageInCache(swfoutput*obj, void*data, int width, int height) +{ + return -1; +} +static void addImageToCache(swfoutput*obj, void*data, int width, int height) +{ +} + static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int targetheight, int* newwidth, int* newheight) { swfoutput*obj = i->obj; RGBA*newpic = 0; RGBA*mem = (RGBA*)img->data; - int bitid = getNewID(obj); int sizex = img->width; int sizey = img->height; @@ -2128,6 +2137,7 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int *newheight = sizey; if(newsizex Scaling %dx%d image to %dx%d", sizex, sizey, newsizex, newsizey); newpic = swf_ImageScale(mem, sizex, sizey, newsizex, newsizey); *newwidth = sizex = newsizex; *newheight = sizey = newsizey; @@ -2158,11 +2168,19 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int } printf("\n");*/ - i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality); + int bitid = -1; + int cacheid = imageInCache(obj, mem, sizex, sizey); + + if(cacheid<=0) { + bitid = getNewID(obj); + i->tag = swf_AddImage(i->tag, bitid, mem, sizex, sizey, config_jpegquality); + addImageToCache(obj, mem, sizex, sizey); + } else { + bitid = cacheid; + } if(newpic) free(newpic); - return bitid; } @@ -2406,6 +2424,8 @@ void swf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*co ArtSVP* svp = gfxstrokeToSVP(line, width, cap_style, joint_style, miterLimit); gfxline_t*gfxline = SVPtogfxline(svp); dev->fill(dev, gfxline, color); + free(gfxline); + art_svp_free(svp); } } void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color) @@ -2422,7 +2442,7 @@ void swf_fill(gfxdevice_t*dev, gfxline_t*line, gfxcolor_t*color) drawgfxline(obj, line); msg(" end of swf_fill (shapeid=%d)", i->shapeid); } -void swf_fillgradient(gfxdevice_t*dev, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix) +void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix) { msg(" Gradient filling not implemented yet"); }