rmagick 5.3.0 → 5.4.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/.devcontainer/setup-user.sh +1 -1
- data/.editorconfig +1 -1
- data/.github/workflows/ci.yml +20 -16
- data/.gitignore +1 -0
- data/.yardopts +1 -1
- data/CHANGELOG.md +13 -0
- data/before_install_osx.sh +1 -1
- data/ext/RMagick/extconf.rb +19 -12
- data/ext/RMagick/{rmagick.c → rmagick.cpp} +19 -22
- data/ext/RMagick/rmagick.h +70 -49
- data/ext/RMagick/{rmdraw.c → rmdraw.cpp} +25 -24
- data/ext/RMagick/{rmenum.c → rmenum.cpp} +42 -42
- data/ext/RMagick/{rmfill.c → rmfill.cpp} +6 -6
- data/ext/RMagick/{rmilist.c → rmilist.cpp} +23 -21
- data/ext/RMagick/{rmimage.c → rmimage.cpp} +202 -157
- data/ext/RMagick/{rminfo.c → rminfo.cpp} +11 -11
- data/ext/RMagick/{rmkinfo.c → rmkinfo.cpp} +4 -9
- data/ext/RMagick/rmmain.cpp +1957 -0
- data/ext/RMagick/{rmmontage.c → rmmontage.cpp} +5 -5
- data/ext/RMagick/{rmpixel.c → rmpixel.cpp} +40 -41
- data/ext/RMagick/{rmstruct.c → rmstruct.cpp} +6 -6
- data/ext/RMagick/{rmutil.c → rmutil.cpp} +33 -13
- data/lib/rmagick/version.rb +1 -1
- data/rmagick.gemspec +1 -0
- metadata +30 -16
- data/ext/RMagick/rmmain.c +0 -1955
data/ext/RMagick/rmagick.h
CHANGED
@@ -16,15 +16,21 @@
|
|
16
16
|
//! Suppress warnings about deprecated functions on Windows
|
17
17
|
#define _CRT_SECURE_NO_DEPRECATE 1
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
#include
|
22
|
-
|
23
|
-
|
24
|
-
#include <
|
25
|
-
#include
|
26
|
-
#include
|
27
|
-
#include
|
19
|
+
// ruby.h contains a C++ template, which cannot be included in extern "C".
|
20
|
+
// Therefore, it includes the header in advance.
|
21
|
+
#include "ruby/defines.h"
|
22
|
+
|
23
|
+
extern "C" {
|
24
|
+
#include <assert.h>
|
25
|
+
#include <stdio.h>
|
26
|
+
#include <ctype.h>
|
27
|
+
#include <stdlib.h>
|
28
|
+
#include <math.h>
|
29
|
+
#include <sys/types.h>
|
30
|
+
#include "ruby.h"
|
31
|
+
#include "ruby/io.h"
|
32
|
+
#include "rmagick_gvl.h"
|
33
|
+
}
|
28
34
|
|
29
35
|
#if defined(__MINGW32__)
|
30
36
|
// Ruby defines wrong format specifiers for MinGW. So this defines original macro in here.
|
@@ -45,10 +51,6 @@
|
|
45
51
|
#endif
|
46
52
|
|
47
53
|
#if defined(__GNUC__)
|
48
|
-
#pragma GCC diagnostic push
|
49
|
-
#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
|
50
|
-
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
51
|
-
|
52
54
|
#if __GNUC__ > 6
|
53
55
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
54
56
|
#endif
|
@@ -316,7 +318,7 @@ typedef enum _QuantumExpressionOperator
|
|
316
318
|
|
317
319
|
|
318
320
|
/** This implements the "omitted storage class model" for external variables.
|
319
|
-
* (Ref: Harbison & Steele.) The rmmain.
|
321
|
+
* (Ref: Harbison & Steele.) The rmmain.cpp file defines MAIN, which causes
|
320
322
|
* the single defining declarations to be generated. No other source files
|
321
323
|
* define MAIN and therefore generate referencing declarations.
|
322
324
|
*/
|
@@ -442,7 +444,7 @@ extern const rb_data_type_t rm_kernel_info_data_type;
|
|
442
444
|
Define simple attribute accessor methods (boolean, int, string, and double types)
|
443
445
|
*/
|
444
446
|
#define C_boolean_to_R_boolean(attr) (attr) ? Qtrue : Qfalse /**< C boolean -> Ruby boolean */
|
445
|
-
#define R_boolean_to_C_boolean(attr) RTEST(attr) /**< C boolean <- Ruby boolean */
|
447
|
+
#define R_boolean_to_C_boolean(attr) (MagickBooleanType)RTEST(attr) /**< C boolean <- Ruby boolean */
|
446
448
|
#define C_int_to_R_int(attr) INT2FIX(attr) /**< C int -> Ruby int */
|
447
449
|
#define R_int_to_C_int(attr) NUM2INT(attr) /**< C int <- Ruby int */
|
448
450
|
#define C_long_to_R_long(attr) LONG2NUM(attr) /**< C long -> Ruby long */
|
@@ -454,47 +456,47 @@ extern const rb_data_type_t rm_kernel_info_data_type;
|
|
454
456
|
#define R_dbl_to_C_dbl(attr) NUM2DBL(attr) /**< C double <- Ruby double */
|
455
457
|
|
456
458
|
//! define attribute reader
|
457
|
-
#define IMPLEMENT_TYPED_ATTR_READER(
|
459
|
+
#define IMPLEMENT_TYPED_ATTR_READER(klass, attr, type, data_type) \
|
458
460
|
{\
|
459
|
-
|
461
|
+
klass *ptr;\
|
460
462
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
461
463
|
rm_check_destroyed(self); \
|
462
464
|
}\
|
463
|
-
TypedData_Get_Struct(self,
|
465
|
+
TypedData_Get_Struct(self, klass, data_type, ptr);\
|
464
466
|
return C_##type##_to_R_##type(ptr->attr);\
|
465
467
|
}
|
466
468
|
|
467
469
|
//! define attribute reader when attribute name is different from the field name
|
468
|
-
#define IMPLEMENT_TYPED_ATTR_READERF(
|
470
|
+
#define IMPLEMENT_TYPED_ATTR_READERF(klass, attr, field, type, data_type) \
|
469
471
|
{\
|
470
|
-
|
472
|
+
klass *ptr;\
|
471
473
|
rm_check_destroyed(self); \
|
472
|
-
TypedData_Get_Struct(self,
|
474
|
+
TypedData_Get_Struct(self, klass, data_type, ptr);\
|
473
475
|
return C_##type##_to_R_##type(ptr->field);\
|
474
476
|
}
|
475
477
|
|
476
478
|
//! define attribute writer
|
477
|
-
#define IMPLEMENT_TYPED_ATTR_WRITER(
|
479
|
+
#define IMPLEMENT_TYPED_ATTR_WRITER(klass, attr, type, data_type) \
|
478
480
|
{\
|
479
|
-
|
481
|
+
klass *ptr;\
|
480
482
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
481
483
|
rm_check_destroyed(self); \
|
482
484
|
}\
|
483
485
|
rb_check_frozen(self);\
|
484
|
-
TypedData_Get_Struct(self,
|
486
|
+
TypedData_Get_Struct(self, klass, data_type, ptr);\
|
485
487
|
ptr->attr = R_##type##_to_C_##type(val);\
|
486
488
|
return val;\
|
487
489
|
}
|
488
490
|
|
489
491
|
//! define attribute writer when attribute name is different from the field name
|
490
|
-
#define IMPLEMENT_TYPED_ATTR_WRITERF(
|
492
|
+
#define IMPLEMENT_TYPED_ATTR_WRITERF(klass, attr, field, type, data_type) \
|
491
493
|
{\
|
492
|
-
|
494
|
+
klass *ptr;\
|
493
495
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
494
496
|
rm_check_destroyed(self); \
|
495
497
|
}\
|
496
498
|
rb_check_frozen(self);\
|
497
|
-
TypedData_Get_Struct(self,
|
499
|
+
TypedData_Get_Struct(self, klass, data_type, ptr);\
|
498
500
|
ptr->field = R_##type##_to_C_##type(val);\
|
499
501
|
return self;\
|
500
502
|
}
|
@@ -504,15 +506,15 @@ extern const rb_data_type_t rm_kernel_info_data_type;
|
|
504
506
|
* Declare attribute accessors
|
505
507
|
*/
|
506
508
|
//! declare attribute reader
|
507
|
-
#define ATTR_READER(
|
508
|
-
extern VALUE
|
509
|
+
#define ATTR_READER(klass, attr) \
|
510
|
+
extern VALUE klass##_##attr(VALUE);
|
509
511
|
//! declare attribute writer
|
510
|
-
#define ATTR_WRITER(
|
511
|
-
extern VALUE
|
512
|
+
#define ATTR_WRITER(klass, attr) \
|
513
|
+
extern VALUE klass##_##attr##_eq(VALUE, VALUE);
|
512
514
|
//! declare attribute accessor
|
513
|
-
#define ATTR_ACCESSOR(
|
514
|
-
ATTR_READER(
|
515
|
-
ATTR_WRITER(
|
515
|
+
#define ATTR_ACCESSOR(klass, attr) \
|
516
|
+
ATTR_READER(klass, attr)\
|
517
|
+
ATTR_WRITER(klass, attr)
|
516
518
|
|
517
519
|
|
518
520
|
//! Define a Magick module constant
|
@@ -544,11 +546,13 @@ extern const rb_data_type_t rm_kernel_info_data_type;
|
|
544
546
|
// the same source file.
|
545
547
|
|
546
548
|
|
547
|
-
|
549
|
+
extern "C" {
|
550
|
+
|
551
|
+
// rmmain.cpp
|
548
552
|
extern void Init_RMagick2(void);
|
549
553
|
|
550
554
|
|
551
|
-
// rmagick.
|
555
|
+
// rmagick.cpp
|
552
556
|
extern VALUE Magick_colors(VALUE);
|
553
557
|
extern VALUE Magick_fonts(VALUE);
|
554
558
|
extern VALUE Magick_init_formats(VALUE);
|
@@ -557,7 +561,7 @@ extern VALUE Magick_set_cache_threshold(VALUE, VALUE);
|
|
557
561
|
extern VALUE Magick_set_log_event_mask(int, VALUE *, VALUE);
|
558
562
|
extern VALUE Magick_set_log_format(VALUE, VALUE);
|
559
563
|
|
560
|
-
// rmdraw.
|
564
|
+
// rmdraw.cpp
|
561
565
|
ATTR_WRITER(Draw, affine)
|
562
566
|
ATTR_WRITER(Draw, align)
|
563
567
|
ATTR_WRITER(Draw, border_color)
|
@@ -608,7 +612,7 @@ ATTR_WRITER(PolaroidOptions, shadow_color);
|
|
608
612
|
ATTR_WRITER(PolaroidOptions, border_color);
|
609
613
|
|
610
614
|
|
611
|
-
// rmmontage.
|
615
|
+
// rmmontage.cpp
|
612
616
|
ATTR_WRITER(Montage, background_color)
|
613
617
|
ATTR_WRITER(Montage, border_color)
|
614
618
|
ATTR_WRITER(Montage, border_width)
|
@@ -631,7 +635,7 @@ extern VALUE Montage_alloc(VALUE);
|
|
631
635
|
extern VALUE rm_montage_new(void);
|
632
636
|
|
633
637
|
|
634
|
-
// rmilist.
|
638
|
+
// rmilist.cpp
|
635
639
|
extern VALUE ImageList_animate(int, VALUE *, VALUE);
|
636
640
|
extern VALUE ImageList_append(VALUE, VALUE);
|
637
641
|
extern VALUE ImageList_average(VALUE);
|
@@ -653,7 +657,7 @@ extern VALUE ImageList_write(VALUE, VALUE);
|
|
653
657
|
extern VALUE rm_imagelist_from_images(Image *);
|
654
658
|
|
655
659
|
|
656
|
-
// rminfo.
|
660
|
+
// rminfo.cpp
|
657
661
|
ATTR_ACCESSOR(Info, antialias)
|
658
662
|
ATTR_ACCESSOR(Info, attenuate)
|
659
663
|
ATTR_ACCESSOR(Info, authenticate)
|
@@ -715,7 +719,7 @@ extern VALUE rm_info_new(void);
|
|
715
719
|
extern DisposeType rm_dispose_to_enum(const char *);
|
716
720
|
extern GravityType rm_gravity_to_enum(const char *);
|
717
721
|
|
718
|
-
// rmkinfo.
|
722
|
+
// rmkinfo.cpp
|
719
723
|
|
720
724
|
extern VALUE KernelInfo_alloc(VALUE);
|
721
725
|
|
@@ -728,7 +732,7 @@ extern VALUE KernelInfo_clone(VALUE);
|
|
728
732
|
extern VALUE KernelInfo_builtin(VALUE, VALUE, VALUE);
|
729
733
|
|
730
734
|
|
731
|
-
// rmimage.
|
735
|
+
// rmimage.cpp
|
732
736
|
ATTR_ACCESSOR(Image, background_color)
|
733
737
|
ATTR_READER(Image, base_columns)
|
734
738
|
ATTR_READER(Image, base_filename)
|
@@ -1031,7 +1035,7 @@ extern VALUE rm_image_new(Image *);
|
|
1031
1035
|
extern void rm_image_destroy(void *);
|
1032
1036
|
|
1033
1037
|
|
1034
|
-
// rmfill.
|
1038
|
+
// rmfill.cpp
|
1035
1039
|
extern VALUE GradientFill_alloc(VALUE);
|
1036
1040
|
extern VALUE GradientFill_initialize(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
1037
1041
|
extern VALUE GradientFill_fill(VALUE, VALUE);
|
@@ -1041,7 +1045,7 @@ extern VALUE TextureFill_initialize(VALUE, VALUE);
|
|
1041
1045
|
extern VALUE TextureFill_fill(VALUE, VALUE);
|
1042
1046
|
|
1043
1047
|
|
1044
|
-
// rmpixel.
|
1048
|
+
// rmpixel.cpp
|
1045
1049
|
|
1046
1050
|
|
1047
1051
|
ATTR_ACCESSOR(Pixel, red)
|
@@ -1072,7 +1076,7 @@ extern VALUE Pixel_to_hsla(VALUE);
|
|
1072
1076
|
extern VALUE Pixel_to_s(VALUE);
|
1073
1077
|
|
1074
1078
|
|
1075
|
-
// rmenum.
|
1079
|
+
// rmenum.cpp
|
1076
1080
|
extern VALUE Enum_alloc(VALUE);
|
1077
1081
|
extern VALUE Enum_initialize(VALUE, VALUE, VALUE);
|
1078
1082
|
extern VALUE Enum_to_s(VALUE);
|
@@ -1081,7 +1085,7 @@ extern VALUE Enum_spaceship(VALUE, VALUE);
|
|
1081
1085
|
extern VALUE Enum_bitwise_or(VALUE, VALUE);
|
1082
1086
|
extern VALUE Enum_case_eq(VALUE, VALUE);
|
1083
1087
|
extern VALUE Enum_type_initialize(VALUE, VALUE, VALUE);
|
1084
|
-
extern VALUE Enum_find(VALUE
|
1088
|
+
extern VALUE Enum_find(VALUE, int);
|
1085
1089
|
extern VALUE Enum_type_each(VALUE);
|
1086
1090
|
extern VALUE rm_enum_new(VALUE, VALUE, VALUE);
|
1087
1091
|
extern VALUE ClassType_find(ClassType);
|
@@ -1108,7 +1112,7 @@ extern const char *StyleType_name(StyleType);
|
|
1108
1112
|
extern VALUE VirtualPixelMethod_find(VirtualPixelMethod);
|
1109
1113
|
|
1110
1114
|
|
1111
|
-
// rmstruct.
|
1115
|
+
// rmstruct.cpp
|
1112
1116
|
extern VALUE ChromaticityInfo_to_s(VALUE);
|
1113
1117
|
extern VALUE ChromaticityInfo_new(ChromaticityInfo *);
|
1114
1118
|
extern void Color_to_PixelColor(PixelColor *, VALUE);
|
@@ -1143,7 +1147,7 @@ extern void Export_TypeInfo(TypeInfo *, VALUE);
|
|
1143
1147
|
extern VALUE Import_TypeMetric(TypeMetric *);
|
1144
1148
|
|
1145
1149
|
|
1146
|
-
// rmutil.
|
1150
|
+
// rmutil.cpp
|
1147
1151
|
extern VALUE ImageMagickError_initialize(int, VALUE *, VALUE);
|
1148
1152
|
extern void *magick_malloc(const size_t);
|
1149
1153
|
extern void *magick_safe_malloc(const size_t, const size_t);
|
@@ -1164,7 +1168,7 @@ extern void rm_check_ary_len(VALUE, long);
|
|
1164
1168
|
extern VALUE rm_check_ary_type(VALUE ary);
|
1165
1169
|
extern Image *rm_check_destroyed(VALUE);
|
1166
1170
|
extern Image *rm_check_frozen(VALUE);
|
1167
|
-
extern char *rm_str2cstr(VALUE,
|
1171
|
+
extern char *rm_str2cstr(VALUE, size_t *);
|
1168
1172
|
extern int rm_check_num2dbl(VALUE);
|
1169
1173
|
extern double rm_fuzz_to_dbl(VALUE);
|
1170
1174
|
extern Quantum rm_app2quantum(VALUE);
|
@@ -1209,9 +1213,26 @@ extern void rm_error_handler(const ExceptionType, const char *, const char *);
|
|
1209
1213
|
extern void rm_warning_handler(const ExceptionType, const char *, const char *);
|
1210
1214
|
extern MagickBooleanType rm_should_raise_exception(ExceptionInfo *, const ExceptionRetention);
|
1211
1215
|
extern void rm_raise_exception(ExceptionInfo *);
|
1216
|
+
extern VALUE rm_io_path(VALUE);
|
1212
1217
|
#if defined(IMAGEMAGICK_6)
|
1213
1218
|
extern void rm_check_image_exception(Image *, ErrorRetention);
|
1214
1219
|
#endif
|
1215
1220
|
|
1221
|
+
#if !defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_9_0)
|
1222
|
+
/* UnityAddKernelInfo() was private function until IM 6.9 */
|
1223
|
+
MagickExport void UnityAddKernelInfo(KernelInfo *kernel, const double scale);
|
1224
|
+
/* ScaleKernelInfo() was private function until IM 6.9 */
|
1225
|
+
MagickExport void ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor, const GeometryFlags normalize_flags);
|
1216
1226
|
#endif
|
1217
1227
|
|
1228
|
+
#if (RUBY_VERSION_MAJOR == 2 && RUBY_VERSION_MINOR < 7)
|
1229
|
+
#define RESCUE_FUNC(func) (VALUE (*)(ANYARGS))(func)
|
1230
|
+
#define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE (*)(ANYARGS))(func)
|
1231
|
+
#else
|
1232
|
+
#define RESCUE_FUNC(func) (VALUE(*)(VALUE))(func)
|
1233
|
+
#define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE(*)(VALUE, VALUE))(func)
|
1234
|
+
#endif
|
1235
|
+
|
1236
|
+
} // extern "C"
|
1237
|
+
|
1238
|
+
#endif
|
@@ -5,8 +5,8 @@
|
|
5
5
|
*
|
6
6
|
* Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
|
7
7
|
*
|
8
|
-
* @file rmdraw.
|
9
|
-
* @version $Id: rmdraw.
|
8
|
+
* @file rmdraw.cpp
|
9
|
+
* @version $Id: rmdraw.cpp,v 1.83 2009/12/20 02:33:33 baror Exp $
|
10
10
|
* @author Tim Hunter
|
11
11
|
******************************************************************************/
|
12
12
|
|
@@ -295,7 +295,7 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
295
295
|
w = FIX2INT(weight);
|
296
296
|
if (w < 100 || w > 900)
|
297
297
|
{
|
298
|
-
rb_raise(rb_eArgError, "invalid font weight (%"RMIuSIZE" given)", w);
|
298
|
+
rb_raise(rb_eArgError, "invalid font weight (%" RMIuSIZE " given)", w);
|
299
299
|
}
|
300
300
|
draw->info->weight = w;
|
301
301
|
}
|
@@ -480,7 +480,7 @@ Image *str_to_image(VALUE str)
|
|
480
480
|
|
481
481
|
info = CloneImageInfo(NULL);
|
482
482
|
exception = AcquireExceptionInfo();
|
483
|
-
GVL_STRUCT_TYPE(BlobToImage) args = { info, RSTRING_PTR(str), RSTRING_LEN(str), exception };
|
483
|
+
GVL_STRUCT_TYPE(BlobToImage) args = { info, RSTRING_PTR(str), (size_t)RSTRING_LEN(str), exception };
|
484
484
|
image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(BlobToImage), &args);
|
485
485
|
DestroyImageInfo(info);
|
486
486
|
CHECK_EXCEPTION();
|
@@ -595,8 +595,8 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
595
595
|
draw->info->stroke_width = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("stroke_width")));
|
596
596
|
draw->info->fill_pattern = str_to_image(rb_hash_aref(ddraw, CSTR2SYM("fill_pattern")));
|
597
597
|
draw->info->stroke_pattern = str_to_image(rb_hash_aref(ddraw, CSTR2SYM("stroke_pattern")));
|
598
|
-
draw->info->stroke_antialias = RTEST(rb_hash_aref(ddraw, CSTR2SYM("stroke_antialias")));
|
599
|
-
draw->info->text_antialias = RTEST(rb_hash_aref(ddraw, CSTR2SYM("text_antialias")));
|
598
|
+
draw->info->stroke_antialias = (MagickBooleanType)RTEST(rb_hash_aref(ddraw, CSTR2SYM("stroke_antialias")));
|
599
|
+
draw->info->text_antialias = (MagickBooleanType)RTEST(rb_hash_aref(ddraw, CSTR2SYM("text_antialias")));
|
600
600
|
draw->info->decorate = (DecorationType) FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("decorate")));
|
601
601
|
OBJ_TO_MAGICK_STRING(draw->info->font, rb_hash_aref(ddraw, CSTR2SYM("font")));
|
602
602
|
OBJ_TO_MAGICK_STRING(draw->info->family, rb_hash_aref(ddraw, CSTR2SYM("family")));
|
@@ -612,7 +612,7 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
612
612
|
val = rb_hash_aref(ddraw, CSTR2SYM("undercolor"));
|
613
613
|
Color_to_PixelColor(&draw->info->undercolor, val);
|
614
614
|
|
615
|
-
draw->info->clip_units = FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("clip_units")));
|
615
|
+
draw->info->clip_units = (ClipPathUnits)FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("clip_units")));
|
616
616
|
#if defined(IMAGEMAGICK_7)
|
617
617
|
draw->info->alpha = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("alpha")));
|
618
618
|
#else
|
@@ -957,7 +957,7 @@ Draw_clone(VALUE self)
|
|
957
957
|
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
958
958
|
* imagelist, uses the current image.
|
959
959
|
*
|
960
|
-
* @overload composite(x, y, width, height, image,
|
960
|
+
* @overload composite(x, y, width, height, image, composite_op = Magick::OverCompositeOp)
|
961
961
|
* - The "image" argument can be either an ImageList object or an Image
|
962
962
|
* argument.
|
963
963
|
* @param x [Float] x position
|
@@ -966,7 +966,7 @@ Draw_clone(VALUE self)
|
|
966
966
|
* @param height [Float] the height
|
967
967
|
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
968
968
|
* imagelist, uses the current image.
|
969
|
-
* @param
|
969
|
+
* @param composite_op [Magick::CompositeOperator] the operator
|
970
970
|
*
|
971
971
|
* @return [Magick::Draw] self
|
972
972
|
*/
|
@@ -976,7 +976,7 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
976
976
|
Draw *draw;
|
977
977
|
const char *op;
|
978
978
|
double x, y, width, height;
|
979
|
-
CompositeOperator
|
979
|
+
CompositeOperator composite_op;
|
980
980
|
VALUE image;
|
981
981
|
Image *comp_img;
|
982
982
|
struct TmpFile_Name *tmpfile_name;
|
@@ -998,16 +998,16 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
998
998
|
width = NUM2DBL(argv[2]);
|
999
999
|
height = NUM2DBL(argv[3]);
|
1000
1000
|
|
1001
|
-
|
1001
|
+
composite_op = OverCompositeOp;
|
1002
1002
|
if (argc == 6)
|
1003
1003
|
{
|
1004
|
-
VALUE_TO_ENUM(argv[5],
|
1004
|
+
VALUE_TO_ENUM(argv[5], composite_op, CompositeOperator);
|
1005
1005
|
}
|
1006
1006
|
|
1007
|
-
op = CommandOptionToMnemonic(MagickComposeOptions,
|
1007
|
+
op = CommandOptionToMnemonic(MagickComposeOptions, composite_op);
|
1008
1008
|
if (rm_strcasecmp("Unrecognized", op) == 0)
|
1009
1009
|
{
|
1010
|
-
rb_raise(rb_eArgError, "unknown composite operator (%d)",
|
1010
|
+
rb_raise(rb_eArgError, "unknown composite operator (%d)", composite_op);
|
1011
1011
|
}
|
1012
1012
|
|
1013
1013
|
TypedData_Get_Struct(self, Draw, &rm_draw_data_type, draw);
|
@@ -1018,7 +1018,7 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1018
1018
|
// Add the temp filename to the filename array.
|
1019
1019
|
// Use Magick storage since we need to keep the list around
|
1020
1020
|
// until destroy_Draw is called.
|
1021
|
-
tmpfile_name = magick_malloc(sizeof(struct TmpFile_Name) + rm_strnlen_s(name, sizeof(name)));
|
1021
|
+
tmpfile_name = (struct TmpFile_Name *)magick_malloc(sizeof(struct TmpFile_Name) + rm_strnlen_s(name, sizeof(name)));
|
1022
1022
|
strcpy(tmpfile_name->name, name);
|
1023
1023
|
tmpfile_name->next = draw->tmpfile_ary;
|
1024
1024
|
draw->tmpfile_ary = tmpfile_name;
|
@@ -1235,14 +1235,14 @@ Draw_inspect(VALUE self)
|
|
1235
1235
|
*
|
1236
1236
|
* @return [Magick::Draw] a new Draw object
|
1237
1237
|
*/
|
1238
|
-
VALUE Draw_alloc(VALUE
|
1238
|
+
VALUE Draw_alloc(VALUE klass)
|
1239
1239
|
{
|
1240
1240
|
Draw *draw;
|
1241
1241
|
VALUE draw_obj;
|
1242
1242
|
|
1243
1243
|
draw = ALLOC(Draw);
|
1244
1244
|
memset(draw, 0, sizeof(Draw));
|
1245
|
-
draw_obj = TypedData_Wrap_Struct(
|
1245
|
+
draw_obj = TypedData_Wrap_Struct(klass, &rm_draw_data_type, draw);
|
1246
1246
|
|
1247
1247
|
RB_GC_GUARD(draw_obj);
|
1248
1248
|
|
@@ -1388,14 +1388,14 @@ new_DrawOptions(void)
|
|
1388
1388
|
* @return [Magick::Image::DrawOptions] a new DrawOptions object
|
1389
1389
|
*/
|
1390
1390
|
VALUE
|
1391
|
-
DrawOptions_alloc(VALUE
|
1391
|
+
DrawOptions_alloc(VALUE klass)
|
1392
1392
|
{
|
1393
1393
|
Draw *draw_options;
|
1394
1394
|
VALUE draw_options_obj;
|
1395
1395
|
|
1396
1396
|
draw_options = ALLOC(Draw);
|
1397
1397
|
memset(draw_options, 0, sizeof(Draw));
|
1398
|
-
draw_options_obj = TypedData_Wrap_Struct(
|
1398
|
+
draw_options_obj = TypedData_Wrap_Struct(klass, &rm_draw_data_type, draw_options);
|
1399
1399
|
|
1400
1400
|
RB_GC_GUARD(draw_options_obj);
|
1401
1401
|
|
@@ -1433,12 +1433,12 @@ DrawOptions_initialize(VALUE self)
|
|
1433
1433
|
* Allocate a new Magick::Image::PolaroidOptions object.
|
1434
1434
|
*
|
1435
1435
|
* - Internally a PolaroidOptions object is the same as a Draw object. The
|
1436
|
-
* methods are implemented by Draw methods in rmdraw.
|
1436
|
+
* methods are implemented by Draw methods in rmdraw.cpp.
|
1437
1437
|
*
|
1438
1438
|
* @return [Magick::Image::PolaroidOptions] a new PolaroidOptions object
|
1439
1439
|
*/
|
1440
1440
|
VALUE
|
1441
|
-
PolaroidOptions_alloc(VALUE
|
1441
|
+
PolaroidOptions_alloc(VALUE klass)
|
1442
1442
|
{
|
1443
1443
|
VALUE polaroid_obj;
|
1444
1444
|
ImageInfo *image_info;
|
@@ -1452,7 +1452,7 @@ PolaroidOptions_alloc(VALUE class)
|
|
1452
1452
|
draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
|
1453
1453
|
(void) DestroyImageInfo(image_info);
|
1454
1454
|
|
1455
|
-
polaroid_obj = TypedData_Wrap_Struct(
|
1455
|
+
polaroid_obj = TypedData_Wrap_Struct(klass, &rm_draw_data_type, draw);
|
1456
1456
|
|
1457
1457
|
RB_GC_GUARD(polaroid_obj);
|
1458
1458
|
|
@@ -1612,7 +1612,7 @@ get_type_metrics(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
|
|
1612
1612
|
VALUE t;
|
1613
1613
|
TypeMetric metrics;
|
1614
1614
|
char *text = NULL;
|
1615
|
-
|
1615
|
+
size_t text_l;
|
1616
1616
|
MagickBooleanType okay;
|
1617
1617
|
#if defined(IMAGEMAGICK_7)
|
1618
1618
|
ExceptionInfo *exception;
|
@@ -1667,7 +1667,8 @@ get_type_metrics(int argc, VALUE *argv, VALUE self, gvl_function_t fp)
|
|
1667
1667
|
#else
|
1668
1668
|
GVL_STRUCT_TYPE(get_type_metrics) args = { image, draw->info, &metrics };
|
1669
1669
|
#endif
|
1670
|
-
|
1670
|
+
void *ret = CALL_FUNC_WITHOUT_GVL(fp, &args);
|
1671
|
+
okay = reinterpret_cast<MagickBooleanType &>(ret);
|
1671
1672
|
|
1672
1673
|
magick_free(draw->info->text);
|
1673
1674
|
draw->info->text = NULL;
|