gdk3 1.2.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,65 +1,41 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  $LOAD_PATH.unshift("./../glib2/lib")
4
- require 'gnome2-raketask'
4
+ require "gnome2/rake/package-task"
5
5
 
6
- package = GNOME2Package.new do |_package|
7
- _package.summary = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
8
- _package.description = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
9
- _package.dependency.gem.runtime = ["atk", "pango", "gdk_pixbuf2"]
10
- _package.win32.packages = []
11
- _package.win32.dependencies = []
12
- _package.win32.build_dependencies = [
13
- "glib2", "atk", "pango", "gdk_pixbuf2",
6
+ package_task = GNOME2::Rake::PackageTask.new do |package|
7
+ package.summary = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
8
+ package.description = "Ruby/GDK3 is a Ruby binding of GDK-3.x."
9
+ package.dependency.gem.runtime = ["pango", "gdk_pixbuf2"]
10
+ package.windows.packages = []
11
+ package.windows.dependencies = []
12
+ package.windows.build_dependencies = [
13
+ "glib2",
14
+ "atk",
15
+ "pango",
16
+ "gdk_pixbuf2",
17
+ "gobject-introspection",
14
18
  ]
15
- _package.win32.build_packages = [
19
+ package.windows.gobject_introspection_dependencies = [
20
+ "atk",
21
+ "pango",
22
+ "gdk_pixbuf2",
23
+ ]
24
+ package.external_packages = [
16
25
  {
17
26
  :name => "gtk+",
18
27
  :download_site => :gnome,
19
- :label => "gtk+",
28
+ :label => "GTK+",
20
29
  :version => "3.8.0",
21
- :configure_args => [],
22
30
  :compression_method => "xz",
31
+ :windows => {
32
+ :configure_args => [
33
+ "--enable-introspection",
34
+ ],
35
+ },
23
36
  }
24
37
  ]
25
- _package.required_ruby_version = ">= 1.9.2"
26
- _package.post_install_message = "This library is experimental."
27
- end
28
- package.define_tasks
29
-
30
-
31
- namespace :win32 do
32
- namespace :theme do
33
- desc "Install Greybird theme"
34
- task :greybird do
35
- themes_dir = File.join("vendor", "local", "share", "themes")
36
- mkdir_p(themes_dir)
37
- theme_dir = File.join(themes_dir, "Greybird")
38
- rm_rf(theme_dir)
39
- sh("git", "clone", "--depth", "1",
40
- "https://github.com/shimmerproject/Greybird",
41
- theme_dir)
42
- rm_rf(File.join(theme_dir, ".git"))
43
- end
44
- end
45
-
46
- desc "Install all themes"
47
- task :theme => ["win32:theme:greybird"]
48
-
49
- desc "Create default settings.ini"
50
- task :settings do
51
- config_dir = File.join("vendor", "local", "etc", "gtk-3.0")
52
- mkdir_p(config_dir)
53
- settings_ini_path = File.join(config_dir, "settings.ini")
54
- File.open(settings_ini_path, "w") do |settings_ini|
55
- settings_ini.puts(<<-EOS)
56
- [Settings]
57
- gtk-theme-name = Greybird
58
- EOS
59
- end
60
- end
61
-
62
- namespace :builder do
63
- task :after => ["win32:theme", "win32:settings"]
64
- end
38
+ package.required_ruby_version = ">= 1.9.2"
39
+ package.post_install_message = "This library is experimental."
65
40
  end
41
+ package_task.define
data/ext/gdk3/rbgdk.c CHANGED
@@ -534,7 +534,4 @@ Init_gdk(void)
534
534
  Init_gdk_visual(RG_TARGET_NAMESPACE);
535
535
  Init_gdk_window(RG_TARGET_NAMESPACE);
536
536
  Init_gdk_windowattr(RG_TARGET_NAMESPACE);
537
- /* deprecated
538
- Init_gdk_draw(RG_TARGET_NAMESPACE);
539
- */
540
537
  }
@@ -86,8 +86,5 @@ G_GNUC_INTERNAL void Init_gdk_window(VALUE mGdk);
86
86
  G_GNUC_INTERNAL void Init_gdk_windowattr(VALUE mGdk);
87
87
  G_GNUC_INTERNAL void Init_gdkx11(void);
88
88
  G_GNUC_INTERNAL void Init_gdkx11_x11window(VALUE mGdkX11);
89
- /* deprecated
90
- G_GNUC_INTERNAL void Init_gdk_draw(VALUE mGdk);
91
- */
92
89
 
93
90
  #endif /* __RBGDK3PRIVATE_H__ */
@@ -65,7 +65,7 @@ rg_set_source_pixmap(VALUE self, VALUE pixmap, VALUE pixmap_x, VALUE pixmap_y)
65
65
  static VALUE
66
66
  rg_gdk_rectangle(VALUE self, VALUE rectangle)
67
67
  {
68
- gdk_cairo_rectangle(_SELF(self),
68
+ gdk_cairo_rectangle(_SELF(self),
69
69
  RVAL2GDKRECTANGLE(rectangle));
70
70
  rb_cairo_check_status(cairo_status(_SELF(self)));
71
71
  return self;
@@ -24,6 +24,10 @@
24
24
 
25
25
  #include "rbgdk3private.h"
26
26
 
27
+ #ifdef HAVE_RB_CAIRO_H
28
+ #include <rb_cairo.h>
29
+ #endif
30
+
27
31
  #define RG_TARGET_NAMESPACE cWindow
28
32
  #define _SELF(s) RVAL2GDKWINDOW(s)
29
33
 
@@ -903,6 +907,20 @@ rg_drag_protocol(VALUE self)
903
907
  return rb_ary_new3(2, GDKDRAGPROTOCOL2RVAL(prot), ary);
904
908
  }
905
909
 
910
+ #ifdef HAVE_RB_CAIRO_H
911
+ static VALUE
912
+ rg_create_cairo_context(VALUE self)
913
+ {
914
+ VALUE rb_cr;
915
+ cairo_t *cr;
916
+ cr = gdk_cairo_create(_SELF(self));
917
+ rb_cairo_check_status(cairo_status(cr));
918
+ rb_cr = CRCONTEXT2RVAL(cr);
919
+ cairo_destroy (cr);
920
+ return rb_cr;
921
+ }
922
+ #endif
923
+
906
924
  void
907
925
  Init_gdk_window(VALUE mGdk)
908
926
  {
@@ -1018,6 +1036,10 @@ Init_gdk_window(VALUE mGdk)
1018
1036
  RG_DEF_METHOD(drag_begin, 1);
1019
1037
  RG_DEF_METHOD(drag_protocol, 0);
1020
1038
 
1039
+ #ifdef HAVE_RB_CAIRO_H
1040
+ RG_DEF_METHOD(create_cairo_context, 0);
1041
+ #endif
1042
+
1021
1043
  G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE);
1022
1044
  G_DEF_CLASS(GDK_TYPE_WINDOW_WINDOW_CLASS, "WindowClass",
1023
1045
  RG_TARGET_NAMESPACE);
data/lib/gdk3/base.rb CHANGED
@@ -10,7 +10,7 @@ require 'gdk_pixbuf2'
10
10
  base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
11
11
  vendor_dir = base_dir + "vendor" + "local"
12
12
  vendor_bin_dir = vendor_dir + "bin"
13
- GLib.prepend_environment_path(vendor_bin_dir)
13
+ GLib.prepend_dll_path(vendor_bin_dir)
14
14
  begin
15
15
  major, minor, _ = RUBY_VERSION.split(/\./)
16
16
  require "#{major}.#{minor}/gdk3.so"
@@ -18,6 +18,15 @@ rescue LoadError
18
18
  require "gdk3.so"
19
19
  end
20
20
 
21
+ if vendor_dir.exist?
22
+ begin
23
+ require "gobject-introspection"
24
+ vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
25
+ GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
26
+ rescue LoadError
27
+ end
28
+ end
29
+
21
30
  module Gdk
22
31
  LOG_DOMAIN = "Gdk"
23
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdk3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-04 00:00:00.000000000 Z
12
+ date: 2013-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: atk
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 1.2.6
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 1.2.6
30
14
  - !ruby/object:Gem::Dependency
31
15
  name: pango
32
16
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +18,7 @@ dependencies:
34
18
  requirements:
35
19
  - - ! '>='
36
20
  - !ruby/object:Gem::Version
37
- version: 1.2.6
21
+ version: 2.0.0
38
22
  type: :runtime
39
23
  prerelease: false
40
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +26,7 @@ dependencies:
42
26
  requirements:
43
27
  - - ! '>='
44
28
  - !ruby/object:Gem::Version
45
- version: 1.2.6
29
+ version: 2.0.0
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: gdk_pixbuf2
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +34,7 @@ dependencies:
50
34
  requirements:
51
35
  - - ! '>='
52
36
  - !ruby/object:Gem::Version
53
- version: 1.2.6
37
+ version: 2.0.0
54
38
  type: :runtime
55
39
  prerelease: false
56
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +42,7 @@ dependencies:
58
42
  requirements:
59
43
  - - ! '>='
60
44
  - !ruby/object:Gem::Version
61
- version: 1.2.6
45
+ version: 2.0.0
62
46
  description: Ruby/GDK3 is a Ruby binding of GDK-3.x.
63
47
  email: ruby-gnome2-devel-en@lists.sourceforge.net
64
48
  executables: []
@@ -88,7 +72,6 @@ files:
88
72
  - ext/gdk3/rbgdkdisplay.c
89
73
  - ext/gdk3/rbgdkdisplaymanager.c
90
74
  - ext/gdk3/rbgdkdragcontext.c
91
- - ext/gdk3/rbgdkdraw.c
92
75
  - ext/gdk3/rbgdkevent.c
93
76
  - ext/gdk3/rbgdkgeometry.c
94
77
  - ext/gdk3/rbgdkkeymap.c
data/ext/gdk3/rbgdkdraw.c DELETED
@@ -1,520 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2005 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
- /* deprecated
26
- #include "rbgdk3private.h"
27
- #include "rbpango.h"
28
- #ifdef GDK_WINDOWING_X11
29
- #include <gdk/gdkx.h>
30
- #endif
31
- #ifdef HAVE_RB_CAIRO_H
32
- #include <rb_cairo.h>
33
- #endif
34
-
35
- #define RG_TARGET_NAMESPACE cDrawable
36
- #define _SELF(s) RVAL2GDKDRAWABLE(s)
37
-
38
- static VALUE
39
- rg_visual(VALUE self)
40
- {
41
- return GOBJ2RVAL(_SELF(self));
42
- }
43
-
44
- static VALUE
45
- rg_set_colormap(VALUE self, VALUE colormap)
46
- {
47
- VALUE old_colormap;
48
-
49
- old_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
50
- G_CHILD_REMOVE(self, old_colormap);
51
-
52
- G_CHILD_ADD(self, colormap);
53
- gdk_drawable_set_colormap(_SELF(self), RVAL2GDKCOLORMAP(colormap));
54
- return self;
55
- }
56
-
57
- static VALUE
58
- rg_colormap(VALUE self)
59
- {
60
- VALUE rb_colormap;
61
-
62
- rb_colormap = GOBJ2RVAL(gdk_drawable_get_colormap(_SELF(self)));
63
- G_CHILD_ADD(self, rb_colormap);
64
- return rb_colormap;
65
- }
66
-
67
- static VALUE
68
- rg_depth(VALUE self)
69
- {
70
- return INT2NUM(gdk_drawable_get_depth(_SELF(self)));
71
- }
72
-
73
- static VALUE
74
- rg_size(VALUE self)
75
- {
76
- gint width, height;
77
- gdk_drawable_get_size(_SELF(self), &width, &height);
78
- return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
79
- }
80
-
81
- static VALUE
82
- rg_clip_region(VALUE self)
83
- {
84
- return GDKREGION2RVAL(gdk_drawable_get_clip_region(_SELF(self)));
85
- }
86
-
87
- static VALUE
88
- rg_visible_region(VALUE self)
89
- {
90
- return GDKREGION2RVAL(gdk_drawable_get_visible_region(_SELF(self)));
91
- }
92
-
93
- static VALUE
94
- rg_draw_point(VALUE self, VALUE gc, VALUE x, VALUE y)
95
- {
96
- gdk_draw_point(_SELF(self), RVAL2GDKGC(gc),
97
- NUM2INT(x), NUM2INT(y));
98
- return self;
99
- }
100
-
101
- static VALUE
102
- rg_draw_points(VALUE self, VALUE rbgc, VALUE rbpoints)
103
- {
104
- GdkDrawable *drawable = _SELF(self);
105
- GdkGC *gc = RVAL2GDKGC(rbgc);
106
- long n;
107
- GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
108
-
109
- gdk_draw_points(drawable, gc, points, n);
110
-
111
- g_free(points);
112
-
113
- return self;
114
- }
115
-
116
- static VALUE
117
- rg_draw_line(VALUE self, VALUE gc, VALUE x1, VALUE y1, VALUE x2, VALUE y2)
118
- {
119
- gdk_draw_line(_SELF(self), RVAL2GDKGC(gc),
120
- NUM2INT(x1), NUM2INT(y1),
121
- NUM2INT(x2), NUM2INT(y2));
122
- return self;
123
- }
124
-
125
- static VALUE
126
- rg_draw_lines(VALUE self, VALUE rbgc, VALUE rbpoints)
127
- {
128
- GdkDrawable *drawable = _SELF(self);
129
- GdkGC *gc = RVAL2GDKGC(rbgc);
130
- long n;
131
- GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
132
-
133
- gdk_draw_lines(drawable, gc, points, n);
134
-
135
- g_free(points);
136
-
137
- return self;
138
- }
139
-
140
- static VALUE
141
- rg_draw_pixbuf(VALUE self, VALUE gc, VALUE pixbuf, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE dither, VALUE x_dither, VALUE y_dither)
142
- {
143
- gdk_draw_pixbuf(_SELF(self),
144
- RVAL2GDKGC(gc),
145
- RVAL2GDKPIXBUF(pixbuf),
146
- NUM2INT(src_x), NUM2INT(src_y),
147
- NUM2INT(dest_x), NUM2INT(dest_y),
148
- NUM2INT(width), NUM2INT(height),
149
- RVAL2GDKRGBDITHER(dither),
150
- NUM2INT(x_dither), NUM2INT(y_dither));
151
- return self;
152
- }
153
-
154
- struct rbgdk_rval2gdksegments_args {
155
- VALUE ary;
156
- long n;
157
- GdkSegment *result;
158
- };
159
-
160
- static VALUE
161
- rbgdk_rval2gdksegments_body(VALUE value)
162
- {
163
- long i;
164
- struct rbgdk_rval2gdksegments_args *args = (struct rbgdk_rval2gdksegments_args *)value;
165
-
166
- for (i = 0; i < args->n; i++) {
167
- VALUE segments = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
168
-
169
- if (RARRAY_LEN(segments) != 2)
170
- rb_raise(rb_eArgError, "segment %ld should be array of size 4", i);
171
-
172
- args->result[i].x1 = NUM2INT(RARRAY_PTR(segments)[0]);
173
- args->result[i].y1 = NUM2INT(RARRAY_PTR(segments)[1]);
174
- args->result[i].x2 = NUM2INT(RARRAY_PTR(segments)[2]);
175
- args->result[i].y2 = NUM2INT(RARRAY_PTR(segments)[3]);
176
- }
177
-
178
- return Qnil;
179
- }
180
-
181
- static G_GNUC_NORETURN VALUE
182
- rbgdk_rval2gdksegments_rescue(VALUE value)
183
- {
184
- g_free(((struct rbgdk_rval2gdksegments_args *)value)->result);
185
-
186
- rb_exc_raise(rb_errinfo());
187
- }
188
-
189
- static GdkSegment *
190
- rbgdk_rval2gdksegments(VALUE value, long *n)
191
- {
192
- struct rbgdk_rval2gdksegments_args args;
193
-
194
- args.ary = rb_ary_to_ary(value);
195
- args.n = RARRAY_LEN(args.ary);
196
- args.result = g_new(GdkSegment, args.n + 1);
197
-
198
- rb_rescue(rbgdk_rval2gdksegments_body, (VALUE)&args,
199
- rbgdk_rval2gdksegments_rescue, (VALUE)&args);
200
-
201
- if (n != NULL)
202
- *n = args.n;
203
-
204
- return args.result;
205
- }
206
-
207
- #define RVAL2GDKSEGMENTS(value, n) rbgdk_rval2gdksegments(value, n)
208
-
209
- static VALUE
210
- rg_draw_segments(VALUE self, VALUE rbgc, VALUE rbsegments)
211
- {
212
- GdkDrawable *drawable = _SELF(self);
213
- GdkGC *gc = RVAL2GDKGC(rbgc);
214
- long n;
215
- GdkSegment *segments = RVAL2GDKSEGMENTS(rbsegments, &n);
216
-
217
- gdk_draw_segments(drawable, gc, segments, n);
218
-
219
- g_free(segments);
220
-
221
- return self;
222
- }
223
-
224
- static VALUE
225
- rg_draw_rectangle(VALUE self, VALUE gc, VALUE filled, VALUE x, VALUE y, VALUE w, VALUE h)
226
- {
227
- gdk_draw_rectangle(_SELF(self), RVAL2GDKGC(gc),
228
- RVAL2CBOOL(filled),
229
- NUM2INT(x), NUM2INT(y),
230
- NUM2INT(w), NUM2INT(h));
231
- return self;
232
- }
233
-
234
- static VALUE
235
- rg_draw_arc(VALUE self, VALUE gc, VALUE filled, VALUE x, VALUE y, VALUE w, VALUE h, VALUE a1, VALUE a2)
236
- {
237
- gdk_draw_arc(_SELF(self), RVAL2GDKGC(gc),
238
- RVAL2CBOOL(filled),
239
- NUM2INT(x), NUM2INT(y),
240
- NUM2INT(w), NUM2INT(h),
241
- NUM2INT(a1), NUM2INT(a2));
242
- return self;
243
- }
244
-
245
- static VALUE
246
- rg_draw_polygon(VALUE self, VALUE rbgc, VALUE rbfilled, VALUE rbpoints)
247
- {
248
- GdkDrawable *drawable = _SELF(self);
249
- GdkGC *gc = RVAL2GDKGC(rbgc);
250
- gboolean filled = RVAL2CBOOL(rbfilled);
251
- long n;
252
- GdkPoint *points = RVAL2GDKPOINTS(rbpoints, &n);
253
-
254
- gdk_draw_polygon(drawable, gc, filled, points, n);
255
-
256
- g_free(points);
257
-
258
- return self;
259
- }
260
-
261
- struct rbgdk_rval2gdktrapezoids_args {
262
- VALUE ary;
263
- long n;
264
- GdkTrapezoid *result;
265
- };
266
-
267
- static VALUE
268
- rbgdk_rval2gdktrapezoids_body(VALUE value)
269
- {
270
- long i;
271
- struct rbgdk_rval2gdktrapezoids_args *args = (struct rbgdk_rval2gdktrapezoids_args *)value;
272
-
273
- for (i = 0; i < args->n; i++) {
274
- VALUE trapezoids = rb_ary_to_ary(RARRAY_PTR(args->ary)[i]);
275
-
276
- if (RARRAY_LEN(trapezoids) != 6)
277
- rb_raise(rb_eArgError, "trapezoid %ld should be array of size 6", i);
278
-
279
- args->result[i].y1 = NUM2DBL(RARRAY_PTR(trapezoids)[0]);
280
- args->result[i].x11 = NUM2DBL(RARRAY_PTR(trapezoids)[1]);
281
- args->result[i].x21 = NUM2DBL(RARRAY_PTR(trapezoids)[2]);
282
- args->result[i].y2 = NUM2DBL(RARRAY_PTR(trapezoids)[3]);
283
- args->result[i].x12 = NUM2DBL(RARRAY_PTR(trapezoids)[4]);
284
- args->result[i].x22 = NUM2DBL(RARRAY_PTR(trapezoids)[5]);
285
- }
286
-
287
- return Qnil;
288
- }
289
-
290
- static G_GNUC_NORETURN VALUE
291
- rbgdk_rval2gdktrapezoids_rescue(VALUE value)
292
- {
293
- g_free(((struct rbgdk_rval2gdktrapezoids_args *)value)->result);
294
-
295
- rb_exc_raise(rb_errinfo());
296
- }
297
-
298
- static GdkTrapezoid *
299
- rbgdk_rval2gdktrapezoids(VALUE value, long *n)
300
- {
301
- struct rbgdk_rval2gdktrapezoids_args args;
302
-
303
- args.ary = rb_ary_to_ary(value);
304
- args.n = RARRAY_LEN(args.ary);
305
- args.result = g_new(GdkTrapezoid, args.n + 1);
306
-
307
- rb_rescue(rbgdk_rval2gdktrapezoids_body, (VALUE)&args,
308
- rbgdk_rval2gdktrapezoids_rescue, (VALUE)&args);
309
-
310
- if (n != NULL)
311
- *n = args.n;
312
-
313
- return args.result;
314
- }
315
-
316
- #define RVAL2GDKTRAPEZOIDS(value, n) rbgdk_rval2gdktrapezoids(value, n)
317
-
318
- static VALUE
319
- rg_draw_trapezoids(VALUE self, VALUE rbgc, VALUE rbtrapezoids)
320
- {
321
- GdkDrawable *drawable = _SELF(self);
322
- GdkGC *gc = RVAL2GDKGC(rbgc);
323
- long n;
324
- GdkTrapezoid *trapezoids = RVAL2GDKTRAPEZOIDS(rbtrapezoids, &n);
325
-
326
- gdk_draw_trapezoids(drawable, gc, trapezoids, n);
327
-
328
- g_free(trapezoids);
329
-
330
- return self;
331
- }
332
-
333
- static VALUE
334
- rg_draw_glyphs(VALUE self, VALUE gc, VALUE font, VALUE x, VALUE y, VALUE glyphs)
335
- {
336
- gdk_draw_glyphs(_SELF(self), RVAL2GDKGC(gc), RVAL2PANGOFONT(font),
337
- NUM2INT(x), NUM2INT(y),
338
- RVAL2PANGOGLYPHSTRING(glyphs));
339
- return self;
340
- }
341
-
342
- static VALUE
343
- rg_draw_glyphs_transformed(VALUE self, VALUE gc, VALUE matrix, VALUE font, VALUE x, VALUE y, VALUE glyphs)
344
- {
345
- gdk_draw_glyphs_transformed(_SELF(self), RVAL2GDKGC(gc),
346
- NIL_P(matrix) ? (PangoMatrix*)NULL : RVAL2PANGOMATRIX(matrix),
347
- RVAL2PANGOFONT(font),
348
- NUM2INT(x), NUM2INT(y),
349
- RVAL2PANGOGLYPHSTRING(glyphs));
350
- return self;
351
- }
352
-
353
- static VALUE
354
- rg_draw_layout_line(int argc, VALUE *argv, VALUE self)
355
- {
356
- VALUE gc, x, y, line, fg, bg;
357
-
358
- rb_scan_args(argc, argv, "42", &gc, &x, &y, &line, &fg, &bg);
359
-
360
- gdk_draw_layout_line_with_colors(_SELF(self), RVAL2GDKGC(gc),
361
- NUM2INT(x), NUM2INT(y),
362
- RVAL2PANGOLAYOUTLINE(line),
363
- RVAL2GDKCOLOR(fg),
364
- RVAL2GDKCOLOR(bg));
365
-
366
- return self;
367
- }
368
-
369
- static VALUE
370
- rg_draw_layout(int argc, VALUE *argv, VALUE self)
371
- {
372
- VALUE gc, x, y, layout, fg, bg;
373
-
374
- rb_scan_args(argc, argv, "42", &gc, &x, &y, &layout, &fg, &bg);
375
-
376
- gdk_draw_layout_with_colors(_SELF(self), RVAL2GDKGC(gc),
377
- NUM2INT(x), NUM2INT(y), RVAL2PANGOLAYOUT(layout),
378
- RVAL2GDKCOLOR(fg),
379
- RVAL2GDKCOLOR(bg));
380
-
381
- return self;
382
- }
383
-
384
- static VALUE
385
- rg_draw_drawable(VALUE self, VALUE gc, VALUE src, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
386
- {
387
- gdk_draw_drawable(_SELF(self), RVAL2GDKGC(gc), _SELF(src),
388
- NUM2INT(xsrc), NUM2INT(ysrc),
389
- NUM2INT(xdst), NUM2INT(ydst),
390
- NUM2INT(w), NUM2INT(h));
391
- return self;
392
- }
393
-
394
- static VALUE
395
- rg_draw_image(VALUE self, VALUE gc, VALUE image, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
396
- {
397
- gdk_draw_image(_SELF(self), RVAL2GDKGC(gc),
398
- RVAL2GDKIMAGE(image),
399
- NUM2INT(xsrc), NUM2INT(ysrc),
400
- NUM2INT(xdst), NUM2INT(ydst),
401
- NUM2INT(w), NUM2INT(h));
402
- return self;
403
- }
404
-
405
- static VALUE
406
- rg_get_image(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
407
- {
408
- return GOBJ2RVAL(gdk_drawable_get_image(_SELF(self),
409
- NUM2INT(x), NUM2INT(y),
410
- NUM2INT(w), NUM2INT(h)));
411
- }
412
-
413
- static VALUE
414
- rg_copy_to_image(VALUE self, VALUE image, VALUE xsrc, VALUE ysrc, VALUE xdst, VALUE ydst, VALUE w, VALUE h)
415
- {
416
- return GOBJ2RVAL(gdk_drawable_copy_to_image(_SELF(self),
417
- RVAL2GDKIMAGE(image),
418
- NUM2INT(xsrc), NUM2INT(ysrc),
419
- NUM2INT(xdst), NUM2INT(ydst),
420
- NUM2INT(w), NUM2INT(h)));
421
- }
422
-
423
- #ifdef GDK_WINDOWING_X11
424
- static VALUE
425
- rg_xid(VALUE self)
426
- {
427
- return ULONG2NUM(GDK_DRAWABLE_XID(_SELF(self)));
428
- }
429
- #endif
430
-
431
- #ifdef GDK_WINDOWING_WIN32
432
- static VALUE
433
- rg_handle(VALUE self)
434
- {
435
- HGDIOBJ handle;
436
- handle = gdk_win32_drawable_get_handle(_SELF(self));
437
- return ULONG2NUM(GPOINTER_TO_UINT(handle));
438
- }
439
- #endif
440
-
441
- static VALUE
442
- rg_display(VALUE self)
443
- {
444
- return GOBJ2RVAL(gdk_drawable_get_display(_SELF(self)));
445
- }
446
-
447
- static VALUE
448
- rg_screen(VALUE self)
449
- {
450
- return GOBJ2RVAL(gdk_drawable_get_screen(_SELF(self)));
451
- }
452
-
453
- #ifdef HAVE_RB_CAIRO_H
454
- static VALUE
455
- rg_create_cairo_context(VALUE self)
456
- {
457
- VALUE rb_cr;
458
- cairo_t *cr;
459
- cr = gdk_cairo_create(_SELF(self));
460
- rb_cairo_check_status(cairo_status(cr));
461
- rb_cr = CRCONTEXT2RVAL(cr);
462
- cairo_destroy (cr);
463
- return rb_cr;
464
- }
465
- #endif
466
-
467
- void
468
- Init_gdk_draw(VALUE mGdk)
469
- {
470
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DRAWABLE, "Drawable", mGdk);
471
-
472
- RG_DEF_METHOD(visual, 0);
473
- RG_DEF_METHOD(set_colormap, 1);
474
- RG_DEF_METHOD(colormap, 0);
475
- RG_DEF_METHOD(depth, 0);
476
- RG_DEF_METHOD(size, 0);
477
- RG_DEF_METHOD(clip_region, 0);
478
- RG_DEF_METHOD(visible_region, 0);
479
- RG_DEF_METHOD(draw_point, 3);
480
- RG_DEF_METHOD(draw_points, 2);
481
- RG_DEF_METHOD(draw_line, 5);
482
- RG_DEF_METHOD(draw_lines, 2);
483
- RG_DEF_METHOD(draw_pixbuf, 11);
484
- RG_DEF_METHOD(draw_segments, 2);
485
- RG_DEF_METHOD(draw_rectangle, 6);
486
- RG_DEF_METHOD(draw_arc, 8);
487
- RG_DEF_METHOD(draw_polygon, 3);
488
- RG_DEF_METHOD(draw_trapezoids, 2);
489
- RG_DEF_METHOD(draw_glyphs, 5);
490
- RG_DEF_METHOD(draw_glyphs_transformed, 6);
491
- RG_DEF_METHOD(draw_layout_line, -1);
492
- RG_DEF_METHOD(draw_layout, -1);
493
- RG_DEF_METHOD(draw_drawable, 8);
494
- RG_DEF_METHOD(draw_image, 8);
495
- RG_DEF_METHOD(get_image, 4);
496
- RG_DEF_METHOD(copy_to_image, 7);
497
-
498
- #ifdef GDK_WINDOWING_X11
499
- RG_DEF_METHOD(xid, 0);
500
- #endif
501
- #ifdef GDK_WINDOWING_WIN32
502
- RG_DEF_METHOD(handle, 0);
503
- #endif
504
- RG_DEF_METHOD(display, 0);
505
- RG_DEF_METHOD(screen, 0);
506
-
507
- #ifdef HAVE_RB_CAIRO_H
508
- RG_DEF_METHOD(create_cairo_context, 0);
509
- #endif
510
-
511
- #ifdef GDK_WINDOWING_X11
512
- G_DEF_CLASS3("GdkDrawableImplX11", "DrawableImplX11", mGdk);
513
- #elif defined(GDK_WINDOWING_WIN32)
514
- G_DEF_CLASS3("GdkDrawableImplWin32", "DrawableImplWin32", mGdk);
515
- #elif defined(GDK_WINDOWING_FB)
516
- G_DEF_CLASS3("GdkDrawableFB", "DrawableFB", mGdk);
517
- #endif
518
- }
519
- */
520
-