cairo 1.17.7 → 1.17.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5ac730747ea5dada591e534a7c0653a0d1ad3fa3962dfdd01173e0074ff835c
4
- data.tar.gz: 2fbccb304f8b4dbd3a89df42c9f1779b45a84b2f4c9be5ab591992eb9d7c3d31
3
+ metadata.gz: dffa934fa956305e9ed3ba9a9a5c92956c61c09277ea1723ceb69c1bee1b5c72
4
+ data.tar.gz: c4a6b1aa7bc5e3e00ca1bb388272d75c726fb20a1366dcbc2f15513d06177cbd
5
5
  SHA512:
6
- metadata.gz: 389eeca0e8c453e3c1b2ebe10053a1713c1c1ae93b22e46100b5bc1c39d566f00f60a1c676ae288e06fa9fdea6f24db8e107d53355bd52bc0e067e5b8b4fe073
7
- data.tar.gz: d107b587d530433a0288f73a5b8d85710e2923213347f88e09de92562645dbcd9e501f8f9ab1bd74bb9ae13559ee94999e94c7555cd96a345b9d1d75965b961c
6
+ metadata.gz: 163b19b0d0fdbfadd8117629b95fbd51f97a84617bc77366eb5083b4e631bc3eb863c1daa51ce6e79fd0cfbe462f69215b6bc3548c9a3960e95861c799f53515
7
+ data.tar.gz: c266cd0dc3e254bccecae19b9f8dfb688c55404cd348446d2e34d67d263e07b1244851292aa1d8c1140e30bfa8162af1135855b99eb1da7af54c9d67d77aefba
data/NEWS CHANGED
@@ -1,3 +1,17 @@
1
+ Release 1.17.8 (2022-09-01) Sutou Kouhei <kou@cozmixng.org>
2
+ ===========================================================
3
+
4
+ Improvements
5
+ ------------
6
+
7
+ * Added support for Pathname for Cairo::Surface#write_to_png.
8
+ [GitHub#37][Reported by scivola]
9
+
10
+ Thanks
11
+ ------
12
+
13
+ * scivola
14
+
1
15
  Release 1.17.7 (2022-07-31) Sutou Kouhei <kou@cozmixng.org>
2
16
  ===========================================================
3
17
 
data/ext/cairo/rb_cairo.h CHANGED
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-19 12:56:27 $
7
7
  *
8
- * Copyright 2006-2021 Sutou Kouhei <kou@cozmixng.org>
8
+ * Copyright 2006-2022 Sutou Kouhei <kou@cozmixng.org>
9
9
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
10
10
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
11
11
  *
@@ -65,7 +65,7 @@ RB_CAIRO_BEGIN_DECLS
65
65
 
66
66
  #define RB_CAIRO_VERSION_MAJOR 1
67
67
  #define RB_CAIRO_VERSION_MINOR 17
68
- #define RB_CAIRO_VERSION_MICRO 7
68
+ #define RB_CAIRO_VERSION_MICRO 8
69
69
 
70
70
  RB_CAIRO_VAR VALUE rb_mCairo;
71
71
  RB_CAIRO_VAR VALUE rb_cCairo_Context;
@@ -126,20 +126,20 @@ cr_destroy (VALUE self)
126
126
  cr_set_user_data (cr, &cr_object_holder_key, NULL, NULL);
127
127
  cairo_destroy (cr);
128
128
 
129
- DATA_PTR (self) = NULL;
129
+ RTYPEDDATA_DATA (self) = NULL;
130
130
  return Qnil;
131
131
  }
132
132
 
133
133
  static VALUE
134
134
  cr_destroyed (VALUE self)
135
135
  {
136
- return CBOOL2RVAL (DATA_PTR (self) == NULL);
136
+ return CBOOL2RVAL (RTYPEDDATA_DATA (self) == NULL);
137
137
  }
138
138
 
139
139
  static VALUE
140
140
  cr_destroy_with_destroy_check (VALUE self)
141
141
  {
142
- if (DATA_PTR (self))
142
+ if (RTYPEDDATA_DATA (self))
143
143
  cr_destroy (self);
144
144
  return Qnil;
145
145
  }
@@ -202,7 +202,7 @@ cr_s_wrap (VALUE self, VALUE pointer)
202
202
 
203
203
  rb_cr = rb_obj_alloc (self);
204
204
  cairo_reference (cr);
205
- DATA_PTR (rb_cr) = cr;
205
+ RTYPEDDATA_DATA (rb_cr) = cr;
206
206
  rb_ivar_set (rb_cr, cr_id_surface, Qnil);
207
207
 
208
208
  if (rb_block_given_p ())
@@ -232,7 +232,7 @@ cr_initialize (VALUE self, VALUE target)
232
232
  &cr_object_holder_key,
233
233
  cr_object_holder_new (self),
234
234
  cr_object_holder_free);
235
- DATA_PTR (self) = cr;
235
+ RTYPEDDATA_DATA (self) = cr;
236
236
  if (rb_block_given_p ())
237
237
  result = rb_ensure (rb_yield, self, cr_destroy_with_destroy_check, self);
238
238
  return result;
@@ -215,7 +215,7 @@ cr_device_destroy (VALUE self)
215
215
 
216
216
  device = _SELF;
217
217
  cairo_device_destroy (device);
218
- DATA_PTR (self) = NULL;
218
+ RTYPEDDATA_DATA (self) = NULL;
219
219
 
220
220
  return self;
221
221
  }
@@ -335,7 +335,7 @@ cr_ ## type ## _device_initialize (VALUE self, \
335
335
  } \
336
336
  \
337
337
  cr_device_check_status (device); \
338
- DATA_PTR (self) = device; \
338
+ RTYPEDDATA_DATA (self) = device; \
339
339
  if (rb_block_given_p ()) \
340
340
  yield_and_finish (self); \
341
341
  return Qnil; \
@@ -81,7 +81,7 @@ cr_font_extents_initialize (VALUE self)
81
81
  extents->max_x_advance = 1.0;
82
82
  extents->max_y_advance = 0.0;
83
83
 
84
- DATA_PTR (self) = extents;
84
+ RTYPEDDATA_DATA (self) = extents;
85
85
 
86
86
  return Qnil;
87
87
  }
@@ -283,7 +283,7 @@ cr_freetype_font_face_initialize (VALUE self, VALUE path)
283
283
  rb_cairo_check_status (status);
284
284
  }
285
285
 
286
- DATA_PTR (self) = face;
286
+ RTYPEDDATA_DATA (self) = face;
287
287
 
288
288
  return Qnil;
289
289
  }
@@ -332,7 +332,7 @@ cr_toy_font_face_initialize (int argc, VALUE *argv, VALUE self)
332
332
 
333
333
  face = cairo_toy_font_face_create (family, slant, weight);
334
334
  cr_font_face_check_status (face);
335
- DATA_PTR (self) = face;
335
+ RTYPEDDATA_DATA (self) = face;
336
336
 
337
337
  return Qnil;
338
338
  }
@@ -758,7 +758,7 @@ cr_user_font_face_initialize (VALUE self)
758
758
  rb_ivar_set (self, cr_id_text_to_glyphs, Qnil);
759
759
  rb_ivar_set (self, cr_id_unicode_to_glyph, Qnil);
760
760
 
761
- DATA_PTR (self) = face;
761
+ RTYPEDDATA_DATA (self) = face;
762
762
 
763
763
  return Qnil;
764
764
  }
@@ -87,7 +87,7 @@ cr_options_create (VALUE self)
87
87
 
88
88
  options = cairo_font_options_create ();
89
89
  cr_options_check_status (options);
90
- DATA_PTR (self) = options;
90
+ RTYPEDDATA_DATA (self) = options;
91
91
  return Qnil;
92
92
  }
93
93
 
@@ -77,7 +77,7 @@ cr_glyph_initialize (VALUE self, VALUE index, VALUE x, VALUE y)
77
77
  glyph->x = NUM2DBL (x);
78
78
  glyph->y = NUM2DBL (y);
79
79
 
80
- DATA_PTR (self) = glyph;
80
+ RTYPEDDATA_DATA (self) = glyph;
81
81
  return Qnil;
82
82
  }
83
83
 
@@ -81,7 +81,7 @@ cr_matrix_initialize (VALUE self,
81
81
  NUM2DBL (xx), NUM2DBL (yx),
82
82
  NUM2DBL (xy), NUM2DBL (yy),
83
83
  NUM2DBL (x0), NUM2DBL (y0));
84
- DATA_PTR (self) = matrix;
84
+ RTYPEDDATA_DATA (self) = matrix;
85
85
  return Qnil;
86
86
  }
87
87
 
@@ -291,7 +291,7 @@ cr_path_initialize (VALUE self)
291
291
  path->status = CAIRO_STATUS_SUCCESS;
292
292
  path->data = NULL;
293
293
  path->num_data = 0;
294
- DATA_PTR (self) = path;
294
+ RTYPEDDATA_DATA (self) = path;
295
295
 
296
296
  return Qnil;
297
297
  }
@@ -259,7 +259,7 @@ cr_solid_pattern_initialize (int argc, VALUE *argv, VALUE self)
259
259
  }
260
260
 
261
261
  cr_pattern_check_status (pattern);
262
- DATA_PTR (self) = pattern;
262
+ RTYPEDDATA_DATA (self) = pattern;
263
263
  return Qnil;
264
264
  }
265
265
 
@@ -270,7 +270,7 @@ cr_surface_pattern_initialize (VALUE self, VALUE surface)
270
270
 
271
271
  pattern = cairo_pattern_create_for_surface (RVAL2CRSURFACE (surface));
272
272
  cr_pattern_check_status (pattern);
273
- DATA_PTR (self) = pattern;
273
+ RTYPEDDATA_DATA (self) = pattern;
274
274
  return Qnil;
275
275
  }
276
276
 
@@ -283,7 +283,7 @@ cr_linear_pattern_initialize (VALUE self, VALUE x0, VALUE y0,
283
283
  pattern = cairo_pattern_create_linear (NUM2DBL (x0), NUM2DBL (y0),
284
284
  NUM2DBL (x1), NUM2DBL (y1));
285
285
  cr_pattern_check_status (pattern);
286
- DATA_PTR (self) = pattern;
286
+ RTYPEDDATA_DATA (self) = pattern;
287
287
  return Qnil;
288
288
  }
289
289
 
@@ -298,7 +298,7 @@ cr_radial_pattern_initialize (VALUE self, VALUE cx0, VALUE cy0, VALUE radius0,
298
298
  NUM2DBL (cx1), NUM2DBL (cy1),
299
299
  NUM2DBL (radius1));
300
300
  cr_pattern_check_status (pattern);
301
- DATA_PTR (self) = pattern;
301
+ RTYPEDDATA_DATA (self) = pattern;
302
302
  return Qnil;
303
303
  }
304
304
 
@@ -526,7 +526,7 @@ cr_mesh_pattern_initialize (VALUE self)
526
526
 
527
527
  pattern = cairo_pattern_create_mesh ();
528
528
  cr_pattern_check_status (pattern);
529
- DATA_PTR (self) = pattern;
529
+ RTYPEDDATA_DATA (self) = pattern;
530
530
  return Qnil;
531
531
  }
532
532
 
@@ -924,7 +924,7 @@ cr_raster_source_pattern_initialize (int argc, VALUE *argv, VALUE self)
924
924
  content, width, height);
925
925
  cr_pattern_check_status (pattern);
926
926
 
927
- DATA_PTR (self) = pattern;
927
+ RTYPEDDATA_DATA (self) = pattern;
928
928
  rb_iv_set (self, "@acquire", Qnil);
929
929
  rb_iv_set (self, "@release", Qnil);
930
930
  rb_iv_set (self, "@snapshot", Qnil);
@@ -134,7 +134,7 @@ cr_quartz_surface_initialize (int argc, VALUE *argv, VALUE self)
134
134
  }
135
135
 
136
136
  rb_cairo_surface_check_status (surface);
137
- DATA_PTR (self) = surface;
137
+ RTYPEDDATA_DATA (self) = surface;
138
138
  if (rb_block_given_p ())
139
139
  rb_cairo__surface_yield_and_finish (self);
140
140
  return Qnil;
@@ -169,7 +169,7 @@ cr_quartz_image_surface_initialize (VALUE self, VALUE image_surface)
169
169
 
170
170
  surface = cairo_quartz_image_surface_create (RVAL2CRSURFACE (image_surface));
171
171
  rb_cairo_surface_check_status (surface);
172
- DATA_PTR (self) = surface;
172
+ RTYPEDDATA_DATA (self) = surface;
173
173
  rb_ivar_set (self, cr_id_image_surface, image_surface);
174
174
  if (rb_block_given_p ())
175
175
  rb_cairo__surface_yield_and_finish (self);
@@ -12,7 +12,7 @@
12
12
 
13
13
  VALUE rb_cCairo_Rectangle;
14
14
 
15
- #define _SELF ((cairo_rectangle_int_t *)DATA_PTR (self))
15
+ #define _SELF ((cairo_rectangle_int_t *)RTYPEDDATA_DATA (self))
16
16
 
17
17
  #if CAIRO_CHECK_VERSION(1, 10, 0)
18
18
  static const rb_data_type_t cr_rectangle_type = {
@@ -39,7 +39,7 @@ cr_rectangle_initialize (VALUE self, VALUE x, VALUE y,
39
39
  cairo_rectangle_int_t *rectangle;
40
40
 
41
41
  rectangle = ALLOC (cairo_rectangle_int_t);
42
- DATA_PTR (self) = rectangle;
42
+ RTYPEDDATA_DATA (self) = rectangle;
43
43
 
44
44
  rectangle->x = NUM2INT (x);
45
45
  rectangle->y = NUM2INT (y);
@@ -106,7 +106,7 @@ cr_region_initialize (int argc, VALUE *argv, VALUE self)
106
106
  region = cairo_region_create_rectangles (rectangles, argc);
107
107
  }
108
108
  cr_region_check_status (region);
109
- DATA_PTR (self) = region;
109
+ RTYPEDDATA_DATA (self) = region;
110
110
  return Qnil;
111
111
  }
112
112
 
@@ -87,7 +87,7 @@ cr_scaled_font_initialize (VALUE self, VALUE face, VALUE matrix,
87
87
  RVAL2CRMATRIX (ctm),
88
88
  RVAL2CRFONTOPTIONS (options));
89
89
  cr_scaled_font_check_status (font);
90
- DATA_PTR (self) = font;
90
+ RTYPEDDATA_DATA (self) = font;
91
91
  return Qnil;
92
92
  }
93
93
 
@@ -280,7 +280,7 @@ cr_surface_destroy (VALUE self)
280
280
 
281
281
  surface = _SELF;
282
282
  cr_surface_destroy_raw (surface);
283
- DATA_PTR (self) = NULL;
283
+ RTYPEDDATA_DATA (self) = NULL;
284
284
 
285
285
  return self;
286
286
  }
@@ -534,7 +534,7 @@ cr_surface_finish (VALUE self)
534
534
  cairo_surface_finish (surface);
535
535
  cairo_surface_set_user_data (surface, &cr_finished_key, (void *)CR_TRUE, NULL);
536
536
  cairo_surface_set_user_data (surface, &cr_object_holder_key, NULL, NULL);
537
- DATA_PTR (self) = NULL;
537
+ RTYPEDDATA_DATA (self) = NULL;
538
538
 
539
539
  if (closure && !NIL_P (closure->error))
540
540
  rb_exc_raise (closure->error);
@@ -750,6 +750,11 @@ cr_surface_write_to_png (VALUE self, VALUE filename)
750
750
  static VALUE
751
751
  cr_surface_write_to_png_generic (VALUE self, VALUE target)
752
752
  {
753
+ if (rb_respond_to (target, rb_cairo__io_id_to_path) &&
754
+ !rb_respond_to (target, rb_cairo__io_id_to_io))
755
+ {
756
+ target = rb_funcall (target, rb_cairo__io_id_to_path, 0);
757
+ }
753
758
  if (rb_respond_to (target, rb_cairo__io_id_write))
754
759
  return cr_surface_write_to_png_stream (self, target);
755
760
  else
@@ -1015,7 +1020,7 @@ cr_image_surface_create_from_png_generic (VALUE klass, VALUE target)
1015
1020
 
1016
1021
  rb_cairo_surface_check_status (surface);
1017
1022
  rb_surface = cr_surface_allocate (klass);
1018
- DATA_PTR (rb_surface) = surface;
1023
+ RTYPEDDATA_DATA (rb_surface) = surface;
1019
1024
  return rb_surface;
1020
1025
  }
1021
1026
  #endif
@@ -1072,7 +1077,7 @@ cr_image_surface_initialize (int argc, VALUE *argv, VALUE self)
1072
1077
  rb_cairo__inspect (rb_ary_new3 (4, arg1, arg2, arg3, arg4)));
1073
1078
 
1074
1079
  rb_cairo_surface_check_status (surface);
1075
- DATA_PTR (self) = surface;
1080
+ RTYPEDDATA_DATA (self) = surface;
1076
1081
  rb_cairo_surface_adjust_memory_usage (surface, CR_TRUE);
1077
1082
  if (rb_block_given_p ())
1078
1083
  rb_cairo__surface_yield_and_finish (self);
@@ -1193,7 +1198,7 @@ cr_ ## type ## _surface_initialize (int argc, VALUE *argv, VALUE self) \
1193
1198
  } \
1194
1199
  \
1195
1200
  rb_cairo_surface_check_status (surface); \
1196
- DATA_PTR (self) = surface; \
1201
+ RTYPEDDATA_DATA (self) = surface; \
1197
1202
  if (rb_block_given_p ()) \
1198
1203
  rb_cairo__surface_yield_and_finish (self); \
1199
1204
  return Qnil; \
@@ -1534,7 +1539,7 @@ cr_win32_surface_initialize (int argc, VALUE *argv, VALUE self)
1534
1539
  if (!surface)
1535
1540
  rb_cairo_check_status (CAIRO_STATUS_INVALID_FORMAT);
1536
1541
  rb_cairo_surface_check_status (surface);
1537
- DATA_PTR (self) = surface;
1542
+ RTYPEDDATA_DATA (self) = surface;
1538
1543
  if (rb_block_given_p ())
1539
1544
  rb_cairo__surface_yield_and_finish (self);
1540
1545
  return Qnil;
@@ -1610,7 +1615,7 @@ cr_win32_printing_surface_initialize (VALUE self, VALUE hdc)
1610
1615
 
1611
1616
  surface = cairo_win32_printing_surface_create (NUM2PTR (hdc));
1612
1617
  rb_cairo_surface_check_status (surface);
1613
- DATA_PTR (self) = surface;
1618
+ RTYPEDDATA_DATA (self) = surface;
1614
1619
  if (rb_block_given_p ())
1615
1620
  rb_cairo__surface_yield_and_finish (self);
1616
1621
  return Qnil;
@@ -1665,7 +1670,7 @@ cr_script_surface_initialize (int argc, VALUE *argv, VALUE self)
1665
1670
  surface = cairo_script_surface_create (device, content, width, height);
1666
1671
 
1667
1672
  rb_cairo_surface_check_status (surface);
1668
- DATA_PTR (self) = surface;
1673
+ RTYPEDDATA_DATA (self) = surface;
1669
1674
  if (rb_block_given_p ())
1670
1675
  rb_cairo__surface_yield_and_finish (self);
1671
1676
  return Qnil;
@@ -1720,7 +1725,7 @@ cr_recording_surface_initialize (int argc, VALUE *argv, VALUE self)
1720
1725
 
1721
1726
  surface = cairo_recording_surface_create (content, &extents);
1722
1727
  rb_cairo_surface_check_status (surface);
1723
- DATA_PTR (self) = surface;
1728
+ RTYPEDDATA_DATA (self) = surface;
1724
1729
  if (rb_block_given_p ())
1725
1730
  rb_cairo__surface_yield_and_finish (self);
1726
1731
  return Qnil;
@@ -1797,7 +1802,7 @@ cr_gl_surface_initialize (int argc, VALUE *argv, VALUE self)
1797
1802
  surface = cairo_gl_surface_create (device, content, width, height);
1798
1803
 
1799
1804
  rb_cairo_surface_check_status (surface);
1800
- DATA_PTR (self) = surface;
1805
+ RTYPEDDATA_DATA (self) = surface;
1801
1806
  if (rb_block_given_p ())
1802
1807
  rb_cairo__surface_yield_and_finish (self);
1803
1808
  return Qnil;
@@ -1844,7 +1849,7 @@ cr_gl_texture_surface_initialize (int argc, VALUE *argv, VALUE self)
1844
1849
  height);
1845
1850
 
1846
1851
  rb_cairo_surface_check_status (surface);
1847
- DATA_PTR (self) = surface;
1852
+ RTYPEDDATA_DATA (self) = surface;
1848
1853
  if (rb_block_given_p ())
1849
1854
  rb_cairo__surface_yield_and_finish (self);
1850
1855
  return Qnil;
@@ -1894,7 +1899,7 @@ cr_tee_surface_initialize (VALUE self, VALUE master)
1894
1899
 
1895
1900
  surface = cairo_tee_surface_create (RVAL2CRSURFACE (master));
1896
1901
  rb_cairo_surface_check_status (surface);
1897
- DATA_PTR (self) = surface;
1902
+ RTYPEDDATA_DATA (self) = surface;
1898
1903
  rb_iv_set (self, "surfaces", rb_ary_new3 (1, master));
1899
1904
  if (rb_block_given_p ())
1900
1905
  rb_cairo__surface_yield_and_finish (self);
@@ -2016,7 +2021,7 @@ cr_xml_surface_initialize (int argc, VALUE *argv, VALUE self)
2016
2021
  surface = cairo_xml_surface_create (device, content, width, height);
2017
2022
 
2018
2023
  rb_cairo_surface_check_status (surface);
2019
- DATA_PTR (self) = surface;
2024
+ RTYPEDDATA_DATA (self) = surface;
2020
2025
  if (rb_block_given_p ())
2021
2026
  rb_cairo__surface_yield_and_finish (self);
2022
2027
  return Qnil;
@@ -81,7 +81,7 @@ cr_text_cluster_initialize (VALUE self, VALUE num_bytes, VALUE num_glyphs)
81
81
  cluster->num_bytes = NUM2INT (num_bytes);
82
82
  cluster->num_glyphs = NUM2INT (num_glyphs);
83
83
 
84
- DATA_PTR (self) = cluster;
84
+ RTYPEDDATA_DATA (self) = cluster;
85
85
  return Qnil;
86
86
  }
87
87
 
@@ -82,7 +82,7 @@ cr_text_extents_initialize (VALUE self)
82
82
  extents->x_advance = 1.0;
83
83
  extents->y_advance = 0.0;
84
84
 
85
- DATA_PTR (self) = extents;
85
+ RTYPEDDATA_DATA (self) = extents;
86
86
 
87
87
  return Qnil;
88
88
  }
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.17.7
4
+ version: 1.17.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-31 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: native-package-installer
@@ -219,7 +219,7 @@ metadata:
219
219
  mailing_list_uri: https://cairographics.org/cgi-bin/mailman/listinfo/cairo
220
220
  source_code_uri: https://github.com/rcairo/rcairo
221
221
  msys2_mingw_dependencies: cairo
222
- post_install_message:
222
+ post_install_message:
223
223
  rdoc_options: []
224
224
  require_paths:
225
225
  - lib
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  requirements:
237
237
  - cairo >= 1.2.0
238
238
  rubygems_version: 3.4.0.dev
239
- signing_key:
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: Ruby bindings for cairo
242
242
  test_files: