for ng, use 4x4 antializing
[swftools.git] / src / swfrender.c
index b782555..326a184 100644 (file)
 #include "../lib/gfxsource.h"
 #include "../lib/readers/swf.h"
 #include "../lib/devices/render.h"
+#include "../lib/devices/rescale.h"
 
 static struct options_t options[] = {
 {"h", "help"},
 {"o", "output"},
 {"l", "legacy"},
 {"V", "version"},
+{"X", "width"},
+{"Y", "height"},
 {0,0}
 };
 
@@ -24,6 +27,9 @@ static char*filename = 0;
 static char*outputname = "output.png";
 static int quantize = 0;
 
+static int width = 0;
+static int height = 0;
+
 int args_callback_option(char*name,char*val)
 {
     if(!strcmp(name, "V")) {
@@ -38,6 +44,12 @@ int args_callback_option(char*name,char*val)
     } else if(!strcmp(name, "q")) {
        quantize = 1;
        return 0;
+    } else if(!strcmp(name, "X")) {
+       width = atoi(val);
+       return 1;
+    } else if(!strcmp(name, "Y")) {
+       height = atoi(val);
+       return 1;
     } else {
         printf("Unknown option: -%s\n", name);
        exit(1);
@@ -113,9 +125,13 @@ int main(int argn, char*argv[])
        }
        gfxdevice_t dev2,*dev=&dev2;
        gfxdevice_render_init(dev);
+        dev->setparameter(dev, "antialise", "4");
         if(quantize) {
             dev->setparameter(dev, "palette", "1");
         }
+       if(width || height) {
+           dev = gfxdevice_rescale_new(dev, width, height, 0);
+       }
 
        int t;
        for(t=1;t<=doc->num_pages;t++) {