fixed framerate calculation.
[swftools.git] / src / swfc.c
index c0bdebe..f57a98e 100644 (file)
@@ -4,8 +4,20 @@
    Part of the swftools package.
 
    Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-   This file is distributed under the GPL, see file COPYING for details */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -325,10 +337,9 @@ static MATRIX s_instancepos(instance_t*i, parameters_t*p)
     return m;
 }
 
-void s_swf(char*name, SRECT r, int version, int fps, int compress)
+void s_swf(char*name, SRECT r, int version, int fps, int compress, RGBA background)
 {
     SWF*swf = (SWF*)malloc(sizeof(SWF));
-    RGBA rgb;
 
     if(stackpos)
        syntaxerror(".swf blocks can't be nested");
@@ -339,8 +350,7 @@ void s_swf(char*name, SRECT r, int version, int fps, int compress)
     swf->frameRate = fps;
     swf->firstTag = tag = swf_InsertTag(0, ST_SETBACKGROUNDCOLOR);
     swf->compressed = compress;
-    rgb.r = 0x00;rgb.g = 0x00;rgb.b = 0x00;
-    swf_SetRGB(tag,&rgb);
+    swf_SetRGB(tag,&background);
     
     if(stackpos==sizeof(stack)/sizeof(stack[0]))
        syntaxerror("too many levels of recursion");
@@ -1254,6 +1264,7 @@ static int c_swf(map_t*args)
     int version = parseInt(lu(args, "version"));
     int fps = (int)(parseFloat(lu(args, "fps"))*256);
     int compress = 0;
+    RGBA color = parseColor(lu(args, "background"));
     if(!strcmp(name, "!default!") || override_outputname)
        name = outputname;
     
@@ -1265,7 +1276,7 @@ static int c_swf(map_t*args)
        compress = 0;
     else syntaxerror("value \"%s\" not supported for the compress argument", compressstr);
 
-    s_swf(name, bbox, version, fps, compress);
+    s_swf(name, bbox, version, fps, compress, color);
     return 0;
 }
 int isRelative(char*str)
@@ -1720,7 +1731,7 @@ static struct {
     command_func_t* func;
     char*arguments;
 } arguments[] =
-{{"swf", c_swf, "bbox=autocrop version=5 fps=50 name=!default! @compress=default"},
+{{"swf", c_swf, "bbox=autocrop background=black version=5 fps=50 name=!default! @compress=default"},
  {"frame", c_frame, "n=<plus>1"},
 
     // "import" type stuff