From 202babdc64693506daa042c25b76eab46835c94e Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 16 May 2004 18:55:10 +0000 Subject: [PATCH] removed jpeg workaround for 32bit alpha images, fixed alpha handling. --- src/png2swf.c | 66 +++++++++++++++++++++++---------------------------------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/src/png2swf.c b/src/png2swf.c index 989e3ba..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; @@ -575,40 +575,30 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) free(firstline); /* the image is now compressed and stored in data. Now let's take - a look at the alpha values to determine which bitmap type we - should write */ - if(header.mode == 6) - 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; @@ -630,13 +620,9 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) rgba[i].b = palette[i*3+2]; if(alphapalette && i