X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmodules%2Fswftools.c;h=2356dfb76da6433d0e4ca09ab270e3b12d83b5ce;hb=44b68a533fc2933019e58c1998cf644eb2651c3c;hp=0b2a740b0bec212ca85a1f745993cd1f2e52af93;hpb=63238b27c482e8b760d2e6db5568b31a4b2cdb5f;p=swftools.git diff --git a/lib/modules/swftools.c b/lib/modules/swftools.c index 0b2a740..2356dfb 100644 --- a/lib/modules/swftools.c +++ b/lib/modules/swftools.c @@ -291,6 +291,30 @@ char* swf_GetName(TAG * t) return name; } +/* used in enumerateUsedIDs */ +void swf_GetMorphGradient(TAG * tag, GRADIENT * gradient1, GRADIENT * gradient2) +{ + GRADIENT dummy1; + GRADIENT dummy2; + int t; + if(!gradient1) + gradient1 = &dummy1; + if(!gradient2) + gradient2 = &dummy2; + gradient1->num = + gradient2->num = swf_GetU8(tag); + for(t=0;tnum;t++) + { + int s=t; + if(s>=8) //FIXME + s=7; + gradient1->ratios[t] = swf_GetU8(tag); + swf_GetRGBA(tag, &gradient1->rgba[t]); + gradient2->ratios[t] = swf_GetU8(tag); + swf_GetRGBA(tag, &gradient2->rgba[t]); + } +} + #define DEBUG_ENUMERATE if(0) static void enumerateUsedIDs_styles(TAG * tag, void (*callback)(TAG*, int, void*), void*callback_data, int num, int morph) @@ -551,8 +575,7 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v callback(tag, tag->pos + base, callback_data); break; - //case ST_DEFINEMORPHSHAPE: /* disabled for now (doesn't work) */ - + case ST_DEFINEMORPHSHAPE: /* disabled for now (doesn't work) */ case ST_DEFINESHAPE3: // these thingies might have bitmap ids in their fillstyles num++; //fallthrough case ST_DEFINESHAPE2: @@ -561,23 +584,28 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v int fillbits; int linebits; int id; + int numshapes = 1; int morph = 0; - if(tag->id == ST_DEFINEMORPHSHAPE) + if(tag->id == ST_DEFINEMORPHSHAPE) { + numshapes = 2; morph = 1; + } id = swf_GetU16(tag); // id; swf_GetRect(tag, NULL); // bounds if(morph) { + swf_ResetReadBits(tag); swf_GetRect(tag, NULL); // bounds2 swf_GetU32(tag); //offset to endedges } - + DEBUG_ENUMERATE printf("Tag:%d Name:%s ID:%d\n", tag->id, swf_TagGetName(tag), id); enumerateUsedIDs_styles(tag, callback, callback_data, num, morph); DEBUG_ENUMERATE printf("-------\n"); - while(--morph>=0) /* morph shapes define two shapes */ + while(--numshapes>=0) /* morph shapes define two shapes */ { + DEBUG_ENUMERATE printf("shape:%d\n", numshapes); fillbits = swf_GetBits(tag, 4); linebits = swf_GetBits(tag, 4); DEBUG_ENUMERATE printf("%d %d\n", fillbits, linebits);