rmagick 4.0.0 → 4.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.appveyor.yml +16 -4
- data/.circleci/config.yml +1 -1
- data/.travis.yml +4 -2
- data/CHANGELOG.md +9 -0
- data/README.textile +1 -1
- data/before_install_linux.sh +5 -1
- data/ext/RMagick/extconf.rb +37 -13
- data/ext/RMagick/rmagick.h +39 -16
- data/ext/RMagick/rmdraw.c +87 -2
- data/ext/RMagick/rmenum.c +12 -3
- data/ext/RMagick/rmfill.c +109 -2
- data/ext/RMagick/rmilist.c +92 -8
- data/ext/RMagick/rmimage.c +1538 -53
- data/ext/RMagick/rminfo.c +30 -0
- data/ext/RMagick/rmkinfo.c +32 -0
- data/ext/RMagick/rmmain.c +33 -11
- data/ext/RMagick/rmpixel.c +125 -10
- data/ext/RMagick/rmstruct.c +14 -1
- data/ext/RMagick/rmutil.c +151 -5
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +3 -1
- data/rmagick.gemspec +0 -1
- data/spec/rmagick/image/dissolve_spec.rb +54 -0
- data/spec/spec_helper.rb +1 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f33d36e9b52a201567b259ed15f90215a5dda6b20200d34c76f8f5bdd80cae
|
4
|
+
data.tar.gz: edcf0fe0e09360c982649b93df9e1bfc5cdcc916a4a9956a5dc30b2062d9302e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 797ec6b5726b0c16b7bbb271a1cd9c57b2610497e9b30a5130c42aad9821692d56f3e02cdc3739eb11983644118d00c809b386baa8bbc73b2ce0f41fcdffaa8c
|
7
|
+
data.tar.gz: f7fe1c5e8630f0c959bad67813c0fe7520a81857cf34686aa5018c01d486616173ffa0e3ce28dd37057dabe53ed35e05e3bdd7002d309f2814605733b17d7f1d
|
data/.appveyor.yml
CHANGED
@@ -8,25 +8,37 @@ environment:
|
|
8
8
|
PATCH_VERSION: 10
|
9
9
|
- RUBY_VERSION: 23-x64
|
10
10
|
IMAGEMAGICK_VERSION: 6.9.10
|
11
|
-
PATCH_VERSION:
|
11
|
+
PATCH_VERSION: 61
|
12
|
+
- RUBY_VERSION: 23-x64
|
13
|
+
IMAGEMAGICK_VERSION: 7.0.8
|
14
|
+
PATCH_VERSION: 61
|
12
15
|
- RUBY_VERSION: 24-x64
|
13
16
|
IMAGEMAGICK_VERSION: 6.8.9
|
14
17
|
PATCH_VERSION: 10
|
15
18
|
- RUBY_VERSION: 24-x64
|
16
19
|
IMAGEMAGICK_VERSION: 6.9.10
|
17
|
-
PATCH_VERSION:
|
20
|
+
PATCH_VERSION: 61
|
21
|
+
- RUBY_VERSION: 24-x64
|
22
|
+
IMAGEMAGICK_VERSION: 7.0.8
|
23
|
+
PATCH_VERSION: 61
|
18
24
|
- RUBY_VERSION: 25-x64
|
19
25
|
IMAGEMAGICK_VERSION: 6.8.9
|
20
26
|
PATCH_VERSION: 10
|
21
27
|
- RUBY_VERSION: 25-x64
|
22
28
|
IMAGEMAGICK_VERSION: 6.9.10
|
23
|
-
PATCH_VERSION:
|
29
|
+
PATCH_VERSION: 61
|
30
|
+
- RUBY_VERSION: 25-x64
|
31
|
+
IMAGEMAGICK_VERSION: 7.0.8
|
32
|
+
PATCH_VERSION: 61
|
24
33
|
- RUBY_VERSION: 26-x64
|
25
34
|
IMAGEMAGICK_VERSION: 6.8.9
|
26
35
|
PATCH_VERSION: 10
|
27
36
|
- RUBY_VERSION: 26-x64
|
28
37
|
IMAGEMAGICK_VERSION: 6.9.10
|
29
|
-
PATCH_VERSION:
|
38
|
+
PATCH_VERSION: 61
|
39
|
+
- RUBY_VERSION: 24-x64
|
40
|
+
IMAGEMAGICK_VERSION: 7.0.8
|
41
|
+
PATCH_VERSION: 61
|
30
42
|
|
31
43
|
install:
|
32
44
|
- appveyor-retry appveyor DownloadFile https://ftp.icm.edu.pl/pub/graphics/ImageMagick/binaries/ImageMagick-%IMAGEMAGICK_VERSION%-%PATCH_VERSION%-Q16-x64-dll.exe
|
data/.circleci/config.yml
CHANGED
data/.travis.yml
CHANGED
@@ -34,8 +34,10 @@ env:
|
|
34
34
|
- IMAGEMAGICK_VERSION=6.7.7-10 CONFIGURE_OPTIONS=--enable-hdri
|
35
35
|
- IMAGEMAGICK_VERSION=6.8.9-10
|
36
36
|
- IMAGEMAGICK_VERSION=6.8.9-10 CONFIGURE_OPTIONS=--enable-hdri
|
37
|
-
- IMAGEMAGICK_VERSION=6.9.10-
|
38
|
-
- IMAGEMAGICK_VERSION=6.9.10-
|
37
|
+
- IMAGEMAGICK_VERSION=6.9.10-61
|
38
|
+
- IMAGEMAGICK_VERSION=6.9.10-61 CONFIGURE_OPTIONS=--enable-hdri
|
39
|
+
- IMAGEMAGICK_VERSION=7.0.8-61
|
40
|
+
- IMAGEMAGICK_VERSION=7.0.8-61 CONFIGURE_OPTIONS=--disable-hdri
|
39
41
|
|
40
42
|
before_install:
|
41
43
|
- /bin/bash before_install_$TRAVIS_OS_NAME.sh
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
All notable changes to this project are documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## RMagick 4.1.0.rc1
|
7
|
+
|
8
|
+
The ImageMagick 7 release is here! This adds beta support for ImageMagick 7.
|
9
|
+
Much thanks to **@Watson1978** for getting the ball rolling on this and to
|
10
|
+
**@dlemstra** for the extraordinary amount of work and patience that went into
|
11
|
+
seeing it through. RMagick should currently behave the same way under IM7 as it
|
12
|
+
did under IM6, so please open an issue if you find anything that seems out of
|
13
|
+
the ordinary.
|
14
|
+
|
6
15
|
## RMagick 4.0.0
|
7
16
|
|
8
17
|
This release removes a *lot* of deprecated functionality, so first upgrade to
|
data/README.textile
CHANGED
@@ -187,7 +187,7 @@ h4. 3) install ImageMagick and additional environment stuff
|
|
187
187
|
<pre>
|
188
188
|
cd /vagrant/rmagick
|
189
189
|
export IMAGEMAGICK_VERSION=6.8.9-10
|
190
|
-
|
190
|
+
bash ./before_install_linux.sh
|
191
191
|
</pre>
|
192
192
|
|
193
193
|
This will take just a few minutes to build ImageMagick
|
data/before_install_linux.sh
CHANGED
@@ -40,7 +40,11 @@ build_imagemagick() {
|
|
40
40
|
mkdir -p build-ImageMagick
|
41
41
|
|
42
42
|
version=(${IMAGEMAGICK_VERSION//./ })
|
43
|
-
if (( "${version[0]}
|
43
|
+
if (( "${version[0]}" >= 7 )); then
|
44
|
+
wget https://github.com/ImageMagick/ImageMagick/archive/${IMAGEMAGICK_VERSION}.tar.gz
|
45
|
+
tar -xf ${IMAGEMAGICK_VERSION}.tar.gz
|
46
|
+
mv ImageMagick-${IMAGEMAGICK_VERSION} $build_dir
|
47
|
+
elif (( "${version[0]}${version[1]}" >= 69 )); then
|
44
48
|
wget https://github.com/ImageMagick/ImageMagick6/archive/${IMAGEMAGICK_VERSION}.tar.gz
|
45
49
|
tar -xf ${IMAGEMAGICK_VERSION}.tar.gz
|
46
50
|
rm ${IMAGEMAGICK_VERSION}.tar.gz
|
data/ext/RMagick/extconf.rb
CHANGED
@@ -51,7 +51,9 @@ module RMagick
|
|
51
51
|
def configure_headers
|
52
52
|
@headers = %w[assert.h ctype.h stdio.h stdlib.h math.h time.h sys/types.h]
|
53
53
|
|
54
|
-
if have_header('
|
54
|
+
if have_header('MagickCore/MagickCore.h')
|
55
|
+
headers << 'MagickCore/MagickCore.h'
|
56
|
+
elsif have_header('magick/MagickCore.h')
|
55
57
|
headers << 'magick/MagickCore.h'
|
56
58
|
else
|
57
59
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find magick/MagickCore.h."
|
@@ -92,7 +94,7 @@ module RMagick
|
|
92
94
|
|
93
95
|
elsif RUBY_PLATFORM =~ /mingw/ # mingw
|
94
96
|
|
95
|
-
|
97
|
+
`#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
|
96
98
|
abort 'Unable to get ImageMagick version' unless Regexp.last_match(1)
|
97
99
|
$magick_version = Regexp.last_match(1)
|
98
100
|
|
@@ -100,11 +102,11 @@ module RMagick
|
|
100
102
|
$CPPFLAGS = %(-I"#{dir_paths[:include]}")
|
101
103
|
$LDFLAGS = %(-L"#{dir_paths[:lib]}")
|
102
104
|
|
103
|
-
have_library('CORE_RL_magick_')
|
105
|
+
have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
|
104
106
|
|
105
107
|
else # mswin
|
106
108
|
|
107
|
-
|
109
|
+
`#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
|
108
110
|
abort 'Unable to get ImageMagick version' unless Regexp.last_match(1)
|
109
111
|
$magick_version = Regexp.last_match(1)
|
110
112
|
|
@@ -112,7 +114,7 @@ module RMagick
|
|
112
114
|
$CPPFLAGS << %( -I"#{dir_paths[:include]}")
|
113
115
|
$LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
|
114
116
|
|
115
|
-
$LOCAL_LIBS = 'CORE_RL_magick_.lib'
|
117
|
+
$LOCAL_LIBS = im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib'
|
116
118
|
|
117
119
|
end
|
118
120
|
|
@@ -165,7 +167,7 @@ SRC
|
|
165
167
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find pkg-config in #{ENV['PATH']}\n"
|
166
168
|
end
|
167
169
|
|
168
|
-
packages = `pkg-config --list-all`.scan(/(ImageMagick\-
|
170
|
+
packages = `pkg-config --list-all`.scan(/(ImageMagick\-[\.A-Z0-9]+) .*/).flatten
|
169
171
|
|
170
172
|
# For ancient version of ImageMagick 6 we need a different regex
|
171
173
|
if packages.empty?
|
@@ -176,6 +178,23 @@ SRC
|
|
176
178
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
|
177
179
|
end
|
178
180
|
|
181
|
+
if packages.length > 1
|
182
|
+
|
183
|
+
im7_packages = packages.grep(/\AImageMagick-7/)
|
184
|
+
|
185
|
+
if im7_packages.any?
|
186
|
+
checking_for('forced use of ImageMagick 6') do
|
187
|
+
if ENV['USE_IMAGEMAGICK_6']
|
188
|
+
packages -= im7_packages
|
189
|
+
true
|
190
|
+
else
|
191
|
+
packages = im7_packages
|
192
|
+
false
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
179
198
|
if packages.length > 1
|
180
199
|
package_lines = packages.map { |package| " - #{package}" }.join("\n")
|
181
200
|
msg = "\nWarning: Found more than one ImageMagick installation. This could cause problems at runtime.\n#{package_lines}\n\n"
|
@@ -259,7 +278,7 @@ SRC
|
|
259
278
|
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
260
279
|
paths.each do |dir|
|
261
280
|
lib = File.join(dir, 'lib')
|
262
|
-
lib_file = File.join(lib, 'CORE_RL_magick_.lib')
|
281
|
+
lib_file = File.join(lib, im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
|
263
282
|
next unless File.exist?(lib_file)
|
264
283
|
|
265
284
|
dir_paths[:include] = File.join(dir, 'include')
|
@@ -316,12 +335,9 @@ END_MINGW
|
|
316
335
|
$defs.push("-DRUBY_VERSION_STRING=\"ruby #{RUBY_VERSION}\"")
|
317
336
|
$defs.push("-DRMAGICK_VERSION_STRING=\"RMagick #{RMAGICK_VERS}\"")
|
318
337
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
if Gem::Version.new($magick_version) >= Gem::Version.new('6.9.0')
|
323
|
-
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_0=1')
|
324
|
-
end
|
338
|
+
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9=1') if im_version_at_least?('6.8.9')
|
339
|
+
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_0=1') if im_version_at_least?('6.9.0')
|
340
|
+
$defs.push('-DIMAGEMAGICK_7=1') if im_version_at_least?('7.0.0')
|
325
341
|
|
326
342
|
create_header
|
327
343
|
end
|
@@ -339,6 +355,14 @@ END_MINGW
|
|
339
355
|
print_summary
|
340
356
|
end
|
341
357
|
|
358
|
+
def magick_command
|
359
|
+
@magick_command ||= find_executable('magick') ? 'magick' : 'identify'
|
360
|
+
end
|
361
|
+
|
362
|
+
def im_version_at_least?(version)
|
363
|
+
Gem::Version.new($magick_version) >= Gem::Version.new(version)
|
364
|
+
end
|
365
|
+
|
342
366
|
def print_summary
|
343
367
|
summary = <<"END_SUMMARY"
|
344
368
|
|
data/ext/RMagick/rmagick.h
CHANGED
@@ -34,16 +34,20 @@
|
|
34
34
|
#undef PACKAGE_TARNAME
|
35
35
|
#undef WORDS_BIGENDIAN
|
36
36
|
|
37
|
-
#include "
|
38
|
-
|
37
|
+
#include "extconf.h"
|
38
|
+
|
39
|
+
#if defined(IMAGEMAGICK_7)
|
40
|
+
#include "MagickCore/MagickCore.h"
|
41
|
+
#include "MagickCore/magick-config.h"
|
42
|
+
#else
|
43
|
+
#include "magick/MagickCore.h"
|
44
|
+
#include "magick/magick-config.h"
|
45
|
+
#endif
|
39
46
|
|
40
47
|
// Undef ImageMagick's versions of these symbols
|
41
48
|
#undef PACKAGE_STRING
|
42
49
|
|
43
50
|
|
44
|
-
#include "extconf.h"
|
45
|
-
|
46
|
-
|
47
51
|
//! For quoting preprocessor symbols
|
48
52
|
#define Q2(q) #q
|
49
53
|
//! For quoting preprocessor symbols
|
@@ -114,17 +118,33 @@
|
|
114
118
|
|
115
119
|
#define MagickLibSubversion MagickLibAddendum
|
116
120
|
|
117
|
-
|
118
121
|
typedef ImageInfo Info; /**< Make type name match class name */
|
119
|
-
|
120
|
-
typedef
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
122
|
+
#if defined(IMAGEMAGICK_7)
|
123
|
+
typedef struct _QuantumPixelPacket
|
124
|
+
{
|
125
|
+
Quantum
|
126
|
+
red,
|
127
|
+
green,
|
128
|
+
blue,
|
129
|
+
alpha,
|
130
|
+
black;
|
131
|
+
} QuantumPixelPacket;
|
132
|
+
|
133
|
+
typedef QuantumPixelPacket Pixel;
|
134
|
+
typedef PixelInfo MagickPixel;
|
135
|
+
typedef PixelInfo PixelColor;
|
136
|
+
#else
|
137
|
+
typedef PixelPacket Pixel;
|
138
|
+
typedef MagickPixelPacket MagickPixel;
|
139
|
+
typedef PixelPacket PixelColor;
|
140
|
+
typedef AlphaChannelType AlphaChannelOption;
|
141
|
+
typedef DistortImageMethod DistortMethod;
|
142
|
+
typedef FilterTypes FilterType;
|
143
|
+
typedef InterpolatePixelMethod PixelInterpolateMethod;
|
144
|
+
typedef ImageLayerMethod LayerMethod;
|
145
|
+
#define TransparentAlpha 0
|
146
|
+
#define IMAGEMAGICK_6 1
|
147
|
+
#endif
|
128
148
|
|
129
149
|
//! Montage
|
130
150
|
typedef struct
|
@@ -1161,7 +1181,6 @@ typedef enum
|
|
1161
1181
|
DestroyExceptionRetention
|
1162
1182
|
} ExceptionRetention;
|
1163
1183
|
|
1164
|
-
extern void rm_check_image_exception(Image *, ErrorRetention);
|
1165
1184
|
extern void rm_check_exception(ExceptionInfo *, Image *, ErrorRetention);
|
1166
1185
|
extern void rm_ensure_result(Image *);
|
1167
1186
|
extern Image *rm_clone_image(Image *);
|
@@ -1174,5 +1193,9 @@ extern void rm_error_handler(const ExceptionType, const char *, const char *);
|
|
1174
1193
|
extern void rm_warning_handler(const ExceptionType, const char *, const char *);
|
1175
1194
|
extern MagickBooleanType rm_should_raise_exception(ExceptionInfo *, const ExceptionRetention);
|
1176
1195
|
extern void rm_raise_exception(ExceptionInfo *);
|
1196
|
+
#if defined(IMAGEMAGICK_6)
|
1197
|
+
extern void rm_check_image_exception(Image *, ErrorRetention);
|
1198
|
+
#endif
|
1199
|
+
|
1177
1200
|
#endif
|
1178
1201
|
|
data/ext/RMagick/rmdraw.c
CHANGED
@@ -18,7 +18,11 @@ static void destroy_Draw(void *);
|
|
18
18
|
static VALUE new_DrawOptions(void);
|
19
19
|
|
20
20
|
/** Method that gets type metrics */
|
21
|
-
|
21
|
+
#if defined(IMAGEMAGICK_7)
|
22
|
+
typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *, ExceptionInfo *);
|
23
|
+
#else
|
24
|
+
typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *);
|
25
|
+
#endif
|
22
26
|
static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t);
|
23
27
|
|
24
28
|
|
@@ -608,7 +612,11 @@ Draw_marshal_dump(VALUE self)
|
|
608
612
|
// rb_hash_aset(ddraw, CSTR2SYM("clip_mask"), MAGICK_STRING_TO_OBJ(draw->info->clip_mask)); internal
|
609
613
|
// rb_hash_aset(ddraw, CSTR2SYM("bounds"), Import_SegmentInfo(&draw->info->bounds)); internal
|
610
614
|
rb_hash_aset(ddraw, CSTR2SYM("clip_units"), INT2FIX(draw->info->clip_units));
|
615
|
+
#if defined(IMAGEMAGICK_7)
|
616
|
+
rb_hash_aset(ddraw, CSTR2SYM("alpha"), QUANTUM2NUM(draw->info->alpha));
|
617
|
+
#else
|
611
618
|
rb_hash_aset(ddraw, CSTR2SYM("opacity"), QUANTUM2NUM(draw->info->opacity));
|
619
|
+
#endif
|
612
620
|
// rb_hash_aset(ddraw, CSTR2SYM("render"), draw->info->render ? Qtrue : Qfalse); internal
|
613
621
|
// rb_hash_aset(ddraw, CSTR2SYM("element_reference"), Qnil); // not used yet
|
614
622
|
// rb_hash_aset(ddraw, CSTR2SYM("debug"), draw->info->debug ? Qtrue : Qfalse);
|
@@ -681,7 +689,11 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
681
689
|
Color_to_PixelColor(&draw->info->undercolor, val);
|
682
690
|
|
683
691
|
draw->info->clip_units = FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("clip_units")));
|
692
|
+
#if defined(IMAGEMAGICK_7)
|
693
|
+
draw->info->alpha = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("alpha")));
|
694
|
+
#else
|
684
695
|
draw->info->opacity = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("opacity")));
|
696
|
+
#endif
|
685
697
|
draw->info->kerning = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("kerning")));
|
686
698
|
draw->info->interword_spacing = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("interword_spacing")));
|
687
699
|
|
@@ -946,6 +958,9 @@ VALUE Draw_annotate(
|
|
946
958
|
long x, y;
|
947
959
|
AffineMatrix keep;
|
948
960
|
char geometry_str[100];
|
961
|
+
#if defined(IMAGEMAGICK_7)
|
962
|
+
ExceptionInfo *exception;
|
963
|
+
#endif
|
949
964
|
|
950
965
|
// Save the affine matrix in case it is modified by
|
951
966
|
// Draw#rotation=
|
@@ -963,9 +978,25 @@ VALUE Draw_annotate(
|
|
963
978
|
}
|
964
979
|
|
965
980
|
// Translate & store in Draw structure
|
981
|
+
#if defined(IMAGEMAGICK_7)
|
982
|
+
exception = AcquireExceptionInfo();
|
983
|
+
draw->info->text = InterpretImageProperties(NULL, image, StringValuePtr(text), exception);
|
984
|
+
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
985
|
+
{
|
986
|
+
if (draw->info->text)
|
987
|
+
{
|
988
|
+
magick_free(draw->info->text);
|
989
|
+
}
|
990
|
+
rm_raise_exception(exception);
|
991
|
+
}
|
992
|
+
#else
|
966
993
|
draw->info->text = InterpretImageProperties(NULL, image, StringValuePtr(text));
|
994
|
+
#endif
|
967
995
|
if (!draw->info->text)
|
968
996
|
{
|
997
|
+
#if defined(IMAGEMAGICK_7)
|
998
|
+
(void) DestroyExceptionInfo(exception);
|
999
|
+
#endif
|
969
1000
|
rb_raise(rb_eArgError, "no text");
|
970
1001
|
}
|
971
1002
|
|
@@ -989,13 +1020,22 @@ VALUE Draw_annotate(
|
|
989
1020
|
|
990
1021
|
magick_clone_string(&draw->info->geometry, geometry_str);
|
991
1022
|
|
1023
|
+
#if defined(IMAGEMAGICK_7)
|
1024
|
+
(void) AnnotateImage(image, draw->info, exception);
|
1025
|
+
#else
|
992
1026
|
(void) AnnotateImage(image, draw->info);
|
1027
|
+
#endif
|
993
1028
|
|
994
1029
|
magick_free(draw->info->text);
|
995
1030
|
draw->info->text = NULL;
|
996
1031
|
draw->info->affine = keep;
|
997
1032
|
|
1033
|
+
#if defined(IMAGEMAGICK_7)
|
1034
|
+
CHECK_EXCEPTION()
|
1035
|
+
(void) DestroyExceptionInfo(exception);
|
1036
|
+
#else
|
998
1037
|
rm_check_image_exception(image, RetainOnError);
|
1038
|
+
#endif
|
999
1039
|
|
1000
1040
|
return self;
|
1001
1041
|
}
|
@@ -1127,6 +1167,9 @@ Draw_draw(VALUE self, VALUE image_arg)
|
|
1127
1167
|
{
|
1128
1168
|
Draw *draw;
|
1129
1169
|
Image *image;
|
1170
|
+
#if defined(IMAGEMAGICK_7)
|
1171
|
+
ExceptionInfo *exception;
|
1172
|
+
#endif
|
1130
1173
|
|
1131
1174
|
image_arg = rm_cur_image(image_arg);
|
1132
1175
|
image = rm_check_frozen(image_arg);
|
@@ -1140,12 +1183,23 @@ Draw_draw(VALUE self, VALUE image_arg)
|
|
1140
1183
|
// Point the DrawInfo structure at the current set of primitives.
|
1141
1184
|
magick_clone_string(&(draw->info->primitive), StringValuePtr(draw->primitives));
|
1142
1185
|
|
1186
|
+
#if defined(IMAGEMAGICK_7)
|
1187
|
+
exception = AcquireExceptionInfo();
|
1188
|
+
(void) DrawImage(image, draw->info, exception);
|
1189
|
+
#else
|
1143
1190
|
(void) DrawImage(image, draw->info);
|
1144
|
-
|
1191
|
+
#endif
|
1145
1192
|
|
1146
1193
|
magick_free(draw->info->primitive);
|
1147
1194
|
draw->info->primitive = NULL;
|
1148
1195
|
|
1196
|
+
#if defined(IMAGEMAGICK_7)
|
1197
|
+
CHECK_EXCEPTION()
|
1198
|
+
(void) DestroyExceptionInfo(exception);
|
1199
|
+
#else
|
1200
|
+
rm_check_image_exception(image, RetainOnError);
|
1201
|
+
#endif
|
1202
|
+
|
1149
1203
|
return self;
|
1150
1204
|
}
|
1151
1205
|
|
@@ -1708,6 +1762,9 @@ get_type_metrics(
|
|
1708
1762
|
char *text = NULL;
|
1709
1763
|
long text_l;
|
1710
1764
|
unsigned int okay;
|
1765
|
+
#if defined(IMAGEMAGICK_7)
|
1766
|
+
ExceptionInfo *exception;
|
1767
|
+
#endif
|
1711
1768
|
|
1712
1769
|
switch (argc)
|
1713
1770
|
{
|
@@ -1731,25 +1788,53 @@ get_type_metrics(
|
|
1731
1788
|
}
|
1732
1789
|
|
1733
1790
|
Data_Get_Struct(self, Draw, draw);
|
1791
|
+
#if defined(IMAGEMAGICK_7)
|
1792
|
+
exception = AcquireExceptionInfo();
|
1793
|
+
draw->info->text = InterpretImageProperties(NULL, image, text, exception);
|
1794
|
+
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
1795
|
+
{
|
1796
|
+
if (draw->info->text)
|
1797
|
+
{
|
1798
|
+
magick_free(draw->info->text);
|
1799
|
+
}
|
1800
|
+
rm_raise_exception(exception);
|
1801
|
+
}
|
1802
|
+
#else
|
1734
1803
|
draw->info->text = InterpretImageProperties(NULL, image, text);
|
1804
|
+
#endif
|
1735
1805
|
if (!draw->info->text)
|
1736
1806
|
{
|
1807
|
+
#if defined(IMAGEMAGICK_7)
|
1808
|
+
(void) DestroyExceptionInfo(exception);
|
1809
|
+
#endif
|
1737
1810
|
rb_raise(rb_eArgError, "no text to measure");
|
1738
1811
|
}
|
1739
1812
|
|
1813
|
+
#if defined(IMAGEMAGICK_7)
|
1814
|
+
okay = (*getter)(image, draw->info, &metrics, exception);
|
1815
|
+
#else
|
1740
1816
|
okay = (*getter)(image, draw->info, &metrics);
|
1817
|
+
#endif
|
1741
1818
|
|
1742
1819
|
magick_free(draw->info->text);
|
1743
1820
|
draw->info->text = NULL;
|
1744
1821
|
|
1745
1822
|
if (!okay)
|
1746
1823
|
{
|
1824
|
+
#if defined(IMAGEMAGICK_7)
|
1825
|
+
CHECK_EXCEPTION()
|
1826
|
+
(void) DestroyExceptionInfo(exception);
|
1827
|
+
#else
|
1747
1828
|
rm_check_image_exception(image, RetainOnError);
|
1829
|
+
#endif
|
1748
1830
|
|
1749
1831
|
// Shouldn't get here...
|
1750
1832
|
rb_raise(rb_eRuntimeError, "Can't measure text. Are the fonts installed? "
|
1751
1833
|
"Is the FreeType library installed?");
|
1752
1834
|
}
|
1835
|
+
#if defined(IMAGEMAGICK_7)
|
1836
|
+
(void) DestroyExceptionInfo(exception);
|
1837
|
+
#endif
|
1753
1838
|
|
1754
1839
|
RB_GC_GUARD(t);
|
1755
1840
|
|