added antialiase option to swf_Render_Init().
[swftools.git] / lib / rfxswf.h
index c3783d5..cf4f707 100644 (file)
@@ -71,6 +71,16 @@ extern "C" {
 #define REVERSESWAP32(s) (REVERSESWAP16(((s)>>16)&0x0000ffff)|((REVERSESWAP16(s)<<16)&0xffff0000))
 #endif
 
+#define ALLOC_ARRAY(type, num) (((type)*)rfxalloc(sizeof(type)*(num)))
+void* rfx_alloc(int size);
+void* rfx_calloc(int size);
+void* rfx_realloc(void*data, int size);
+void rfx_free(void*data);
+#ifdef MEMORY_INFO
+long rfx_memory_used();
+char* rfx_memory_used_str();
+#endif
+
 // SWF Types
 
 typedef         unsigned long   U32;
@@ -220,6 +230,7 @@ int   swf_DeleteTag(TAG * t);
 
 void  swf_ClearTag(TAG * t);                //frees tag data
 void  swf_ResetTag(TAG*tag, U16 id);        //set's tag position and length to 0, without freeing it
+TAG*  swf_CopyTag(TAG*tag, TAG*to_copy);     //stores a copy of another tag into this taglist
     
 void  swf_SetTagPos(TAG * t,U32 pos);       // resets Bitcount
 U32   swf_GetTagPos(TAG * t);
@@ -351,6 +362,12 @@ typedef struct _LINESTYLE
   RGBA          color;
 } LINESTYLE, * LPLINESTYLE;
 
+#define FILL_SOLID      0x00
+#define FILL_LINEAR     0x10  // Gradient
+#define FILL_RADIAL     0x12
+#define FILL_TILED      0x40  // Bitmap
+#define FILL_CLIPPED    0x41
+
 typedef struct _FILLSTYLE
 { U8       type;
   RGBA     color;
@@ -693,6 +710,7 @@ void swf_GetJPEGSize(char * fname, int*width, int*height);
 int swf_SetJPEGBits(TAG * t,char * fname,int quality);
 void swf_SetJPEGBits2(TAG * t,U16 width,U16 height,RGBA * bitmap,int quality);
 int swf_SetJPEGBits3(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality);
+RGBA* swf_JPEG2TagToImage(TAG*tag, int*width, int*height);
 
 #define BYTES_PER_SCANLINE(width) ((width+3)&0xfffffffc)
 
@@ -703,6 +721,9 @@ int swf_SetJPEGBits3(TAG * tag,U16 width,U16 height,RGBA* bitmap, int quality);
 int swf_SetLosslessBits(TAG * t,U16 width,U16 height,void * bitmap,U8 bitmap_flags);
 int swf_SetLosslessBitsIndexed(TAG * t,U16 width,U16 height,U8 * bitmap,RGBA * palette,U16 ncolors);
 int swf_SetLosslessBitsGrayscale(TAG * t,U16 width,U16 height,U8 * bitmap);
+RGBA* swf_DefineLosslessBitsTagToImage(TAG*tag, int*width, int*height);
+
+RGBA* swf_ExtractImage(TAG*tag, int*dwidth, int*dheight);
 
 // swfsound.c
 void swf_SetSoundStreamHead(TAG*tag, int avgnumsamples);
@@ -712,9 +733,13 @@ void swf_SetSoundInfo(TAG*tag, SOUNDINFO*info);
 
 // swftools.c
 
+void swf_Optimize(SWF*swf);
 U8 swf_isDefiningTag(TAG * t);
 U8 swf_isPseudoDefiningTag(TAG * t);
 U8 swf_isAllowedSpriteTag(TAG * t);
+U8 swf_isImageTag(TAG*tag);
+U8 swf_isShapeTag(TAG*tag);
+
 U16 swf_GetDefineID(TAG * t);
 SRECT swf_GetDefineBBox(TAG * t);
 void swf_SetDefineID(TAG * t, U16 newid);
@@ -921,6 +946,23 @@ void swf_SetVideoStreamPFrame(TAG*tag, VIDEOSTREAM*s, RGBA*pic, int quant/* 1-31
 void swf_SetVideoStreamMover(TAG*tag, VIDEOSTREAM*s, signed char* movex, signed char* movey, void** image, int quant);
 void swf_VideoStreamClear(VIDEOSTREAM*stream);
 
+// swfrender.c
+
+typedef struct RENDERBUF 
+{
+    int width;
+    int height;
+    int posx,posy;
+    void*internal;
+} RENDERBUF;
+
+void swf_Render_Init(RENDERBUF*buf, int posx, int posy, int width, int height, char antialize);
+RGBA* swf_Render(RENDERBUF*dest);
+void swf_RenderShape(RENDERBUF*dest, SHAPE2*shape, MATRIX*m, CXFORM*c, U16 depth,U16 clipdepth);
+void swf_Render_AddImage(RENDERBUF*buf, U16 id, RGBA*img, int width, int height);
+void swf_Render_ClearCanvas(RENDERBUF*dest);
+void swf_Render_Delete(RENDERBUF*dest);
+
 #ifdef __cplusplus
 }
 #endif