rmagick 4.2.2 → 5.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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 +59 -24
  9. data/.gitignore +3 -0
  10. data/.rubocop_todo.yml +0 -1
  11. data/.yardopts +1 -1
  12. data/CHANGELOG.md +131 -0
  13. data/README.md +12 -17
  14. data/Rakefile +53 -81
  15. data/before_install_linux.sh +4 -4
  16. data/before_install_osx.sh +7 -6
  17. data/ext/RMagick/extconf.rb +94 -45
  18. data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
  19. data/ext/RMagick/rmagick.h +90 -60
  20. data/ext/RMagick/rmagick_gvl.h +224 -0
  21. data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +160 -146
  22. data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
  23. data/ext/RMagick/{rmfill.c → rmfill.cpp} +81 -20
  24. data/ext/RMagick/{rmilist.c → rmilist.cpp} +184 -93
  25. data/ext/RMagick/{rmimage.c → rmimage.cpp} +1276 -731
  26. data/ext/RMagick/{rminfo.c → rminfo.cpp} +119 -131
  27. data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +41 -16
  28. data/ext/RMagick/rmmain.cpp +1957 -0
  29. data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +49 -28
  30. data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +109 -84
  31. data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +12 -12
  32. data/ext/RMagick/{rmutil.c → rmutil.cpp} +52 -91
  33. data/lib/rmagick/version.rb +3 -1
  34. data/lib/rmagick.rb +2 -0
  35. data/lib/rmagick_internal.rb +9 -48
  36. data/lib/rvg/rvg.rb +2 -2
  37. data/rmagick.gemspec +8 -7
  38. metadata +54 -23
  39. data/.codeclimate.yml +0 -63
  40. data/deprecated/RMagick.rb +0 -6
  41. 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
  /**
@@ -22,15 +29,15 @@
22
29
  * No Ruby usage (internal function)
23
30
  *
24
31
  * Notes:
25
- * - If the Magick::Montage#texture method wrote a texture file, the file is
32
+ * - If the Magick::ImageList::Montage#texture method wrote a texture file, the file is
26
33
  * deleted here.
27
34
  *
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;
@@ -73,13 +94,13 @@ Montage_alloc(VALUE class)
73
94
 
74
95
  if (!montage_info)
75
96
  {
76
- rb_raise(rb_eNoMemError, "not enough memory to initialize Magick::Montage object");
97
+ rb_raise(rb_eNoMemError, "not enough memory to initialize Magick::ImageList::Montage object");
77
98
  }
78
99
 
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;
@@ -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
 
@@ -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.
@@ -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,18 +453,18 @@ 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
  }
439
460
 
440
461
 
441
462
  /**
442
- * Return a new Magick::Montage object.
463
+ * Return a new Magick::ImageList::Montage object.
443
464
  *
444
465
  * No Ruby usage (internal function)
445
466
  *
446
- * @return a new Magick::Montage object
467
+ * @return a new Magick::ImageList::Montage object
447
468
  */
448
469
  VALUE
449
470
  rm_montage_new(void)