cairo 1.17.8 → 1.17.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dffa934fa956305e9ed3ba9a9a5c92956c61c09277ea1723ceb69c1bee1b5c72
4
- data.tar.gz: c4a6b1aa7bc5e3e00ca1bb388272d75c726fb20a1366dcbc2f15513d06177cbd
3
+ metadata.gz: 05f4568d5884a55b9ec5f2490536c75737a5513ee52db87d6a1847bccb233499
4
+ data.tar.gz: cf202c94b822be61b2d77fcbdf49a566022038ac23447a3f4cd8780cd5fe4de3
5
5
  SHA512:
6
- metadata.gz: 163b19b0d0fdbfadd8117629b95fbd51f97a84617bc77366eb5083b4e631bc3eb863c1daa51ce6e79fd0cfbe462f69215b6bc3548c9a3960e95861c799f53515
7
- data.tar.gz: c266cd0dc3e254bccecae19b9f8dfb688c55404cd348446d2e34d67d263e07b1244851292aa1d8c1140e30bfa8162af1135855b99eb1da7af54c9d67d77aefba
6
+ metadata.gz: 569e8766de9065d5887b3de6bfe01b23fdf97f9865b392e85312a7e9e2015a7f0dfccef6ab91dccdc1cc91b48534437c3d61b927b4d799098975b0bc6fdcaa70
7
+ data.tar.gz: dcc158f18e380017c86d15dc94c66c0d45beb1463937f10366daf017913c1dbdcba82972efd1a76ac981ffc001328103364011816adf5c1e52cc0f8675531bdb
data/NEWS CHANGED
@@ -1,3 +1,48 @@
1
+ Release 1.17.9 (2023-06-14) Sutou Kouhei <kou@cozmixng.org>
2
+ ===========================================================
3
+
4
+ Improvements
5
+ ------------
6
+
7
+ * Dropped support for fat gem.
8
+ [GH-78][https://github.com/rcairo/rcairo/issues/78]
9
+ [Reported by Largo]
10
+
11
+ * Added support for auto native package installation with conda.
12
+
13
+ * Added support for cairo 1.17.8:
14
+
15
+ * Added Cairo::SVGFontError.
16
+
17
+ * Added Cairo::ColorMode.
18
+
19
+ * Added Cairo::FontOptions#color_mode.
20
+
21
+ * Added Cairo::FontOptions#color_mode=.
22
+
23
+ * Added Cairo::ColorPalette.
24
+
25
+ * Added Cairo::FontOptions#color_palette.
26
+
27
+ * Added Cairo::FontOptions#color_palette=.
28
+
29
+ * Added Cairo::FontOptions#set_custom_palette_color.
30
+
31
+ Fixes
32
+ -----
33
+
34
+ * Fixed the number of arguments of Cairo::GLSurface#initialize and
35
+ Cairo::GLTextureSurface#initialize.
36
+ [GH-79][https://github.com/rcairo/rcairo/issues/79]
37
+ [Patch by Dimitry Andric]
38
+
39
+ Thanks
40
+ ------
41
+
42
+ * Largo
43
+
44
+ * Dimitry Andric
45
+
1
46
  Release 1.17.8 (2022-09-01) Sutou Kouhei <kou@cozmixng.org>
2
47
  ===========================================================
3
48
 
data/ext/cairo/extconf.rb CHANGED
@@ -49,6 +49,7 @@ end
49
49
 
50
50
  unless required_pkg_config_package([package, major, minor, micro],
51
51
  :arch_linux => "cairo",
52
+ :conda => "cairo",
52
53
  :debian => "libcairo2-dev",
53
54
  :homebrew => "cairo",
54
55
  :macports => "cairo",
data/ext/cairo/rb_cairo.h CHANGED
@@ -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 8
68
+ #define RB_CAIRO_VERSION_MICRO 9
69
69
 
70
70
  RB_CAIRO_VAR VALUE rb_mCairo;
71
71
  RB_CAIRO_VAR VALUE rb_cCairo_Context;
@@ -136,6 +136,8 @@ RB_CAIRO_VAR VALUE rb_mCairo_FontWeight;
136
136
  RB_CAIRO_VAR VALUE rb_mCairo_SubpixelOrder;
137
137
  RB_CAIRO_VAR VALUE rb_mCairo_HintStyle;
138
138
  RB_CAIRO_VAR VALUE rb_mCairo_HintMetrics;
139
+ RB_CAIRO_VAR VALUE rb_mCairo_ColorMode;
140
+ RB_CAIRO_VAR VALUE rb_mCairo_ColorPalette;
139
141
  RB_CAIRO_VAR VALUE rb_mCairo_FontType;
140
142
  RB_CAIRO_VAR VALUE rb_mCairo_PathDataType;
141
143
  RB_CAIRO_VAR VALUE rb_mCairo_Content;
@@ -266,6 +268,9 @@ VALUE rb_cairo_device_to_ruby_object (cairo_device_t *de
266
268
  #define RVAL2CRSUBPIXELORDER(obj) (rb_cairo_subpixel_order_from_ruby_object(obj))
267
269
  #define RVAL2CRHINTSTYLE(obj) (rb_cairo_hint_style_from_ruby_object(obj))
268
270
  #define RVAL2CRHINTMETRICS(obj) (rb_cairo_hint_metrics_from_ruby_object(obj))
271
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
272
+ #define RVAL2CRCOLORMODE(obj) (rb_cairo_color_mode_from_ruby_object(obj))
273
+ #endif
269
274
  #define RVAL2CRPATHDATATYPE(obj) (rb_cairo_path_data_type_from_ruby_object(obj))
270
275
  #define RVAL2CRCONTENT(obj) (rb_cairo_content_from_ruby_object(obj))
271
276
  #define RVAL2CRFORMAT(obj) (rb_cairo_format_from_ruby_object(obj))
@@ -311,6 +316,9 @@ cairo_font_weight_t rb_cairo_font_weight_from_ruby_object (VALUE obj);
311
316
  cairo_subpixel_order_t rb_cairo_subpixel_order_from_ruby_object (VALUE obj);
312
317
  cairo_hint_style_t rb_cairo_hint_style_from_ruby_object (VALUE obj);
313
318
  cairo_hint_metrics_t rb_cairo_hint_metrics_from_ruby_object (VALUE obj);
319
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
320
+ cairo_color_mode_t rb_cairo_color_mode_from_ruby_object (VALUE obj);
321
+ #endif
314
322
  cairo_path_data_type_t rb_cairo_path_data_type_from_ruby_object (VALUE obj);
315
323
  cairo_content_t rb_cairo_content_from_ruby_object (VALUE obj);
316
324
  cairo_format_t rb_cairo_format_from_ruby_object (VALUE obj);
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-19 12:56:27 $
7
7
  *
8
- * Copyright 2005-2022 Sutou Kouhei <kou@cozmixng.org>
8
+ * Copyright 2005-2023 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
  *
@@ -27,6 +27,8 @@ VALUE rb_mCairo_FontWeight;
27
27
  VALUE rb_mCairo_SubpixelOrder;
28
28
  VALUE rb_mCairo_HintStyle;
29
29
  VALUE rb_mCairo_HintMetrics;
30
+ VALUE rb_mCairo_ColorMode;
31
+ VALUE rb_mCairo_ColorPalette;
30
32
  VALUE rb_mCairo_PathDataType;
31
33
  VALUE rb_mCairo_Content;
32
34
  VALUE rb_mCairo_Format;
@@ -81,6 +83,9 @@ VALUE rb_mCairo_SVGUnit = Qnil;
81
83
  #define CAIRO_HINT_METRICS_MIN CAIRO_HINT_METRICS_DEFAULT
82
84
  #define CAIRO_HINT_METRICS_MAX CAIRO_HINT_METRICS_ON
83
85
 
86
+ #define CAIRO_COLOR_MODE_MIN CAIRO_COLOR_MODE_DEFAULT
87
+ #define CAIRO_COLOR_MODE_MAX CAIRO_COLOR_MODE_COLOR
88
+
84
89
  #define CAIRO_PATH_MIN CAIRO_PATH_MOVE_TO
85
90
  #define CAIRO_PATH_MAX CAIRO_PATH_CLOSE_PATH
86
91
 
@@ -182,6 +187,9 @@ DEFINE_RVAL2ENUM(font_weight, FONT_WEIGHT)
182
187
  DEFINE_RVAL2ENUM(subpixel_order, SUBPIXEL_ORDER)
183
188
  DEFINE_RVAL2ENUM(hint_style, HINT_STYLE)
184
189
  DEFINE_RVAL2ENUM(hint_metrics, HINT_METRICS)
190
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
191
+ DEFINE_RVAL2ENUM(color_mode, COLOR_MODE)
192
+ #endif
185
193
  DEFINE_RVAL2ENUM(path_data_type, PATH)
186
194
  DEFINE_RVAL2ENUM(content, CONTENT)
187
195
  DEFINE_RVAL2ENUM(format, FORMAT)
@@ -529,6 +537,20 @@ Init_cairo_constants (void)
529
537
  rb_define_const (rb_mCairo_HintMetrics, "OFF",
530
538
  INT2FIX (CAIRO_HINT_METRICS_OFF));
531
539
 
540
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
541
+ /* cairo_color_mode_t */
542
+ rb_mCairo_ColorMode = rb_define_module_under (rb_mCairo, "ColorMode");
543
+ rb_define_const (rb_mCairo_ColorMode, "DEFAULT",
544
+ INT2FIX (CAIRO_COLOR_MODE_DEFAULT));
545
+ rb_define_const (rb_mCairo_ColorMode, "NO_COLOR",
546
+ INT2FIX (CAIRO_COLOR_MODE_NO_COLOR));
547
+ rb_define_const (rb_mCairo_ColorMode, "COLOR",
548
+ INT2FIX (CAIRO_COLOR_MODE_COLOR));
549
+
550
+ rb_mCairo_ColorPalette = rb_define_module_under (rb_mCairo, "ColorPalette");
551
+ rb_define_const (rb_mCairo_ColorPalette, "DEFAULT",
552
+ INT2FIX (CAIRO_COLOR_PALETTE_DEFAULT));
553
+ #endif
532
554
 
533
555
  /* cairo_path_data_type_t */
534
556
  rb_mCairo_PathDataType = rb_define_module_under (rb_mCairo, "PathDataType");
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-08-16 12:52:16 $
7
7
  *
8
- * Copyright 2010-2022 Sutou Kouhei <kou@cozmixng.org>
8
+ * Copyright 2010-2023 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
  *
@@ -74,6 +74,9 @@ static VALUE rb_eCairo_TagError;
74
74
  #if CAIRO_CHECK_VERSION(1, 17, 6)
75
75
  static VALUE rb_eCairo_DirectWriteError;
76
76
  #endif
77
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
78
+ static VALUE rb_eCairo_SVGFontError;
79
+ #endif
77
80
 
78
81
  void
79
82
  rb_cairo_check_status (cairo_status_t status)
@@ -229,6 +232,11 @@ rb_cairo_check_status (cairo_status_t status)
229
232
  rb_raise (rb_eCairo_DirectWriteError, "%s", string);
230
233
  break;
231
234
  #endif
235
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
236
+ case CAIRO_STATUS_SVG_FONT_ERROR:
237
+ rb_raise (rb_eCairo_SVGFontError, "%s", string);
238
+ break;
239
+ #endif
232
240
  #if CAIRO_CHECK_VERSION(1, 10, 0)
233
241
  case CAIRO_STATUS_LAST_STATUS:
234
242
  #else
@@ -340,6 +348,10 @@ rb_cairo__exception_to_status (VALUE exception)
340
348
  else if (rb_cairo__is_kind_of (exception, rb_eCairo_DirectWriteError))
341
349
  return CAIRO_STATUS_DWRITE_ERROR;
342
350
  #endif
351
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
352
+ else if (rb_cairo__is_kind_of (exception, rb_eCairo_SVGFontError))
353
+ return CAIRO_STATUS_SVG_FONT_ERROR;
354
+ #endif
343
355
 
344
356
  return -1;
345
357
  }
@@ -506,4 +518,10 @@ Init_cairo_exception (void)
506
518
  rb_define_class_under (rb_mCairo, "DirectWriteError",
507
519
  rb_eCairo_Error);
508
520
  #endif
521
+
522
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
523
+ rb_eCairo_SVGFontError =
524
+ rb_define_class_under (rb_mCairo, "SVGFontError",
525
+ rb_eCairo_Error);
526
+ #endif
509
527
  }
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-19 12:56:27 $
7
7
  *
8
- * Copyright 2005-2022 Sutou Kouhei <kou@cozmixng.org>
8
+ * Copyright 2005-2023 Sutou Kouhei <kou@cozmixng.org>
9
9
  *
10
10
  * This file is made available under the same terms as Ruby
11
11
  *
@@ -196,6 +196,53 @@ cr_options_get_variations (VALUE self)
196
196
  }
197
197
  #endif
198
198
 
199
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
200
+ static VALUE
201
+ cr_options_set_color_mode (VALUE self, VALUE mode)
202
+ {
203
+ cairo_font_options_set_color_mode (_SELF (self),
204
+ RVAL2CRCOLORMODE (mode));
205
+ return self;
206
+ }
207
+
208
+ static VALUE
209
+ cr_options_get_color_mode (VALUE self)
210
+ {
211
+ return INT2NUM (cairo_font_options_get_color_mode (_SELF (self)));
212
+ }
213
+
214
+ static VALUE
215
+ cr_options_set_color_palette (VALUE self, VALUE index)
216
+ {
217
+ cairo_font_options_set_color_palette (_SELF (self),
218
+ NUM2UINT (index));
219
+ return self;
220
+ }
221
+
222
+ static VALUE
223
+ cr_options_get_color_palette (VALUE self)
224
+ {
225
+ return UINT2NUM (cairo_font_options_get_color_palette (_SELF (self)));
226
+ }
227
+
228
+ static VALUE
229
+ cr_options_set_custom_palette_color (VALUE self,
230
+ VALUE index,
231
+ VALUE red,
232
+ VALUE green,
233
+ VALUE blue,
234
+ VALUE alpha)
235
+ {
236
+ cairo_font_options_set_custom_palette_color (_SELF (self),
237
+ NUM2UINT (index),
238
+ NUM2DBL (red),
239
+ NUM2DBL (green),
240
+ NUM2DBL (blue),
241
+ NUM2DBL (alpha));
242
+ return self;
243
+ }
244
+ #endif
245
+
199
246
  void
200
247
  Init_cairo_font_options (void)
201
248
  {
@@ -234,6 +281,18 @@ Init_cairo_font_options (void)
234
281
  rb_define_method (rb_cCairo_FontOptions, "variations",
235
282
  cr_options_get_variations, 0);
236
283
  #endif
284
+ #if CAIRO_CHECK_VERSION(1, 17, 8)
285
+ rb_define_method (rb_cCairo_FontOptions, "set_color_mode",
286
+ cr_options_set_color_mode, 1);
287
+ rb_define_method (rb_cCairo_FontOptions, "color_mode",
288
+ cr_options_get_color_mode, 0);
289
+ rb_define_method (rb_cCairo_FontOptions, "set_color_palette",
290
+ cr_options_set_color_palette, 1);
291
+ rb_define_method (rb_cCairo_FontOptions, "color_palette",
292
+ cr_options_get_color_palette, 0);
293
+ rb_define_method (rb_cCairo_FontOptions, "set_custom_palette_color",
294
+ cr_options_set_custom_palette_color, 5);
295
+ #endif
237
296
 
238
297
  RB_CAIRO_DEF_SETTERS (rb_cCairo_FontOptions);
239
298
  }
@@ -2352,7 +2352,7 @@ Init_cairo_surface (void)
2352
2352
  rb_define_class_under (rb_mCairo, "GLTextureSurface", rb_cCairo_GLSurface);
2353
2353
  #ifdef RB_CAIRO_HAS_GL_SURFACE
2354
2354
  rb_define_method (rb_cCairo_GLSurface, "initialize",
2355
- cr_gl_surface_initialize, 1);
2355
+ cr_gl_surface_initialize, -1);
2356
2356
 
2357
2357
  rb_define_method (rb_cCairo_GLSurface, "set_size",
2358
2358
  cr_gl_surface_set_size, 2);
@@ -2366,7 +2366,7 @@ Init_cairo_surface (void)
2366
2366
  RB_CAIRO_DEF_SETTERS (rb_cCairo_GLSurface);
2367
2367
 
2368
2368
  rb_define_method (rb_cCairo_GLTextureSurface, "initialize",
2369
- cr_gl_texture_surface_initialize, 1);
2369
+ cr_gl_texture_surface_initialize, -1);
2370
2370
 
2371
2371
  RB_CAIRO_DEF_SETTERS (rb_cCairo_GLTextureSurface);
2372
2372
  #endif
data/lib/cairo.rb CHANGED
@@ -1,28 +1,3 @@
1
- # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
2
-
3
- if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
4
- require "pathname"
5
- base_dir = Pathname(File.dirname(__FILE__))
6
- base_dir = base_dir.parent + "vendor" + "local"
7
- if base_dir.exist?
8
- base_dir = base_dir.to_s.gsub(/\//, "\\")
9
- begin
10
- require "ruby_installer/runtime"
11
- rescue LoadError
12
- else
13
- RubyInstaller::Runtime.add_dll_directory("#{base_dir}\\bin")
14
- end
15
- ENV["PATH"] = %w(bin lib).collect do |dir|
16
- "#{base_dir}\\#{dir};"
17
- end.join("") + ENV["PATH"]
18
- else
19
- require "rbconfig"
20
- ENV["PATH"] = %w(bin lib).collect do |dir|
21
- "#{RbConfig::CONFIG["prefix"]}\\lib\\GTK\\#{dir};"
22
- end.join("") + ENV["PATH"]
23
- end
24
- end
25
-
26
1
  require "time"
27
2
 
28
3
  module Cairo
@@ -46,13 +21,7 @@ end
46
21
 
47
22
  require "cairo/color"
48
23
  require "cairo/paper"
49
-
50
- begin
51
- major, minor, _ = RUBY_VERSION.split(/\./)
52
- require "#{major}.#{minor}/cairo.so"
53
- rescue LoadError
54
- require "cairo.so"
55
- end
24
+ require "cairo.so"
56
25
  require "cairo/constants"
57
26
 
58
27
  module Cairo
@@ -24,4 +24,16 @@ class ConstantsTest < Test::Unit::TestCase
24
24
  send(assertion, Cairo::MimeType, :JBIG2_GLOBAL)
25
25
  send(assertion, Cairo::MimeType, :JBIG2_GLOBAL_ID)
26
26
  end
27
+
28
+ def test_new_constants_since_1_17_8
29
+ if Cairo.satisfied_version?(1, 17, 8)
30
+ assert_const_defined(Cairo::ColorMode, :DEFAULT)
31
+ assert_const_defined(Cairo::ColorMode, :COLOR)
32
+ assert_const_defined(Cairo::ColorMode, :NO_COLOR)
33
+ assert_const_defined(Cairo::ColorPalette, :DEFAULT)
34
+ else
35
+ assert_not_const_defined(Cairo, :ColorMode)
36
+ assert_not_const_defined(Cairo, :ColorPalette)
37
+ end
38
+ end
27
39
  end
data/test/test_context.rb CHANGED
@@ -105,6 +105,7 @@ class ContextTest < Test::Unit::TestCase
105
105
  sub_test_case("#tag") do
106
106
  setup do
107
107
  only_cairo_version(1, 15, 4)
108
+ only_not_windows
108
109
  end
109
110
 
110
111
  test("LINK") do
@@ -62,4 +62,23 @@ class FontOptionsTest < Test::Unit::TestCase
62
62
  @options.variations = "wdth=200"
63
63
  assert_equal("wdth=200", @options.variations)
64
64
  end
65
+
66
+ test "color mode" do
67
+ only_cairo_version(1, 17, 8)
68
+ assert_equal(Cairo::ColorMode::DEFAULT, @options.color_mode)
69
+ @options.color_mode = Cairo::ColorMode::COLOR
70
+ assert_equal(Cairo::ColorMode::COLOR, @options.color_mode)
71
+ end
72
+
73
+ test "color palette" do
74
+ only_cairo_version(1, 17, 8)
75
+ assert_equal(Cairo::ColorPalette::DEFAULT, @options.color_palette)
76
+ @options.set_custom_palette_color(1,
77
+ 1.0,
78
+ 0.2,
79
+ 0.0,
80
+ 0.8)
81
+ @options.color_palette = 1
82
+ assert_equal(1, @options.color_palette)
83
+ end
65
84
  end
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.8
4
+ version: 1.17.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-01 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: native-package-installer
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  requirements:
237
237
  - cairo >= 1.2.0
238
- rubygems_version: 3.4.0.dev
238
+ rubygems_version: 3.5.0.dev
239
239
  signing_key:
240
240
  specification_version: 4
241
241
  summary: Ruby bindings for cairo