gdk3 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -4
- data/lib/gdk3/atom.rb +26 -0
- data/lib/gdk3/cairo.rb +60 -0
- data/lib/gdk3/color.rb +27 -0
- data/lib/gdk3/deprecated.rb +14 -16
- data/lib/gdk3/event.rb +38 -0
- data/lib/gdk3/loader.rb +266 -0
- data/lib/gdk3/rectangle.rb +38 -0
- data/lib/gdk3/rgba.rb +32 -0
- data/lib/gdk3/window-attr.rb +28 -0
- data/lib/gdk3/window.rb +21 -0
- data/lib/gdk3.rb +61 -2
- data/test/run-test.rb +15 -6
- data/test/test-gdk-cairo.rb +41 -0
- data/test/test-gdk-event-type.rb +25 -0
- data/test/test-gdk-event.rb +47 -49
- data/test/test-gdk-keyval.rb +21 -0
- data/test/test-gdk-pixbuf.rb +49 -0
- data/test/test-gdk-rectangle.rb +35 -4
- data/test/test-gdk-rgba.rb +6 -1
- data/test/test-gdk-window-attr.rb +1 -1
- metadata +23 -51
- data/ext/gdk3/depend +0 -11
- data/ext/gdk3/extconf.rb +0 -130
- data/ext/gdk3/gdk3.def +0 -12
- data/ext/gdk3/init.c +0 -35
- data/ext/gdk3/rbgdk.c +0 -491
- data/ext/gdk3/rbgdk3.h +0 -73
- data/ext/gdk3/rbgdk3conversions.h +0 -121
- data/ext/gdk3/rbgdk3private.h +0 -85
- data/ext/gdk3/rbgdkatom.c +0 -122
- data/ext/gdk3/rbgdkcairo.c +0 -91
- data/ext/gdk3/rbgdkcolor.c +0 -137
- data/ext/gdk3/rbgdkconst.c +0 -33
- data/ext/gdk3/rbgdkcursor.c +0 -92
- data/ext/gdk3/rbgdkdevice.c +0 -253
- data/ext/gdk3/rbgdkdevicemanager.c +0 -39
- data/ext/gdk3/rbgdkdisplay.c +0 -434
- data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
- data/ext/gdk3/rbgdkdragcontext.c +0 -191
- data/ext/gdk3/rbgdkevent.c +0 -1173
- data/ext/gdk3/rbgdkgeometry.c +0 -253
- data/ext/gdk3/rbgdkkeymap.c +0 -151
- data/ext/gdk3/rbgdkkeyval.c +0 -108
- data/ext/gdk3/rbgdkpango.c +0 -197
- data/ext/gdk3/rbgdkpangorenderer.c +0 -144
- data/ext/gdk3/rbgdkpixbuf.c +0 -176
- data/ext/gdk3/rbgdkproperty.c +0 -305
- data/ext/gdk3/rbgdkrectangle.c +0 -140
- data/ext/gdk3/rbgdkrgb.c +0 -199
- data/ext/gdk3/rbgdkrgba.c +0 -142
- data/ext/gdk3/rbgdkscreen.c +0 -443
- data/ext/gdk3/rbgdkselection.c +0 -146
- data/ext/gdk3/rbgdkthreads.c +0 -77
- data/ext/gdk3/rbgdktimecoord.c +0 -133
- data/ext/gdk3/rbgdkvisual.c +0 -251
- data/ext/gdk3/rbgdkwindow.c +0 -1069
- data/ext/gdk3/rbgdkwindowattr.c +0 -191
- data/ext/gdk3/rbgdkx11.c +0 -102
- data/ext/gdk3/rbgdkx11x11window.c +0 -66
- data/extconf.rb +0 -49
- data/lib/gdk3/base.rb +0 -59
data/ext/gdk3/rbgdkrectangle.c
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2002,2003 Masao Mutoh
|
5
|
-
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
-
* Daisuke Kanda,
|
7
|
-
* Hiroshi Igarashi
|
8
|
-
*
|
9
|
-
* This library is free software; you can redistribute it and/or
|
10
|
-
* modify it under the terms of the GNU Lesser General Public
|
11
|
-
* License as published by the Free Software Foundation; either
|
12
|
-
* version 2.1 of the License, or (at your option) any later version.
|
13
|
-
*
|
14
|
-
* This library is distributed in the hope that it will be useful,
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
* Lesser General Public License for more details.
|
18
|
-
*
|
19
|
-
* You should have received a copy of the GNU Lesser General Public
|
20
|
-
* License along with this library; if not, write to the Free Software
|
21
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
-
* MA 02110-1301 USA
|
23
|
-
*/
|
24
|
-
|
25
|
-
#include "rbgdk3private.h"
|
26
|
-
|
27
|
-
#define RG_TARGET_NAMESPACE cRectangle
|
28
|
-
#define _SELF(r) (RVAL2GDKRECTANGLE(r))
|
29
|
-
|
30
|
-
static VALUE
|
31
|
-
rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
|
32
|
-
{
|
33
|
-
GdkRectangle rectangle;
|
34
|
-
|
35
|
-
rectangle.x = NUM2INT(x);
|
36
|
-
rectangle.y = NUM2INT(y);
|
37
|
-
rectangle.width = NUM2INT(width);
|
38
|
-
rectangle.height = NUM2INT(height);
|
39
|
-
|
40
|
-
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RECTANGLE, &rectangle));
|
41
|
-
return Qnil;
|
42
|
-
}
|
43
|
-
|
44
|
-
static VALUE
|
45
|
-
rg_intersect(VALUE self, VALUE other)
|
46
|
-
{
|
47
|
-
GdkRectangle dest;
|
48
|
-
gboolean ret = gdk_rectangle_intersect(_SELF(self), _SELF(other), &dest);
|
49
|
-
return ret ? GDKRECTANGLE2RVAL(&dest) : Qnil;
|
50
|
-
}
|
51
|
-
|
52
|
-
static VALUE
|
53
|
-
rg_union(VALUE self, VALUE other)
|
54
|
-
{
|
55
|
-
GdkRectangle dest;
|
56
|
-
gdk_rectangle_union(_SELF(self), _SELF(other), &dest);
|
57
|
-
return GDKRECTANGLE2RVAL(&dest);
|
58
|
-
}
|
59
|
-
|
60
|
-
/* Struct accessors */
|
61
|
-
static VALUE
|
62
|
-
rg_x(VALUE self)
|
63
|
-
{
|
64
|
-
return INT2NUM(_SELF(self)->x);
|
65
|
-
}
|
66
|
-
|
67
|
-
static VALUE
|
68
|
-
rg_y(VALUE self)
|
69
|
-
{
|
70
|
-
return INT2NUM(_SELF(self)->y);
|
71
|
-
}
|
72
|
-
|
73
|
-
static VALUE
|
74
|
-
rg_width(VALUE self)
|
75
|
-
{
|
76
|
-
return INT2NUM(_SELF(self)->width);
|
77
|
-
}
|
78
|
-
|
79
|
-
static VALUE
|
80
|
-
rg_height(VALUE self)
|
81
|
-
{
|
82
|
-
return INT2NUM(_SELF(self)->height);
|
83
|
-
}
|
84
|
-
|
85
|
-
static VALUE
|
86
|
-
rg_set_x(VALUE self, VALUE x)
|
87
|
-
{
|
88
|
-
_SELF(self)->x = NUM2INT(x);
|
89
|
-
return self;
|
90
|
-
}
|
91
|
-
|
92
|
-
static VALUE
|
93
|
-
rg_set_y(VALUE self, VALUE y)
|
94
|
-
{
|
95
|
-
_SELF(self)->y = NUM2INT(y);
|
96
|
-
return self;
|
97
|
-
}
|
98
|
-
|
99
|
-
static VALUE
|
100
|
-
rg_set_width(VALUE self, VALUE width)
|
101
|
-
{
|
102
|
-
_SELF(self)->width = NUM2INT(width);
|
103
|
-
return self;
|
104
|
-
}
|
105
|
-
|
106
|
-
static VALUE
|
107
|
-
rg_set_height(VALUE self, VALUE height)
|
108
|
-
{
|
109
|
-
_SELF(self)->height = NUM2INT(height);
|
110
|
-
return self;
|
111
|
-
}
|
112
|
-
|
113
|
-
static VALUE
|
114
|
-
rg_to_a(VALUE self)
|
115
|
-
{
|
116
|
-
GdkRectangle* a = _SELF(self);
|
117
|
-
return rb_ary_new3(4, INT2FIX(a->x), INT2FIX(a->y),
|
118
|
-
INT2FIX(a->width), INT2FIX(a->height));
|
119
|
-
}
|
120
|
-
|
121
|
-
void
|
122
|
-
Init_gdk_rectangle(VALUE mGdk)
|
123
|
-
{
|
124
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RECTANGLE, "Rectangle", mGdk);
|
125
|
-
|
126
|
-
RG_DEF_METHOD(initialize, 4);
|
127
|
-
RG_DEF_METHOD(intersect, 1);
|
128
|
-
RG_DEF_ALIAS("&", "intersect");
|
129
|
-
RG_DEF_METHOD(union, 1);
|
130
|
-
RG_DEF_ALIAS("|", "union");
|
131
|
-
RG_DEF_METHOD(x, 0);
|
132
|
-
RG_DEF_METHOD(y, 0);
|
133
|
-
RG_DEF_METHOD(width, 0);
|
134
|
-
RG_DEF_METHOD(height, 0);
|
135
|
-
RG_DEF_METHOD(set_x, 1);
|
136
|
-
RG_DEF_METHOD(set_y, 1);
|
137
|
-
RG_DEF_METHOD(set_width, 1);
|
138
|
-
RG_DEF_METHOD(set_height, 1);
|
139
|
-
RG_DEF_METHOD(to_a, 0);
|
140
|
-
}
|
data/ext/gdk3/rbgdkrgb.c
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
|
5
|
-
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
-
* Daisuke Kanda,
|
7
|
-
* Hiroshi Igarashi
|
8
|
-
*
|
9
|
-
* This library is free software; you can redistribute it and/or
|
10
|
-
* modify it under the terms of the GNU Lesser General Public
|
11
|
-
* License as published by the Free Software Foundation; either
|
12
|
-
* version 2.1 of the License, or (at your option) any later version.
|
13
|
-
*
|
14
|
-
* This library is distributed in the hope that it will be useful,
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
* Lesser General Public License for more details.
|
18
|
-
*
|
19
|
-
* You should have received a copy of the GNU Lesser General Public
|
20
|
-
* License along with this library; if not, write to the Free Software
|
21
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
-
* MA 02110-1301 USA
|
23
|
-
*/
|
24
|
-
|
25
|
-
/* deprecated
|
26
|
-
#include "rbgdk3private.h"
|
27
|
-
|
28
|
-
#define RG_TARGET_NAMESPACE mRGB
|
29
|
-
#define RVAL2DRAW(s) RVAL2GDKDRAWABLE(s)
|
30
|
-
|
31
|
-
static VALUE
|
32
|
-
rg_s_draw_rgb_image(int argc, VALUE *argv, VALUE self)
|
33
|
-
{
|
34
|
-
VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
|
35
|
-
|
36
|
-
rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
|
37
|
-
&buf, &rowstride, &xdith, &ydith);
|
38
|
-
|
39
|
-
if (argc == 9){
|
40
|
-
gdk_draw_rgb_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
|
41
|
-
NUM2INT(x), NUM2INT(y),
|
42
|
-
NUM2INT(w), NUM2INT(h),
|
43
|
-
RVAL2GDKRGBDITHER(dither),
|
44
|
-
(guchar*)RVAL2CSTR(buf),
|
45
|
-
NUM2INT(rowstride));
|
46
|
-
} else {
|
47
|
-
gdk_draw_rgb_image_dithalign(RVAL2DRAW(win), RVAL2GDKGC(gc),
|
48
|
-
NUM2INT(x), NUM2INT(y),
|
49
|
-
NUM2INT(w), NUM2INT(h),
|
50
|
-
RVAL2GDKRGBDITHER(dither),
|
51
|
-
(guchar*)RVAL2CSTR(buf),
|
52
|
-
NUM2INT(rowstride),
|
53
|
-
NUM2INT(xdith), NUM2INT(ydith));
|
54
|
-
}
|
55
|
-
|
56
|
-
return self;
|
57
|
-
}
|
58
|
-
|
59
|
-
static VALUE
|
60
|
-
rg_s_draw_indexed_image(VALUE self, VALUE win, VALUE rbgc, VALUE rbx, VALUE rby,
|
61
|
-
VALUE rbwidth, VALUE rbheight, VALUE rbdither,
|
62
|
-
VALUE rbbuf, VALUE rbrowstride, VALUE rbcolors)
|
63
|
-
{
|
64
|
-
GdkDrawable *drawable = RVAL2DRAW(win);
|
65
|
-
GdkGC *gc = RVAL2GDKGC(rbgc);
|
66
|
-
gint x = NUM2INT(rbx);
|
67
|
-
gint y = NUM2INT(rby);
|
68
|
-
gint width = NUM2INT(rbwidth);
|
69
|
-
gint height = NUM2INT(rbheight);
|
70
|
-
GdkRgbDither dither = RVAL2GDKRGBDITHER(rbdither);
|
71
|
-
const guchar *buf = (const guchar *)RVAL2CSTR(rbbuf);
|
72
|
-
gint rowstride = NUM2INT(rbrowstride);
|
73
|
-
long n;
|
74
|
-
guint32 *colors = RVAL2GUINT32S(rbcolors, n);
|
75
|
-
GdkRgbCmap *cmap;
|
76
|
-
|
77
|
-
if (n < 0 || n > 255) {
|
78
|
-
g_free(colors);
|
79
|
-
|
80
|
-
rb_raise(rb_eArgError, "colors: out of range (0 - 255)");
|
81
|
-
}
|
82
|
-
|
83
|
-
cmap = gdk_rgb_cmap_new(colors, n);
|
84
|
-
|
85
|
-
g_free(colors);
|
86
|
-
|
87
|
-
gdk_draw_indexed_image(drawable, gc, x, y, width, height, dither, buf, rowstride, cmap);
|
88
|
-
|
89
|
-
gdk_rgb_cmap_free(cmap);
|
90
|
-
|
91
|
-
return self;
|
92
|
-
}
|
93
|
-
|
94
|
-
static VALUE
|
95
|
-
rg_s_draw_gray_image(VALUE self, VALUE win, VALUE gc, VALUE x, VALUE y, VALUE w, VALUE h, VALUE dither, VALUE buf, VALUE rowstride)
|
96
|
-
{
|
97
|
-
gdk_draw_gray_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
|
98
|
-
NUM2INT(x), NUM2INT(y),
|
99
|
-
NUM2INT(w), NUM2INT(h),
|
100
|
-
RVAL2GDKRGBDITHER(dither),
|
101
|
-
(guchar*)RVAL2CSTR(buf),
|
102
|
-
NUM2INT(rowstride));
|
103
|
-
return self;
|
104
|
-
}
|
105
|
-
|
106
|
-
static VALUE
|
107
|
-
rg_s_draw_rgb_32_image(int argc, VALUE *argv, VALUE self)
|
108
|
-
{
|
109
|
-
VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;
|
110
|
-
|
111
|
-
rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither,
|
112
|
-
&buf, &rowstride, &xdith, &ydith);
|
113
|
-
|
114
|
-
if (argc == 9){
|
115
|
-
gdk_draw_rgb_32_image(RVAL2DRAW(win), RVAL2GDKGC(gc),
|
116
|
-
NUM2INT(x), NUM2INT(y),
|
117
|
-
NUM2INT(w), NUM2INT(h),
|
118
|
-
RVAL2GDKRGBDITHER(dither),
|
119
|
-
(guchar*)RVAL2CSTR(buf),
|
120
|
-
NUM2INT(rowstride));
|
121
|
-
} else {
|
122
|
-
gdk_draw_rgb_32_image_dithalign(RVAL2DRAW(win), RVAL2GDKGC(gc),
|
123
|
-
NUM2INT(x), NUM2INT(y),
|
124
|
-
NUM2INT(w), NUM2INT(h),
|
125
|
-
RVAL2GDKRGBDITHER(dither),
|
126
|
-
(guchar*)RVAL2CSTR(buf),
|
127
|
-
NUM2INT(rowstride), NUM2INT(xdith), NUM2INT(ydith));
|
128
|
-
}
|
129
|
-
return self;
|
130
|
-
}
|
131
|
-
|
132
|
-
static VALUE
|
133
|
-
rg_s_find_color(VALUE self, VALUE colormap, VALUE color)
|
134
|
-
{
|
135
|
-
gdk_rgb_find_color(RVAL2GDKCOLORMAP(colormap),
|
136
|
-
RVAL2GDKCOLOR(color));
|
137
|
-
return self;
|
138
|
-
}
|
139
|
-
|
140
|
-
static VALUE
|
141
|
-
rg_s_set_install(VALUE self, VALUE install)
|
142
|
-
{
|
143
|
-
gdk_rgb_set_install(RVAL2CBOOL(install));
|
144
|
-
return self;
|
145
|
-
}
|
146
|
-
|
147
|
-
static VALUE
|
148
|
-
rg_s_set_min_colors(VALUE self, VALUE min_colors)
|
149
|
-
{
|
150
|
-
gdk_rgb_set_min_colors(NUM2INT(min_colors));
|
151
|
-
return self;
|
152
|
-
}
|
153
|
-
|
154
|
-
static VALUE
|
155
|
-
rg_s_visual(G_GNUC_UNUSED VALUE self)
|
156
|
-
{
|
157
|
-
return GOBJ2RVAL(gdk_rgb_get_visual());
|
158
|
-
}
|
159
|
-
|
160
|
-
static VALUE
|
161
|
-
rg_s_colormap(G_GNUC_UNUSED VALUE self)
|
162
|
-
{
|
163
|
-
return GOBJ2RVAL(gdk_rgb_get_colormap());
|
164
|
-
}
|
165
|
-
|
166
|
-
static VALUE
|
167
|
-
rg_s_ditherable_p(G_GNUC_UNUSED VALUE self)
|
168
|
-
{
|
169
|
-
return CBOOL2RVAL(gdk_rgb_ditherable());
|
170
|
-
}
|
171
|
-
|
172
|
-
static VALUE
|
173
|
-
rg_s_set_verbose(VALUE self, VALUE verbose)
|
174
|
-
{
|
175
|
-
gdk_rgb_set_verbose(RVAL2CBOOL(verbose));
|
176
|
-
return self;
|
177
|
-
}
|
178
|
-
|
179
|
-
void
|
180
|
-
Init_gdk_rgb(VALUE mGdk)
|
181
|
-
{
|
182
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "RGB");
|
183
|
-
|
184
|
-
RG_DEF_SMETHOD(draw_rgb_image, -1);
|
185
|
-
RG_DEF_SMETHOD(draw_indexed_image, 10);
|
186
|
-
RG_DEF_SMETHOD(draw_gray_image, 9);
|
187
|
-
RG_DEF_SMETHOD(draw_rgb_32_image, -1);
|
188
|
-
RG_DEF_SMETHOD(find_color, 2);
|
189
|
-
RG_DEF_SMETHOD(set_install, 1);
|
190
|
-
RG_DEF_SMETHOD(set_min_colors, 0);
|
191
|
-
RG_DEF_SMETHOD(visual, 0);
|
192
|
-
RG_DEF_SMETHOD(colormap, 0);
|
193
|
-
RG_DEF_SMETHOD_P(ditherable, 0);
|
194
|
-
RG_DEF_SMETHOD(set_verbose, 1);
|
195
|
-
|
196
|
-
G_DEF_CLASS(GDK_TYPE_RGB_DITHER, "Dither", RG_TARGET_NAMESPACE);
|
197
|
-
}
|
198
|
-
*/
|
199
|
-
|
data/ext/gdk3/rbgdkrgba.c
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
*
|
5
|
-
* This library is free software; you can redistribute it and/or
|
6
|
-
* modify it under the terms of the GNU Lesser General Public
|
7
|
-
* License as published by the Free Software Foundation; either
|
8
|
-
* version 2.1 of the License, or (at your option) any later version.
|
9
|
-
*
|
10
|
-
* This library is distributed in the hope that it will be useful,
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
* Lesser General Public License for more details.
|
14
|
-
*
|
15
|
-
* You should have received a copy of the GNU Lesser General Public
|
16
|
-
* License along with this library; if not, write to the Free Software
|
17
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgdk3private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cRGBA
|
24
|
-
#define _SELF(self) (RVAL2GDKRGBA(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE spec)
|
28
|
-
{
|
29
|
-
GdkRGBA color;
|
30
|
-
if (!gdk_rgba_parse(&color, RVAL2CSTR(spec)))
|
31
|
-
rb_raise(rb_eArgError, "can't parse color representation `%s'", RVAL2CSTR(spec));
|
32
|
-
return GDKRGBA2RVAL(&color);
|
33
|
-
}
|
34
|
-
|
35
|
-
static VALUE
|
36
|
-
rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha)
|
37
|
-
{
|
38
|
-
GdkRGBA rgba;
|
39
|
-
|
40
|
-
rgba.red = NUM2DBL(red);
|
41
|
-
rgba.green = NUM2DBL(green);
|
42
|
-
rgba.blue = NUM2DBL(blue);
|
43
|
-
rgba.alpha = NUM2DBL(alpha);
|
44
|
-
|
45
|
-
G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RGBA, &rgba));
|
46
|
-
|
47
|
-
return Qnil;
|
48
|
-
}
|
49
|
-
|
50
|
-
static VALUE
|
51
|
-
rg_red(VALUE self)
|
52
|
-
{
|
53
|
-
return DBL2NUM(_SELF(self)->red);
|
54
|
-
}
|
55
|
-
|
56
|
-
static VALUE
|
57
|
-
rg_set_red(VALUE self, VALUE red)
|
58
|
-
{
|
59
|
-
_SELF(self)->red = NUM2DBL(red);
|
60
|
-
return self;
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE
|
64
|
-
rg_green(VALUE self)
|
65
|
-
{
|
66
|
-
return DBL2NUM(_SELF(self)->green);
|
67
|
-
}
|
68
|
-
|
69
|
-
static VALUE
|
70
|
-
rg_set_green(VALUE self, VALUE green)
|
71
|
-
{
|
72
|
-
_SELF(self)->green = NUM2DBL(green);
|
73
|
-
return self;
|
74
|
-
}
|
75
|
-
|
76
|
-
static VALUE
|
77
|
-
rg_blue(VALUE self)
|
78
|
-
{
|
79
|
-
return DBL2NUM(_SELF(self)->blue);
|
80
|
-
}
|
81
|
-
|
82
|
-
static VALUE
|
83
|
-
rg_set_blue(VALUE self, VALUE blue)
|
84
|
-
{
|
85
|
-
_SELF(self)->blue = NUM2DBL(blue);
|
86
|
-
return self;
|
87
|
-
}
|
88
|
-
|
89
|
-
static VALUE
|
90
|
-
rg_alpha(VALUE self)
|
91
|
-
{
|
92
|
-
return DBL2NUM(_SELF(self)->alpha);
|
93
|
-
}
|
94
|
-
|
95
|
-
static VALUE
|
96
|
-
rg_set_alpha(VALUE self, VALUE alpha)
|
97
|
-
{
|
98
|
-
_SELF(self)->alpha = NUM2DBL(alpha);
|
99
|
-
return self;
|
100
|
-
}
|
101
|
-
|
102
|
-
static VALUE
|
103
|
-
rg_to_a(VALUE self)
|
104
|
-
{
|
105
|
-
GdkRGBA *rgba = _SELF(self);
|
106
|
-
return rb_ary_new3(4, DBL2NUM(rgba->red),
|
107
|
-
DBL2NUM(rgba->green),
|
108
|
-
DBL2NUM(rgba->blue),
|
109
|
-
DBL2NUM(rgba->alpha));
|
110
|
-
}
|
111
|
-
|
112
|
-
static VALUE
|
113
|
-
rg_to_s(VALUE self)
|
114
|
-
{
|
115
|
-
return CSTR2RVAL_FREE(gdk_rgba_to_string(_SELF(self)));
|
116
|
-
}
|
117
|
-
|
118
|
-
static VALUE
|
119
|
-
rg_operator_equal(VALUE self, VALUE other)
|
120
|
-
{
|
121
|
-
return CBOOL2RVAL(gdk_rgba_equal(_SELF(self), _SELF(other)));
|
122
|
-
}
|
123
|
-
|
124
|
-
void
|
125
|
-
Init_gdk_rgba(VALUE mGdk)
|
126
|
-
{
|
127
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RGBA, "RGBA", mGdk);
|
128
|
-
|
129
|
-
RG_DEF_SMETHOD(parse, 1);
|
130
|
-
RG_DEF_METHOD(initialize, 4);
|
131
|
-
RG_DEF_METHOD(red, 0);
|
132
|
-
RG_DEF_METHOD(set_red, 1);
|
133
|
-
RG_DEF_METHOD(green, 0);
|
134
|
-
RG_DEF_METHOD(set_green, 1);
|
135
|
-
RG_DEF_METHOD(blue, 0);
|
136
|
-
RG_DEF_METHOD(set_blue, 1);
|
137
|
-
RG_DEF_METHOD(alpha, 0);
|
138
|
-
RG_DEF_METHOD(set_alpha, 1);
|
139
|
-
RG_DEF_METHOD(to_a, 0);
|
140
|
-
RG_DEF_METHOD(to_s, 0);
|
141
|
-
RG_DEF_METHOD_OPERATOR("==", equal, 1);
|
142
|
-
}
|