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::Gradient.new(evas) => gradient
31 * Creates an Evas::Gradient 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, grad);
39 grad->real = evas_object_gradient_add (e->real);
41 rb_call_super (1, &evas);
48 * gradient.add_color(r, g, b, a, distance) => nil
50 * Adds a color to <i>gradient</i>.
52 static VALUE c_add_color (VALUE self, VALUE r, VALUE g, VALUE b,
53 VALUE a, VALUE distance)
55 GET_OBJ (self, RbEvasObject, e);
57 Check_Type (r, T_FIXNUM);
58 Check_Type (g, T_FIXNUM);
59 Check_Type (b, T_FIXNUM);
60 Check_Type (a, T_FIXNUM);
61 Check_Type (distance, T_FIXNUM);
63 evas_object_gradient_color_add (e->real, FIX2INT (r), FIX2INT (g),
64 FIX2INT (b), FIX2INT (a),
72 * gradient.clear_colors => nil
74 * Clears the colors of <i>gradient</i>.
76 static VALUE c_clear_colors (VALUE self)
78 GET_OBJ (self, RbEvasObject, e);
80 evas_object_gradient_colors_clear (e->real);
87 * gradient.angle => fixnum
89 * Returns the angle of <i>gradient</i>.
91 static VALUE c_angle_get (VALUE self)
93 GET_OBJ (self, RbEvasObject, e);
95 return INT2FIX (evas_object_gradient_angle_get (e->real));
100 * gradient.angle(fixnum)
102 * Sets the angle of <i>gradient</i>.
104 static VALUE c_angle_set (VALUE self, VALUE val)
106 GET_OBJ (self, RbEvasObject, e);
108 Check_Type (val, T_FIXNUM);
110 evas_object_gradient_angle_set (e->real, FIX2INT (val));
115 void Init_Gradient (void)
117 VALUE c = rb_define_class_under (mEvas, "Gradient", cEvasObject);
119 rb_define_method (c, "initialize", c_init, 1);
120 rb_define_method (c, "add_color", c_add_color, 5);
121 rb_define_method (c, "clear_colors", c_clear_colors, 0);
122 rb_define_method (c, "angle", c_angle_get, 0);
123 rb_define_method (c, "angle=", c_angle_set, 1);