}
if(!extractframes && !hollow) {
if(!originalplaceobjects && (extractids||extractname_id>=0)) {
+ int number = 0;
+ int id = 0;
int t;
- int s=0;
+ TAG* objtag = 0;
+ SRECT bbox;
+ memset(&bbox, 0, sizeof(SRECT));
+ for(t=0;t<65536;t++) {
+ if(is_in_range(t, extractids)) {
+ id = t;
+ number++;
+ }
+ }
+ if(number>=2)
+ printf("warning! You should use the -P when extracting multiple objects\n");
+ if(number == 1) {
+ /* if there is only one object, we will scale it.
+ So let's figure out it's bounding box */
+ TAG*tag = swf->firstTag;
+ while(tag) {
+ if(swf_isDefiningTag(tag) && tag->id != ST_DEFINESPRITE) {
+ if(swf_GetDefineID(tag) == id)
+ bbox = swf_GetDefineBBox(tag);
+ objtag = tag;
+ }
+ tag = tag->next;
+ }
+ }
+
if((objectbbox.xmin|objectbbox.ymin|objectbbox.xmax|objectbbox.ymax)!=0)
newswf.movieSize = objectbbox;
if(extractname_id>=0) {
} else {
for(t=0;t<65536;t++) {
if(is_in_range(t, extractids)) {
+ MATRIX m;
desttag = swf_InsertTag(desttag, ST_PLACEOBJECT2);
- swf_ObjectPlace(desttag, t, t, 0,0,0);
- s++;
- if(s==2)
- printf("warning! You should use the -P when extracting multiple objects\n");
+ swf_GetMatrix(0, &m);
+ if(objtag) {
+ int width = bbox.xmax - bbox.xmin;
+ int height = bbox.ymax - bbox.ymin;
+ int max = width>height?width:height;
+ m.tx = -bbox.xmin;
+ m.ty = -bbox.ymin;
+ if(max) {
+ m.sx = (512*20*65536)/max;
+ m.sy = (512*20*65536)/max;
+ }
+ newswf.movieSize = swf_TurnRect(newswf.movieSize, &m);
+ }
+ swf_ObjectPlace(desttag, t, t, &m,0,0);
}
}
}
int t;
int frame = 0;
char*names[] = {"Shape", "MovieClip", "JPEG", "PNG", "Sound", "Font"};
+ char*options[] = {"-i", "-i", "-j", "-p", "-s", "-F"};
+ int mp3=0;
printf("Objects in file %s:\n",filename);
swf_FoldAll(swf);
for(t=0;t<sizeof(names)/sizeof(names[0]);t++) {
tag = swf->firstTag;
first = 1;
while(tag) {
+ if(tag->id == ST_SOUNDSTREAMHEAD || tag->id == ST_SOUNDSTREAMHEAD2)
+ mp3 = 1;
if(isOfType(t,tag))
nr++;
tag = tag->next;
if(!nr)
continue;
- printf(" %d %s%s: ID(s) ", nr, names[t], nr>1?"s":"");
+ printf(" [%s] %d %s%s: ID(s) ", options[t], nr, names[t], nr>1?"s":"");
tag = swf->firstTag;
while(tag) {
}
if(frame)
- printf(" %d Frames: ID(s) 0-%d\n", frame, frame);
+ printf(" [-f] %d Frames: ID(s) 0-%d\n", frame, frame);
else
- printf(" 1 Frame: ID(s) 0\n");
+ printf(" [-f] 1 Frame: ID(s) 0\n");
+
+ if(mp3)
+ printf(" [-m] 1 MP3 Soundstream\n");
}
void handlefont(SWF*swf, TAG*tag)
png_write_byte(fi,palette[t].b);
}
png_end_chunk(fi);
+
+ if(alpha) {
+ /* write alpha palette */
+ png_start_chunk(fi, "tRNS", 256);
+ for(t=0;t<256;t++) {
+ png_write_byte(fi,palette[t].a);
+ }
+ png_end_chunk(fi);
+ }
}
{
int pos2 = 0;
int x,y;
int srcwidth = width * (bpp/8);
- datalen3 = width*height*4;
+ datalen3 = (width*4+5)*height;
data3 = (U8*)malloc(datalen3);
for(y=0;y<height;y++)
{