#include "../lib/q.h"
#include "parser.h"
#include "wav.h"
+#include "../lib/png.h"
//#define DEBUG
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) {
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);
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 */
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))
U16*samples;
int numsamples;
int t;
+ int blocksize = 1152;
if(!readWAV(filename, &wav)) {
warning("Couldn't read wav file \"%s\"", filename);
}
#endif
}
+
+ if(numsamples%blocksize != 0)
+ {
+ // apply padding, so that block is a multiple of blocksize
+ int numblocks = (numsamples+blocksize-1)/blocksize;
+ int numsamples2;
+ U16* samples2;
+ numsamples2 = numblocks * blocksize;
+ samples2 = malloc(sizeof(U16)*numsamples2);
+ memcpy(samples2, samples, numsamples*sizeof(U16));
+ memset(&samples2[numsamples], 0, sizeof(U16)*(numsamples2 - numsamples));
+ numsamples = numsamples2;
+ samples = samples2;
+ }
tag = swf_InsertTag(tag, ST_DEFINESOUND);
swf_SetU16(tag, id); //id