rmagick 5.4.4 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/ImageMagick6/devcontainer.json +1 -1
- data/.devcontainer/devcontainer.json +1 -1
- data/.github/workflows/ci.yml +41 -31
- data/.gitignore +1 -0
- data/.rubocop.yml +36 -9
- data/.rubocop_todo.yml +369 -187
- data/CHANGELOG.md +77 -0
- data/Gemfile +14 -0
- data/README.md +3 -3
- data/Rakefile +12 -1
- data/before_install_linux.sh +1 -11
- data/before_install_osx.sh +5 -7
- data/ext/RMagick/extconf.rb +58 -68
- data/ext/RMagick/rmagick.h +7 -12
- data/ext/RMagick/rmdraw.cpp +10 -20
- data/ext/RMagick/rmfill.cpp +4 -4
- data/ext/RMagick/rmilist.cpp +10 -2
- data/ext/RMagick/rmimage.cpp +342 -344
- data/ext/RMagick/rminfo.cpp +22 -21
- data/ext/RMagick/rmkinfo.cpp +5 -18
- data/ext/RMagick/rmmain.cpp +42 -91
- data/ext/RMagick/rmmontage.cpp +5 -5
- data/ext/RMagick/rmpixel.cpp +3 -3
- data/ext/RMagick/rmutil.cpp +58 -89
- data/lib/rmagick/version.rb +3 -3
- data/lib/rmagick.rb +1 -1
- data/lib/rmagick_internal.rb +111 -103
- data/lib/rvg/container.rb +3 -3
- data/lib/rvg/embellishable.rb +7 -3
- data/lib/rvg/misc.rb +15 -15
- data/lib/rvg/rvg.rb +6 -6
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/transformable.rb +1 -1
- data/lib/rvg/units.rb +1 -0
- data/rmagick.gemspec +2 -15
- data/sig/rmagick/_draw_common_methods.rbs +64 -0
- data/sig/rmagick/_image_common_methods.rbs +387 -0
- data/sig/rmagick/draw.rbs +38 -0
- data/sig/rmagick/draw_attribute.rbs +28 -0
- data/sig/rmagick/enum.rbs +820 -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 +196 -0
- data/sig/rmagick/image_list.rbs +183 -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 +38 -134
data/ext/RMagick/rminfo.cpp
CHANGED
@@ -819,8 +819,8 @@ Info_density(VALUE self)
|
|
819
819
|
/**
|
820
820
|
* Set the text rendering density geometry
|
821
821
|
*
|
822
|
-
* @param density_arg [String] the density
|
823
|
-
* @return [String] the given value
|
822
|
+
* @param density_arg [Magick::Geometry, String] the density
|
823
|
+
* @return [Magick::Geometry, String] the given value
|
824
824
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
825
825
|
*/
|
826
826
|
VALUE
|
@@ -836,7 +836,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
836
836
|
{
|
837
837
|
magick_free(info->density);
|
838
838
|
info->density = NULL;
|
839
|
-
return
|
839
|
+
return density_arg;
|
840
840
|
}
|
841
841
|
|
842
842
|
density = rb_String(density_arg);
|
@@ -1000,7 +1000,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1000
1000
|
if (NIL_P(disp))
|
1001
1001
|
{
|
1002
1002
|
DeleteImageOption(info, "dispose");
|
1003
|
-
return
|
1003
|
+
return disp;
|
1004
1004
|
}
|
1005
1005
|
|
1006
1006
|
VALUE_TO_ENUM(disp, dispose, DisposeType);
|
@@ -1096,8 +1096,8 @@ Info_extract(VALUE self)
|
|
1096
1096
|
/**
|
1097
1097
|
* Set the extract geometry.
|
1098
1098
|
*
|
1099
|
-
* @param extract_arg [String] the extract string
|
1100
|
-
* @return [String] the given value
|
1099
|
+
* @param extract_arg [Magick::Geometry, String] the extract string
|
1100
|
+
* @return [Magick::Geometry, String] the given value
|
1101
1101
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1102
1102
|
*/
|
1103
1103
|
VALUE
|
@@ -1113,7 +1113,7 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1113
1113
|
{
|
1114
1114
|
magick_free(info->extract);
|
1115
1115
|
info->extract = NULL;
|
1116
|
-
return
|
1116
|
+
return extract_arg;
|
1117
1117
|
}
|
1118
1118
|
|
1119
1119
|
extract = rb_String(extract_arg);
|
@@ -1431,7 +1431,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1431
1431
|
if (NIL_P(grav))
|
1432
1432
|
{
|
1433
1433
|
DeleteImageOption(info, "gravity");
|
1434
|
-
return
|
1434
|
+
return grav;
|
1435
1435
|
}
|
1436
1436
|
|
1437
1437
|
VALUE_TO_ENUM(grav, gravity, GravityType);
|
@@ -1668,8 +1668,8 @@ Info_origin(VALUE self)
|
|
1668
1668
|
* The geometry format is
|
1669
1669
|
* +-x+-y
|
1670
1670
|
*
|
1671
|
-
* @param origin_arg [String] the origin geometry
|
1672
|
-
* @return [String] the given value
|
1671
|
+
* @param origin_arg [Magick::Geometry, String] the origin geometry
|
1672
|
+
* @return [Magick::Geometry, String] the given value
|
1673
1673
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1674
1674
|
*/
|
1675
1675
|
VALUE
|
@@ -1684,7 +1684,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1684
1684
|
if (NIL_P(origin_arg))
|
1685
1685
|
{
|
1686
1686
|
DeleteImageOption(info, "origin");
|
1687
|
-
return
|
1687
|
+
return origin_arg;
|
1688
1688
|
}
|
1689
1689
|
|
1690
1690
|
origin_str = rb_String(origin_arg);
|
@@ -1724,8 +1724,8 @@ Info_page(VALUE self)
|
|
1724
1724
|
* Store the Postscript page geometry. Argument may be a Geometry object as well
|
1725
1725
|
* as a geometry string.
|
1726
1726
|
*
|
1727
|
-
* @param page_arg [String] the geometry
|
1728
|
-
* @return [String] the given value
|
1727
|
+
* @param page_arg [Magick::Geometry, String] the geometry
|
1728
|
+
* @return [Magick::Geometry, String] the given value
|
1729
1729
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1730
1730
|
*/
|
1731
1731
|
VALUE
|
@@ -1740,7 +1740,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1740
1740
|
{
|
1741
1741
|
magick_free(info->page);
|
1742
1742
|
info->page = NULL;
|
1743
|
-
return
|
1743
|
+
return page_arg;
|
1744
1744
|
}
|
1745
1745
|
geom_str = rb_String(page_arg);
|
1746
1746
|
geometry = GetPageGeometry(StringValueCStr(geom_str));
|
@@ -1748,7 +1748,7 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1748
1748
|
{
|
1749
1749
|
magick_free(info->page);
|
1750
1750
|
info->page = NULL;
|
1751
|
-
return
|
1751
|
+
return page_arg;
|
1752
1752
|
}
|
1753
1753
|
info->page = geometry;
|
1754
1754
|
|
@@ -1949,8 +1949,8 @@ Info_size(VALUE self)
|
|
1949
1949
|
/**
|
1950
1950
|
* Set the size (either as a Geometry object or a Geometry string
|
1951
1951
|
*
|
1952
|
-
* @param size_arg [String] the size
|
1953
|
-
* @return [String] the given value
|
1952
|
+
* @param size_arg [Magick::Geometry, String] the size
|
1953
|
+
* @return [Magick::Geometry, String] the given value
|
1954
1954
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1955
1955
|
*/
|
1956
1956
|
VALUE
|
@@ -1966,7 +1966,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
1966
1966
|
{
|
1967
1967
|
magick_free(info->size);
|
1968
1968
|
info->size = NULL;
|
1969
|
-
return
|
1969
|
+
return size_arg;
|
1970
1970
|
}
|
1971
1971
|
|
1972
1972
|
size = rb_String(size_arg);
|
@@ -2100,8 +2100,8 @@ Info_tile_offset(VALUE self)
|
|
2100
2100
|
/**
|
2101
2101
|
* Set tile offset geometry.
|
2102
2102
|
*
|
2103
|
-
* @param offset [String] the offset geometry
|
2104
|
-
* @return [String] the given value
|
2103
|
+
* @param offset [Magick::Geometry, String] the offset geometry
|
2104
|
+
* @return [Magick::Geometry, String] the given value
|
2105
2105
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2106
2106
|
*/
|
2107
2107
|
VALUE
|
@@ -2401,7 +2401,8 @@ rm_info_new(void)
|
|
2401
2401
|
* @overload initialize
|
2402
2402
|
*
|
2403
2403
|
* @overload initialize
|
2404
|
-
* @yield [
|
2404
|
+
* @yield [info]
|
2405
|
+
* @yieldparam info [Magick::Image::Info]
|
2405
2406
|
*
|
2406
2407
|
* @return self
|
2407
2408
|
*/
|
data/ext/RMagick/rmkinfo.cpp
CHANGED
@@ -74,15 +74,13 @@ VALUE
|
|
74
74
|
KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
75
75
|
{
|
76
76
|
KernelInfo *kernel;
|
77
|
+
char *string = StringValueCStr(kernel_string);
|
78
|
+
|
77
79
|
#if defined(IMAGEMAGICK_7)
|
78
80
|
ExceptionInfo *exception;
|
79
|
-
#endif
|
80
|
-
|
81
|
-
Check_Type(kernel_string, T_STRING);
|
82
81
|
|
83
|
-
#if defined(IMAGEMAGICK_7)
|
84
82
|
exception = AcquireExceptionInfo();
|
85
|
-
kernel = AcquireKernelInfo(
|
83
|
+
kernel = AcquireKernelInfo(string, exception);
|
86
84
|
if (rm_should_raise_exception(exception, DestroyExceptionRetention))
|
87
85
|
{
|
88
86
|
if (kernel != (KernelInfo *) NULL)
|
@@ -92,7 +90,7 @@ KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
|
92
90
|
rm_raise_exception(exception);
|
93
91
|
}
|
94
92
|
#else
|
95
|
-
kernel = AcquireKernelInfo(
|
93
|
+
kernel = AcquireKernelInfo(string);
|
96
94
|
#endif
|
97
95
|
|
98
96
|
if (!kernel)
|
@@ -114,9 +112,6 @@ KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
|
114
112
|
VALUE
|
115
113
|
KernelInfo_unity_add(VALUE self, VALUE scale)
|
116
114
|
{
|
117
|
-
if (!FIXNUM_P(scale))
|
118
|
-
Check_Type(scale, T_FLOAT);
|
119
|
-
|
120
115
|
GVL_STRUCT_TYPE(UnityAddKernelInfo) args = { (KernelInfo*)DATA_PTR(self), NUM2DBL(scale) };
|
121
116
|
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnityAddKernelInfo), &args);
|
122
117
|
return Qnil;
|
@@ -136,13 +131,7 @@ KernelInfo_scale(VALUE self, VALUE scale, VALUE flags)
|
|
136
131
|
{
|
137
132
|
GeometryFlags geoflags;
|
138
133
|
|
139
|
-
|
140
|
-
Check_Type(scale, T_FLOAT);
|
141
|
-
|
142
|
-
if (rb_obj_is_instance_of(flags, Class_GeometryFlags))
|
143
|
-
VALUE_TO_ENUM(flags, geoflags, GeometryFlags);
|
144
|
-
else
|
145
|
-
rb_raise(rb_eArgError, "expected Integer or Magick::GeometryFlags to specify flags");
|
134
|
+
VALUE_TO_ENUM(flags, geoflags, GeometryFlags);
|
146
135
|
|
147
136
|
GVL_STRUCT_TYPE(ScaleKernelInfo) args = { (KernelInfo*)DATA_PTR(self), NUM2DBL(scale), geoflags };
|
148
137
|
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ScaleKernelInfo), &args);
|
@@ -158,7 +147,6 @@ KernelInfo_scale(VALUE self, VALUE scale, VALUE flags)
|
|
158
147
|
VALUE
|
159
148
|
KernelInfo_scale_geometry(VALUE self, VALUE geometry)
|
160
149
|
{
|
161
|
-
Check_Type(geometry, T_STRING);
|
162
150
|
GVL_STRUCT_TYPE(ScaleGeometryKernelInfo) args = { (KernelInfo*)DATA_PTR(self), StringValueCStr(geometry) };
|
163
151
|
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ScaleGeometryKernelInfo), &args);
|
164
152
|
return Qnil;
|
@@ -195,7 +183,6 @@ KernelInfo_builtin(VALUE self, VALUE what, VALUE geometry)
|
|
195
183
|
ExceptionInfo *exception;
|
196
184
|
#endif
|
197
185
|
|
198
|
-
Check_Type(geometry, T_STRING);
|
199
186
|
VALUE_TO_ENUM(what, kernel_type, KernelInfoType);
|
200
187
|
ParseGeometry(StringValueCStr(geometry), &info);
|
201
188
|
|
data/ext/RMagick/rmmain.cpp
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
#define MAIN // Define external variables
|
15
15
|
#include "rmagick.h"
|
16
16
|
|
17
|
-
#if defined(HAVE_SETMAGICKALIGNEDMEMORYMETHODS)
|
17
|
+
#if defined(HAVE_SETMAGICKALIGNEDMEMORYMETHODS)
|
18
18
|
#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE__ALIGNED_MSIZE)
|
19
19
|
#define USE_RM_ALIGNED_MALLOC 1
|
20
20
|
|
@@ -653,30 +653,33 @@ Init_RMagick2(void)
|
|
653
653
|
rb_define_alloc_func(Class_Draw, Draw_alloc);
|
654
654
|
|
655
655
|
// Define the attributes
|
656
|
-
|
657
|
-
rb_define_method(
|
658
|
-
rb_define_method(
|
659
|
-
rb_define_method(
|
660
|
-
rb_define_method(
|
661
|
-
rb_define_method(
|
662
|
-
rb_define_method(
|
663
|
-
rb_define_method(
|
664
|
-
rb_define_method(
|
665
|
-
rb_define_method(
|
666
|
-
rb_define_method(
|
667
|
-
rb_define_method(
|
668
|
-
rb_define_method(
|
669
|
-
rb_define_method(
|
670
|
-
rb_define_method(
|
671
|
-
rb_define_method(
|
672
|
-
rb_define_method(
|
673
|
-
rb_define_method(
|
674
|
-
rb_define_method(
|
675
|
-
rb_define_method(
|
676
|
-
rb_define_method(
|
677
|
-
rb_define_method(
|
678
|
-
rb_define_method(
|
679
|
-
rb_define_method(
|
656
|
+
Module_DrawAttribute = rb_define_module_under(Module_Magick, "DrawAttribute");
|
657
|
+
rb_define_method(Module_DrawAttribute, "affine=", RUBY_METHOD_FUNC(Draw_affine_eq), 1);
|
658
|
+
rb_define_method(Module_DrawAttribute, "align=", RUBY_METHOD_FUNC(Draw_align_eq), 1);
|
659
|
+
rb_define_method(Module_DrawAttribute, "decorate=", RUBY_METHOD_FUNC(Draw_decorate_eq), 1);
|
660
|
+
rb_define_method(Module_DrawAttribute, "density=", RUBY_METHOD_FUNC(Draw_density_eq), 1);
|
661
|
+
rb_define_method(Module_DrawAttribute, "encoding=", RUBY_METHOD_FUNC(Draw_encoding_eq), 1);
|
662
|
+
rb_define_method(Module_DrawAttribute, "fill=", RUBY_METHOD_FUNC(Draw_fill_eq), 1);
|
663
|
+
rb_define_method(Module_DrawAttribute, "fill_pattern=", RUBY_METHOD_FUNC(Draw_fill_pattern_eq), 1);
|
664
|
+
rb_define_method(Module_DrawAttribute, "font=", RUBY_METHOD_FUNC(Draw_font_eq), 1);
|
665
|
+
rb_define_method(Module_DrawAttribute, "font_family=", RUBY_METHOD_FUNC(Draw_font_family_eq), 1);
|
666
|
+
rb_define_method(Module_DrawAttribute, "font_stretch=", RUBY_METHOD_FUNC(Draw_font_stretch_eq), 1);
|
667
|
+
rb_define_method(Module_DrawAttribute, "font_style=", RUBY_METHOD_FUNC(Draw_font_style_eq), 1);
|
668
|
+
rb_define_method(Module_DrawAttribute, "font_weight=", RUBY_METHOD_FUNC(Draw_font_weight_eq), 1);
|
669
|
+
rb_define_method(Module_DrawAttribute, "gravity=", RUBY_METHOD_FUNC(Draw_gravity_eq), 1);
|
670
|
+
rb_define_method(Module_DrawAttribute, "interline_spacing=", RUBY_METHOD_FUNC(Draw_interline_spacing_eq), 1);
|
671
|
+
rb_define_method(Module_DrawAttribute, "interword_spacing=", RUBY_METHOD_FUNC(Draw_interword_spacing_eq), 1);
|
672
|
+
rb_define_method(Module_DrawAttribute, "kerning=", RUBY_METHOD_FUNC(Draw_kerning_eq), 1);
|
673
|
+
rb_define_method(Module_DrawAttribute, "pointsize=", RUBY_METHOD_FUNC(Draw_pointsize_eq), 1);
|
674
|
+
rb_define_method(Module_DrawAttribute, "rotation=", RUBY_METHOD_FUNC(Draw_rotation_eq), 1);
|
675
|
+
rb_define_method(Module_DrawAttribute, "stroke=", RUBY_METHOD_FUNC(Draw_stroke_eq), 1);
|
676
|
+
rb_define_method(Module_DrawAttribute, "stroke_pattern=", RUBY_METHOD_FUNC(Draw_stroke_pattern_eq), 1);
|
677
|
+
rb_define_method(Module_DrawAttribute, "stroke_width=", RUBY_METHOD_FUNC(Draw_stroke_width_eq), 1);
|
678
|
+
rb_define_method(Module_DrawAttribute, "text_antialias=", RUBY_METHOD_FUNC(Draw_text_antialias_eq), 1);
|
679
|
+
rb_define_method(Module_DrawAttribute, "tile=", RUBY_METHOD_FUNC(Draw_tile_eq), 1);
|
680
|
+
rb_define_method(Module_DrawAttribute, "undercolor=", RUBY_METHOD_FUNC(Draw_undercolor_eq), 1);
|
681
|
+
|
682
|
+
rb_include_module(Class_Draw, Module_DrawAttribute);
|
680
683
|
|
681
684
|
rb_define_method(Class_Draw, "annotate", RUBY_METHOD_FUNC(Draw_annotate), 6);
|
682
685
|
rb_define_method(Class_Draw, "clone", RUBY_METHOD_FUNC(Draw_clone), 0);
|
@@ -704,27 +707,8 @@ Init_RMagick2(void)
|
|
704
707
|
|
705
708
|
rb_define_method(Class_DrawOptions, "initialize", RUBY_METHOD_FUNC(DrawOptions_initialize), 0);
|
706
709
|
|
707
|
-
|
708
|
-
|
709
|
-
rb_define_method(Class_DrawOptions, "decorate=", RUBY_METHOD_FUNC(Draw_decorate_eq), 1);
|
710
|
-
rb_define_method(Class_DrawOptions, "density=", RUBY_METHOD_FUNC(Draw_density_eq), 1);
|
711
|
-
rb_define_method(Class_DrawOptions, "encoding=", RUBY_METHOD_FUNC(Draw_encoding_eq), 1);
|
712
|
-
rb_define_method(Class_DrawOptions, "fill=", RUBY_METHOD_FUNC(Draw_fill_eq), 1);
|
713
|
-
rb_define_method(Class_DrawOptions, "fill_pattern=", RUBY_METHOD_FUNC(Draw_fill_pattern_eq), 1);
|
714
|
-
rb_define_method(Class_DrawOptions, "font=", RUBY_METHOD_FUNC(Draw_font_eq), 1);
|
715
|
-
rb_define_method(Class_DrawOptions, "font_family=", RUBY_METHOD_FUNC(Draw_font_family_eq), 1);
|
716
|
-
rb_define_method(Class_DrawOptions, "font_stretch=", RUBY_METHOD_FUNC(Draw_font_stretch_eq), 1);
|
717
|
-
rb_define_method(Class_DrawOptions, "font_style=", RUBY_METHOD_FUNC(Draw_font_style_eq), 1);
|
718
|
-
rb_define_method(Class_DrawOptions, "font_weight=", RUBY_METHOD_FUNC(Draw_font_weight_eq), 1);
|
719
|
-
rb_define_method(Class_DrawOptions, "gravity=", RUBY_METHOD_FUNC(Draw_gravity_eq), 1);
|
720
|
-
rb_define_method(Class_DrawOptions, "pointsize=", RUBY_METHOD_FUNC(Draw_pointsize_eq), 1);
|
721
|
-
rb_define_method(Class_DrawOptions, "rotation=", RUBY_METHOD_FUNC(Draw_rotation_eq), 1);
|
722
|
-
rb_define_method(Class_DrawOptions, "stroke=", RUBY_METHOD_FUNC(Draw_stroke_eq), 1);
|
723
|
-
rb_define_method(Class_DrawOptions, "stroke_pattern=", RUBY_METHOD_FUNC(Draw_stroke_pattern_eq), 1);
|
724
|
-
rb_define_method(Class_DrawOptions, "stroke_width=", RUBY_METHOD_FUNC(Draw_stroke_width_eq), 1);
|
725
|
-
rb_define_method(Class_DrawOptions, "text_antialias=", RUBY_METHOD_FUNC(Draw_text_antialias_eq), 1);
|
726
|
-
rb_define_method(Class_DrawOptions, "tile=", RUBY_METHOD_FUNC(Draw_tile_eq), 1);
|
727
|
-
rb_define_method(Class_DrawOptions, "undercolor=", RUBY_METHOD_FUNC(Draw_undercolor_eq), 1);
|
710
|
+
rb_include_module(Class_DrawOptions, Module_DrawAttribute);
|
711
|
+
|
728
712
|
|
729
713
|
/*-----------------------------------------------------------------------*/
|
730
714
|
/* Class Magick::Pixel */
|
@@ -948,25 +932,7 @@ Init_RMagick2(void)
|
|
948
932
|
rb_define_method(Class_PolaroidOptions, "border_color=", RUBY_METHOD_FUNC(PolaroidOptions_border_color_eq), 1);
|
949
933
|
|
950
934
|
// The other attribute writer methods are implemented by Draw's functions
|
951
|
-
|
952
|
-
rb_define_method(Class_PolaroidOptions, "decorate=", RUBY_METHOD_FUNC(Draw_decorate_eq), 1);
|
953
|
-
rb_define_method(Class_PolaroidOptions, "density=", RUBY_METHOD_FUNC(Draw_density_eq), 1);
|
954
|
-
rb_define_method(Class_PolaroidOptions, "encoding=", RUBY_METHOD_FUNC(Draw_encoding_eq), 1);
|
955
|
-
rb_define_method(Class_PolaroidOptions, "fill=", RUBY_METHOD_FUNC(Draw_fill_eq), 1);
|
956
|
-
rb_define_method(Class_PolaroidOptions, "fill_pattern=", RUBY_METHOD_FUNC(Draw_fill_pattern_eq), 1);
|
957
|
-
rb_define_method(Class_PolaroidOptions, "font=", RUBY_METHOD_FUNC(Draw_font_eq), 1);
|
958
|
-
rb_define_method(Class_PolaroidOptions, "font_family=", RUBY_METHOD_FUNC(Draw_font_family_eq), 1);
|
959
|
-
rb_define_method(Class_PolaroidOptions, "font_stretch=", RUBY_METHOD_FUNC(Draw_font_stretch_eq), 1);
|
960
|
-
rb_define_method(Class_PolaroidOptions, "font_style=", RUBY_METHOD_FUNC(Draw_font_style_eq), 1);
|
961
|
-
rb_define_method(Class_PolaroidOptions, "font_weight=", RUBY_METHOD_FUNC(Draw_font_weight_eq), 1);
|
962
|
-
rb_define_method(Class_PolaroidOptions, "gravity=", RUBY_METHOD_FUNC(Draw_gravity_eq), 1);
|
963
|
-
rb_define_method(Class_PolaroidOptions, "pointsize=", RUBY_METHOD_FUNC(Draw_pointsize_eq), 1);
|
964
|
-
rb_define_method(Class_PolaroidOptions, "stroke=", RUBY_METHOD_FUNC(Draw_stroke_eq), 1);
|
965
|
-
rb_define_method(Class_PolaroidOptions, "stroke_pattern=", RUBY_METHOD_FUNC(Draw_stroke_pattern_eq), 1);
|
966
|
-
rb_define_method(Class_PolaroidOptions, "stroke_width=", RUBY_METHOD_FUNC(Draw_stroke_width_eq), 1);
|
967
|
-
rb_define_method(Class_PolaroidOptions, "text_antialias=", RUBY_METHOD_FUNC(Draw_text_antialias_eq), 1);
|
968
|
-
rb_define_method(Class_PolaroidOptions, "undercolor=", RUBY_METHOD_FUNC(Draw_undercolor_eq), 1);
|
969
|
-
|
935
|
+
rb_include_module(Class_PolaroidOptions, Module_DrawAttribute);
|
970
936
|
|
971
937
|
/*-----------------------------------------------------------------------*/
|
972
938
|
/* Magick::******Fill classes and methods */
|
@@ -1053,10 +1019,8 @@ Init_RMagick2(void)
|
|
1053
1019
|
ENUMERATOR(ShapeAlphaChannel)
|
1054
1020
|
ENUMERATOR(TransparentAlphaChannel)
|
1055
1021
|
ENUMERATOR(BackgroundAlphaChannel)
|
1056
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1057
1022
|
ENUMERATOR(AssociateAlphaChannel)
|
1058
1023
|
ENUMERATOR(DisassociateAlphaChannel)
|
1059
|
-
#endif
|
1060
1024
|
#if defined(IMAGEMAGICK_7)
|
1061
1025
|
ENUMERATOR(OnAlphaChannel)
|
1062
1026
|
ENUMERATOR(OffAlphaChannel)
|
@@ -1086,7 +1050,12 @@ Init_RMagick2(void)
|
|
1086
1050
|
ENUMERATOR(BlackChannel)
|
1087
1051
|
ENUMERATOR(IndexChannel)
|
1088
1052
|
ENUMERATOR(GrayChannel)
|
1053
|
+
ENUMERATOR(CompositeChannels)
|
1089
1054
|
ENUMERATOR(AllChannels)
|
1055
|
+
ENUMERATOR(TrueAlphaChannel)
|
1056
|
+
ENUMERATOR(RGBChannels)
|
1057
|
+
ENUMERATOR(GrayChannels)
|
1058
|
+
ENUMERATOR(SyncChannels)
|
1090
1059
|
ENUMERATORV(AlphaChannel, OpacityChannel)
|
1091
1060
|
ENUMERATORV(DefaultChannels, 0xff & ~OpacityChannel)
|
1092
1061
|
ENUMERATORV(HueChannel, RedChannel)
|
@@ -1124,7 +1093,6 @@ Init_RMagick2(void)
|
|
1124
1093
|
ENUMERATOR(Rec709YCbCrColorspace)
|
1125
1094
|
ENUMERATOR(LogColorspace)
|
1126
1095
|
ENUMERATOR(CMYColorspace)
|
1127
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1128
1096
|
ENUMERATOR(LuvColorspace)
|
1129
1097
|
ENUMERATOR(HCLColorspace)
|
1130
1098
|
ENUMERATOR(LCHColorspace)
|
@@ -1137,7 +1105,6 @@ Init_RMagick2(void)
|
|
1137
1105
|
ENUMERATOR(HCLpColorspace)
|
1138
1106
|
ENUMERATOR(YDbDrColorspace)
|
1139
1107
|
ENUMERATORV(XyYColorspace, xyYColorspace)
|
1140
|
-
#endif
|
1141
1108
|
#if defined(IMAGEMAGICK_7)
|
1142
1109
|
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_7_0_8)
|
1143
1110
|
ENUMERATOR(LinearGRAYColorspace)
|
@@ -1230,9 +1197,7 @@ Init_RMagick2(void)
|
|
1230
1197
|
ENUMERATOR(UndefinedCompositeOp)
|
1231
1198
|
ENUMERATOR(VividLightCompositeOp)
|
1232
1199
|
ENUMERATOR(XorCompositeOp)
|
1233
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1234
1200
|
ENUMERATOR(HardMixCompositeOp)
|
1235
|
-
#endif
|
1236
1201
|
#if defined(IMAGEMAGICK_7)
|
1237
1202
|
ENUMERATOR(CopyAlphaCompositeOp)
|
1238
1203
|
#else
|
@@ -1276,6 +1241,7 @@ Init_RMagick2(void)
|
|
1276
1241
|
|
1277
1242
|
// DisposeType constants
|
1278
1243
|
DEF_ENUM(DisposeType)
|
1244
|
+
ENUMERATOR(UnrecognizedDispose)
|
1279
1245
|
ENUMERATOR(UndefinedDispose)
|
1280
1246
|
ENUMERATOR(BackgroundDispose)
|
1281
1247
|
ENUMERATOR(NoneDispose)
|
@@ -1352,9 +1318,7 @@ Init_RMagick2(void)
|
|
1352
1318
|
ENUMERATOR(RobidouxSharpFilter)
|
1353
1319
|
ENUMERATOR(CosineFilter)
|
1354
1320
|
ENUMERATOR(SplineFilter)
|
1355
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1356
1321
|
ENUMERATOR(LanczosRadiusFilter)
|
1357
|
-
#endif
|
1358
1322
|
ENUMERATORV(WelchFilter, WelshFilter)
|
1359
1323
|
ENUMERATORV(HannFilter, HanningFilter)
|
1360
1324
|
END_ENUM
|
@@ -1446,9 +1410,7 @@ Init_RMagick2(void)
|
|
1446
1410
|
ENUMERATOR(RootMeanSquaredErrorMetric)
|
1447
1411
|
ENUMERATOR(NormalizedCrossCorrelationErrorMetric)
|
1448
1412
|
ENUMERATOR(FuzzErrorMetric)
|
1449
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1450
1413
|
ENUMERATOR(PerceptualHashErrorMetric)
|
1451
|
-
#endif
|
1452
1414
|
#if defined(IMAGEMAGICK_7)
|
1453
1415
|
ENUMERATOR(UndefinedErrorMetric)
|
1454
1416
|
ENUMERATOR(MeanErrorPerPixelErrorMetric)
|
@@ -1580,9 +1542,7 @@ Init_RMagick2(void)
|
|
1580
1542
|
ENUMERATOR(ExponentialQuantumOperator)
|
1581
1543
|
ENUMERATOR(MedianQuantumOperator)
|
1582
1544
|
ENUMERATOR(SumQuantumOperator)
|
1583
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1584
1545
|
ENUMERATOR(RootMeanSquareQuantumOperator)
|
1585
|
-
#endif
|
1586
1546
|
END_ENUM
|
1587
1547
|
|
1588
1548
|
// RenderingIntent
|
@@ -1707,9 +1667,7 @@ Init_RMagick2(void)
|
|
1707
1667
|
ENUMERATOR(CorrelateNormalizeValue)
|
1708
1668
|
ENUMERATOR(AreaValue)
|
1709
1669
|
ENUMERATOR(DecimalValue)
|
1710
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1711
1670
|
ENUMERATOR(SeparatorValue)
|
1712
|
-
#endif
|
1713
1671
|
ENUMERATOR(AllValues)
|
1714
1672
|
END_ENUM
|
1715
1673
|
|
@@ -1778,9 +1736,7 @@ Init_RMagick2(void)
|
|
1778
1736
|
ENUMERATOR(OctagonalKernel)
|
1779
1737
|
ENUMERATOR(EuclideanKernel)
|
1780
1738
|
ENUMERATOR(UserDefinedKernel)
|
1781
|
-
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
1782
1739
|
ENUMERATOR(BinomialKernel)
|
1783
|
-
#endif
|
1784
1740
|
END_ENUM
|
1785
1741
|
|
1786
1742
|
/*-----------------------------------------------------------------------*/
|
@@ -1856,25 +1812,20 @@ Init_RMagick2(void)
|
|
1856
1812
|
* were compiled with.
|
1857
1813
|
*
|
1858
1814
|
* No Ruby usage (internal function)
|
1859
|
-
*
|
1860
|
-
* Notes:
|
1861
|
-
* - Bypass the test by defining the constant RMAGICK_BYPASS_VERSION_TEST to
|
1862
|
-
* 'true' at the top level, before requiring 'rmagick'
|
1863
1815
|
*/
|
1864
1816
|
static void
|
1865
1817
|
test_Magick_version(void)
|
1866
1818
|
{
|
1867
1819
|
size_t version_number;
|
1868
1820
|
const char *version_str;
|
1869
|
-
ID bypass = rb_intern("RMAGICK_BYPASS_VERSION_TEST");
|
1870
1821
|
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1822
|
+
/* ImageMagick versions are defined as major, minor and patch, each of which are defined as a value in 1 byte. */
|
1823
|
+
/* ImageMagick 6.9.12 has `#define MagickLibVersion 0x69C` */
|
1824
|
+
/* It use only major and minor versions. */
|
1825
|
+
size_t mask_major_minor_version = 0xFFFFFFF0;
|
1875
1826
|
|
1876
1827
|
version_str = GetMagickVersion(&version_number);
|
1877
|
-
if (version_number != MagickLibVersion)
|
1828
|
+
if ((version_number & mask_major_minor_version) != (MagickLibVersion & mask_major_minor_version))
|
1878
1829
|
{
|
1879
1830
|
int n, x;
|
1880
1831
|
|
data/ext/RMagick/rmmontage.cpp
CHANGED
@@ -235,7 +235,7 @@ Montage_font_eq(VALUE self, VALUE font)
|
|
235
235
|
* <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
|
236
236
|
* or a Geometry object
|
237
237
|
*
|
238
|
-
* @param frame_arg [String] the frame geometry
|
238
|
+
* @param frame_arg [Magick::Geometry, String] the frame geometry
|
239
239
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
240
240
|
*/
|
241
241
|
VALUE
|
@@ -261,8 +261,8 @@ Montage_frame_eq(VALUE self, VALUE frame_arg)
|
|
261
261
|
* <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
|
262
262
|
* or a Geometry object
|
263
263
|
*
|
264
|
-
* @param geometry_arg [String] the geometry
|
265
|
-
* @return [String] the given geometry
|
264
|
+
* @param geometry_arg [Magick::Geometry, String] the geometry
|
265
|
+
* @return [Magick::Geometry, String] the given geometry
|
266
266
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
267
267
|
*/
|
268
268
|
VALUE
|
@@ -422,8 +422,8 @@ Montage_texture_eq(VALUE self, VALUE texture)
|
|
422
422
|
* <width>x<height>+<outer-bevel-width>+<inner-bevel-width>
|
423
423
|
* or a Geometry object
|
424
424
|
*
|
425
|
-
* @param tile_arg [String] the tile geometry
|
426
|
-
* @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
|
427
427
|
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
428
428
|
*/
|
429
429
|
VALUE
|
data/ext/RMagick/rmpixel.cpp
CHANGED
@@ -595,7 +595,7 @@ Pixel_eql_q(VALUE self, VALUE other)
|
|
595
595
|
* Compare pixel values for equality.
|
596
596
|
*
|
597
597
|
* @overload fcmp(other, fuzz = 0.0, colorspace = Magick::RGBColorspace)
|
598
|
-
* @param other [Magick::Pixel] The pixel to which the receiver is compared
|
598
|
+
* @param other [Magick::Pixel, String] The pixel to which the receiver is compared
|
599
599
|
* @param fuzz [Numeric] The amount of fuzz to allow before the colors are considered to be different
|
600
600
|
* @param colorspace [Magick::ColorspaceType] The colorspace
|
601
601
|
* @return [Boolean] true if equal, otherwise false
|
@@ -1191,7 +1191,7 @@ rm_set_magick_pixel_packet(Pixel *pixel, MagickPixel *pp)
|
|
1191
1191
|
/**
|
1192
1192
|
* Return the color name corresponding to the pixel values.
|
1193
1193
|
*
|
1194
|
-
* @overload to_color(compliance = Magick::AllCompliance, alpha = false, depth = Magick::MAGICKCORE_QUANTUM_DEPTH, hex =
|
1194
|
+
* @overload to_color(compliance = Magick::AllCompliance, alpha = false, depth = Magick::MAGICKCORE_QUANTUM_DEPTH, hex = true)
|
1195
1195
|
* @param compliance [Magick::ComplianceType] A ComplianceType constant
|
1196
1196
|
* @param alpha [Boolean] If false, the pixel's alpha attribute is ignored
|
1197
1197
|
* @param depth [Numeric] An image depth
|
@@ -1205,7 +1205,7 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self)
|
|
1205
1205
|
Image *image;
|
1206
1206
|
Pixel *pixel;
|
1207
1207
|
MagickPixel mpp;
|
1208
|
-
MagickBooleanType hex =
|
1208
|
+
MagickBooleanType hex = MagickTrue;
|
1209
1209
|
char name[MaxTextExtent];
|
1210
1210
|
ExceptionInfo *exception;
|
1211
1211
|
ComplianceType compliance = AllCompliance;
|