From 3aeed2339b751b5c2974481683c5cc9e0ff05347 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 26 Nov 2006 19:43:54 +0000 Subject: [PATCH] initial revision --- src/swfrender.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/swfrender.c diff --git a/src/swfrender.c b/src/swfrender.c new file mode 100644 index 0000000..ba87dbd --- /dev/null +++ b/src/swfrender.c @@ -0,0 +1,94 @@ +#include "../config.h" +#include +#include +#include +#include +#include +#include "../lib/rfxswf.h" + +// swfrender.c + +typedef struct RENDERBUF +{ + int width; + int height; + void*internal; +} RENDERBUF; + +typedef struct heap_t +{ +}; + +typedef struct _renderbuf_internal +{ + heap_t* lines; +} renderbuf_internal; + + +void swf_RenderShape(RENDERBUF*dest, SHAPE2*shape) +{ + renderbuf_internal*i = (renderbuf_internal)dest->internal; + + SHAPELINE*line = shape->lines; + int x=0,y=0; + + while(line) + { + if(line->type == moveTo) { + /* max 31 bits + sign */ + x = line->x; + y = line->y; + } else if(line->type == lineTo) { + /* max 17 bits + sign */ + int diffx = line->x - x; + int diffy = line->y - y; + int stepx,posx=0,posy=0; + if(diffy<0) { + x = line->x; + y = line->y; + diffx = -diffx; + diffy = -diffy; + } + stepx = (diffx*0x1000) / diffy; + + while(posyx; + y = line->y; + } else if(line->type == splineTo) { + } + + line = line->next; + } +} + +int main() +{ + char*filename = "output.swf"; + fi = open(filename, O_RDONLY|O_BINARY); + if (fi<=0) { + fprintf(stderr,"Couldn't open %s\n", filename); + perror(argv[1]); + exit(1); + } + + if(swf_ReadSWF(fi,&swf)<0) { + fprintf(stderr,"%s is not a valid SWF file or contains errors.\n",argv[1]); + close(fi); + } + + tag = swf.firstTag; + while(tag) { + if(tag.id == ST_DEFINESHAPE3) { + SHAPE2 shape; + swf_ParseDefineShape(tag, &shape); + swf_RenderShape(tag, MATRIX m); + } + } +} -- 1.7.10.4