From: kramm Date: Sun, 16 Jun 2002 17:16:30 +0000 (+0000) Subject: implemented bit depths. X-Git-Tag: release-0-4-0~9 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=f7b166f46c40c7e67fe89fef3379a649df5e8b4d implemented bit depths. --- diff --git a/src/png2swf.c b/src/png2swf.c index 0bf05a9..9092aac 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -152,8 +152,8 @@ int png_read_header(FILE*fi, struct png_header*header) fprintf(stderr, "Image mode %d not supported!\n", b); exit(1); } - if(a!=8) { - fprintf(stderr, "Bpp %d not supported!\n", a); + if(a!=8 && b==2) { + fprintf(stderr, "Bpp %d in mode %d not supported!\n", a); exit(1); } if(c!=0) { @@ -388,7 +388,6 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) if(data) free(data); } - t = swf_InsertTag(t, ST_DEFINEBITSLOSSLESS); swf_SetU16(t, id); // id if(header.mode == 2) { @@ -399,10 +398,21 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) /* 24->32 bit conversion */ for(y=0;y>(16-header.bpp-(s&7)))&v; + s+=header.bpp; + } + src = tmpline; + pos+=(header.width*header.bpp+7)/8; + } + if(!y) { memset(data2,0,swf_width); old = &data2[y*swf_width]; @@ -444,9 +472,9 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) old = &data2[(y-1)*swf_width]; } applyfilter1(mode, src, old, dest, header.width); - pos+=header.width; } swf_SetLosslessBitsIndexed(t, header.width, header.height, data2, rgba, palettelen); + free(tmpline); free(rgba); free(data2); } @@ -654,6 +682,9 @@ int main(int argc, char **argv) processargs(argc, argv); + if(global.nfiles<=0) + return 1; + if (VERBOSE(2)) fprintf(stderr, "Processing %i file(s)...\n", global.nfiles);