X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfc.c;h=009a21564ef70e0d4037b15d53df3146202deec2;hb=c98051785717925e8afb55626f88211b8e7a691d;hp=092a49de1df0f4c2ff30f8a78335744e6f1b5e93;hpb=eeb31b425e73e967eb830e2523c6bf789c28fe09;p=swftools.git diff --git a/src/swfc.c b/src/swfc.c index 092a49d..009a215 100644 --- a/src/swfc.c +++ b/src/swfc.c @@ -34,6 +34,7 @@ #include "../lib/q.h" #include "parser.h" #include "wav.h" +#include "../lib/png.h" //#define DEBUG @@ -727,11 +728,13 @@ void s_frame(int nr, int cut, char*name) if(t==nr-1 && name && *name) { tag = swf_InsertTag(tag, ST_FRAMELABEL); swf_SetString(tag, name); + swf_SetU8(tag, 1); //make this an anchor } } if(nr == 0 && currentframe == 0 && name) { tag = swf_InsertTag(tag, ST_FRAMELABEL); swf_SetString(tag, name); + swf_SetU8(tag, 1); //make this an anchor } if(cut) { @@ -1020,12 +1023,7 @@ void s_image(char*name, char*type, char*filename, int quality) SRECT r; int imageID = id; int width, height; - if(type=="png") { - warning("image type \"png\" not supported yet!"); - s_box(name, 0, 0, black, 20, 0); - return; - } - if(type=="jpeg") { + if(!strcmp(type,"jpeg")) { #ifndef HAVE_LIBJPEG warning("no jpeg support compiled in"); s_box(name, 0, 0, black, 20, 0); @@ -1048,6 +1046,31 @@ void s_image(char*name, char*type, char*filename, int quality) s_addimage(name, id, tag, r); incrementid(); #endif + } else if(!strcmp(type,"png")) { + RGBA*data = 0; + swf_SetU16(tag, imageID); + + getPNG(filename, &width, &height, (unsigned char**)&data); + + if(!data) { + syntaxerror("Image \"%s\" not found, or contains errors", filename); + } + + /*tag = swf_AddImage(tag, imageID, data, width, height, quality)*/ + tag = swf_InsertTag(tag, ST_DEFINEBITSLOSSLESS); + swf_SetU16(tag, imageID); + swf_SetLosslessImage(tag, data, width, height); + + r.xmin = 0; + r.ymin = 0; + r.xmax = width*20; + r.ymax = height*20; + s_addimage(name, id, tag, r); + incrementid(); + } else { + warning("image type \"%s\" not supported yet!", type); + s_box(name, 0, 0, black, 20, 0); + return; } /* step 2: the character */ @@ -1156,6 +1179,10 @@ void s_font(char*name, char*filename) font->id = id; tag = swf_InsertTag(tag, ST_DEFINEFONT2); swf_FontSetDefine2(tag, font); + tag = swf_InsertTag(tag, ST_EXPORTASSETS); + swf_SetU16(tag, 1); + swf_SetU16(tag, id); + swf_SetString(tag, name); incrementid(); if(dictionary_lookup(&fonts, name))