X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpng2swf.c;h=578edfd5de3706e25f9fbda9e649bb610f36c2ef;hb=1bc632448cd804201098dc4f70700a813d5f6795;hp=8a10871fa148232311b6abda8d125fcd6459285a;hpb=44b68a533fc2933019e58c1998cf644eb2651c3c;p=swftools.git diff --git a/src/png2swf.c b/src/png2swf.c index 8a10871..578edfd 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -42,7 +42,7 @@ TAG *MovieStart(SWF * swf, int framerate, int dx, int dy) memset(swf, 0x00, sizeof(SWF)); - swf->fileVersion = 4; + swf->fileVersion = 5; swf->frameRate = (25600 / framerate); swf->movieSize.xmax = dx * 20; swf->movieSize.ymax = dy * 20; @@ -50,6 +50,7 @@ TAG *MovieStart(SWF * swf, int framerate, int dx, int dy) t = swf->firstTag = swf_InsertTag(NULL, ST_SETBACKGROUNDCOLOR); rgb.r = rgb.g = rgb.b = rgb.a = 0x00; + rgb.g = 0xff; swf_SetRGB(t, &rgb); return t; @@ -149,11 +150,11 @@ int png_read_header(FILE*fi, struct png_header*header) f = data[11]; // filter mode (0) i = data[12]; // interlace mode (0) - if(b!=2 && b!=3) { + if(b!=2 && b!=3 && b!=6) { fprintf(stderr, "Image mode %d not supported!\n", b); exit(1); } - if(a!=8 && b==2) { + if(a!=8 && (b==2 || b==6)) { fprintf(stderr, "Bpp %d in mode %d not supported!\n", a); exit(1); } @@ -199,7 +200,7 @@ byte inline PaethPredictor (byte a,byte b,byte c) else return c; } -void applyfilter(int mode, U8*src, U8*old, U8*dest, int width) +void applyfilter3(int mode, U8*src, U8*old, U8*dest, int width) { int x; unsigned char lastr=0; @@ -277,6 +278,89 @@ void applyfilter(int mode, U8*src, U8*old, U8*dest, int width) } +void applyfilter4(int mode, U8*src, U8*old, U8*dest, int width) +{ + int x; + unsigned char lastr=0; + unsigned char lastg=0; + unsigned char lastb=0; + unsigned char lasta=0; + unsigned char upperlastr=0; + unsigned char upperlastg=0; + unsigned char upperlastb=0; + unsigned char upperlasta=0; + + if(mode==0) { + for(x=0;x32 bit conversion */ + int opaque=0; + int transparent=0; + /* in case for mode 2, the following also performs 24->32 bit conversion */ for(y=0;yid = ST_DEFINEBITSJPEG3; + } + else +#endif + { + swf_SetLosslessBits(t, header.width, header.height, data2, BMF_32BIT); } - swf_SetLosslessBits(t, header.width, header.height, data2, BMF_32BIT); free(data2); } else { @@ -456,8 +592,20 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) rgba[i].r = palette[i*3+0]; rgba[i].g = palette[i*3+1]; rgba[i].b = palette[i*3+2]; - rgba[i].a = 255; + if(alphapalette && imovieSize.xmax - (int) header.width * 20) / 2; m.ty = (swf->movieSize.ymax - (int) header.height * 20) / 2; - swf_ObjectPlace(t, id + 1, 1, &m, NULL, NULL); + swf_ObjectPlace(t, id + 1, 50, &m, NULL, NULL); t = swf_InsertTag(t, ST_SHOWFRAME);