X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=e1416dc124dbd582d7e48a91902bb71ce15b218e;hb=dd1a5526445c9a2345097f76943e21012c97177e;hp=554309ee41b9a041cd6d83a6ecf8c5a8c2124ec3;hpb=6de7848de7c75fa777eece7d6cf21ee61db83ef4;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 554309e..e1416dc 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -239,6 +239,16 @@ int swf_SetRGB(TAG * t,RGBA * col) } else swf_SetBlock(t,NULL,3); return 0; } +void swf_GetRGB(TAG * t, RGBA * col) +{ + RGBA dummy; + if(!col); + col = &dummy; + col->r = swf_GetU8(t); + col->g = swf_GetU8(t); + col->b = swf_GetU8(t); + col->a = 255; +} int swf_SetRGBA(TAG * t,RGBA * col) { if (!t) return -1; @@ -250,6 +260,36 @@ int swf_SetRGBA(TAG * t,RGBA * col) } else swf_SetBlock(t,NULL,4); return 0; } +void swf_GetRGBA(TAG * t, RGBA * col) +{ + RGBA dummy; + if(!col); + col = &dummy; + col->r = swf_GetU8(t); + col->g = swf_GetU8(t); + col->b = swf_GetU8(t); + col->a = swf_GetU8(t); +} + +void swf_GetGradient(TAG * tag, GRADIENT * gradient, char alpha) +{ + GRADIENT dummy; + int t; + if(!gradient) + gradient = &dummy; + gradient->num = swf_GetU8(tag); + for(t=0;tnum;t++) + { + int s=t; + if(s>=8) //FIXME + s=7; + gradient->ratios[t] = swf_GetU8(tag); + if(!alpha) + swf_GetRGB(tag, &gradient->rgba[t]); + else + swf_GetRGBA(tag, &gradient->rgba[t]); + } +} int swf_CountBits(U32 v,int nbits) { int n = 33;