new function swf_GetSWFBackgroundColor()
[swftools.git] / lib / modules / swftools.c
index 053acaf..822fe38 100644 (file)
@@ -409,7 +409,7 @@ void swf_GetMorphGradient(TAG * tag, GRADIENT * gradient1, GRADIENT * gradient2)
 
 #define DEBUG_ENUMERATE if(0)
 
-static void enumerateUsedIDs_styles(TAG * tag, void (*callback)(TAG*, int, void*), void*callback_data, int num, int morph)
+void enumerateUsedIDs_styles(TAG * tag, void (*callback)(TAG*, int, void*), void*callback_data, int num, int morph)
 {
     U16 count;
     int t;
@@ -1113,3 +1113,22 @@ void swf_SetDefineBBox(TAG * tag, SRECT newbbox)
     }
 }
 
+RGBA swf_GetSWFBackgroundColor(SWF*swf)
+{
+    TAG*t=swf->firstTag;
+    RGBA color;
+    color.r = color.b = color.g = 0;
+    color.a = 255;
+    while(t) {
+       if(t->id == ST_SETBACKGROUNDCOLOR) {
+           swf_SetTagPos(t, 0);
+           color.r = swf_GetU8(t);
+           color.g = swf_GetU8(t);
+           color.b = swf_GetU8(t);
+           break;
+       }
+       t=t->next;
+    }
+    return color;
+}
+