rmagick 4.2.6 → 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/ImageMagick6/devcontainer.json +1 -1
- data/.devcontainer/{ImageMagick7/devcontainer.json → devcontainer.json} +2 -2
- data/.devcontainer/setup-user.sh +1 -1
- data/.editorconfig +1 -1
- data/.github/workflows/ci.yml +87 -9
- data/.gitignore +4 -0
- data/.rubocop_todo.yml +16 -9
- data/.yardopts +1 -1
- data/CHANGELOG.md +130 -0
- data/Gemfile +20 -0
- data/README.md +10 -17
- data/Rakefile +63 -80
- data/before_install_linux.sh +3 -3
- data/before_install_osx.sh +6 -5
- data/ext/RMagick/extconf.rb +112 -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} +1543 -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 +4 -13
- 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 +59 -129
- data/.codeclimate.yml +0 -63
- data/deprecated/RMagick.rb +0 -6
- data/ext/RMagick/rmmain.c +0 -1951
@@ -3,15 +3,30 @@
|
|
3
3
|
*
|
4
4
|
* Copyright © RMagick Project
|
5
5
|
*
|
6
|
-
* @file rmkinfo.
|
7
|
-
* @version $Id: rmkinfo.
|
6
|
+
* @file rmkinfo.cpp
|
7
|
+
* @version $Id: rmkinfo.cpp,v 1.0 2011/11/29 15:33:14 naquad Exp $
|
8
8
|
* @author Naquad
|
9
9
|
****************************************************************************/
|
10
10
|
|
11
11
|
#include "rmagick.h"
|
12
12
|
|
13
|
+
static void rm_kernel_info_destroy(void *kernel);
|
14
|
+
static size_t rm_kernel_info_memsize(const void *ptr);
|
15
|
+
|
16
|
+
const rb_data_type_t rm_kernel_info_data_type = {
|
17
|
+
"Magick::KernelInfo",
|
18
|
+
{ NULL, rm_kernel_info_destroy, rm_kernel_info_memsize, },
|
19
|
+
0, 0,
|
20
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
21
|
+
};
|
22
|
+
|
23
|
+
DEFINE_GVL_VOID_STUB2(UnityAddKernelInfo, KernelInfo *, const double);
|
24
|
+
DEFINE_GVL_VOID_STUB3(ScaleKernelInfo, KernelInfo *, const double, const GeometryFlags);
|
25
|
+
DEFINE_GVL_VOID_STUB2(ScaleGeometryKernelInfo, KernelInfo *, const char *);
|
26
|
+
|
27
|
+
|
13
28
|
/**
|
14
|
-
* If there's a kernel info, delete it before destroying the KernelInfo
|
29
|
+
* If there's a kernel info, delete it before destroying the KernelInfo
|
15
30
|
*
|
16
31
|
* No Ruby usage (internal function)
|
17
32
|
*
|
@@ -25,15 +40,28 @@ rm_kernel_info_destroy(void *kernel)
|
|
25
40
|
DestroyKernelInfo((KernelInfo*)kernel);
|
26
41
|
}
|
27
42
|
|
43
|
+
/**
|
44
|
+
* Get KernelInfo object size.
|
45
|
+
*
|
46
|
+
* No Ruby usage (internal function)
|
47
|
+
*
|
48
|
+
* @param ptr pointer to the KernelInfo object
|
49
|
+
*/
|
50
|
+
static size_t
|
51
|
+
rm_kernel_info_memsize(const void *ptr)
|
52
|
+
{
|
53
|
+
return sizeof(KernelInfo);
|
54
|
+
}
|
55
|
+
|
28
56
|
/**
|
29
57
|
* Create a KernelInfo object.
|
30
58
|
*
|
31
59
|
* @return [Magick::KernelInfo] a new KernelInfo object
|
32
60
|
*/
|
33
61
|
VALUE
|
34
|
-
KernelInfo_alloc(VALUE
|
62
|
+
KernelInfo_alloc(VALUE klass)
|
35
63
|
{
|
36
|
-
return
|
64
|
+
return TypedData_Wrap_Struct(klass, &rm_kernel_info_data_type, NULL);
|
37
65
|
}
|
38
66
|
|
39
67
|
/**
|
@@ -46,15 +74,13 @@ VALUE
|
|
46
74
|
KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
47
75
|
{
|
48
76
|
KernelInfo *kernel;
|
77
|
+
char *string = StringValueCStr(kernel_string);
|
78
|
+
|
49
79
|
#if defined(IMAGEMAGICK_7)
|
50
80
|
ExceptionInfo *exception;
|
51
|
-
#endif
|
52
81
|
|
53
|
-
Check_Type(kernel_string, T_STRING);
|
54
|
-
|
55
|
-
#if defined(IMAGEMAGICK_7)
|
56
82
|
exception = AcquireExceptionInfo();
|
57
|
-
kernel = AcquireKernelInfo(
|
83
|
+
kernel = AcquireKernelInfo(string, exception);
|
58
84
|
if (rm_should_raise_exception(exception, DestroyExceptionRetention))
|
59
85
|
{
|
60
86
|
if (kernel != (KernelInfo *) NULL)
|
@@ -64,7 +90,7 @@ KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
|
64
90
|
rm_raise_exception(exception);
|
65
91
|
}
|
66
92
|
#else
|
67
|
-
kernel = AcquireKernelInfo(
|
93
|
+
kernel = AcquireKernelInfo(string);
|
68
94
|
#endif
|
69
95
|
|
70
96
|
if (!kernel)
|
@@ -86,13 +112,8 @@ KernelInfo_initialize(VALUE self, VALUE kernel_string)
|
|
86
112
|
VALUE
|
87
113
|
KernelInfo_unity_add(VALUE self, VALUE scale)
|
88
114
|
{
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
/* UnityAddKernelInfo() was private function until IM 6.9 */
|
93
|
-
MagickExport void UnityAddKernelInfo(KernelInfo *kernel, const double scale);
|
94
|
-
|
95
|
-
UnityAddKernelInfo((KernelInfo*)DATA_PTR(self), NUM2DBL(scale));
|
115
|
+
GVL_STRUCT_TYPE(UnityAddKernelInfo) args = { (KernelInfo*)DATA_PTR(self), NUM2DBL(scale) };
|
116
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(UnityAddKernelInfo), &args);
|
96
117
|
return Qnil;
|
97
118
|
}
|
98
119
|
|
@@ -110,18 +131,10 @@ KernelInfo_scale(VALUE self, VALUE scale, VALUE flags)
|
|
110
131
|
{
|
111
132
|
GeometryFlags geoflags;
|
112
133
|
|
113
|
-
|
114
|
-
Check_Type(scale, T_FLOAT);
|
115
|
-
|
116
|
-
if (rb_obj_is_instance_of(flags, Class_GeometryFlags))
|
117
|
-
VALUE_TO_ENUM(flags, geoflags, GeometryFlags);
|
118
|
-
else
|
119
|
-
rb_raise(rb_eArgError, "expected Integer or Magick::GeometryFlags to specify flags");
|
120
|
-
|
121
|
-
/* ScaleKernelInfo() was private function until IM 6.9 */
|
122
|
-
MagickExport void ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor, const GeometryFlags normalize_flags);
|
134
|
+
VALUE_TO_ENUM(flags, geoflags, GeometryFlags);
|
123
135
|
|
124
|
-
ScaleKernelInfo(
|
136
|
+
GVL_STRUCT_TYPE(ScaleKernelInfo) args = { (KernelInfo*)DATA_PTR(self), NUM2DBL(scale), geoflags };
|
137
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ScaleKernelInfo), &args);
|
125
138
|
return Qnil;
|
126
139
|
}
|
127
140
|
|
@@ -134,8 +147,8 @@ KernelInfo_scale(VALUE self, VALUE scale, VALUE flags)
|
|
134
147
|
VALUE
|
135
148
|
KernelInfo_scale_geometry(VALUE self, VALUE geometry)
|
136
149
|
{
|
137
|
-
|
138
|
-
|
150
|
+
GVL_STRUCT_TYPE(ScaleGeometryKernelInfo) args = { (KernelInfo*)DATA_PTR(self), StringValueCStr(geometry) };
|
151
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ScaleGeometryKernelInfo), &args);
|
139
152
|
return Qnil;
|
140
153
|
}
|
141
154
|
|
@@ -148,7 +161,7 @@ VALUE
|
|
148
161
|
KernelInfo_clone(VALUE self)
|
149
162
|
{
|
150
163
|
KernelInfo *kernel = CloneKernelInfo((KernelInfo*)DATA_PTR(self));
|
151
|
-
return
|
164
|
+
return TypedData_Wrap_Struct(Class_KernelInfo, &rm_kernel_info_data_type, kernel);
|
152
165
|
}
|
153
166
|
|
154
167
|
/**
|
@@ -170,7 +183,6 @@ KernelInfo_builtin(VALUE self, VALUE what, VALUE geometry)
|
|
170
183
|
ExceptionInfo *exception;
|
171
184
|
#endif
|
172
185
|
|
173
|
-
Check_Type(geometry, T_STRING);
|
174
186
|
VALUE_TO_ENUM(what, kernel_type, KernelInfoType);
|
175
187
|
ParseGeometry(StringValueCStr(geometry), &info);
|
176
188
|
|
@@ -194,5 +206,5 @@ KernelInfo_builtin(VALUE self, VALUE what, VALUE geometry)
|
|
194
206
|
rb_raise(rb_eRuntimeError, "failed to acquire builtin kernel");
|
195
207
|
}
|
196
208
|
|
197
|
-
return
|
209
|
+
return TypedData_Wrap_Struct(self, &rm_kernel_info_data_type, kernel);
|
198
210
|
}
|