rmagick 4.2.5 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +14 -0
  3. data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
  4. data/.devcontainer/devcontainer.json +11 -0
  5. data/.devcontainer/setup-repo.sh +10 -0
  6. data/.devcontainer/setup-user.sh +45 -0
  7. data/.editorconfig +1 -1
  8. data/.github/workflows/ci.yml +90 -9
  9. data/.gitignore +4 -0
  10. data/.rubocop_todo.yml +16 -9
  11. data/.yardopts +1 -1
  12. data/CHANGELOG.md +141 -0
  13. data/Gemfile +20 -0
  14. data/README.md +12 -17
  15. data/Rakefile +63 -80
  16. data/before_install_linux.sh +4 -4
  17. data/before_install_osx.sh +7 -6
  18. data/ext/RMagick/extconf.rb +113 -52
  19. data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
  20. data/ext/RMagick/rmagick.h +88 -59
  21. data/ext/RMagick/rmagick_gvl.h +224 -0
  22. data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +170 -159
  23. data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
  24. data/ext/RMagick/{rmfill.c → rmfill.cpp} +85 -24
  25. data/ext/RMagick/{rmilist.c → rmilist.cpp} +191 -93
  26. data/ext/RMagick/{rmimage.c → rmimage.cpp} +1544 -989
  27. data/ext/RMagick/{rminfo.c → rminfo.cpp} +140 -152
  28. data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +46 -34
  29. data/ext/RMagick/rmmain.cpp +1923 -0
  30. data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +50 -29
  31. data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +108 -83
  32. data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +6 -6
  33. data/ext/RMagick/{rmutil.c → rmutil.cpp} +62 -161
  34. data/lib/rmagick/version.rb +3 -1
  35. data/lib/rmagick.rb +2 -0
  36. data/lib/rmagick_internal.rb +76 -110
  37. data/lib/rvg/embellishable.rb +6 -2
  38. data/lib/rvg/misc.rb +7 -7
  39. data/lib/rvg/rvg.rb +2 -0
  40. data/lib/rvg/stretchable.rb +2 -2
  41. data/lib/rvg/transformable.rb +1 -1
  42. data/rmagick.gemspec +6 -17
  43. data/sig/rmagick/_draw_common_methods.rbs +64 -0
  44. data/sig/rmagick/_image_common_methods.rbs +389 -0
  45. data/sig/rmagick/draw.rbs +38 -0
  46. data/sig/rmagick/draw_attribute.rbs +28 -0
  47. data/sig/rmagick/enum.rbs +814 -0
  48. data/sig/rmagick/error.rbs +11 -0
  49. data/sig/rmagick/fill.rbs +21 -0
  50. data/sig/rmagick/geometry.rbs +14 -0
  51. data/sig/rmagick/image.rbs +194 -0
  52. data/sig/rmagick/image_list.rbs +181 -0
  53. data/sig/rmagick/iptc.rbs +101 -0
  54. data/sig/rmagick/kernel_info.rbs +12 -0
  55. data/sig/rmagick/optional_method_arguments.rbs +10 -0
  56. data/sig/rmagick/pixel.rbs +46 -0
  57. data/sig/rmagick/struct.rbs +90 -0
  58. data/sig/rmagick.rbs +43 -0
  59. data/sig/rvg/clippath.rbs +34 -0
  60. data/sig/rvg/container.rbs +78 -0
  61. data/sig/rvg/deep_equal.rbs +48 -0
  62. data/sig/rvg/describable.rbs +30 -0
  63. data/sig/rvg/embellishable.rbs +226 -0
  64. data/sig/rvg/misc.rbs +145 -0
  65. data/sig/rvg/paint.rbs +55 -0
  66. data/sig/rvg/pathdata.rbs +77 -0
  67. data/sig/rvg/rvg.rbs +125 -0
  68. data/sig/rvg/stretchable.rbs +56 -0
  69. data/sig/rvg/stylable.rbs +66 -0
  70. data/sig/rvg/text.rbs +118 -0
  71. data/sig/rvg/transformable.rbs +59 -0
  72. data/sig/rvg/units.rbs +33 -0
  73. metadata +63 -128
  74. data/.codeclimate.yml +0 -63
  75. data/deprecated/RMagick.rb +0 -6
  76. data/ext/RMagick/rmmain.c +0 -1951
@@ -5,15 +5,22 @@
5
5
  *
6
6
  * Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
7
7
  *
8
- * @file rmmontage.c
9
- * @version $Id: rmmontage.c,v 1.5 2009/12/20 02:33:33 baror Exp $
8
+ * @file rmmontage.cpp
9
+ * @version $Id: rmmontage.cpp,v 1.5 2009/12/20 02:33:33 baror Exp $
10
10
  * @author Tim Hunter
11
11
  ******************************************************************************/
12
12
 
13
13
  #include "rmagick.h"
14
14
 
15
+ static void Montage_destroy(void *obj);
16
+ static size_t Montage_memsize(const void *obj);
15
17
 
16
-
18
+ const rb_data_type_t rm_montage_data_type = {
19
+ "Magick::ImageList::Montage",
20
+ { NULL, Montage_destroy, Montage_memsize, },
21
+ 0, 0,
22
+ RUBY_TYPED_FROZEN_SHAREABLE,
23
+ };
17
24
 
18
25
 
19
26
  /**
@@ -28,9 +35,9 @@
28
35
  * @param obj the montage object
29
36
  */
30
37
  static void
31
- destroy_Montage(void *obj)
38
+ Montage_destroy(void *obj)
32
39
  {
33
- Montage *montage = obj;
40
+ Montage *montage = (Montage *)obj;
34
41
 
35
42
  // If we saved a temporary texture image, delete it now.
36
43
  if (montage->info && montage->info->texture != NULL)
@@ -48,13 +55,27 @@ destroy_Montage(void *obj)
48
55
  }
49
56
 
50
57
 
58
+ /**
59
+ * Get Montage object size.
60
+ *
61
+ * No Ruby usage (internal function)
62
+ *
63
+ * @param ptr pointer to the Montage object
64
+ */
65
+ static size_t
66
+ Montage_memsize(const void *ptr)
67
+ {
68
+ return sizeof(Montage);
69
+ }
70
+
71
+
51
72
  /**
52
73
  * Create a new Montage object.
53
74
  *
54
75
  * @return [Magick::ImageList::Montage] a new Montage object
55
76
  */
56
77
  VALUE
57
- Montage_alloc(VALUE class)
78
+ Montage_alloc(VALUE klass)
58
79
  {
59
80
  MontageInfo *montage_info;
60
81
  Montage *montage;
@@ -79,7 +100,7 @@ Montage_alloc(VALUE class)
79
100
  montage = ALLOC(Montage);
80
101
  montage->info = montage_info;
81
102
  montage->compose = OverCompositeOp;
82
- montage_obj = Data_Wrap_Struct(class, NULL, destroy_Montage, montage);
103
+ montage_obj = TypedData_Wrap_Struct(klass, &rm_montage_data_type, montage);
83
104
 
84
105
  RB_GC_GUARD(montage_obj);
85
106
 
@@ -98,7 +119,7 @@ Montage_background_color_eq(VALUE self, VALUE color)
98
119
  {
99
120
  Montage *montage;
100
121
 
101
- Data_Get_Struct(self, Montage, montage);
122
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
102
123
  Color_to_PixelColor(&montage->info->background_color, color);
103
124
  return color;
104
125
  }
@@ -115,7 +136,7 @@ Montage_border_color_eq(VALUE self, VALUE color)
115
136
  {
116
137
  Montage *montage;
117
138
 
118
- Data_Get_Struct(self, Montage, montage);
139
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
119
140
  Color_to_PixelColor(&montage->info->border_color, color);
120
141
  return color;
121
142
  }
@@ -132,7 +153,7 @@ Montage_border_width_eq(VALUE self, VALUE width)
132
153
  {
133
154
  Montage *montage;
134
155
 
135
- Data_Get_Struct(self, Montage, montage);
156
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
136
157
  montage->info->border_width = NUM2ULONG(width);
137
158
  return width;
138
159
  }
@@ -149,7 +170,7 @@ Montage_compose_eq(VALUE self, VALUE compose)
149
170
  {
150
171
  Montage *montage;
151
172
 
152
- Data_Get_Struct(self, Montage, montage);
173
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
153
174
  VALUE_TO_ENUM(compose, montage->compose, CompositeOperator);
154
175
  return compose;
155
176
  }
@@ -166,7 +187,7 @@ Montage_filename_eq(VALUE self, VALUE filename)
166
187
  {
167
188
  Montage *montage;
168
189
 
169
- Data_Get_Struct(self, Montage, montage);
190
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
170
191
  strlcpy(montage->info->filename, StringValueCStr(filename), sizeof(montage->info->filename));
171
192
  return filename;
172
193
  }
@@ -183,7 +204,7 @@ Montage_fill_eq(VALUE self, VALUE color)
183
204
  {
184
205
  Montage *montage;
185
206
 
186
- Data_Get_Struct(self, Montage, montage);
207
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
187
208
  Color_to_PixelColor(&montage->info->fill, color);
188
209
  return color;
189
210
  }
@@ -200,7 +221,7 @@ Montage_font_eq(VALUE self, VALUE font)
200
221
  {
201
222
  Montage *montage;
202
223
 
203
- Data_Get_Struct(self, Montage, montage);
224
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
204
225
  magick_clone_string(&montage->info->font, StringValueCStr(font));
205
226
 
206
227
  return font;
@@ -214,7 +235,7 @@ Montage_font_eq(VALUE self, VALUE font)
214
235
  * <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
215
236
  * or a Geometry object
216
237
  *
217
- * @param frame_arg [String] the frame geometry
238
+ * @param frame_arg [Magick::Geometry, String] the frame geometry
218
239
  * @see https://www.imagemagick.org/Magick++/Geometry.html
219
240
  */
220
241
  VALUE
@@ -223,7 +244,7 @@ Montage_frame_eq(VALUE self, VALUE frame_arg)
223
244
  Montage *montage;
224
245
  VALUE frame;
225
246
 
226
- Data_Get_Struct(self, Montage, montage);
247
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
227
248
  frame = rb_String(frame_arg);
228
249
  magick_clone_string(&montage->info->frame, StringValueCStr(frame));
229
250
 
@@ -240,8 +261,8 @@ Montage_frame_eq(VALUE self, VALUE frame_arg)
240
261
  * <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
241
262
  * or a Geometry object
242
263
  *
243
- * @param geometry_arg [String] the geometry
244
- * @return [String] the given geometry
264
+ * @param geometry_arg [Magick::Geometry, String] the geometry
265
+ * @return [Magick::Geometry, String] the given geometry
245
266
  * @see https://www.imagemagick.org/Magick++/Geometry.html
246
267
  */
247
268
  VALUE
@@ -250,7 +271,7 @@ Montage_geometry_eq(VALUE self, VALUE geometry_arg)
250
271
  Montage *montage;
251
272
  VALUE geometry;
252
273
 
253
- Data_Get_Struct(self, Montage, montage);
274
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
254
275
  geometry = rb_String(geometry_arg);
255
276
  magick_clone_string(&montage->info->geometry, StringValueCStr(geometry));
256
277
 
@@ -271,7 +292,7 @@ Montage_gravity_eq(VALUE self, VALUE gravity)
271
292
  {
272
293
  Montage *montage;
273
294
 
274
- Data_Get_Struct(self, Montage, montage);
295
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
275
296
  VALUE_TO_ENUM(gravity, montage->info->gravity, GravityType);
276
297
  return gravity;
277
298
  }
@@ -301,7 +322,7 @@ Montage_matte_color_eq(VALUE self, VALUE color)
301
322
  {
302
323
  Montage *montage;
303
324
 
304
- Data_Get_Struct(self, Montage, montage);
325
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
305
326
  Color_to_PixelColor(&montage->info->matte_color, color);
306
327
  return color;
307
328
  }
@@ -318,7 +339,7 @@ Montage_pointsize_eq(VALUE self, VALUE size)
318
339
  {
319
340
  Montage *montage;
320
341
 
321
- Data_Get_Struct(self, Montage, montage);
342
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
322
343
  montage->info->pointsize = NUM2DBL(size);
323
344
  return size;
324
345
  }
@@ -335,7 +356,7 @@ Montage_shadow_eq(VALUE self, VALUE shadow)
335
356
  {
336
357
  Montage *montage;
337
358
 
338
- Data_Get_Struct(self, Montage, montage);
359
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
339
360
  montage->info->shadow = (MagickBooleanType) RTEST(shadow);
340
361
  return shadow;
341
362
  }
@@ -352,7 +373,7 @@ Montage_stroke_eq(VALUE self, VALUE color)
352
373
  {
353
374
  Montage *montage;
354
375
 
355
- Data_Get_Struct(self, Montage, montage);
376
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
356
377
  Color_to_PixelColor(&montage->info->stroke, color);
357
378
  return color;
358
379
  }
@@ -372,7 +393,7 @@ Montage_texture_eq(VALUE self, VALUE texture)
372
393
  Image *texture_image;
373
394
  char temp_name[MaxTextExtent];
374
395
 
375
- Data_Get_Struct(self, Montage, montage);
396
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
376
397
 
377
398
  // If we had a previously defined temp texture image,
378
399
  // remove it now in preparation for this new one.
@@ -401,8 +422,8 @@ Montage_texture_eq(VALUE self, VALUE texture)
401
422
  * <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
402
423
  * or a Geometry object
403
424
  *
404
- * @param tile_arg [String] the tile geometry
405
- * @return [String] the given tile geometry
425
+ * @param tile_arg [Magick::Geometry, String] the tile geometry
426
+ * @return [Magick::Geometry, String] the given tile geometry
406
427
  * @see https://www.imagemagick.org/Magick++/Geometry.html
407
428
  */
408
429
  VALUE
@@ -411,7 +432,7 @@ Montage_tile_eq(VALUE self, VALUE tile_arg)
411
432
  Montage *montage;
412
433
  VALUE tile;
413
434
 
414
- Data_Get_Struct(self, Montage, montage);
435
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
415
436
  tile = rb_String(tile_arg);
416
437
  magick_clone_string(&montage->info->tile, StringValueCStr(tile));
417
438
 
@@ -432,7 +453,7 @@ Montage_title_eq(VALUE self, VALUE title)
432
453
  {
433
454
  Montage *montage;
434
455
 
435
- Data_Get_Struct(self, Montage, montage);
456
+ TypedData_Get_Struct(self, Montage, &rm_montage_data_type, montage);
436
457
  magick_clone_string(&montage->info->title, StringValueCStr(title));
437
458
  return title;
438
459
  }