X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fpng2swf.c;h=6e04212a4cd0e3aa35fbe5e7bb65d8266c6ce055;hb=202babdc64693506daa042c25b76eab46835c94e;hp=fe465512e423077f54c3ae58c2fd68da74400c83;hpb=7b03732b2f00e2698cf29a2ffc0fab8b2b1677f1;p=swftools.git diff --git a/src/png2swf.c b/src/png2swf.c index fe46551..6e04212 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -61,7 +61,7 @@ TAG *MovieStart(SWF * swf, float 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; <--- handy for testing alpha conversion + //rgb.g = 0xff; //<--- handy for testing alpha conversion swf_SetRGB(t, &rgb); return t; @@ -542,6 +542,8 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) int transparent=0; int semitransparent=0; /* in case for mode 2, the following also performs 24->32 bit conversion */ + unsigned char* firstline = malloc(header.width*4); + for(y=0;yid = ST_DEFINEBITSLOSSLESS2; } } - /* mode 6 images which are not fully opaque or fully transparent - will be stored as definejpeg3 */ - if(header.mode == 6 && transparent != header.width*header.height - && opaque != header.width*header.height) -#ifndef HAVE_JPEGLIB - fprintf(stderr, "Warning: No jpeg lib compiled in- not able to store transparency information\n"); -#else - { - fprintf(stderr, "Image has transparency information. Storing as DefineBitsJpeg3 Tag (jpeg+alpha)\n"); - if(VERBOSE(2)) - printf("Image is semi-transparent\n"); - - // we always use quality 100, since png2swf is expected to - // use more or less lossless compression - - swf_SetJPEGBits3(t, header.width, header.height, (RGBA*)data2, 100); - t->id = 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 if(header.mode == 0 || header.mode == 3) { RGBA*rgba; @@ -627,13 +620,9 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) rgba[i].b = palette[i*3+2]; if(alphapalette && i