rmagick 4.2.5 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +14 -0
- data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
- data/.devcontainer/devcontainer.json +11 -0
- data/.devcontainer/setup-repo.sh +10 -0
- data/.devcontainer/setup-user.sh +45 -0
- data/.editorconfig +1 -1
- data/.github/workflows/ci.yml +90 -9
- data/.gitignore +4 -0
- data/.rubocop_todo.yml +16 -9
- data/.yardopts +1 -1
- data/CHANGELOG.md +141 -0
- data/Gemfile +20 -0
- data/README.md +12 -17
- data/Rakefile +63 -80
- data/before_install_linux.sh +4 -4
- data/before_install_osx.sh +7 -6
- data/ext/RMagick/extconf.rb +113 -52
- data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
- data/ext/RMagick/rmagick.h +88 -59
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +170 -159
- data/ext/RMagick/{rmenum.c → rmenum.cpp} +69 -50
- data/ext/RMagick/{rmfill.c → rmfill.cpp} +85 -24
- data/ext/RMagick/{rmilist.c → rmilist.cpp} +191 -93
- data/ext/RMagick/{rmimage.c → rmimage.cpp} +1544 -989
- data/ext/RMagick/{rminfo.c → rminfo.cpp} +140 -152
- data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +46 -34
- data/ext/RMagick/rmmain.cpp +1923 -0
- data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +50 -29
- data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +108 -83
- data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +6 -6
- data/ext/RMagick/{rmutil.c → rmutil.cpp} +62 -161
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +76 -110
- data/lib/rvg/embellishable.rb +6 -2
- data/lib/rvg/misc.rb +7 -7
- data/lib/rvg/rvg.rb +2 -0
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/transformable.rb +1 -1
- data/rmagick.gemspec +6 -17
- data/sig/rmagick/_draw_common_methods.rbs +64 -0
- data/sig/rmagick/_image_common_methods.rbs +389 -0
- data/sig/rmagick/draw.rbs +38 -0
- data/sig/rmagick/draw_attribute.rbs +28 -0
- data/sig/rmagick/enum.rbs +814 -0
- data/sig/rmagick/error.rbs +11 -0
- data/sig/rmagick/fill.rbs +21 -0
- data/sig/rmagick/geometry.rbs +14 -0
- data/sig/rmagick/image.rbs +194 -0
- data/sig/rmagick/image_list.rbs +181 -0
- data/sig/rmagick/iptc.rbs +101 -0
- data/sig/rmagick/kernel_info.rbs +12 -0
- data/sig/rmagick/optional_method_arguments.rbs +10 -0
- data/sig/rmagick/pixel.rbs +46 -0
- data/sig/rmagick/struct.rbs +90 -0
- data/sig/rmagick.rbs +43 -0
- data/sig/rvg/clippath.rbs +34 -0
- data/sig/rvg/container.rbs +78 -0
- data/sig/rvg/deep_equal.rbs +48 -0
- data/sig/rvg/describable.rbs +30 -0
- data/sig/rvg/embellishable.rbs +226 -0
- data/sig/rvg/misc.rbs +145 -0
- data/sig/rvg/paint.rbs +55 -0
- data/sig/rvg/pathdata.rbs +77 -0
- data/sig/rvg/rvg.rbs +125 -0
- data/sig/rvg/stretchable.rbs +56 -0
- data/sig/rvg/stylable.rbs +66 -0
- data/sig/rvg/text.rbs +118 -0
- data/sig/rvg/transformable.rbs +59 -0
- data/sig/rvg/units.rbs +33 -0
- metadata +63 -128
- data/.codeclimate.yml +0 -63
- data/deprecated/RMagick.rb +0 -6
- data/ext/RMagick/rmmain.c +0 -1951
@@ -5,13 +5,23 @@
|
|
5
5
|
*
|
6
6
|
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
7
|
*
|
8
|
-
* @file rminfo.
|
9
|
-
* @version $Id: rminfo.
|
8
|
+
* @file rminfo.cpp
|
9
|
+
* @version $Id: rminfo.cpp,v 1.79 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 Info_free(void *infoptr);
|
16
|
+
static size_t Info_memsize(const void *infoptr);
|
17
|
+
|
18
|
+
const rb_data_type_t rm_info_data_type = {
|
19
|
+
"Magick::Image::Info",
|
20
|
+
{ NULL, Info_free, Info_memsize, },
|
21
|
+
0, 0,
|
22
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
23
|
+
};
|
24
|
+
|
15
25
|
|
16
26
|
/**
|
17
27
|
* Return the value of the specified option.
|
@@ -28,7 +38,7 @@ get_option(VALUE self, const char *key)
|
|
28
38
|
Info *info;
|
29
39
|
const char *value;
|
30
40
|
|
31
|
-
|
41
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
32
42
|
|
33
43
|
value = GetImageOption(info, key);
|
34
44
|
if (value)
|
@@ -54,7 +64,7 @@ set_option(VALUE self, const char *key, VALUE string)
|
|
54
64
|
{
|
55
65
|
Info *info;
|
56
66
|
|
57
|
-
|
67
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
58
68
|
|
59
69
|
if (NIL_P(string))
|
60
70
|
{
|
@@ -90,7 +100,7 @@ static VALUE set_color_option(VALUE self, const char *option, VALUE color)
|
|
90
100
|
PixelColor pp;
|
91
101
|
MagickBooleanType okay;
|
92
102
|
|
93
|
-
|
103
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
94
104
|
|
95
105
|
if (NIL_P(color))
|
96
106
|
{
|
@@ -136,7 +146,7 @@ static VALUE get_dbl_option(VALUE self, const char *option)
|
|
136
146
|
double d;
|
137
147
|
long n;
|
138
148
|
|
139
|
-
|
149
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
140
150
|
|
141
151
|
value = GetImageOption(info, option);
|
142
152
|
if (!value)
|
@@ -167,7 +177,7 @@ static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
|
|
167
177
|
{
|
168
178
|
Info *info;
|
169
179
|
|
170
|
-
|
180
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
171
181
|
|
172
182
|
if (NIL_P(value))
|
173
183
|
{
|
@@ -206,7 +216,7 @@ static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
|
|
206
216
|
VALUE
|
207
217
|
Info_antialias(VALUE self)
|
208
218
|
{
|
209
|
-
|
219
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, antialias, boolean, &rm_info_data_type);
|
210
220
|
}
|
211
221
|
|
212
222
|
/**
|
@@ -218,7 +228,7 @@ Info_antialias(VALUE self)
|
|
218
228
|
VALUE
|
219
229
|
Info_antialias_eq(VALUE self, VALUE val)
|
220
230
|
{
|
221
|
-
|
231
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, antialias, boolean, &rm_info_data_type);
|
222
232
|
}
|
223
233
|
|
224
234
|
/** Maximum length of a format (@see Info_aref) */
|
@@ -245,7 +255,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
245
255
|
{
|
246
256
|
Info *info;
|
247
257
|
char *format_p, *key_p;
|
248
|
-
|
258
|
+
size_t format_l, key_l;
|
249
259
|
const char *value;
|
250
260
|
char fkey[MaxTextExtent];
|
251
261
|
|
@@ -272,7 +282,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
272
282
|
|
273
283
|
}
|
274
284
|
|
275
|
-
|
285
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
276
286
|
value = GetImageOption(info, fkey);
|
277
287
|
if (!value)
|
278
288
|
{
|
@@ -308,10 +318,10 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
308
318
|
Info *info;
|
309
319
|
VALUE value;
|
310
320
|
char *format_p, *key_p, *value_p = NULL;
|
311
|
-
|
321
|
+
size_t format_l, key_l;
|
312
322
|
char ckey[MaxTextExtent];
|
313
323
|
|
314
|
-
|
324
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
315
325
|
|
316
326
|
switch (argc)
|
317
327
|
{
|
@@ -401,7 +411,7 @@ Info_authenticate(VALUE self)
|
|
401
411
|
{
|
402
412
|
Info *info;
|
403
413
|
|
404
|
-
|
414
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
405
415
|
#if defined(IMAGEMAGICK_7)
|
406
416
|
return C_str_to_R_str(GetImageOption(info, "authenticate"));
|
407
417
|
#else
|
@@ -422,7 +432,7 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
|
|
422
432
|
Info *info;
|
423
433
|
char *passwd = NULL;
|
424
434
|
|
425
|
-
|
435
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
426
436
|
|
427
437
|
if (!NIL_P(passwd_arg))
|
428
438
|
{
|
@@ -465,7 +475,7 @@ Info_background_color(VALUE self)
|
|
465
475
|
{
|
466
476
|
Info *info;
|
467
477
|
|
468
|
-
|
478
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
469
479
|
return rm_pixelcolor_to_color_name_info(info, &info->background_color);
|
470
480
|
}
|
471
481
|
|
@@ -481,7 +491,7 @@ Info_background_color_eq(VALUE self, VALUE bc_arg)
|
|
481
491
|
{
|
482
492
|
Info *info;
|
483
493
|
|
484
|
-
|
494
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
485
495
|
Color_to_PixelColor(&info->background_color, bc_arg);
|
486
496
|
|
487
497
|
return bc_arg;
|
@@ -498,7 +508,7 @@ Info_border_color(VALUE self)
|
|
498
508
|
{
|
499
509
|
Info *info;
|
500
510
|
|
501
|
-
|
511
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
502
512
|
return rm_pixelcolor_to_color_name_info(info, &info->border_color);
|
503
513
|
}
|
504
514
|
|
@@ -513,7 +523,7 @@ Info_border_color_eq(VALUE self, VALUE bc_arg)
|
|
513
523
|
{
|
514
524
|
Info *info;
|
515
525
|
|
516
|
-
|
526
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
517
527
|
Color_to_PixelColor(&info->border_color, bc_arg);
|
518
528
|
|
519
529
|
return bc_arg;
|
@@ -572,7 +582,7 @@ Info_channel(int argc, VALUE *argv, VALUE self)
|
|
572
582
|
raise_ChannelType_error(argv[argc-1]);
|
573
583
|
}
|
574
584
|
|
575
|
-
|
585
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
576
586
|
|
577
587
|
info->channel = channels;
|
578
588
|
return self;
|
@@ -589,7 +599,7 @@ Info_colorspace(VALUE self)
|
|
589
599
|
{
|
590
600
|
Info *info;
|
591
601
|
|
592
|
-
|
602
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
593
603
|
return ColorspaceType_find(info->colorspace);
|
594
604
|
}
|
595
605
|
|
@@ -604,7 +614,7 @@ Info_colorspace_eq(VALUE self, VALUE colorspace)
|
|
604
614
|
{
|
605
615
|
Info *info;
|
606
616
|
|
607
|
-
|
617
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
608
618
|
VALUE_TO_ENUM(colorspace, info->colorspace, ColorspaceType);
|
609
619
|
return colorspace;
|
610
620
|
}
|
@@ -640,7 +650,7 @@ Info_compression(VALUE self)
|
|
640
650
|
{
|
641
651
|
Info *info;
|
642
652
|
|
643
|
-
|
653
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
644
654
|
return CompressionType_find(info->compression);
|
645
655
|
}
|
646
656
|
|
@@ -655,7 +665,7 @@ Info_compression_eq(VALUE self, VALUE type)
|
|
655
665
|
{
|
656
666
|
Info *info;
|
657
667
|
|
658
|
-
|
668
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
659
669
|
VALUE_TO_ENUM(type, info->compression, CompressionType);
|
660
670
|
return type;
|
661
671
|
}
|
@@ -676,12 +686,12 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
676
686
|
Info *info;
|
677
687
|
char *format, *key;
|
678
688
|
const char *value = "";
|
679
|
-
|
689
|
+
size_t format_l, key_l;
|
680
690
|
char ckey[100];
|
681
691
|
unsigned int okay;
|
682
692
|
VALUE fmt_arg;
|
683
693
|
|
684
|
-
|
694
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
685
695
|
|
686
696
|
switch (argc)
|
687
697
|
{
|
@@ -728,7 +738,7 @@ Info_delay(VALUE self)
|
|
728
738
|
const char *delay;
|
729
739
|
char *p;
|
730
740
|
|
731
|
-
|
741
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
732
742
|
|
733
743
|
delay = GetImageOption(info, "delay");
|
734
744
|
if (delay)
|
@@ -771,7 +781,7 @@ Info_delay_eq(VALUE self, VALUE string)
|
|
771
781
|
Info *info;
|
772
782
|
int not_num;
|
773
783
|
|
774
|
-
|
784
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
775
785
|
|
776
786
|
if (NIL_P(string))
|
777
787
|
{
|
@@ -803,14 +813,14 @@ Info_delay_eq(VALUE self, VALUE string)
|
|
803
813
|
VALUE
|
804
814
|
Info_density(VALUE self)
|
805
815
|
{
|
806
|
-
|
816
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, density, str, &rm_info_data_type);
|
807
817
|
}
|
808
818
|
|
809
819
|
/**
|
810
820
|
* Set the text rendering density geometry
|
811
821
|
*
|
812
|
-
* @param density_arg [String] the density
|
813
|
-
* @return [String] the given value
|
822
|
+
* @param density_arg [Magick::Geometry, String] the density
|
823
|
+
* @return [Magick::Geometry, String] the given value
|
814
824
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
815
825
|
*/
|
816
826
|
VALUE
|
@@ -820,13 +830,13 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
820
830
|
VALUE density;
|
821
831
|
char *dens;
|
822
832
|
|
823
|
-
|
833
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
824
834
|
|
825
835
|
if (NIL_P(density_arg))
|
826
836
|
{
|
827
837
|
magick_free(info->density);
|
828
838
|
info->density = NULL;
|
829
|
-
return
|
839
|
+
return density_arg;
|
830
840
|
}
|
831
841
|
|
832
842
|
density = rb_String(density_arg);
|
@@ -851,7 +861,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
851
861
|
VALUE
|
852
862
|
Info_depth(VALUE self)
|
853
863
|
{
|
854
|
-
|
864
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, depth, int, &rm_info_data_type);
|
855
865
|
}
|
856
866
|
|
857
867
|
/**
|
@@ -866,7 +876,7 @@ Info_depth_eq(VALUE self, VALUE depth)
|
|
866
876
|
Info *info;
|
867
877
|
unsigned long d;
|
868
878
|
|
869
|
-
|
879
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
870
880
|
d = NUM2ULONG(depth);
|
871
881
|
switch (d)
|
872
882
|
{
|
@@ -950,7 +960,7 @@ Info_dispose(VALUE self)
|
|
950
960
|
ID dispose_id;
|
951
961
|
const char *dispose;
|
952
962
|
|
953
|
-
|
963
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
954
964
|
|
955
965
|
dispose_id = rb_intern("UndefinedDispose");
|
956
966
|
|
@@ -985,12 +995,12 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
985
995
|
const char *option;
|
986
996
|
int x;
|
987
997
|
|
988
|
-
|
998
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
989
999
|
|
990
1000
|
if (NIL_P(disp))
|
991
1001
|
{
|
992
1002
|
DeleteImageOption(info, "dispose");
|
993
|
-
return
|
1003
|
+
return disp;
|
994
1004
|
}
|
995
1005
|
|
996
1006
|
VALUE_TO_ENUM(disp, dispose, DisposeType);
|
@@ -1017,7 +1027,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1017
1027
|
VALUE
|
1018
1028
|
Info_dither(VALUE self)
|
1019
1029
|
{
|
1020
|
-
|
1030
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, dither, boolean, &rm_info_data_type);
|
1021
1031
|
}
|
1022
1032
|
|
1023
1033
|
/**
|
@@ -1029,7 +1039,7 @@ Info_dither(VALUE self)
|
|
1029
1039
|
VALUE
|
1030
1040
|
Info_dither_eq(VALUE self, VALUE val)
|
1031
1041
|
{
|
1032
|
-
|
1042
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, dither, boolean, &rm_info_data_type);
|
1033
1043
|
}
|
1034
1044
|
|
1035
1045
|
|
@@ -1043,7 +1053,7 @@ Info_endian(VALUE self)
|
|
1043
1053
|
{
|
1044
1054
|
Info *info;
|
1045
1055
|
|
1046
|
-
|
1056
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1047
1057
|
return EndianType_find(info->endian);
|
1048
1058
|
}
|
1049
1059
|
|
@@ -1065,7 +1075,7 @@ Info_endian_eq(VALUE self, VALUE endian)
|
|
1065
1075
|
VALUE_TO_ENUM(endian, type, EndianType);
|
1066
1076
|
}
|
1067
1077
|
|
1068
|
-
|
1078
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1069
1079
|
info->endian = type;
|
1070
1080
|
return endian;
|
1071
1081
|
}
|
@@ -1080,14 +1090,14 @@ Info_endian_eq(VALUE self, VALUE endian)
|
|
1080
1090
|
VALUE
|
1081
1091
|
Info_extract(VALUE self)
|
1082
1092
|
{
|
1083
|
-
|
1093
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, extract, str, &rm_info_data_type);
|
1084
1094
|
}
|
1085
1095
|
|
1086
1096
|
/**
|
1087
1097
|
* Set the extract geometry.
|
1088
1098
|
*
|
1089
|
-
* @param extract_arg [String] the extract string
|
1090
|
-
* @return [String] the given value
|
1099
|
+
* @param extract_arg [Magick::Geometry, String] the extract string
|
1100
|
+
* @return [Magick::Geometry, String] the given value
|
1091
1101
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1092
1102
|
*/
|
1093
1103
|
VALUE
|
@@ -1097,13 +1107,13 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1097
1107
|
char *extr;
|
1098
1108
|
VALUE extract;
|
1099
1109
|
|
1100
|
-
|
1110
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1101
1111
|
|
1102
1112
|
if (NIL_P(extract_arg))
|
1103
1113
|
{
|
1104
1114
|
magick_free(info->extract);
|
1105
1115
|
info->extract = NULL;
|
1106
|
-
return
|
1116
|
+
return extract_arg;
|
1107
1117
|
}
|
1108
1118
|
|
1109
1119
|
extract = rb_String(extract_arg);
|
@@ -1133,7 +1143,7 @@ Info_filename(VALUE self)
|
|
1133
1143
|
{
|
1134
1144
|
Info *info;
|
1135
1145
|
|
1136
|
-
|
1146
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1137
1147
|
return rb_str_new2(info->filename);
|
1138
1148
|
}
|
1139
1149
|
|
@@ -1150,7 +1160,7 @@ Info_filename_eq(VALUE self, VALUE filename)
|
|
1150
1160
|
{
|
1151
1161
|
Info *info;
|
1152
1162
|
|
1153
|
-
|
1163
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1154
1164
|
|
1155
1165
|
// Allow "nil" - remove current filename
|
1156
1166
|
if (NIL_P(filename) || StringValueCStr(filename) == NULL)
|
@@ -1201,7 +1211,7 @@ Info_fill_eq(VALUE self, VALUE color)
|
|
1201
1211
|
VALUE
|
1202
1212
|
Info_font(VALUE self)
|
1203
1213
|
{
|
1204
|
-
|
1214
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, font, str, &rm_info_data_type);
|
1205
1215
|
}
|
1206
1216
|
|
1207
1217
|
/**
|
@@ -1215,7 +1225,7 @@ Info_font_eq(VALUE self, VALUE font_arg)
|
|
1215
1225
|
{
|
1216
1226
|
Info *info;
|
1217
1227
|
|
1218
|
-
|
1228
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1219
1229
|
if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
|
1220
1230
|
{
|
1221
1231
|
magick_free(info->font);
|
@@ -1240,7 +1250,7 @@ VALUE Info_format(VALUE self)
|
|
1240
1250
|
{
|
1241
1251
|
Info *info;
|
1242
1252
|
|
1243
|
-
|
1253
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1244
1254
|
if (*info->magick)
|
1245
1255
|
{
|
1246
1256
|
const MagickInfo *magick_info;
|
@@ -1270,7 +1280,7 @@ Info_format_eq(VALUE self, VALUE magick)
|
|
1270
1280
|
char *mgk;
|
1271
1281
|
ExceptionInfo *exception;
|
1272
1282
|
|
1273
|
-
|
1283
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1274
1284
|
|
1275
1285
|
mgk = StringValueCStr(magick);
|
1276
1286
|
|
@@ -1297,7 +1307,7 @@ Info_format_eq(VALUE self, VALUE magick)
|
|
1297
1307
|
VALUE
|
1298
1308
|
Info_fuzz(VALUE self)
|
1299
1309
|
{
|
1300
|
-
|
1310
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, fuzz, dbl, &rm_info_data_type);
|
1301
1311
|
}
|
1302
1312
|
|
1303
1313
|
/**
|
@@ -1313,7 +1323,7 @@ Info_fuzz_eq(VALUE self, VALUE fuzz)
|
|
1313
1323
|
{
|
1314
1324
|
Info *info;
|
1315
1325
|
|
1316
|
-
|
1326
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1317
1327
|
info->fuzz = rm_fuzz_to_dbl(fuzz);
|
1318
1328
|
return fuzz;
|
1319
1329
|
}
|
@@ -1380,7 +1390,7 @@ VALUE Info_gravity(VALUE self)
|
|
1380
1390
|
const char *gravity;
|
1381
1391
|
ID gravity_id;
|
1382
1392
|
|
1383
|
-
|
1393
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1384
1394
|
|
1385
1395
|
gravity_id = rb_intern("UndefinedGravity");
|
1386
1396
|
|
@@ -1416,12 +1426,12 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1416
1426
|
const char *option;
|
1417
1427
|
int x;
|
1418
1428
|
|
1419
|
-
|
1429
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1420
1430
|
|
1421
1431
|
if (NIL_P(grav))
|
1422
1432
|
{
|
1423
1433
|
DeleteImageOption(info, "gravity");
|
1424
|
-
return
|
1434
|
+
return grav;
|
1425
1435
|
}
|
1426
1436
|
|
1427
1437
|
VALUE_TO_ENUM(grav, gravity, GravityType);
|
@@ -1451,7 +1461,7 @@ Info_image_type(VALUE self)
|
|
1451
1461
|
{
|
1452
1462
|
Info *info;
|
1453
1463
|
|
1454
|
-
|
1464
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1455
1465
|
return ImageType_find(info->type);
|
1456
1466
|
}
|
1457
1467
|
|
@@ -1466,7 +1476,7 @@ Info_image_type_eq(VALUE self, VALUE type)
|
|
1466
1476
|
{
|
1467
1477
|
Info *info;
|
1468
1478
|
|
1469
|
-
|
1479
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1470
1480
|
VALUE_TO_ENUM(type, info->type, ImageType);
|
1471
1481
|
return type;
|
1472
1482
|
}
|
@@ -1481,7 +1491,7 @@ Info_interlace(VALUE self)
|
|
1481
1491
|
{
|
1482
1492
|
Info *info;
|
1483
1493
|
|
1484
|
-
|
1494
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1485
1495
|
return InterlaceType_find(info->interlace);
|
1486
1496
|
}
|
1487
1497
|
|
@@ -1496,7 +1506,7 @@ Info_interlace_eq(VALUE self, VALUE inter)
|
|
1496
1506
|
{
|
1497
1507
|
Info *info;
|
1498
1508
|
|
1499
|
-
|
1509
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1500
1510
|
VALUE_TO_ENUM(inter, info->interlace, InterlaceType);
|
1501
1511
|
return inter;
|
1502
1512
|
}
|
@@ -1533,7 +1543,7 @@ Info_matte_color(VALUE self)
|
|
1533
1543
|
{
|
1534
1544
|
Info *info;
|
1535
1545
|
|
1536
|
-
|
1546
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1537
1547
|
return rm_pixelcolor_to_color_name_info(info, &info->matte_color);
|
1538
1548
|
}
|
1539
1549
|
|
@@ -1548,38 +1558,12 @@ Info_matte_color_eq(VALUE self, VALUE matte_arg)
|
|
1548
1558
|
{
|
1549
1559
|
Info *info;
|
1550
1560
|
|
1551
|
-
|
1561
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1552
1562
|
Color_to_PixelColor(&info->matte_color, matte_arg);
|
1553
1563
|
|
1554
1564
|
return matte_arg;
|
1555
1565
|
}
|
1556
1566
|
|
1557
|
-
/**
|
1558
|
-
* Establish a progress monitor.
|
1559
|
-
*
|
1560
|
-
* @param monitor [Proc] the monitor
|
1561
|
-
* @return [Proc] monitor
|
1562
|
-
* @see Image#monitor=
|
1563
|
-
*/
|
1564
|
-
VALUE
|
1565
|
-
Info_monitor_eq(VALUE self, VALUE monitor)
|
1566
|
-
{
|
1567
|
-
Info *info;
|
1568
|
-
|
1569
|
-
Data_Get_Struct(self, Info, info);
|
1570
|
-
|
1571
|
-
if (NIL_P(monitor))
|
1572
|
-
{
|
1573
|
-
info->progress_monitor = NULL;
|
1574
|
-
}
|
1575
|
-
else
|
1576
|
-
{
|
1577
|
-
SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
|
1578
|
-
}
|
1579
|
-
|
1580
|
-
return monitor;
|
1581
|
-
}
|
1582
|
-
|
1583
1567
|
/**
|
1584
1568
|
* Get the monochrome value.
|
1585
1569
|
*
|
@@ -1588,7 +1572,7 @@ Info_monitor_eq(VALUE self, VALUE monitor)
|
|
1588
1572
|
VALUE
|
1589
1573
|
Info_monochrome(VALUE self)
|
1590
1574
|
{
|
1591
|
-
|
1575
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, monochrome, boolean, &rm_info_data_type);
|
1592
1576
|
}
|
1593
1577
|
|
1594
1578
|
/**
|
@@ -1600,7 +1584,7 @@ Info_monochrome(VALUE self)
|
|
1600
1584
|
VALUE
|
1601
1585
|
Info_monochrome_eq(VALUE self, VALUE val)
|
1602
1586
|
{
|
1603
|
-
|
1587
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, monochrome, boolean, &rm_info_data_type);
|
1604
1588
|
}
|
1605
1589
|
|
1606
1590
|
/**
|
@@ -1611,7 +1595,7 @@ Info_monochrome_eq(VALUE self, VALUE val)
|
|
1611
1595
|
VALUE
|
1612
1596
|
Info_number_scenes(VALUE self)
|
1613
1597
|
{
|
1614
|
-
|
1598
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, number_scenes, ulong, &rm_info_data_type);
|
1615
1599
|
}
|
1616
1600
|
|
1617
1601
|
/**
|
@@ -1623,7 +1607,7 @@ Info_number_scenes(VALUE self)
|
|
1623
1607
|
VALUE
|
1624
1608
|
Info_number_scenes_eq(VALUE self, VALUE val)
|
1625
1609
|
{
|
1626
|
-
|
1610
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, number_scenes, ulong, &rm_info_data_type);
|
1627
1611
|
}
|
1628
1612
|
|
1629
1613
|
/**
|
@@ -1636,7 +1620,7 @@ Info_orientation(VALUE self)
|
|
1636
1620
|
{
|
1637
1621
|
Info *info;
|
1638
1622
|
|
1639
|
-
|
1623
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1640
1624
|
return OrientationType_find(info->orientation);
|
1641
1625
|
}
|
1642
1626
|
|
@@ -1652,7 +1636,7 @@ Info_orientation_eq(VALUE self, VALUE inter)
|
|
1652
1636
|
{
|
1653
1637
|
Info *info;
|
1654
1638
|
|
1655
|
-
|
1639
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1656
1640
|
VALUE_TO_ENUM(inter, info->orientation, OrientationType);
|
1657
1641
|
return inter;
|
1658
1642
|
}
|
@@ -1670,7 +1654,7 @@ Info_origin(VALUE self)
|
|
1670
1654
|
Info *info;
|
1671
1655
|
const char *origin;
|
1672
1656
|
|
1673
|
-
|
1657
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1674
1658
|
|
1675
1659
|
origin = GetImageOption(info, "origin");
|
1676
1660
|
return origin ? rb_str_new2(origin) : Qnil;
|
@@ -1684,8 +1668,8 @@ Info_origin(VALUE self)
|
|
1684
1668
|
* The geometry format is
|
1685
1669
|
* +-x+-y
|
1686
1670
|
*
|
1687
|
-
* @param origin_arg [String] the origin geometry
|
1688
|
-
* @return [String] the given value
|
1671
|
+
* @param origin_arg [Magick::Geometry, String] the origin geometry
|
1672
|
+
* @return [Magick::Geometry, String] the given value
|
1689
1673
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1690
1674
|
*/
|
1691
1675
|
VALUE
|
@@ -1695,12 +1679,12 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1695
1679
|
VALUE origin_str;
|
1696
1680
|
char *origin;
|
1697
1681
|
|
1698
|
-
|
1682
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1699
1683
|
|
1700
1684
|
if (NIL_P(origin_arg))
|
1701
1685
|
{
|
1702
1686
|
DeleteImageOption(info, "origin");
|
1703
|
-
return
|
1687
|
+
return origin_arg;
|
1704
1688
|
}
|
1705
1689
|
|
1706
1690
|
origin_str = rb_String(origin_arg);
|
@@ -1731,7 +1715,7 @@ Info_page(VALUE self)
|
|
1731
1715
|
{
|
1732
1716
|
Info *info;
|
1733
1717
|
|
1734
|
-
|
1718
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1735
1719
|
return info->page ? rb_str_new2(info->page) : Qnil;
|
1736
1720
|
|
1737
1721
|
}
|
@@ -1740,8 +1724,8 @@ Info_page(VALUE self)
|
|
1740
1724
|
* Store the Postscript page geometry. Argument may be a Geometry object as well
|
1741
1725
|
* as a geometry string.
|
1742
1726
|
*
|
1743
|
-
* @param page_arg [String] the geometry
|
1744
|
-
* @return [String] the given value
|
1727
|
+
* @param page_arg [Magick::Geometry, String] the geometry
|
1728
|
+
* @return [Magick::Geometry, String] the given value
|
1745
1729
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1746
1730
|
*/
|
1747
1731
|
VALUE
|
@@ -1751,12 +1735,12 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1751
1735
|
VALUE geom_str;
|
1752
1736
|
char *geometry;
|
1753
1737
|
|
1754
|
-
|
1738
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1755
1739
|
if (NIL_P(page_arg))
|
1756
1740
|
{
|
1757
1741
|
magick_free(info->page);
|
1758
1742
|
info->page = NULL;
|
1759
|
-
return
|
1743
|
+
return page_arg;
|
1760
1744
|
}
|
1761
1745
|
geom_str = rb_String(page_arg);
|
1762
1746
|
geometry = GetPageGeometry(StringValueCStr(geom_str));
|
@@ -1764,7 +1748,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1764
1748
|
{
|
1765
1749
|
magick_free(info->page);
|
1766
1750
|
info->page = NULL;
|
1767
|
-
return
|
1751
|
+
return page_arg;
|
1768
1752
|
}
|
1769
1753
|
info->page = geometry;
|
1770
1754
|
|
@@ -1781,7 +1765,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1781
1765
|
VALUE
|
1782
1766
|
Info_pointsize(VALUE self)
|
1783
1767
|
{
|
1784
|
-
|
1768
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, pointsize, dbl, &rm_info_data_type);
|
1785
1769
|
}
|
1786
1770
|
|
1787
1771
|
/**
|
@@ -1793,7 +1777,7 @@ Info_pointsize(VALUE self)
|
|
1793
1777
|
VALUE
|
1794
1778
|
Info_pointsize_eq(VALUE self, VALUE val)
|
1795
1779
|
{
|
1796
|
-
|
1780
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, pointsize, dbl, &rm_info_data_type);
|
1797
1781
|
}
|
1798
1782
|
|
1799
1783
|
/**
|
@@ -1804,7 +1788,7 @@ Info_pointsize_eq(VALUE self, VALUE val)
|
|
1804
1788
|
VALUE
|
1805
1789
|
Info_quality(VALUE self)
|
1806
1790
|
{
|
1807
|
-
|
1791
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, quality, ulong, &rm_info_data_type);
|
1808
1792
|
}
|
1809
1793
|
|
1810
1794
|
/**
|
@@ -1816,7 +1800,7 @@ Info_quality(VALUE self)
|
|
1816
1800
|
VALUE
|
1817
1801
|
Info_quality_eq(VALUE self, VALUE val)
|
1818
1802
|
{
|
1819
|
-
|
1803
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, quality, ulong, &rm_info_data_type);
|
1820
1804
|
}
|
1821
1805
|
|
1822
1806
|
/**
|
@@ -1829,7 +1813,7 @@ Info_sampling_factor(VALUE self)
|
|
1829
1813
|
{
|
1830
1814
|
Info *info;
|
1831
1815
|
|
1832
|
-
|
1816
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1833
1817
|
if (info->sampling_factor)
|
1834
1818
|
{
|
1835
1819
|
return rb_str_new2(info->sampling_factor);
|
@@ -1851,9 +1835,9 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
|
1851
1835
|
{
|
1852
1836
|
Info *info;
|
1853
1837
|
char *sampling_factor_p = NULL;
|
1854
|
-
|
1838
|
+
size_t sampling_factor_len = 0;
|
1855
1839
|
|
1856
|
-
|
1840
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1857
1841
|
|
1858
1842
|
if (!NIL_P(sampling_factor))
|
1859
1843
|
{
|
@@ -1884,7 +1868,7 @@ Info_scene(VALUE self)
|
|
1884
1868
|
{
|
1885
1869
|
Info *info;
|
1886
1870
|
|
1887
|
-
|
1871
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1888
1872
|
return ULONG2NUM(info->scene);
|
1889
1873
|
}
|
1890
1874
|
|
@@ -1901,10 +1885,10 @@ Info_scene_eq(VALUE self, VALUE scene)
|
|
1901
1885
|
Info *info;
|
1902
1886
|
char buf[25];
|
1903
1887
|
|
1904
|
-
|
1888
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1905
1889
|
info->scene = NUM2ULONG(scene);
|
1906
1890
|
|
1907
|
-
snprintf(buf, sizeof(buf), "%"RMIuSIZE"", info->scene);
|
1891
|
+
snprintf(buf, sizeof(buf), "%" RMIuSIZE "", info->scene);
|
1908
1892
|
SetImageOption(info, "scene", buf);
|
1909
1893
|
|
1910
1894
|
return scene;
|
@@ -1919,7 +1903,7 @@ Info_scene_eq(VALUE self, VALUE scene)
|
|
1919
1903
|
VALUE
|
1920
1904
|
Info_server_name(VALUE self)
|
1921
1905
|
{
|
1922
|
-
|
1906
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, server_name, str, &rm_info_data_type);
|
1923
1907
|
}
|
1924
1908
|
|
1925
1909
|
|
@@ -1934,7 +1918,7 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
|
|
1934
1918
|
{
|
1935
1919
|
Info *info;
|
1936
1920
|
|
1937
|
-
|
1921
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1938
1922
|
if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
|
1939
1923
|
{
|
1940
1924
|
magick_free(info->server_name);
|
@@ -1959,14 +1943,14 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
|
|
1959
1943
|
VALUE
|
1960
1944
|
Info_size(VALUE self)
|
1961
1945
|
{
|
1962
|
-
|
1946
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, size, str, &rm_info_data_type);
|
1963
1947
|
}
|
1964
1948
|
|
1965
1949
|
/**
|
1966
1950
|
* Set the size (either as a Geometry object or a Geometry string
|
1967
1951
|
*
|
1968
|
-
* @param size_arg [String] the size
|
1969
|
-
* @return [String] the given value
|
1952
|
+
* @param size_arg [Magick::Geometry, String] the size
|
1953
|
+
* @return [Magick::Geometry, String] the given value
|
1970
1954
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1971
1955
|
*/
|
1972
1956
|
VALUE
|
@@ -1976,13 +1960,13 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
1976
1960
|
VALUE size;
|
1977
1961
|
char *sz;
|
1978
1962
|
|
1979
|
-
|
1963
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1980
1964
|
|
1981
1965
|
if (NIL_P(size_arg))
|
1982
1966
|
{
|
1983
1967
|
magick_free(info->size);
|
1984
1968
|
info->size = NULL;
|
1985
|
-
return
|
1969
|
+
return size_arg;
|
1986
1970
|
}
|
1987
1971
|
|
1988
1972
|
size = rb_String(size_arg);
|
@@ -2062,7 +2046,7 @@ Info_texture_eq(VALUE self, VALUE texture)
|
|
2062
2046
|
Image *image;
|
2063
2047
|
char name[MaxTextExtent];
|
2064
2048
|
|
2065
|
-
|
2049
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2066
2050
|
|
2067
2051
|
// Delete any existing texture file
|
2068
2052
|
if (info->texture)
|
@@ -2100,7 +2084,7 @@ Info_tile_offset(VALUE self)
|
|
2100
2084
|
Info *info;
|
2101
2085
|
const char *tile_offset;
|
2102
2086
|
|
2103
|
-
|
2087
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2104
2088
|
|
2105
2089
|
tile_offset = GetImageOption(info, "tile-offset");
|
2106
2090
|
|
@@ -2116,8 +2100,8 @@ Info_tile_offset(VALUE self)
|
|
2116
2100
|
/**
|
2117
2101
|
* Set tile offset geometry.
|
2118
2102
|
*
|
2119
|
-
* @param offset [String] the offset geometry
|
2120
|
-
* @return [String] the given value
|
2103
|
+
* @param offset [Magick::Geometry, String] the offset geometry
|
2104
|
+
* @return [Magick::Geometry, String] the given value
|
2121
2105
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2122
2106
|
*/
|
2123
2107
|
VALUE
|
@@ -2134,7 +2118,7 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
2134
2118
|
rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
|
2135
2119
|
}
|
2136
2120
|
|
2137
|
-
|
2121
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2138
2122
|
|
2139
2123
|
DeleteImageOption(info, "tile-offset");
|
2140
2124
|
SetImageOption(info, "tile-offset", tile_offset);
|
@@ -2156,7 +2140,7 @@ Info_transparent_color(VALUE self)
|
|
2156
2140
|
{
|
2157
2141
|
Info *info;
|
2158
2142
|
|
2159
|
-
|
2143
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2160
2144
|
return rm_pixelcolor_to_color_name_info(info, &info->transparent_color);
|
2161
2145
|
}
|
2162
2146
|
|
@@ -2172,7 +2156,7 @@ Info_transparent_color_eq(VALUE self, VALUE tc_arg)
|
|
2172
2156
|
{
|
2173
2157
|
Info *info;
|
2174
2158
|
|
2175
|
-
|
2159
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2176
2160
|
Color_to_PixelColor(&info->transparent_color, tc_arg);
|
2177
2161
|
|
2178
2162
|
return tc_arg;
|
@@ -2191,7 +2175,7 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
|
|
2191
2175
|
{
|
2192
2176
|
Info *info;
|
2193
2177
|
char *format_p, *key_p;
|
2194
|
-
|
2178
|
+
size_t format_l, key_l;
|
2195
2179
|
char fkey[MaxTextExtent];
|
2196
2180
|
|
2197
2181
|
format_p = rm_str2cstr(format, &format_l);
|
@@ -2204,7 +2188,7 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
|
|
2204
2188
|
|
2205
2189
|
snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
|
2206
2190
|
|
2207
|
-
|
2191
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2208
2192
|
DeleteImageOption(info, fkey);
|
2209
2193
|
|
2210
2194
|
return self;
|
@@ -2244,7 +2228,7 @@ Info_units(VALUE self)
|
|
2244
2228
|
{
|
2245
2229
|
Info *info;
|
2246
2230
|
|
2247
|
-
|
2231
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2248
2232
|
return ResolutionType_find(info->units);
|
2249
2233
|
}
|
2250
2234
|
|
@@ -2259,7 +2243,7 @@ Info_units_eq(VALUE self, VALUE units)
|
|
2259
2243
|
{
|
2260
2244
|
Info *info;
|
2261
2245
|
|
2262
|
-
|
2246
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2263
2247
|
VALUE_TO_ENUM(units, info->units, ResolutionType);
|
2264
2248
|
return units;
|
2265
2249
|
}
|
@@ -2274,7 +2258,7 @@ Info_view(VALUE self)
|
|
2274
2258
|
{
|
2275
2259
|
Info *info;
|
2276
2260
|
|
2277
|
-
|
2261
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2278
2262
|
#if defined(IMAGEMAGICK_7)
|
2279
2263
|
return C_str_to_R_str(GetImageOption(info, "fpx:view"));
|
2280
2264
|
#else
|
@@ -2294,7 +2278,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
|
|
2294
2278
|
Info *info;
|
2295
2279
|
char *view = NULL;
|
2296
2280
|
|
2297
|
-
|
2281
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2298
2282
|
|
2299
2283
|
if (!NIL_P(view_arg))
|
2300
2284
|
{
|
@@ -2334,7 +2318,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
|
|
2334
2318
|
* @param infoptr pointer to the Info object
|
2335
2319
|
*/
|
2336
2320
|
static void
|
2337
|
-
|
2321
|
+
Info_free(void *infoptr)
|
2338
2322
|
{
|
2339
2323
|
Info *info = (Info *)infoptr;
|
2340
2324
|
|
@@ -2348,17 +2332,29 @@ destroy_Info(void *infoptr)
|
|
2348
2332
|
DestroyImageInfo(info);
|
2349
2333
|
}
|
2350
2334
|
|
2335
|
+
/**
|
2336
|
+
* Get Info object size.
|
2337
|
+
*
|
2338
|
+
* No Ruby usage (internal function)
|
2339
|
+
*
|
2340
|
+
* @param infoptr pointer to the Info object
|
2341
|
+
*/
|
2342
|
+
static size_t
|
2343
|
+
Info_memsize(const void *infoptr)
|
2344
|
+
{
|
2345
|
+
return sizeof(Info);
|
2346
|
+
}
|
2351
2347
|
|
2352
2348
|
/**
|
2353
2349
|
* Create an Image::Info object.
|
2354
2350
|
*
|
2355
2351
|
* No Ruby usage (internal function)
|
2356
2352
|
*
|
2357
|
-
* @param
|
2353
|
+
* @param klass the Ruby class to use
|
2358
2354
|
* @return a new ImageInfo object
|
2359
2355
|
*/
|
2360
2356
|
VALUE
|
2361
|
-
Info_alloc(VALUE
|
2357
|
+
Info_alloc(VALUE klass)
|
2362
2358
|
{
|
2363
2359
|
Info *info;
|
2364
2360
|
VALUE info_obj;
|
@@ -2368,7 +2364,7 @@ Info_alloc(VALUE class)
|
|
2368
2364
|
{
|
2369
2365
|
rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
|
2370
2366
|
}
|
2371
|
-
info_obj =
|
2367
|
+
info_obj = TypedData_Wrap_Struct(klass, &rm_info_data_type, info);
|
2372
2368
|
|
2373
2369
|
RB_GC_GUARD(info_obj);
|
2374
2370
|
|
@@ -2405,7 +2401,8 @@ rm_info_new(void)
|
|
2405
2401
|
* @overload initialize
|
2406
2402
|
*
|
2407
2403
|
* @overload initialize
|
2408
|
-
* @yield [
|
2404
|
+
* @yield [info]
|
2405
|
+
* @yieldparam info [Magick::Image::Info]
|
2409
2406
|
*
|
2410
2407
|
* @return self
|
2411
2408
|
*/
|
@@ -2414,16 +2411,7 @@ Info_initialize(VALUE self)
|
|
2414
2411
|
{
|
2415
2412
|
if (rb_block_given_p())
|
2416
2413
|
{
|
2417
|
-
|
2418
|
-
{
|
2419
|
-
// Run the block in self's context
|
2420
|
-
rb_warn("passing a block without an image argument is deprecated");
|
2421
|
-
rb_obj_instance_eval(0, NULL, self);
|
2422
|
-
}
|
2423
|
-
else
|
2424
|
-
{
|
2425
|
-
rb_yield(self);
|
2426
|
-
}
|
2414
|
+
rb_yield(self);
|
2427
2415
|
}
|
2428
2416
|
return self;
|
2429
2417
|
}
|