int clips;
SWF swf;
int width,height;
+ MATRIX m;
} swf_doc_internal_t;
#define TYPE_SHAPE 1
U16 depth = swf_GetDepth(tag);
map16_remove_id(depthmap, depth);
}
- if(tag->id == ST_SHOWFRAME) {
+ if(tag->id == ST_SHOWFRAME || tag->id == ST_END) {
if(frame == frame_to_extract) {
return depthmap;
}
- frame++;
- map16_enumerate(depthmap, increaseAge, 0);
+ if(tag->id == ST_SHOWFRAME) {
+ frame++;
+ map16_enumerate(depthmap, increaseAge, 0);
+ }
}
}
+ fprintf(stderr, "gfxsource_swf: frame %d not found\n", frame_to_extract);
return depthmap;
}
{
map16_t*id2char;
gfxdevice_t*device;
+ MATRIX m;
int clips;
} render_t;
RGBA swf_ColorTransform(RGBA*color, CXFORM*cx)
{
RGBA dest;
- dest.r = (cx->r0*dest.r + cx->r1*256) >> 8;
- dest.g = (cx->g0*dest.g + cx->g1*256) >> 8;
- dest.b = (cx->b0*dest.b + cx->b1*256) >> 8;
- dest.a = (cx->a0*dest.a + cx->a1*256) >> 8;
+ dest.r = (cx->r0*color->r + cx->r1*256) >> 8;
+ dest.g = (cx->g0*color->g + cx->g1*256) >> 8;
+ dest.b = (cx->b0*color->b + cx->b1*256) >> 8;
+ dest.a = (cx->a0*color->a + cx->a1*256) >> 8;
return dest;
}
if(c->type == TYPE_SHAPE) {
SHAPE2 shape;
swf_ParseDefineShape(c->tag, &shape);
- swf_ApplyMatrixToShape(&shape, &p->po.matrix);
+ MATRIX m;
+ swf_MatrixJoin(&m, &r->m, &p->po.matrix);
+ swf_ApplyMatrixToShape(&shape, &m);
SHAPELINE*line = shape.lines;
int t;
for(t=1;t<=shape.numfillstyles;t++) {
r.id2char = pi->id2char;
r.clips = 0;
r.device = output;
+ r.m = pi->m;
map16_enumerate(depths, placeObject, &r);
}
return swf_page;
}
-void swf_set_parameter(char*name, char*value)
+void swf_set_parameter(gfxsource_t*src, char*name, char*value)
{
msg("<verbose> setting parameter %s to \"%s\"", name, value);
}
-gfxdocument_t*swf_open(char*filename)
+gfxdocument_t*swf_open(gfxsource_t*src, char*filename)
{
gfxdocument_t*swf_doc = (gfxdocument_t*)malloc(sizeof(gfxdocument_t));
memset(swf_doc, 0, sizeof(gfxdocument_t));
TAG*tag = 0;
int f;
- SWF swf;
int frame;
render_t r;
gfxdevice_t d;
perror("Couldn't open file: ");
return 0;
}
- if FAILED(swf_ReadSWF(f,&swf)) {
+ if FAILED(swf_ReadSWF(f,&i->swf)) {
fprintf(stderr, "%s is not a valid SWF file or contains errors.\n",filename);
close(f);
return 0;
}
- swf_UnFoldAll(&swf);
+ swf_UnFoldAll(&i->swf);
+
+ i->id2char = extractDefinitions(&i->swf);
+ i->width = (i->swf.movieSize.xmax - i->swf.movieSize.xmin) / 20;
+ i->height = (i->swf.movieSize.ymax - i->swf.movieSize.ymin) / 20;
- i->id2char = extractDefinitions(&swf);
- i->width = (swf.movieSize.xmax - swf.movieSize.xmin) / 20;
- i->height = (swf.movieSize.ymax - swf.movieSize.ymin) / 20;
+ swf_GetMatrix(0, &i->m);
+ i->m.tx = -i->swf.movieSize.xmin;
+ i->m.ty = -i->swf.movieSize.ymin;
- swf_doc->num_pages = swf.frameCount;
+ swf_doc->num_pages = i->swf.frameCount;
swf_doc->internal = i;
swf_doc->get = 0;
swf_doc->destroy = swf_doc_destroy;