2 * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "rb_evas_main.h"
25 #include "rb_evas_object.h"
29 * Evas::Polygon.new(evas) => polygon
31 * Creates an new Evas::Polygon object.
33 static VALUE c_init (VALUE self, VALUE evas)
35 CHECK_CLASS (evas, cEvas);
36 GET_OBJ (evas, RbEvas, e);
37 GET_OBJ (self, RbEvasObject, poly);
39 poly->real = evas_object_polygon_add (e->real);
41 rb_call_super (1, &evas);
48 * polygon.add_point(x, y) => nil
50 * Adds a point to <i>polygon</i>.
52 static VALUE c_add_point (VALUE self, VALUE x, VALUE y)
54 GET_OBJ (self, RbEvasObject, e);
56 Check_Type (x, T_FIXNUM);
57 Check_Type (y, T_FIXNUM);
59 evas_object_polygon_point_add (e->real, FIX2INT (x), FIX2INT (y));
66 * polygon.clear_points => nil
68 * Clears the points of <i>polygon</i>.
70 static VALUE c_clear_points (VALUE self)
72 GET_OBJ (self, RbEvasObject, e);
74 evas_object_polygon_points_clear (e->real);
79 void Init_Polygon (void)
81 VALUE c = rb_define_class_under (mEvas, "Polygon", cEvasObject);
83 rb_define_method (c, "initialize", c_init, 1);
84 rb_define_method (c, "add_point", c_add_point, 2);
85 rb_define_method (c, "clear_points", c_clear_points, 0);