Permalink
Browse files

adding swf blur and swf filter

  • Loading branch information...
1 parent 1503d59 commit 123818f91245369afa6f41ec6da1a2fe37806b66 @tenderlove committed Feb 11, 2009
View
@@ -17,4 +17,6 @@ void Init_kedama()
init_swf_init_action();
init_swf_button();
init_swf_button_record();
+ init_swf_blur();
+ init_swf_filter();
}
View
@@ -22,5 +22,7 @@
#include <swf_init_action.h>
#include <swf_button.h>
#include <swf_button_record.h>
+#include <swf_blur.h>
+#include <swf_filter.h>
#endif
View
@@ -8,4 +8,3 @@ extern VALUE cKedamaSwfAction;
void init_swf_action();
#endif
-
View
@@ -0,0 +1,24 @@
+#include <swf_blur.h>
+
+static VALUE new(VALUE klass, VALUE blur_x, VALUE blur_y, VALUE passes)
+{
+ SWFBlur blur = newSWFBlur(
+ NUM2DBL(blur_x),
+ NUM2DBL(blur_y),
+ NUM2INT(passes)
+ );
+
+ return Data_Wrap_Struct(cKedamaSwfBlur, NULL, destroySWFBlur, blur);
+}
+
+VALUE cKedamaSwfBlur;
+void init_swf_blur()
+{
+ VALUE kedama = rb_define_module("Kedama");
+ VALUE swf = rb_define_module_under(kedama, "SWF");
+ VALUE klass = rb_define_class_under(swf, "Blur", rb_cObject);
+
+ cKedamaSwfBlur = klass;
+
+ rb_define_singleton_method(klass, "new", new, 3);
+}
View
@@ -0,0 +1,10 @@
+#ifndef KEDAMA_SWF_BLUR
+#define KEDAMA_SWF_BLUR
+
+#include <kedama.h>
+
+extern VALUE cKedamaSwfBlur;
+
+void init_swf_blur();
+
+#endif
View
@@ -0,0 +1,23 @@
+#include <swf_filter.h>
+
+static VALUE from_blur(VALUE klass, VALUE _blur)
+{
+ SWFBlur blur;
+ Data_Get_Struct(_blur, struct Blur_s, blur);
+
+ SWFFilter f = newBlurFilter(blur);
+
+ return Data_Wrap_Struct(cKedamaSwfFilter, NULL, destroySWFFilter, f);
+}
+
+VALUE cKedamaSwfFilter;
+void init_swf_filter()
+{
+ VALUE kedama = rb_define_module("Kedama");
+ VALUE swf = rb_define_module_under(kedama, "SWF");
+ VALUE klass = rb_define_class_under(swf, "Filter", rb_cObject);
+
+ cKedamaSwfFilter = klass;
+
+ rb_define_singleton_method(klass, "from_blur", from_blur, 1);
+}
View
@@ -0,0 +1,10 @@
+#ifndef KEDAMA_SWF_FILTER
+#define KEDAMA_SWF_FILTER
+
+#include <kedama.h>
+
+extern VALUE cKedamaSwfFilter;
+
+void init_swf_filter();
+
+#endif
View
@@ -0,0 +1,9 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
+
+module SWF
+ class TestBlur < Kedama::TestCase
+ def test_new
+ assert blur = Blur.new(5, 5, 2)
+ end
+ end
+end
View
@@ -0,0 +1,9 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
+
+module SWF
+ class TestFilter < Kedama::TestCase
+ def test_from_blur
+ assert Filter.from_blur(Blur.new(1.2, 2.2, 2))
+ end
+ end
+end

0 comments on commit 123818f

Please sign in to comment.