From: boehme Date: Sun, 28 Oct 2001 18:55:08 +0000 (+0000) Subject: new lossless image functions X-Git-Tag: release-0-1-0~99 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=f9de3ffeeb987492d4e4030c4235f7e5ad66256b new lossless image functions --- diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 1c9bd66..ec0d3d2 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -18,8 +18,15 @@ #ifdef HAVE_JPEGLIB_H #include #define _JPEGLIB_INCLUDED_ -#endif //HAVE_JPEGLIB_H -#endif //HAVE_LIBJPEG +#endif // HAVE_JPEGLIB_H +#endif // HAVE_LIBJPEG + +#ifdef HAVE_LIBZ +#ifdef HAVE_ZLIB_H +#include +#define _ZLIB_INCLUDED_ +#endif // HAVE_ZLIB_H +#endif // HAVE_LIBZ // Win32 support may be broken since it was only tested in an older version for Watcom C #ifdef __NT__ @@ -651,7 +658,7 @@ int ReadSWF(int handle,SWF * swf) // Reads SWF to memory (malloc'ed), retu if (!swf) return -1; memset(swf,0x00,sizeof(SWF)); - { char b[32]; // Header lesen + { char b[32]; // read Header TAG t1; TAG * t; @@ -673,7 +680,7 @@ int ReadSWF(int handle,SWF * swf) // Reads SWF to memory (malloc'ed), retu GetU8(&t1); lseek(handle,GetTagPos(&t1)-1,SEEK_SET); - // Tags lesen und verketten + // reda tags and connect to list t = &t1; while (t) t = ReadTag(handle,t); swf->FirstTag = t1.next; @@ -739,8 +746,8 @@ int WriteSWF(int handle,SWF * swf) // Writes SWF to file, returns length or if (ret!=l) { #ifdef DEBUG_RFXSWF - printf("ret:%d (fd:%d)\n",ret, handle); - perror("write:"); + printf("ret:%d (fd:%d)\n",ret, handle); + perror("write:"); fprintf(stderr,"WriteSWF() failed: Header.\n"); #endif return -1; diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 5efc48a..e846438 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -40,10 +40,10 @@ typedef struct _SPOINT } SPOINT, * LPSPOINT; typedef struct _RGBA -{ U8 r; +{ U8 a; + U8 r; U8 g; U8 b; - U8 a; } RGBA, * LPRGBA; typedef struct _SRECT @@ -420,6 +420,24 @@ int SetJPEGBitsFinish(JPEGBITS * jpegbits); int SetJPEGBits(TAG * t,char * fname,int quality); // paste jpg file into swf stream +#define BYTES_PER_SCANLINE(width) ((width+3)&0xfffffffc) + +#define BMF_8BIT 3 // Bitmap formats +#define BMF_16BIT 4 +#define BMF_32BIT 5 + +#define BM16_BLUE 0xf800 // Bitmasks for 16 Bit Color +#define BM16_RED 0x00f0 +#define BM16_GREEN 0x000f + +#define BM32_BLUE 0xff000000 // Bitmasks for 32 Bit Color +#define BM32_GREEN 0x00ff0000 +#define BM32_RED 0x0000ff00 + +int SetLosslessBits(TAG * t,U16 width,U16 height,void * bitmap,U8 bitmap_flags); +int SetLosslessBitsIndexed(TAG * t,U16 width,U16 height,U8 * bitmap,RGBA * palette,U16 ncolors); +int SetLosslessBitsGrayscale(TAG * t,U16 width,U16 height,U8 * bitmap); + // swftools.c char isDefiningTag(TAG * t);