cairo 1.15.13 → 1.15.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +24 -0
- data/README.rdoc +11 -40
- data/Rakefile +4 -2
- data/ext/cairo/rb_cairo.h +1 -1
- data/ext/cairo/rb_cairo_context.c +35 -3
- data/ext/cairo/rb_cairo_font_options.c +5 -6
- data/ext/cairo/rb_cairo_private.h +2 -2
- data/ext/cairo/rb_cairo_scaled_font.c +11 -2
- data/ext/cairo/rb_cairo_surface.c +89 -48
- data/test/{cairo-test-utils.rb → helper.rb} +4 -5
- data/test/run-test.rb +3 -10
- data/test/test_context.rb +6 -6
- data/test/test_font_extents.rb +1 -1
- data/test/test_font_face.rb +1 -1
- data/test/test_font_options.rb +1 -1
- data/test/test_image_surface.rb +2 -2
- data/test/test_pdf_surface.rb +1 -1
- data/test/test_quartz_image_surface.rb +1 -1
- data/test/test_raster_source_pattern.rb +13 -13
- data/test/test_recording_surface.rb +2 -2
- data/test/test_region.rb +1 -1
- data/test/test_scaled_font.rb +1 -1
- data/test/test_script_device.rb +1 -1
- data/test/test_script_surface.rb +1 -1
- data/test/test_surface.rb +5 -5
- data/test/test_svg_surface.rb +1 -1
- data/test/test_tee_surface.rb +2 -2
- data/test/test_text_cluster.rb +1 -1
- data/test/test_text_extents.rb +1 -1
- data/test/test_text_to_glyphs_data.rb +1 -1
- data/test/test_xml_device.rb +1 -1
- data/test/test_xml_surface.rb +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d4c77ff394eb0630d50c862e6ad09609b79896d3d3e69fa229e3e574a62692a
|
4
|
+
data.tar.gz: d9c69f792f6ca09fbd1e64d6746d0143b83d4075880337010a8982397757ebb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7759358f7a76eb72918c6fa912033af6b4309d956599f00b30324b485a4073843c3e33dbb2d2c4cf423169a68a9e8a80996ce58b5ab6f20944637e7b7c8600fb
|
7
|
+
data.tar.gz: 6f5d4929fcd61116f2b8c50bbd2d29864f8f4d41696dbf236c2f859201f394f5ad99ee5707ce47ee17fc1234ade7faba90639c08abe55359f1b25a7582782169
|
data/NEWS
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
Release 1.15.14 (2018-08-20) Kouhei Sutou <kou@cozmixng.org>
|
2
|
+
============================================================
|
3
|
+
|
4
|
+
Improvements
|
5
|
+
------------
|
6
|
+
|
7
|
+
* Added Cairo::Surface.create {}. Cairo::Surface.new {} is deprecated.
|
8
|
+
|
9
|
+
* Added Cairo::Context.create {}. Cairo::Context.new {} is deprecated.
|
10
|
+
|
11
|
+
* Windows: Added support for installing a normal gem (not fat gem)
|
12
|
+
by "gem install --platform ruby". If you use Bundler, use "bundle
|
13
|
+
config --local force_ruby_platform true" and "bundle exec ruby -rdevkit".
|
14
|
+
|
15
|
+
* Changed to use SPDX license ID in gemspec.
|
16
|
+
|
17
|
+
Fixes
|
18
|
+
-----
|
19
|
+
|
20
|
+
* Fixed a bug that CRFONTOPTIOSN2RVAL() doesn't copy the target
|
21
|
+
options.
|
22
|
+
* Other CR*2RVAL() copy or refer the target objects. So
|
23
|
+
CRFONTOPTIONS2RVAL() must copy for consistency.
|
24
|
+
|
1
25
|
Release 1.15.13 (2018-05-01) Kouhei Sutou <kou@cozmixng.org>
|
2
26
|
============================================================
|
3
27
|
|
data/README.rdoc
CHANGED
@@ -8,12 +8,12 @@ rcairo
|
|
8
8
|
|
9
9
|
Ruby bindings for cairo // cairo extension for Ruby
|
10
10
|
|
11
|
-
|
11
|
+
https://cairographics.org/
|
12
12
|
|
13
13
|
== Dependencies
|
14
14
|
|
15
|
-
* ruby >=
|
16
|
-
* cairo >= 1.2.0
|
15
|
+
* ruby >= 2.2.1
|
16
|
+
* cairo >= 1.2.0
|
17
17
|
|
18
18
|
== Install
|
19
19
|
|
@@ -27,56 +27,27 @@ This way is recommended.
|
|
27
27
|
|
28
28
|
For experimental users.
|
29
29
|
|
30
|
-
|
30
|
+
Add the following to your Gemfile:
|
31
31
|
|
32
|
-
|
33
|
-
% tar xvzf rcairo-X.Y.Z.tar.gz
|
32
|
+
gem "cairo", github: "rcairo/rcairo"
|
34
33
|
|
35
|
-
|
36
|
-
% cd rcairo-X.Y.Z
|
37
|
-
% ruby extconf.rb # to check for dependencies and create Makefiles
|
38
|
-
% make # to compile
|
34
|
+
Then run the following command:
|
39
35
|
|
40
|
-
|
41
|
-
# The samples in the samples folder should be able
|
42
|
-
# to run before installation except text-on-path.rb
|
43
|
-
# and text2.rb. They uses Ruby/Pango with rcairo
|
44
|
-
# support. So you need to install rcairo and build
|
45
|
-
# Ruby/Pango with it before you run them.
|
46
|
-
|
47
|
-
Options to extconf.rb:
|
48
|
-
|
49
|
-
* --without-vendor-override: Use system libraries instead of those found in
|
50
|
-
vendor/local for compiling
|
51
|
-
|
52
|
-
== Windows
|
53
|
-
|
54
|
-
cairo-X.Y.Z-x86-mingw32.gem includes cairo related binaries.
|
55
|
-
|
56
|
-
* cairo related binaries:
|
57
|
-
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
|
58
|
-
|
59
|
-
* cairo-X.Y.Z-a_win32.zip
|
60
|
-
* cairo-dev-X.Y.Z-a_win32.zip
|
61
|
-
* libpng-X.Y.Z-a_win32.zip
|
62
|
-
* zlib-X.Y.Z-a_win32.zip
|
63
|
-
* expat_X.Y.Z-a_win32.zip
|
64
|
-
* fontconfig_X.Y.Z-a_win32.zip
|
65
|
-
* freetype_X.Y.Z-a_win32.zip
|
36
|
+
% bundle install
|
66
37
|
|
67
38
|
== Documents
|
68
39
|
|
69
40
|
* Reference manual:
|
70
|
-
|
41
|
+
https://rcairo.github.io/doc/
|
71
42
|
* Repository of the reference manual:
|
72
|
-
|
43
|
+
https://github.com/rcairo/doc
|
73
44
|
* An article for rcairo on Rubyst Magazine a.k.a. RubiMa (in Japanese):
|
74
|
-
|
45
|
+
https://magazine.rubyist.net/articles/0019/0019-cairo.html
|
75
46
|
|
76
47
|
== Source
|
77
48
|
|
78
49
|
There is the rcairo repository at GitHub:
|
79
|
-
|
50
|
+
https://github.com/rcairo/rcairo
|
80
51
|
|
81
52
|
== Mailing list
|
82
53
|
|
data/Rakefile
CHANGED
@@ -54,6 +54,8 @@ Rake::ExtensionTask.new("cairo", spec) do |ext|
|
|
54
54
|
ext.cross_compile = true
|
55
55
|
ext.cross_compiling do |_spec|
|
56
56
|
if /mingw|mswin/ =~ _spec.platform.to_s
|
57
|
+
_spec.metadata.delete("msys2_mingw_dependencies")
|
58
|
+
|
57
59
|
binary_files = []
|
58
60
|
Find.find(binary_dir) do |name|
|
59
61
|
next unless File.file?(name)
|
@@ -440,8 +442,8 @@ end
|
|
440
442
|
|
441
443
|
windows_task = WindowsTask.new(spec) do |task|
|
442
444
|
zlib_version = "1.2.11"
|
443
|
-
libpng_version = "1.6.
|
444
|
-
freetype_version = "2.
|
445
|
+
libpng_version = "1.6.35"
|
446
|
+
freetype_version = "2.9.1"
|
445
447
|
task.packages = [
|
446
448
|
{
|
447
449
|
# We should use the same version as Ruby Installer.
|
data/ext/cairo/rb_cairo.h
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
* $Author: kou $
|
6
6
|
* $Date: 2008-09-26 13:52:08 $
|
7
7
|
*
|
8
|
-
* Copyright 2005-
|
8
|
+
* Copyright 2005-2018 Kouhei Sutou <kou@cozmixng.org>
|
9
9
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
10
10
|
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
11
11
|
*
|
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
VALUE rb_cCairo_Context;
|
27
27
|
|
28
|
+
static ID cr_id_new;
|
28
29
|
static ID cr_id_surface, cr_id_source;
|
29
30
|
static ID cr_id_plus, cr_id_minus, cr_id_multi, cr_id_div;
|
30
31
|
static cairo_user_data_key_t cr_object_holder_key;
|
@@ -141,6 +142,22 @@ cr_get_reference_count (VALUE self)
|
|
141
142
|
return UINT2NUM (reference_count);
|
142
143
|
}
|
143
144
|
|
145
|
+
static VALUE
|
146
|
+
cr_s_create (int argc, VALUE *argv, VALUE klass)
|
147
|
+
{
|
148
|
+
VALUE rb_cr;
|
149
|
+
rb_cr = rb_funcallv (klass, cr_id_new, argc, argv);
|
150
|
+
if (rb_block_given_p ())
|
151
|
+
{
|
152
|
+
return rb_ensure (rb_yield, rb_cr,
|
153
|
+
cr_destroy_with_destroy_check, rb_cr);
|
154
|
+
}
|
155
|
+
else
|
156
|
+
{
|
157
|
+
return rb_cr;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
144
161
|
static VALUE
|
145
162
|
cr_s_wrap (VALUE self, VALUE pointer)
|
146
163
|
{
|
@@ -1230,11 +1247,22 @@ cr_set_font_options (VALUE self, VALUE options)
|
|
1230
1247
|
static VALUE
|
1231
1248
|
cr_get_font_options (VALUE self)
|
1232
1249
|
{
|
1233
|
-
cairo_font_options_t *options
|
1250
|
+
cairo_font_options_t *options;
|
1251
|
+
VALUE rb_options;
|
1252
|
+
|
1253
|
+
options = cairo_font_options_create ();
|
1234
1254
|
rb_cairo_check_status (cairo_font_options_status (options));
|
1255
|
+
|
1256
|
+
/* TODO: Use rb_ensure() */
|
1257
|
+
rb_options = CRFONTOPTIONS2RVAL (options);
|
1258
|
+
cairo_font_options_destroy (options);
|
1259
|
+
|
1260
|
+
options = RVAL2CRFONTOPTIONS (rb_options);
|
1235
1261
|
cairo_get_font_options (_SELF, options);
|
1262
|
+
cr_check_status (_SELF);
|
1236
1263
|
rb_cairo_check_status (cairo_font_options_status (options));
|
1237
|
-
|
1264
|
+
|
1265
|
+
return rb_options;
|
1238
1266
|
}
|
1239
1267
|
|
1240
1268
|
static VALUE
|
@@ -1663,6 +1691,8 @@ cr_destroy_all_guarded_contexts_at_end (VALUE data)
|
|
1663
1691
|
void
|
1664
1692
|
Init_cairo_context (void)
|
1665
1693
|
{
|
1694
|
+
cr_id_new = rb_intern ("new");
|
1695
|
+
|
1666
1696
|
cr_id_surface = rb_intern ("surface");
|
1667
1697
|
cr_id_source = rb_intern ("source");
|
1668
1698
|
|
@@ -1679,6 +1709,8 @@ Init_cairo_context (void)
|
|
1679
1709
|
rb_cairo__initialize_gc_guard_holder_class (rb_cCairo_Context);
|
1680
1710
|
rb_set_end_proc(cr_destroy_all_guarded_contexts_at_end, Qnil);
|
1681
1711
|
|
1712
|
+
rb_define_singleton_method (rb_cCairo_Context, "create", cr_s_create, -1);
|
1713
|
+
|
1682
1714
|
/* For integrate other libraries such as a FFI based library. */
|
1683
1715
|
rb_define_singleton_method (rb_cCairo_Context, "wrap", cr_s_wrap, 1);
|
1684
1716
|
|
@@ -50,8 +50,11 @@ rb_cairo_font_options_to_ruby_object (cairo_font_options_t *options)
|
|
50
50
|
{
|
51
51
|
if (options)
|
52
52
|
{
|
53
|
+
cairo_font_options_t *copied_options;
|
54
|
+
copied_options = cairo_font_options_copy (options);
|
55
|
+
cr_options_check_status (copied_options);
|
53
56
|
return Data_Wrap_Struct (rb_cCairo_FontOptions, NULL,
|
54
|
-
cr_options_free,
|
57
|
+
cr_options_free, copied_options);
|
55
58
|
}
|
56
59
|
else
|
57
60
|
{
|
@@ -79,11 +82,7 @@ cr_options_create (VALUE self)
|
|
79
82
|
static VALUE
|
80
83
|
cr_options_copy (VALUE self)
|
81
84
|
{
|
82
|
-
|
83
|
-
|
84
|
-
options = cairo_font_options_copy (_SELF (self));
|
85
|
-
cr_options_check_status (options);
|
86
|
-
return CRFONTOPTIONS2RVAL (options);
|
85
|
+
return CRFONTOPTIONS2RVAL (_SELF (self));
|
87
86
|
}
|
88
87
|
|
89
88
|
static VALUE
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* $Author: kou $
|
6
6
|
* $Date: 2008-08-17 07:21:42 $
|
7
7
|
*
|
8
|
-
* Copyright 2005-
|
8
|
+
* Copyright 2005-2018 Kouhei Sutou <kou@cozmixng.org>
|
9
9
|
*
|
10
10
|
* This file is made available under the same terms as Ruby
|
11
11
|
*
|
@@ -126,6 +126,6 @@ VALUE rb_cairo__invoke_callback (cr_callback_func_t func, VALUE user_data);
|
|
126
126
|
|
127
127
|
extern VALUE rb_cairo__cFFIPointer;
|
128
128
|
|
129
|
-
|
129
|
+
VALUE rb_cairo__surface_yield_and_finish (VALUE self);
|
130
130
|
|
131
131
|
#endif
|
@@ -181,12 +181,21 @@ static VALUE
|
|
181
181
|
cr_scaled_font_get_font_options (VALUE self)
|
182
182
|
{
|
183
183
|
cairo_font_options_t *options;
|
184
|
+
VALUE rb_options;
|
184
185
|
|
185
|
-
options = cairo_font_options_create();
|
186
|
+
options = cairo_font_options_create ();
|
187
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
188
|
+
|
189
|
+
/* TODO: Use rb_ensure() */
|
190
|
+
rb_options = CRFONTOPTIONS2RVAL (options);
|
191
|
+
cairo_font_options_destroy (options);
|
192
|
+
|
193
|
+
options = RVAL2CRFONTOPTIONS (rb_options);
|
186
194
|
cairo_scaled_font_get_font_options (_SELF (self), options);
|
187
195
|
cr_scaled_font_check_status (_SELF (self));
|
188
196
|
rb_cairo_check_status (cairo_font_options_status (options));
|
189
|
-
|
197
|
+
|
198
|
+
return rb_options;
|
190
199
|
}
|
191
200
|
|
192
201
|
#if CAIRO_CHECK_VERSION(1, 7, 2)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
/*
|
3
3
|
* Ruby Cairo Binding
|
4
4
|
*
|
5
|
-
* Copyright 2005-
|
5
|
+
* Copyright 2005-2018 Kouhei Sutou <kou@cozmixng.org>
|
6
6
|
* Copyright 2014 Patrick Hanevold <patrick.hanevold@gmail.com>
|
7
7
|
* Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
|
8
8
|
* Copyright 2004-2005 MenTaLguY <mental@rydia.com>
|
@@ -90,6 +90,7 @@ VALUE rb_cCairo_SkiaSurface = Qnil;
|
|
90
90
|
VALUE rb_cCairo_SubSurface = Qnil;
|
91
91
|
VALUE rb_cCairo_CoglSurface = Qnil;
|
92
92
|
|
93
|
+
static ID cr_id_new;
|
93
94
|
static ID cr_id_parse;
|
94
95
|
static ID cr_id_size;
|
95
96
|
static ID cr_id_set_unit;
|
@@ -217,6 +218,67 @@ cr_surface_get_klass (cairo_surface_t *surface)
|
|
217
218
|
return klass;
|
218
219
|
}
|
219
220
|
|
221
|
+
static void
|
222
|
+
rb_cairo_surface_adjust_memory_usage (cairo_surface_t *surface,
|
223
|
+
cairo_bool_t new)
|
224
|
+
{
|
225
|
+
#ifdef HAVE_RB_GC_ADJUST_MEMORY_USAGE
|
226
|
+
if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE)
|
227
|
+
{
|
228
|
+
ssize_t memory_usage_diff;
|
229
|
+
memory_usage_diff =
|
230
|
+
cairo_image_surface_get_stride (surface) *
|
231
|
+
cairo_image_surface_get_height (surface);
|
232
|
+
if (!new)
|
233
|
+
memory_usage_diff = -memory_usage_diff;
|
234
|
+
rb_gc_adjust_memory_usage (memory_usage_diff);
|
235
|
+
}
|
236
|
+
#endif
|
237
|
+
}
|
238
|
+
|
239
|
+
static void
|
240
|
+
cr_surface_destroy_raw (cairo_surface_t *surface)
|
241
|
+
{
|
242
|
+
rb_cairo_surface_adjust_memory_usage (surface, CR_FALSE);
|
243
|
+
cairo_surface_destroy (surface);
|
244
|
+
}
|
245
|
+
|
246
|
+
static VALUE
|
247
|
+
cr_surface_destroy (VALUE self)
|
248
|
+
{
|
249
|
+
cairo_surface_t *surface;
|
250
|
+
|
251
|
+
surface = _SELF;
|
252
|
+
cr_surface_destroy_raw (surface);
|
253
|
+
DATA_PTR (self) = NULL;
|
254
|
+
|
255
|
+
return self;
|
256
|
+
}
|
257
|
+
|
258
|
+
static VALUE
|
259
|
+
cr_surface_destroy_with_destroy_check (VALUE self)
|
260
|
+
{
|
261
|
+
if (_SELF)
|
262
|
+
cr_surface_destroy (self);
|
263
|
+
return Qnil;
|
264
|
+
}
|
265
|
+
|
266
|
+
static VALUE
|
267
|
+
cr_surface_create (int argc, VALUE *argv, VALUE klass)
|
268
|
+
{
|
269
|
+
VALUE rb_surface;
|
270
|
+
rb_surface = rb_funcallv (klass, cr_id_new, argc, argv);
|
271
|
+
if (rb_block_given_p ())
|
272
|
+
{
|
273
|
+
return rb_ensure (rb_cairo__surface_yield_and_finish, rb_surface,
|
274
|
+
cr_surface_destroy_with_destroy_check, rb_surface);
|
275
|
+
}
|
276
|
+
else
|
277
|
+
{
|
278
|
+
return rb_surface;
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
220
282
|
static VALUE
|
221
283
|
cr_surface_image_supported_p (VALUE klass)
|
222
284
|
{
|
@@ -349,24 +411,6 @@ cr_surface_xml_supported_p (VALUE klass)
|
|
349
411
|
#endif
|
350
412
|
}
|
351
413
|
|
352
|
-
static void
|
353
|
-
rb_cairo_surface_adjust_memory_usage (cairo_surface_t *surface,
|
354
|
-
cairo_bool_t new)
|
355
|
-
{
|
356
|
-
#ifdef HAVE_RB_GC_ADJUST_MEMORY_USAGE
|
357
|
-
if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE)
|
358
|
-
{
|
359
|
-
ssize_t memory_usage_diff;
|
360
|
-
memory_usage_diff =
|
361
|
-
cairo_image_surface_get_stride (surface) *
|
362
|
-
cairo_image_surface_get_height (surface);
|
363
|
-
if (!new)
|
364
|
-
memory_usage_diff = -memory_usage_diff;
|
365
|
-
rb_gc_adjust_memory_usage (memory_usage_diff);
|
366
|
-
}
|
367
|
-
#endif
|
368
|
-
}
|
369
|
-
|
370
414
|
/* constructor/de-constructor */
|
371
415
|
cairo_surface_t *
|
372
416
|
rb_cairo_surface_from_ruby_object (VALUE obj)
|
@@ -402,9 +446,7 @@ cr_surface_free (void *ptr)
|
|
402
446
|
if (!surface)
|
403
447
|
return;
|
404
448
|
|
405
|
-
|
406
|
-
|
407
|
-
cairo_surface_destroy (surface);
|
449
|
+
cr_surface_destroy_raw (surface);
|
408
450
|
}
|
409
451
|
|
410
452
|
VALUE
|
@@ -453,18 +495,6 @@ cr_surface_initialize (int argc, VALUE *argv, VALUE self)
|
|
453
495
|
}
|
454
496
|
|
455
497
|
/* Surface manipulation */
|
456
|
-
static VALUE
|
457
|
-
cr_surface_destroy (VALUE self)
|
458
|
-
{
|
459
|
-
cairo_surface_t *surface;
|
460
|
-
|
461
|
-
surface = _SELF;
|
462
|
-
cairo_surface_destroy (surface);
|
463
|
-
DATA_PTR (self) = NULL;
|
464
|
-
|
465
|
-
return self;
|
466
|
-
}
|
467
|
-
|
468
498
|
static VALUE
|
469
499
|
cr_surface_get_reference_count (VALUE self)
|
470
500
|
{
|
@@ -497,20 +527,25 @@ cr_surface_finish (VALUE self)
|
|
497
527
|
return self;
|
498
528
|
}
|
499
529
|
|
500
|
-
|
530
|
+
VALUE
|
501
531
|
rb_cairo__surface_yield_and_finish (VALUE self)
|
502
532
|
{
|
533
|
+
VALUE rb_result;
|
503
534
|
cairo_surface_t *surface;
|
504
535
|
|
505
|
-
rb_yield (self);
|
536
|
+
rb_result = rb_yield (self);
|
506
537
|
|
507
538
|
surface = _SELF;
|
539
|
+
if (!surface)
|
540
|
+
return rb_result;
|
508
541
|
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
509
|
-
return;
|
542
|
+
return rb_result;
|
510
543
|
if (cairo_surface_get_user_data (surface, &cr_finished_key))
|
511
|
-
return;
|
544
|
+
return rb_result;
|
512
545
|
|
513
546
|
cr_surface_finish (self);
|
547
|
+
|
548
|
+
return rb_result;
|
514
549
|
}
|
515
550
|
|
516
551
|
static VALUE
|
@@ -632,14 +667,6 @@ cr_surface_unmap_image (VALUE self, VALUE rb_mapped_image)
|
|
632
667
|
#endif
|
633
668
|
|
634
669
|
#if CAIRO_CHECK_VERSION(1, 10, 0)
|
635
|
-
static VALUE
|
636
|
-
cr_surface_destroy_with_destroy_check (VALUE self)
|
637
|
-
{
|
638
|
-
if (DATA_PTR (self))
|
639
|
-
cr_surface_destroy (self);
|
640
|
-
return Qnil;
|
641
|
-
}
|
642
|
-
|
643
670
|
static VALUE
|
644
671
|
cr_surface_create_sub_rectangle_surface (VALUE self, VALUE x, VALUE y,
|
645
672
|
VALUE width, VALUE height)
|
@@ -782,11 +809,22 @@ cr_surface_supported_mime_type_p (VALUE self, VALUE rb_mime_type)
|
|
782
809
|
static VALUE
|
783
810
|
cr_surface_get_font_options (VALUE self)
|
784
811
|
{
|
785
|
-
cairo_font_options_t *options
|
812
|
+
cairo_font_options_t *options;
|
813
|
+
VALUE rb_options;
|
814
|
+
|
815
|
+
options = cairo_font_options_create ();
|
816
|
+
rb_cairo_check_status (cairo_font_options_status (options));
|
817
|
+
|
818
|
+
/* TODO: Use rb_ensure() */
|
819
|
+
rb_options = CRFONTOPTIONS2RVAL (options);
|
820
|
+
cairo_font_options_destroy (options);
|
821
|
+
|
822
|
+
options = RVAL2CRFONTOPTIONS (rb_options);
|
786
823
|
cairo_surface_get_font_options (_SELF, options);
|
787
824
|
rb_cairo_surface_check_status (_SELF);
|
788
825
|
rb_cairo_check_status (cairo_font_options_status (options));
|
789
|
-
|
826
|
+
|
827
|
+
return rb_options;
|
790
828
|
}
|
791
829
|
|
792
830
|
static VALUE
|
@@ -1967,6 +2005,7 @@ cr_finish_all_guarded_surfaces_at_end (VALUE data)
|
|
1967
2005
|
void
|
1968
2006
|
Init_cairo_surface (void)
|
1969
2007
|
{
|
2008
|
+
cr_id_new = rb_intern ("new");
|
1970
2009
|
cr_id_parse = rb_intern ("parse");
|
1971
2010
|
cr_id_size = rb_intern ("size");
|
1972
2011
|
cr_id_set_unit = rb_intern ("unit=");
|
@@ -1982,6 +2021,8 @@ Init_cairo_surface (void)
|
|
1982
2021
|
rb_cairo__initialize_gc_guard_holder_class (rb_cCairo_Surface);
|
1983
2022
|
rb_set_end_proc(cr_finish_all_guarded_surfaces_at_end, Qnil);
|
1984
2023
|
|
2024
|
+
rb_define_singleton_method (rb_cCairo_Surface, "create",
|
2025
|
+
cr_surface_create, -1);
|
1985
2026
|
rb_define_singleton_method (rb_cCairo_Surface, "image_supported?",
|
1986
2027
|
cr_surface_image_supported_p, 0);
|
1987
2028
|
rb_define_singleton_method (rb_cCairo_Surface, "pdf_supported?",
|
@@ -1,9 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require 'test/unit/notify'
|
1
|
+
require "cairo"
|
2
|
+
require "poppler"
|
3
|
+
require "stringio"
|
5
4
|
|
6
|
-
module
|
5
|
+
module Helper
|
7
6
|
private
|
8
7
|
def only_cairo_version(major, minor, micro=nil)
|
9
8
|
unless Cairo.satisfied_version?(major, minor, micro)
|
data/test/run-test.rb
CHANGED
@@ -11,19 +11,12 @@ if system("which make >/dev/null 2>&1")
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
require
|
15
|
-
require 'bundler/setup'
|
16
|
-
require 'test-unit'
|
14
|
+
require "test-unit"
|
17
15
|
|
18
16
|
$LOAD_PATH.unshift(base_dir)
|
19
17
|
$LOAD_PATH.unshift(ext_dir)
|
20
18
|
$LOAD_PATH.unshift(lib_dir)
|
21
19
|
|
22
|
-
|
23
|
-
require 'cairo-test-utils'
|
20
|
+
require_relative "helper"
|
24
21
|
|
25
|
-
|
26
|
-
require file.sub(/\.rb$/, '')
|
27
|
-
end
|
28
|
-
|
29
|
-
exit Test::Unit::AutoRunner.run(false)
|
22
|
+
exit Test::Unit::AutoRunner.run(true, test_dir)
|
data/test/test_context.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class ContextTest < Test::Unit::TestCase
|
2
|
-
include
|
2
|
+
include Helper
|
3
3
|
|
4
4
|
def setup
|
5
5
|
@output = StringIO.new
|
@@ -14,17 +14,17 @@ class ContextTest < Test::Unit::TestCase
|
|
14
14
|
assert_equal("%%EOF\n", @output.string[-6..-1])
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
Cairo::Context.
|
17
|
+
def test_create_with_block
|
18
|
+
Cairo::Context.create(@surface) do |context|
|
19
19
|
@surface.destroy
|
20
20
|
assert_not_equal("%%EOF\n", @output.string[-6..-1])
|
21
21
|
end
|
22
22
|
assert_equal("%%EOF\n", @output.string[-6..-1])
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def test_create_with_block_and_destroy
|
26
26
|
assert_nothing_raised do
|
27
|
-
Cairo::Context.
|
27
|
+
Cairo::Context.create(@surface) do |context|
|
28
28
|
context.destroy
|
29
29
|
end
|
30
30
|
end
|
@@ -106,7 +106,7 @@ class ContextTest < Test::Unit::TestCase
|
|
106
106
|
end
|
107
107
|
|
108
108
|
test("LINK") do
|
109
|
-
Cairo::Context.
|
109
|
+
Cairo::Context.create(@surface) do |context|
|
110
110
|
context.tag(Cairo::Tag::LINK, "uri='http://localhost/'") do
|
111
111
|
context.show_text("localhost")
|
112
112
|
end
|
data/test/test_font_extents.rb
CHANGED
data/test/test_font_face.rb
CHANGED
data/test/test_font_options.rb
CHANGED
data/test/test_image_surface.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'cairo'
|
2
2
|
|
3
3
|
class ImageSurfaceTest < Test::Unit::TestCase
|
4
|
-
include
|
4
|
+
include Helper
|
5
5
|
|
6
6
|
def test_cloned_data
|
7
7
|
width = 10
|
@@ -15,7 +15,7 @@ class ImageSurfaceTest < Test::Unit::TestCase
|
|
15
15
|
:a1, width, height,
|
16
16
|
original_surface.stride)
|
17
17
|
|
18
|
-
Cairo::Context.
|
18
|
+
Cairo::Context.create(cloned_surface) do |context|
|
19
19
|
context.set_source_rgb(255, 255, 255)
|
20
20
|
context.scale(width, height)
|
21
21
|
context.move_to(0, 0)
|
data/test/test_pdf_surface.rb
CHANGED
@@ -2,15 +2,15 @@ require "cairo"
|
|
2
2
|
require "tempfile"
|
3
3
|
|
4
4
|
class RasterSourcePatternTest < Test::Unit::TestCase
|
5
|
-
include
|
5
|
+
include Helper
|
6
6
|
|
7
7
|
def setup
|
8
8
|
only_pattern("RasterSource")
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_acquire_and_release
|
12
|
-
Cairo::ImageSurface.
|
13
|
-
Cairo::Context.
|
12
|
+
Cairo::ImageSurface.create(100, 100) do |surface|
|
13
|
+
Cairo::Context.create(surface) do |context|
|
14
14
|
context.set_source(1, 1, 1)
|
15
15
|
context.paint
|
16
16
|
|
@@ -20,7 +20,7 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
20
20
|
called << :acquire
|
21
21
|
red_image = target.create_similar_image(extents.width, extents.height)
|
22
22
|
red_image.set_device_offset(extents.x, extents.y)
|
23
|
-
Cairo::Context.
|
23
|
+
Cairo::Context.create(red_image) do |red_image_context|
|
24
24
|
red_image_context.set_source(1, 0, 0)
|
25
25
|
red_image_context.paint
|
26
26
|
end
|
@@ -46,8 +46,8 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_success
|
49
|
-
Cairo::RecordingSurface.
|
50
|
-
Cairo::Context.
|
49
|
+
Cairo::RecordingSurface.create(0, 0, 100, 100) do |surface|
|
50
|
+
Cairo::Context.create(surface) do |context|
|
51
51
|
called = []
|
52
52
|
raster_source = Cairo::RasterSourcePattern.new(100, 100)
|
53
53
|
raster_source.snapshot do |pattern|
|
@@ -63,8 +63,8 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_error
|
66
|
-
Cairo::RecordingSurface.
|
67
|
-
Cairo::Context.
|
66
|
+
Cairo::RecordingSurface.create(0, 0, 100, 100) do |surface|
|
67
|
+
Cairo::Context.create(surface) do |context|
|
68
68
|
called = []
|
69
69
|
raster_source = Cairo::RasterSourcePattern.new(100, 100)
|
70
70
|
raster_source.snapshot do |pattern|
|
@@ -92,8 +92,8 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
92
92
|
def test_success
|
93
93
|
output = StringIO.new
|
94
94
|
device = Cairo::ScriptDevice.new(output)
|
95
|
-
Cairo::ScriptSurface.
|
96
|
-
Cairo::Context.
|
95
|
+
Cairo::ScriptSurface.create(device, 100, 200) do |surface|
|
96
|
+
Cairo::Context.create(surface) do |context|
|
97
97
|
called = []
|
98
98
|
|
99
99
|
raster_source = Cairo::RasterSourcePattern.new(100, 100)
|
@@ -102,7 +102,7 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
102
102
|
red_image = target.create_similar_image(extents.width,
|
103
103
|
extents.height)
|
104
104
|
red_image.set_device_offset(extents.x, extents.y)
|
105
|
-
Cairo::Context.
|
105
|
+
Cairo::Context.create(red_image) do |red_image_context|
|
106
106
|
red_image_context.set_source(1, 0, 0)
|
107
107
|
red_image_context.paint
|
108
108
|
end
|
@@ -129,8 +129,8 @@ class RasterSourcePatternTest < Test::Unit::TestCase
|
|
129
129
|
def test_error
|
130
130
|
output = StringIO.new
|
131
131
|
device = Cairo::ScriptDevice.new(output)
|
132
|
-
Cairo::ScriptSurface.
|
133
|
-
Cairo::Context.
|
132
|
+
Cairo::ScriptSurface.create(device, 100, 200) do |surface|
|
133
|
+
Cairo::Context.create(surface) do |context|
|
134
134
|
called = []
|
135
135
|
|
136
136
|
raster_source = Cairo::RasterSourcePattern.new(100, 100)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class RecordingSurfaceTest < Test::Unit::TestCase
|
2
|
-
include
|
2
|
+
include Helper
|
3
3
|
|
4
4
|
def setup
|
5
5
|
only_surface("Recording")
|
@@ -10,7 +10,7 @@ class RecordingSurfaceTest < Test::Unit::TestCase
|
|
10
10
|
only_cairo_version(1, 12, 0)
|
11
11
|
surface = Cairo::RecordingSurface.new(10, 20, 300, 400)
|
12
12
|
assert_equal([0.0, 0.0, 0.0, 0.0], surface.ink_extents)
|
13
|
-
Cairo::Context.
|
13
|
+
Cairo::Context.create(surface) do |context|
|
14
14
|
context.move_to(15, 30)
|
15
15
|
context.line_to(80, 100)
|
16
16
|
context.stroke
|
data/test/test_region.rb
CHANGED
data/test/test_scaled_font.rb
CHANGED
data/test/test_script_device.rb
CHANGED
data/test/test_script_surface.rb
CHANGED
data/test/test_surface.rb
CHANGED
@@ -2,7 +2,7 @@ require 'cairo'
|
|
2
2
|
require 'stringio'
|
3
3
|
|
4
4
|
class SurfaceTest < Test::Unit::TestCase
|
5
|
-
include
|
5
|
+
include Helper
|
6
6
|
|
7
7
|
def test_new
|
8
8
|
output = StringIO.new
|
@@ -12,17 +12,17 @@ class SurfaceTest < Test::Unit::TestCase
|
|
12
12
|
assert_equal("%%EOF\n", output.string[-6..-1])
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def test_create_with_block
|
16
16
|
output = StringIO.new
|
17
|
-
Cairo::PDFSurface.
|
17
|
+
Cairo::PDFSurface.create(output, 10, 10) do |surface|
|
18
18
|
assert_not_equal("%%EOF\n", output.string[-6..-1])
|
19
19
|
end
|
20
20
|
assert_equal("%%EOF\n", output.string[-6..-1])
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def test_create_with_block_and_finish
|
24
24
|
assert_nothing_raised do
|
25
|
-
Cairo::PDFSurface.
|
25
|
+
Cairo::PDFSurface.create(StringIO.new, 10, 10) do |surface|
|
26
26
|
surface.finish
|
27
27
|
end
|
28
28
|
end
|
data/test/test_svg_surface.rb
CHANGED
data/test/test_tee_surface.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class TeeSurfaceTest < Test::Unit::TestCase
|
2
|
-
include
|
2
|
+
include Helper
|
3
3
|
|
4
4
|
def setup
|
5
5
|
only_surface("Tee")
|
@@ -16,7 +16,7 @@ class TeeSurfaceTest < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
surface = Cairo::TeeSurface.new(surface1)
|
18
18
|
surface << surface2
|
19
|
-
Cairo::Context.
|
19
|
+
Cairo::Context.create(surface) do |context|
|
20
20
|
context.move_to(15, 30)
|
21
21
|
context.line_to(80, 100)
|
22
22
|
context.stroke
|
data/test/test_text_cluster.rb
CHANGED
data/test/test_text_extents.rb
CHANGED
data/test/test_xml_device.rb
CHANGED
data/test/test_xml_surface.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class XMLSurfaceTest < Test::Unit::TestCase
|
2
|
-
include
|
2
|
+
include Helper
|
3
3
|
|
4
4
|
def setup
|
5
5
|
only_surface("XML")
|
@@ -10,7 +10,7 @@ class XMLSurfaceTest < Test::Unit::TestCase
|
|
10
10
|
output = StringIO.new
|
11
11
|
device = Cairo::XMLDevice.new(output)
|
12
12
|
surface = Cairo::XMLSurface.new(device, 100, 200)
|
13
|
-
Cairo::Context.
|
13
|
+
Cairo::Context.create(surface) do |context|
|
14
14
|
context.move_to(15, 30)
|
15
15
|
context.line_to(80, 100)
|
16
16
|
context.stroke
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cairo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: test-unit
|
56
|
+
name: test-unit
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -180,7 +180,7 @@ files:
|
|
180
180
|
- samples/scalable.rb
|
181
181
|
- samples/text-on-path.rb
|
182
182
|
- samples/text2.rb
|
183
|
-
- test/
|
183
|
+
- test/helper.rb
|
184
184
|
- test/run-test.rb
|
185
185
|
- test/test_color.rb
|
186
186
|
- test/test_constants.rb
|
@@ -207,10 +207,11 @@ files:
|
|
207
207
|
- test/test_text_to_glyphs_data.rb
|
208
208
|
- test/test_xml_device.rb
|
209
209
|
- test/test_xml_surface.rb
|
210
|
-
homepage:
|
210
|
+
homepage: https://rcairo.github.io/
|
211
211
|
licenses:
|
212
|
-
- Ruby
|
213
|
-
metadata:
|
212
|
+
- Ruby
|
213
|
+
metadata:
|
214
|
+
msys2_mingw_dependencies: cairo
|
214
215
|
post_install_message:
|
215
216
|
rdoc_options: []
|
216
217
|
require_paths:
|
@@ -227,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
230
|
rubyforge_project:
|
230
|
-
rubygems_version:
|
231
|
+
rubygems_version: 3.0.0.beta1
|
231
232
|
signing_key:
|
232
233
|
specification_version: 4
|
233
234
|
summary: Ruby bindings for cairo
|
@@ -240,9 +241,9 @@ test_files:
|
|
240
241
|
- test/test_svg_surface.rb
|
241
242
|
- test/test_script_device.rb
|
242
243
|
- test/test_xml_device.rb
|
243
|
-
- test/cairo-test-utils.rb
|
244
244
|
- test/test_script_surface.rb
|
245
245
|
- test/test_context.rb
|
246
|
+
- test/helper.rb
|
246
247
|
- test/test_font_face.rb
|
247
248
|
- test/test_raster_source_pattern.rb
|
248
249
|
- test/test_image_surface.rb
|