X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Fswf.c;h=83a5e675020040df8839cffab2b3f7b8a64131d5;hb=35727bd4787aeef582c43772cb13a79c0b680873;hp=b12f27baaa06130ceee9e0070d5b428d0f906152;hpb=66f6d2a40bed5716c469f0e2c8de1cc13e0022a2;p=swftools.git diff --git a/lib/devices/swf.c b/lib/devices/swf.c index b12f27b..83a5e67 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -91,6 +91,7 @@ typedef struct _swfoutput_internal char* config_linktarget; char*config_internallinkfunction; char*config_externallinkfunction; + char config_animate; SWF* swf; @@ -753,7 +754,7 @@ static void endtext(gfxdevice_t*dev) swf_SetU8(i->tag, 0);//reserved } i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); - + swf_ObjectPlace(i->tag,i->textid,getNewDepth(dev),&i->page_matrix,NULL,NULL); i->textid = -1; } @@ -1123,7 +1124,7 @@ static void endshape(gfxdevice_t*dev) changeRect(dev, i->tag, i->bboxrectpos, &i->bboxrect); - msg(" Placing shape id %d", i->shapeid); + msg(" Placing shape ID %d", i->shapeid); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); MATRIX m = i->page_matrix; @@ -1131,6 +1132,10 @@ static void endshape(gfxdevice_t*dev) m.ty += i->shapeposy; swf_ObjectPlace(i->tag,i->shapeid,getNewDepth(dev),&m,NULL,NULL); + if(i->config_animate) { + i->tag = swf_InsertTag(i->tag,ST_SHOWFRAME); + } + swf_ShapeFree(i->shape); i->shape = 0; i->shapeid = -1; @@ -1661,6 +1666,7 @@ static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gf } } + msg(" Placing link ID %d", buttonid); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); if(posx!=0 || posy!=0) { @@ -1787,6 +1793,8 @@ int swf_setparameter(gfxdevice_t*dev, const char*name, const char*value) i->config_linktarget = strdup(value); } else if(!strcmp(name, "dumpfonts")) { i->config_dumpfonts = atoi(value); + } else if(!strcmp(name, "animate")) { + i->config_animate = atoi(value); } else if(!strcmp(name, "next_bitmap_is_jpeg")) { i->jpeg = 1; } else if(!strcmp(name, "jpegquality")) { @@ -1844,10 +1852,10 @@ static CXFORM gfxcxform_to_cxform(gfxcxform_t* c) cx.r0 = (S16)(c->rr*256); cx.g0 = (S16)(c->gg*256); cx.b0 = (S16)(c->bb*256); - cx.a1 = c->t.a; - cx.r1 = c->t.r; - cx.g1 = c->t.g; - cx.b1 = c->t.b; + cx.a1 = c->ta; + cx.r1 = c->tr; + cx.g1 = c->tg; + cx.b1 = c->tb; return cx; } @@ -1875,16 +1883,20 @@ static int add_image(swfoutput_internal*i, gfximage_t*img, int targetwidth, int /// { if(is_jpeg && i->config_jpegsubpixels) { - newsizex = (int)(targetwidth*i->config_jpegsubpixels+0.5); - newsizey = (int)(targetheight*i->config_jpegsubpixels+0.5); + newsizex = (int)(targetwidth*i->config_jpegsubpixels + 0.5); + newsizey = (int)(targetheight*i->config_jpegsubpixels + 0.5); } else if(!is_jpeg && i->config_ppmsubpixels) { - newsizex = (int)(targetwidth*i->config_ppmsubpixels+0.5); - newsizey = (int)(targetheight*i->config_ppmsubpixels+0.5); + newsizex = (int)(targetwidth*i->config_ppmsubpixels + 0.5); + newsizey = (int)(targetheight*i->config_ppmsubpixels + 0.5); } /// } - if(sizex<=0 || sizey<=0 || newsizex<=0 || newsizey<=0) + if(sizex<=0 || sizey<=0) return -1; + if(newsizex<=0) + newsizex = 1; + if(newsizey<=0) + newsizey = 1; /* TODO: cache images */ @@ -2005,6 +2017,7 @@ static void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxm swf_ShapeSetEnd(i->tag); swf_ShapeFree(shape); + msg(" Placing bitmap ID %d", myshapeid); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); CXFORM cxform2 = gfxcxform_to_cxform(cxform); swf_ObjectPlace(i->tag,myshapeid,getNewDepth(dev),&i->page_matrix,&cxform2,NULL); @@ -2049,6 +2062,7 @@ static void swf_startclip(gfxdevice_t*dev, gfxline_t*line) /* TODO: remember the bbox, and check all shapes against it */ + msg(" Placing clip ID %d", myshapeid); i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2); i->cliptags[i->clippos] = i->tag; i->clipshapes[i->clippos] = myshapeid;