Added framebuffer support.
[ruby-ecore.git] / src / ecore_evas / rb_fb.c
diff --git a/src/ecore_evas/rb_fb.c b/src/ecore_evas/rb_fb.c
new file mode 100644 (file)
index 0000000..86b12c2
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Evas.h>
+
+#include "rb_ecore_evas_main.h"
+#include "rb_ecore_evas.h"
+
+VALUE cFb;
+
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
+{
+       VALUE disp, rot, w, h;
+       Ecore_Evas **ee = NULL;
+       char *cdisp = NULL;
+       int irot = 0, iw = 0, ih = 0;
+
+       Data_Get_Struct (self, Ecore_Evas *, ee);
+
+       rb_scan_args (argc, argv, "04", &disp, &rot, &w, &h);
+
+       if (!NIL_P (disp)) {
+               Check_Type (disp, T_STRING);
+               cdisp = StringValuePtr (disp);
+       }
+
+       if (!NIL_P (rot)) {
+               Check_Type (rot, T_FIXNUM);
+               irot = NUM2INT (rot);
+       }
+
+       if (!NIL_P (w)) {
+               Check_Type (w, T_FIXNUM);
+               iw = NUM2INT (w);
+       }
+
+       if (!NIL_P (h)) {
+               Check_Type (h, T_FIXNUM);
+               ih = NUM2INT (h);
+       }
+
+       *ee = ecore_evas_fb_new (cdisp, irot, iw, ih);
+
+       return self;
+}
+
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+{
+       VALUE self;
+       Ecore_Evas **ee;
+
+       self = Data_Make_Struct (klass, Ecore_Evas *,
+                                NULL, c_ecore_evas_free, ee);
+
+       rb_obj_call_init (self, argc, argv);
+
+       return self;
+}
+
+void Init_Fb (void)
+{
+       cFb = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
+
+       rb_define_singleton_method (cFb, "new", c_new, -1);
+       rb_define_method (cFb, "initialize", c_init, -1);
+}
+