rsvg2 2.2.5-x64-mingw32 → 3.0.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/ext/rsvg2/extconf.rb +1 -1
  4. data/ext/rsvg2/rbrsvg.c +2 -15
  5. data/ext/rsvg2/rbrsvghandle.c +44 -197
  6. data/ext/rsvg2/rsvg2.h +13 -19
  7. data/lib/2.0/rsvg2.so +0 -0
  8. data/lib/2.1/rsvg2.so +0 -0
  9. data/lib/2.2/rsvg2.so +0 -0
  10. data/lib/rsvg2.rb +26 -11
  11. data/sample/svg-viewer.rb +2 -2
  12. data/test/rsvg2-test-utils.rb +11 -0
  13. data/test/test-handle.rb +4 -0
  14. data/vendor/local/bin/csslint-0.6.exe +0 -0
  15. data/vendor/local/bin/libcroco-0.6-3.dll +0 -0
  16. data/vendor/local/bin/librsvg-2-2.dll +0 -0
  17. data/vendor/local/bin/rsvg-convert.exe +0 -0
  18. data/vendor/local/include/librsvg-2.0/librsvg/librsvg-features.h +2 -2
  19. data/vendor/local/lib/girepository-1.0/Rsvg-2.0.typelib +0 -0
  20. data/vendor/local/lib/libcroco-0.6.a +0 -0
  21. data/vendor/local/lib/libcroco-0.6.dll.a +0 -0
  22. data/vendor/local/lib/libcroco-0.6.la +2 -2
  23. data/vendor/local/lib/librsvg-2.a +0 -0
  24. data/vendor/local/lib/librsvg-2.dll.a +0 -0
  25. data/vendor/local/lib/librsvg-2.la +2 -2
  26. data/vendor/local/lib/pkgconfig/librsvg-2.0.pc +1 -1
  27. data/vendor/local/share/gir-1.0/Rsvg-2.0.gir +2 -2
  28. data/vendor/local/share/gtk-doc/html/rsvg-2.0/RsvgHandle.html +724 -1039
  29. data/vendor/local/share/gtk-doc/html/rsvg-2.0/annotation-glossary.html +32 -29
  30. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-14.html +19 -16
  31. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-22.html +16 -13
  32. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-32.html +17 -14
  33. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-36.html +20 -15
  34. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-4.html +15 -12
  35. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-8.html +22 -17
  36. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-9.html +23 -18
  37. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-deprecated.html +36 -31
  38. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-full.html +85 -80
  39. data/vendor/local/share/gtk-doc/html/rsvg-2.0/home.png +0 -0
  40. data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.html +4 -4
  41. data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.sgml +28 -31
  42. data/vendor/local/share/gtk-doc/html/rsvg-2.0/left.png +0 -0
  43. data/vendor/local/share/gtk-doc/html/rsvg-2.0/licence.html +9 -9
  44. data/vendor/local/share/gtk-doc/html/rsvg-2.0/object-tree.html +15 -15
  45. data/vendor/local/share/gtk-doc/html/rsvg-2.0/right.png +0 -0
  46. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-2.0.devhelp2 +59 -55
  47. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GIO.html +190 -247
  48. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GdkPixbuf.html +239 -336
  49. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-cairo.html +70 -95
  50. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Version-check-and-feature-tests.html +37 -77
  51. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg.html +9 -9
  52. data/vendor/local/share/gtk-doc/html/rsvg-2.0/style.css +104 -314
  53. data/vendor/local/share/gtk-doc/html/rsvg-2.0/up.png +0 -0
  54. metadata +4 -7
  55. data/vendor/local/share/gtk-doc/html/rsvg-2.0/left-insensitive.png +0 -0
  56. data/vendor/local/share/gtk-doc/html/rsvg-2.0/right-insensitive.png +0 -0
  57. data/vendor/local/share/gtk-doc/html/rsvg-2.0/up-insensitive.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e8f7eeaeb76a7923aa41a6d5fc2f6f13be43fd9
4
- data.tar.gz: 7ed76bb796d248f965161cbdfab96f42766b49fd
3
+ metadata.gz: e987c3b90285aedf7859c799dbced589ccfcf1cb
4
+ data.tar.gz: 9449b88cb762fb6b911d74fcec7fa6eca4fb5987
5
5
  SHA512:
6
- metadata.gz: 848064c6b03ba673484adc53378cfc90cd7e332918ef6c44a1123fc79d10032696fcfffe4945ec3af04f8648783d80d8e356ac1aca8c5ada304fbb2777371b6c
7
- data.tar.gz: 00d9616c199fc0d7a640abf009d67fcd2dd8bd3e2e4e3db3833541ba7d1f9446928dbc32d10cc6cc97c22cb00d6ffa50153b74360d0391e62677ad904f6618a2
6
+ metadata.gz: 2c91f9bb076d5b26b5ba37b6c7314f75ba11a59d609c75ea72d38657d731598c46ca8ea1cc578b56cfb007d05385f80255b4f33d5bc6588d688c4defe9b76c74
7
+ data.tar.gz: eac12aaeb3c28e1e4cc778a0fddc7c6cee86a3f52362afa1caed107642955807739e180043b548a7159b82a4c4e5a0fa64e7616809a9594376299d22b04b448e
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2010-2013 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2010-2015 Ruby-GNOME2 Project Team
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -52,7 +52,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
52
52
  :name => "librsvg",
53
53
  :download_site => :gnome,
54
54
  :label => "librsvg",
55
- :version => "2.40.6",
55
+ :version => "2.40.9",
56
56
  :compression_method => "xz",
57
57
  :windows => {
58
58
  :configure_args => [
@@ -45,7 +45,7 @@ end
45
45
 
46
46
  setup_windows(module_name, base_dir)
47
47
 
48
- unless required_pkg_config_package(package_id,
48
+ unless required_pkg_config_package([package_id, 2, 16, 1],
49
49
  :debian => "librsvg2-dev",
50
50
  :redhat => "librsvg2-devel",
51
51
  :homebrew => "librsvg",
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2005-2015 Ruby-GNOME2 Project Team
5
4
  * Copyright (C) 2004 Kouhei Sutou <kou@cozmixng.org>
6
5
  *
7
6
  * This library is free software; you can redistribute it and/or
@@ -155,22 +154,12 @@ rg_s_pixbuf_from_file_at_zoom_with_max(G_GNUC_UNUSED VALUE self,
155
154
  return rb_pixbuf;
156
155
  }
157
156
 
158
- static VALUE
159
- rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self)
160
- {
161
- #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H
162
- return Qtrue;
163
- #else
164
- return Qfalse;
165
- #endif
166
- }
167
-
168
157
  void
169
158
  Init_rsvg2(void)
170
159
  {
171
160
  VALUE RG_TARGET_NAMESPACE = rb_define_module("RSVG");
172
161
 
173
- #if LIBRSVG_CHECK_VERSION(2, 9, 0)
162
+ #if !LIBRSVG_CHECK_VERSION(2, 35, 0)
174
163
  rsvg_init();
175
164
  atexit(rsvg_term);
176
165
  #endif
@@ -199,8 +188,6 @@ Init_rsvg2(void)
199
188
  RG_DEF_SMETHOD(pixbuf_from_file_at_max_size, 3);
200
189
  RG_DEF_SMETHOD(pixbuf_from_file_at_zoom_with_max, 5);
201
190
 
202
- RG_DEF_SMETHOD_P(cairo_available, 0);
203
-
204
191
  Init_rsvg_handle(RG_TARGET_NAMESPACE);
205
192
  Init_rsvg_dimensiondata(RG_TARGET_NAMESPACE);
206
193
  }
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2005-2015 Ruby-GNOME2 Project Team
5
4
  * Copyright (C) 2004 Kouhei Sutou <kou@cozmixng.org>
6
5
  *
7
6
  * This library is free software; you can redistribute it and/or
@@ -92,96 +91,73 @@ rb_rsvg_handle_alloc(VALUE klass)
92
91
  }
93
92
  #endif
94
93
 
95
- #if LIBRSVG_CHECK_VERSION(2, 14, 0)
96
94
  static VALUE
97
- rg_s_new_from_data(G_GNUC_UNUSED VALUE self, VALUE data)
95
+ rg_initialize(int argc, VALUE *argv, VALUE self)
98
96
  {
99
- GError *error = NULL;
100
97
  RsvgHandle *handle;
101
-
102
- handle = rsvg_handle_new_from_data((const guint8 *)RVAL2CSTR(data),
103
- RSTRING_LEN(data), &error);
104
-
105
- if (error)
106
- RAISE_GERROR(error);
107
-
108
- return GOBJ2RVAL(handle);
109
- }
110
-
111
- static VALUE
112
- rg_s_new_from_file(int argc, VALUE *argv, VALUE self)
113
- {
114
- VALUE rb_file_path, rb_options, rb_flags;
98
+ VALUE rb_options;
99
+ const char *file_name = NULL;
100
+ const guint8 *data = NULL;
101
+ gsize data_size = 0;
115
102
  GError *error = NULL;
116
- RsvgHandle *handle;
103
+ #if LIBRSVG_CHECK_VERSION(2, 40, 3)
104
+ RsvgHandleFlags flags = RSVG_HANDLE_FLAGS_NONE;
105
+ #endif
117
106
 
118
- rb_scan_args(argc, argv, "11", &rb_file_path, &rb_options);
119
- rbg_scan_options(rb_options,
120
- "flags", &rb_flags,
121
- NULL);
107
+ rb_scan_args(argc, argv, "01", &rb_options);
122
108
 
123
- #if LIBRSVG_CHECK_VERSION(2, 40, 3)
124
- {
125
- GFile *file;
126
- GCancellable *cancellable = NULL;
127
- RsvgHandleFlags flags = RSVG_HANDLE_FLAGS_NONE;
109
+ if (!NIL_P(rb_options)) {
110
+ VALUE rb_file_name;
111
+ VALUE rb_data;
112
+ VALUE rb_flags;
128
113
 
114
+ rbg_scan_options(rb_options,
115
+ "file_name", &rb_file_name,
116
+ "data", &rb_data,
117
+ "flags", &rb_flags,
118
+ NULL);
119
+ if (!NIL_P(rb_file_name)) {
120
+ file_name = RVAL2CSTRFILENAME(rb_file_name);
121
+ }
122
+ if (!NIL_P(rb_data)) {
123
+ data = (const guint8 *)RSTRING_PTR(rb_data);
124
+ data_size = RSTRING_LEN(rb_data);
125
+ }
129
126
  if (!NIL_P(rb_flags)) {
127
+ #if LIBRSVG_CHECK_VERSION(2, 40, 3)
130
128
  flags = RVAL2GFLAGS(rb_flags, RSVG_TYPE_HANDLE_FLAGS);
131
- }
132
-
133
- file = g_file_new_for_path((const char *)RVAL2CSTR(rb_file_path));
134
- handle = rsvg_handle_new_from_gfile_sync(file, flags,
135
- cancellable,
136
- &error);
137
- g_object_unref(file);
138
- }
139
129
  #else
140
- if (!NIL_P(rb_flags)) {
141
130
  rb_raise(rb_eArgError,
142
131
  "librsvg 2.40.3 or later is required for :flags: <%d.%d.%d>",
143
132
  LIBRSVG_MAJOR_VERSION,
144
133
  LIBRSVG_MINOR_VERSION,
145
134
  LIBRSVG_MICRO_VERSION);
146
- }
147
- handle = rsvg_handle_new_from_file((const gchar *)RVAL2CSTR(rb_file_path),
148
- &error);
149
- #endif
150
-
151
- if (error)
152
- RAISE_GERROR(error);
153
-
154
- return GOBJ2RVAL(handle);
155
- }
156
135
  #endif
136
+ }
137
+ }
157
138
 
158
- static VALUE
159
- rg_initialize(int argc, VALUE *argv, VALUE self)
160
- {
161
- RsvgHandle *handle;
162
- VALUE gz;
163
- rb_scan_args(argc, argv, "01", &gz);
139
+ if (file_name) {
140
+ #if LIBRSVG_CHECK_VERSION(2, 40, 3)
141
+ GFile *file;
142
+ GCancellable *cancellable = NULL;
164
143
 
165
- #if LIBRSVG_CHECK_VERSION(2, 11, 0)
166
- handle = rsvg_handle_new();
144
+ file = g_file_new_for_path(file_name);
145
+ handle = rsvg_handle_new_from_gfile_sync(file, flags, cancellable,
146
+ &error);
147
+ g_object_unref(file);
167
148
  #else
168
- if (RVAL2CBOOL(gz)) {
169
- # ifdef HAVE_LIBRSVG_RSVG_GZ_H
170
- handle = rsvg_handle_new_gz();
171
- # else
172
- rb_warning("gz handling is not supported in your librsvg");
173
- handle = rsvg_handle_new();
174
- # endif
149
+ handle = rsvg_handle_new_from_file(file_name, &error);
150
+ #endif
151
+ } else if (data) {
152
+ handle = rsvg_handle_new_from_data(data, data_size, &error);
175
153
  } else {
176
154
  handle = rsvg_handle_new();
177
155
  }
178
- #endif
179
156
 
180
- #ifdef RSVG_TYPE_HANDLE
157
+ if (error)
158
+ RAISE_GERROR(error);
159
+
181
160
  G_INITIALIZE(self, handle);
182
- #else
183
- DATA_PTR(self) = handle;
184
- #endif
185
161
 
186
162
  rb_ivar_set(self, id_closed, Qfalse);
187
163
  return Qnil;
@@ -305,118 +281,6 @@ rg_metadata(VALUE self)
305
281
  # endif
306
282
  #endif
307
283
 
308
- #if !LIBRSVG_CHECK_VERSION(2, 11, 0)
309
- /* Extended Convenience API */
310
- static VALUE
311
- rg_pixbuf_from_file_at_size(VALUE self, VALUE file_name,
312
- VALUE width, VALUE height)
313
- {
314
- VALUE rb_pixbuf;
315
- GdkPixbuf *pixbuf;
316
- GError *error = NULL;
317
-
318
- pixbuf = rsvg_pixbuf_from_file_at_size_ex(_SELF(self),
319
- RVAL2CSTR(file_name),
320
- NUM2INT(width),
321
- NUM2INT(height),
322
- &error);
323
-
324
- if (error) RAISE_GERROR(error);
325
-
326
- rb_pixbuf = GOBJ2RVAL(pixbuf);
327
- g_object_unref(pixbuf);
328
- return rb_pixbuf;
329
- }
330
-
331
- static VALUE
332
- rg_pixbuf_from_file(VALUE self, VALUE file_name)
333
- {
334
- VALUE rb_pixbuf;
335
- GdkPixbuf *pixbuf;
336
- GError *error = NULL;
337
-
338
- pixbuf = rsvg_pixbuf_from_file_ex(_SELF(self),
339
- RVAL2CSTR(file_name),
340
- &error);
341
-
342
- if (error) RAISE_GERROR(error);
343
-
344
- rb_pixbuf = GOBJ2RVAL(pixbuf);
345
- g_object_unref(pixbuf);
346
- return rb_pixbuf;
347
- }
348
-
349
- static VALUE
350
- rg_pixbuf_from_file_at_zoom(VALUE self, VALUE file_name,
351
- VALUE x_zoom, VALUE y_zoom)
352
- {
353
- VALUE rb_pixbuf;
354
- GdkPixbuf *pixbuf;
355
- GError *error = NULL;
356
-
357
- pixbuf = rsvg_pixbuf_from_file_at_zoom_ex(_SELF(self),
358
- RVAL2CSTR(file_name),
359
- NUM2DBL(x_zoom),
360
- NUM2DBL(y_zoom),
361
- &error);
362
-
363
- if (error) RAISE_GERROR(error);
364
-
365
- rb_pixbuf = GOBJ2RVAL(pixbuf);
366
- g_object_unref(pixbuf);
367
- return rb_pixbuf;
368
- }
369
-
370
- static VALUE
371
- rg_pixbuf_from_file_at_max_size(VALUE self, VALUE file_name,
372
- VALUE max_width, VALUE max_height)
373
- {
374
- VALUE rb_pixbuf;
375
- GdkPixbuf *pixbuf;
376
- GError *error = NULL;
377
-
378
- pixbuf = rsvg_pixbuf_from_file_at_max_size_ex(_SELF(self),
379
- RVAL2CSTR(file_name),
380
- NUM2INT(max_width),
381
- NUM2INT(max_height),
382
- &error);
383
-
384
- if (error) RAISE_GERROR(error);
385
-
386
- rb_pixbuf = GOBJ2RVAL(pixbuf);
387
- g_object_unref(pixbuf);
388
- return rb_pixbuf;
389
- }
390
-
391
- static VALUE
392
- rg_pixbuf_from_file_at_zoom_with_max(VALUE self,
393
- VALUE file_name,
394
- VALUE x_zoom,
395
- VALUE y_zoom,
396
- VALUE max_width,
397
- VALUE max_height)
398
- {
399
- VALUE rb_pixbuf;
400
- GdkPixbuf *pixbuf;
401
- GError *error = NULL;
402
-
403
- pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max_ex(_SELF(self),
404
- RVAL2CSTR(file_name),
405
- NUM2DBL(x_zoom),
406
- NUM2DBL(y_zoom),
407
- NUM2INT(max_width),
408
- NUM2INT(max_height),
409
- &error);
410
-
411
- if (error) RAISE_GERROR(error);
412
-
413
- rb_pixbuf = GOBJ2RVAL(pixbuf);
414
- g_object_unref(pixbuf);
415
- return rb_pixbuf;
416
- }
417
- #endif
418
-
419
- #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H
420
284
  static VALUE
421
285
  rg_render_cairo(int argc, VALUE *argv, VALUE self)
422
286
  {
@@ -432,7 +296,6 @@ rg_render_cairo(int argc, VALUE *argv, VALUE self)
432
296
 
433
297
  return Qnil;
434
298
  }
435
- #endif
436
299
 
437
300
  void
438
301
  Init_rsvg_handle(VALUE mRSVG)
@@ -448,11 +311,6 @@ Init_rsvg_handle(VALUE mRSVG)
448
311
  rb_define_alloc_func(RG_TARGET_NAMESPACE, rb_rsvg_handle_alloc);
449
312
  #endif
450
313
 
451
- #if LIBRSVG_CHECK_VERSION(2, 14, 0)
452
- RG_DEF_SMETHOD(new_from_data, 1);
453
- RG_DEF_SMETHOD(new_from_file, -1);
454
- #endif
455
-
456
314
  RG_DEF_METHOD(initialize, -1);
457
315
  RG_DEF_METHOD(set_size_callback, 0);
458
316
  RG_DEF_METHOD(set_dpi, 1);
@@ -475,18 +333,7 @@ Init_rsvg_handle(VALUE mRSVG)
475
333
  # endif
476
334
  #endif
477
335
 
478
- #if !LIBRSVG_CHECK_VERSION(2, 11, 0)
479
- /* Extended Convenience API */
480
- RG_DEF_METHOD(pixbuf_from_file_at_size, 3);
481
- RG_DEF_METHOD(pixbuf_from_file, 1);
482
- RG_DEF_METHOD(pixbuf_from_file_at_zoom, 3);
483
- RG_DEF_METHOD(pixbuf_from_file_at_max_size, 3);
484
- RG_DEF_METHOD(pixbuf_from_file_at_zoom_with_max, 5);
485
- #endif
486
-
487
- #ifdef HAVE_LIBRSVG_RSVG_CAIRO_H
488
336
  RG_DEF_METHOD(render_cairo, -1);
489
- #endif
490
337
 
491
338
  #if LIBRSVG_CHECK_VERSION(2, 40, 3)
492
339
  /* RsvgHandleFlags */
@@ -31,32 +31,26 @@ extern "C" {
31
31
 
32
32
  #include <rbglib.h>
33
33
  #include <rbgobject.h>
34
+ #include <rb_cairo.h>
34
35
 
35
- #ifdef HAVE_LIBRSVG_RSVG_GZ_H
36
- # include <librsvg/rsvg-gz.h>
37
- #else
38
- # include <librsvg/rsvg.h>
39
- #endif
40
-
41
- #ifdef HAVE_RB_CAIRO_H
42
- # include <rb_cairo.h>
43
- # include <librsvg/rsvg-cairo.h>
44
- #endif
45
-
46
- #ifdef HAVE_LIBRSVG_LIBRSVG_ENUM_TYPES_H
47
- # include <librsvg/librsvg-enum-types.h>
48
- #else
49
- # include "librsvg-enum-types.h"
50
- #endif
36
+ #include <librsvg/rsvg.h>
51
37
 
52
- #define LIBRSVG_CHECK_VERSION(major, minor, micro) \
53
- (LIBRSVG_MAJOR_VERSION > (major) || \
38
+ #ifndef LIBRSVG_CHECK_VERSION
39
+ # include <librsvg/librsvg-features.h>
40
+ # define LIBRSVG_CHECK_VERSION(major, minor, micro) \
41
+ (LIBRSVG_MAJOR_VERSION > (major) || \
54
42
  (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \
55
43
  (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && \
56
44
  LIBRSVG_MICRO_VERSION >= (micro)))
45
+ #endif
57
46
 
58
47
  #if !LIBRSVG_CHECK_VERSION(2, 36, 2)
59
- # include <librsvg/librsvg-features.h>
48
+ # include <librsvg/rsvg-cairo.h>
49
+ # ifdef HAVE_LIBRSVG_LIBRSVG_ENUM_TYPES_H
50
+ # include <librsvg/librsvg-enum-types.h>
51
+ # else
52
+ # include "librsvg-enum-types.h"
53
+ # endif
60
54
  #endif
61
55
 
62
56
 
Binary file
Binary file
Binary file
@@ -1,16 +1,13 @@
1
1
  require "glib2"
2
2
  require "gdk_pixbuf2"
3
- begin
4
- require "cairo"
5
- rescue LoadError
6
- end
3
+ require "cairo"
7
4
 
8
5
  base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
9
6
  vendor_dir = base_dir + "vendor" + "local"
10
7
  vendor_bin_dir = vendor_dir + "bin"
11
8
  GLib.prepend_dll_path(vendor_bin_dir)
12
9
  begin
13
- major, minor, micro, = RUBY_VERSION.split(/\./)
10
+ major, minor, = RUBY_VERSION.split(/\./)
14
11
  require "#{major}.#{minor}/rsvg2.so"
15
12
  rescue LoadError
16
13
  require "rsvg2.so"
@@ -18,14 +15,32 @@ end
18
15
 
19
16
  module RSVG
20
17
  LOG_DOMAIN = "librsvg"
21
- end
22
18
 
23
- if RSVG.cairo_available?
24
- module Cairo
25
- class Context
26
- def render_rsvg_handle(handle, *args, &block)
27
- handle.render_cairo(self, *args, &block)
19
+ class << self
20
+ def cairo_available?
21
+ true
22
+ end
23
+ end
24
+
25
+ class Handle
26
+ class << self
27
+ # For backward compatibility
28
+ def new_from_data(data)
29
+ new(:data => data)
28
30
  end
31
+
32
+ # For backward compatibility
33
+ def new_from_file(file_name, options={})
34
+ new(options.merge(:file_name => file_name))
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ module Cairo
41
+ class Context
42
+ def render_rsvg_handle(handle, *args, &block)
43
+ handle.render_cairo(self, *args, &block)
29
44
  end
30
45
  end
31
46
  end