seed random from ruby interface
[swftools.git] / lib / ruby / gfx.c
index 3a5f60c..7c48a09 100644 (file)
@@ -1,4 +1,5 @@
 #include <ruby.h>
+#include "../../config.h"
 #include "../gfxdevice.h"
 #include "../gfxsource.h"
 #include "../gfxtools.h"
@@ -437,6 +438,7 @@ static ID id_radial = 0;
 static ID id_linear = 0;
 static ID id_remove_font_transforms = 0;
 static ID id_maketransparent = 0;
+static ID id_vectors_to_glyphs = 0;
 
 static VALUE noop(int argc, VALUE *argv, VALUE obj) {return obj;}
 
@@ -707,6 +709,8 @@ static VALUE doc_render(VALUE cls, VALUE device, VALUE _range, VALUE filters)
                            else x = RARRAY(filters)->ptr[t++];
            if(id == id_remove_font_transforms) {
                wrap_filter2(dev, remove_font_transforms);
+           } else if(id == id_vectors_to_glyphs) {
+               wrap_filter2(dev, vectors_to_glyphs);
            } else if(id == id_maketransparent) {
                PARAM(alpha);
                wrap_filter(dev, maketransparent, FIX2INT(alpha));
@@ -762,6 +766,14 @@ VALUE gfx_setparameter(VALUE module, VALUE _key, VALUE _value)
 void Init_gfx()
 {
     initLog(0,0,0,0,0,2);
+#ifdef HAVE_SRAND48
+    srand48(time(0));
+#else
+#ifdef HAVE_SRAND
+    srand(time(0));
+#endif
+#endif
+
     pdfdriver = gfxsource_pdf_create();
     swfdriver = gfxsource_swf_create();
     imagedriver = gfxsource_image_create();
@@ -856,5 +868,6 @@ void Init_gfx()
     id_linear = rb_intern("linear");
     id_remove_font_transforms = rb_intern("remove_font_transforms");
     id_maketransparent = rb_intern("maketransparent");
+    id_vectors_to_glyphs = rb_intern("vectors_to_glyphs");
 }