-x and -y now take (float) pixel coordinates, not twips.
[swftools.git] / src / swfcombine.c
index 4b5af94..103dfe0 100644 (file)
@@ -3,9 +3,21 @@
 
    Part of the swftools package.
    
-   Copyright (c) 2001 Matthias Kramm <kramm@quiss.org> 
-
-   This file is distributed under the GPL, see file COPYING for details */
+   Copyright (c) 2001,2002,2003 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.
+
+   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>
@@ -91,12 +103,14 @@ int args_callback_option(char*name,char*val) {
     }
     else if (!strcmp(name, "x"))
     {
-       config.movex = atoi(val);
+       float x = atof(val);
+       config.movex = (int)(x*20+0.5);
        return 1;
     }
     else if (!strcmp(name, "y"))
     {
-       config.movey = atoi(val);
+       float y = atof(val);
+       config.movey = (int)(y*20+0.5);
        return 1;
     }
     else if (!strcmp(name, "m"))
@@ -121,7 +135,13 @@ int args_callback_option(char*name,char*val) {
     }
     else if (!strcmp(name, "r"))
     {
-       config.framerate = atoi(val)*256/100;
+
+       float rate = atof(val);
+       if ((rate < 1.0/256) ||(rate >= 256.0)) {
+           fprintf(stderr, "Error: You must specify a valid framerate between 1/256 and 255.\n");
+           exit(1);
+       }
+       config.framerate = (int)(rate*256);
        return 1;
     }
     else if (!strcmp(name, "X"))
@@ -250,15 +270,15 @@ void args_callback_usage(char*name)
     printf("-a                  --cat       concatenate all slave files (no master movie)\n");
     printf("-l                  --overlay   Don't remove any master objects, only overlay new objects\n");
     printf("-c                  --clip      Clip the slave objects by the corresponding master objects\n");
-    printf("-v                  --verbose   Use more than one -v for greater effect \n");
-    printf("-d                  --dummy     Don't require slave objects \n");
+    printf("-v                  --verbose   Be verbose. Use more than one -v for greater effect \n");
+    printf("-d                  --dummy     Don't require slave objects (for changing movie attributes)\n");
     printf("-f                  --frame     The following identifier is a frame or framelabel, not an id or objectname\n");
-    printf("-x xpos             --movex     x Adjust position of slave by xpos twips (1/20 pixel)\n");
-    printf("-y ypos             --movey     y Adjust position of slave by ypos twips (1/20 pixel)\n");
-    printf("-s scale            --scale     Adjust size of slave by scale%\n");
-    printf("-r framerate        --rate      Set movie framerate (100 frames/sec)\n");
-    printf("-X width            --width     Force movie width to scale (default: use master width (not with -t))\n");
-    printf("-Y height           --height    Force movie height to scale (default: use master height (not with -t))\n");
+    printf("-x xpos             --movex     x Adjust position of slave by xpos pixels\n");
+    printf("-y ypos             --movey     y Adjust position of slave by ypos pixels\n");
+    printf("-s scale            --scale     Adjust size of slave by scale% (e.g. 100%% = original size)\n");
+    printf("-r framerate        --rate      Set movie framerate (frames/sec)\n");
+    printf("-X width            --width     Force movie bbox width to scale (default: use master width (not with -t))\n");
+    printf("-Y height           --height    Force movie bbox height to scale (default: use master height (not with -t))\n");
     printf("-z zlib             --zlib      Enable Flash 6 (MX) Zlib Compression\n");
 }