rmagick 2.13.2 → 4.2.2
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 +7 -0
- data/.codeclimate.yml +63 -0
- data/.editorconfig +17 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.github/workflows/ci.yml +107 -0
- data/.gitignore +25 -0
- data/.rspec +2 -0
- data/.rubocop.yml +37 -0
- data/.rubocop_todo.yml +449 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +1277 -0
- data/CODE_OF_CONDUCT.md +128 -0
- data/CONTRIBUTING.md +81 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +324 -0
- data/Rakefile +190 -0
- data/before_install_linux.sh +69 -0
- data/before_install_osx.sh +57 -0
- data/deprecated/RMagick.rb +6 -0
- data/ext/RMagick/extconf.rb +334 -333
- data/ext/RMagick/rmagick.c +129 -127
- data/ext/RMagick/rmagick.h +221 -320
- data/ext/RMagick/rmdraw.c +458 -767
- data/ext/RMagick/rmenum.c +305 -752
- data/ext/RMagick/rmfill.c +231 -199
- data/ext/RMagick/rmilist.c +437 -478
- data/ext/RMagick/rmimage.c +6130 -5342
- data/ext/RMagick/rminfo.c +695 -833
- data/ext/RMagick/rmkinfo.c +198 -0
- data/ext/RMagick/rmmain.c +752 -506
- data/ext/RMagick/rmmontage.c +94 -152
- data/ext/RMagick/rmpixel.c +619 -425
- data/ext/RMagick/rmstruct.c +206 -309
- data/ext/RMagick/rmutil.c +514 -344
- data/lib/rmagick/version.rb +5 -0
- data/lib/rmagick.rb +1 -0
- data/lib/rmagick_internal.rb +1922 -0
- data/lib/rvg/clippath.rb +35 -39
- data/lib/rvg/container.rb +123 -124
- data/lib/rvg/deep_equal.rb +45 -49
- data/lib/rvg/describable.rb +41 -47
- data/lib/rvg/embellishable.rb +380 -411
- data/lib/rvg/misc.rb +691 -711
- data/lib/rvg/paint.rb +43 -47
- data/lib/rvg/pathdata.rb +119 -125
- data/lib/rvg/rvg.rb +214 -213
- data/lib/rvg/stretchable.rb +153 -162
- data/lib/rvg/stylable.rb +111 -117
- data/lib/rvg/text.rb +169 -180
- data/lib/rvg/transformable.rb +121 -127
- data/lib/rvg/units.rb +58 -61
- data/rmagick.gemspec +36 -16
- metadata +188 -365
- data/ChangeLog +0 -773
- data/Doxyfile +0 -1514
- data/README-Mac-OSX.txt +0 -1
- data/README.html +0 -10
- data/build_tarball.rake +0 -215
- data/doc/comtasks.html +0 -287
- data/doc/constants.html +0 -1581
- data/doc/css/doc.css +0 -299
- data/doc/css/popup.css +0 -34
- data/doc/css/ref.css +0 -67
- data/doc/draw.html +0 -3269
- data/doc/ex/InitialCoords.rb +0 -23
- data/doc/ex/NewCoordSys.rb +0 -32
- data/doc/ex/OrigCoordSys.rb +0 -18
- data/doc/ex/PreserveAspectRatio.rb +0 -205
- data/doc/ex/RotateScale.rb +0 -37
- data/doc/ex/Skew.rb +0 -38
- data/doc/ex/Use01.rb +0 -16
- data/doc/ex/Use02.rb +0 -21
- data/doc/ex/Use03.rb +0 -16
- data/doc/ex/ViewBox.rb +0 -33
- data/doc/ex/adaptive_threshold.rb +0 -10
- data/doc/ex/add_noise.rb +0 -17
- data/doc/ex/affine.rb +0 -48
- data/doc/ex/affine_transform.rb +0 -20
- data/doc/ex/arc.rb +0 -49
- data/doc/ex/arcpath.rb +0 -33
- data/doc/ex/arcs01.rb +0 -28
- data/doc/ex/arcs02.rb +0 -61
- data/doc/ex/average.rb +0 -15
- data/doc/ex/axes.rb +0 -64
- data/doc/ex/baseline_shift01.rb +0 -18
- data/doc/ex/bilevel_channel.rb +0 -9
- data/doc/ex/blur_image.rb +0 -12
- data/doc/ex/border.rb +0 -10
- data/doc/ex/bounding_box.rb +0 -44
- data/doc/ex/cbezier1.rb +0 -42
- data/doc/ex/cbezier2.rb +0 -42
- data/doc/ex/cbezier3.rb +0 -42
- data/doc/ex/cbezier4.rb +0 -43
- data/doc/ex/cbezier5.rb +0 -43
- data/doc/ex/cbezier6.rb +0 -53
- data/doc/ex/channel.rb +0 -26
- data/doc/ex/charcoal.rb +0 -12
- data/doc/ex/chop.rb +0 -29
- data/doc/ex/circle.rb +0 -33
- data/doc/ex/circle01.rb +0 -17
- data/doc/ex/clip_path.rb +0 -60
- data/doc/ex/coalesce.rb +0 -60
- data/doc/ex/color_fill_to_border.rb +0 -29
- data/doc/ex/color_floodfill.rb +0 -28
- data/doc/ex/color_histogram.rb +0 -48
- data/doc/ex/color_reset.rb +0 -11
- data/doc/ex/colorize.rb +0 -16
- data/doc/ex/colors.rb +0 -64
- data/doc/ex/compose_mask.rb +0 -23
- data/doc/ex/composite.rb +0 -135
- data/doc/ex/composite_layers.rb +0 -53
- data/doc/ex/composite_tiled.rb +0 -23
- data/doc/ex/contrast.rb +0 -36
- data/doc/ex/crop.rb +0 -31
- data/doc/ex/crop_with_gravity.rb +0 -46
- data/doc/ex/cubic01.rb +0 -45
- data/doc/ex/cubic02.rb +0 -94
- data/doc/ex/cycle_colormap.rb +0 -21
- data/doc/ex/dissolve.rb +0 -13
- data/doc/ex/drawcomp.rb +0 -42
- data/doc/ex/drop_shadow.rb +0 -60
- data/doc/ex/edge.rb +0 -11
- data/doc/ex/ellipse.rb +0 -45
- data/doc/ex/ellipse01.rb +0 -22
- data/doc/ex/emboss.rb +0 -11
- data/doc/ex/enhance.rb +0 -28
- data/doc/ex/equalize.rb +0 -11
- data/doc/ex/evenodd.rb +0 -43
- data/doc/ex/fill_pattern.rb +0 -26
- data/doc/ex/flatten_images.rb +0 -36
- data/doc/ex/flip.rb +0 -11
- data/doc/ex/flop.rb +0 -11
- data/doc/ex/font_styles.rb +0 -34
- data/doc/ex/fonts.rb +0 -20
- data/doc/ex/frame.rb +0 -12
- data/doc/ex/gaussian_blur.rb +0 -11
- data/doc/ex/get_multiline_type_metrics.rb +0 -42
- data/doc/ex/get_pixels.rb +0 -48
- data/doc/ex/get_type_metrics.rb +0 -146
- data/doc/ex/gradientfill.rb +0 -27
- data/doc/ex/grav.rb +0 -46
- data/doc/ex/gravity.rb +0 -79
- data/doc/ex/group.rb +0 -26
- data/doc/ex/hatchfill.rb +0 -27
- data/doc/ex/image.rb +0 -46
- data/doc/ex/images/Apple.miff +0 -0
- data/doc/ex/images/Ballerina.jpg +0 -0
- data/doc/ex/images/Ballerina3.jpg +0 -0
- data/doc/ex/images/Button_0.gif +0 -0
- data/doc/ex/images/Button_1.gif +0 -0
- data/doc/ex/images/Button_2.gif +0 -0
- data/doc/ex/images/Button_3.gif +0 -0
- data/doc/ex/images/Button_4.gif +0 -0
- data/doc/ex/images/Button_5.gif +0 -0
- data/doc/ex/images/Button_6.gif +0 -0
- data/doc/ex/images/Button_7.gif +0 -0
- data/doc/ex/images/Button_8.gif +0 -0
- data/doc/ex/images/Button_9.gif +0 -0
- data/doc/ex/images/Button_A.gif +0 -0
- data/doc/ex/images/Button_B.gif +0 -0
- data/doc/ex/images/Button_C.gif +0 -0
- data/doc/ex/images/Button_D.gif +0 -0
- data/doc/ex/images/Button_E.gif +0 -0
- data/doc/ex/images/Button_F.gif +0 -0
- data/doc/ex/images/Button_G.gif +0 -0
- data/doc/ex/images/Button_H.gif +0 -0
- data/doc/ex/images/Button_I.gif +0 -0
- data/doc/ex/images/Button_J.gif +0 -0
- data/doc/ex/images/Button_K.gif +0 -0
- data/doc/ex/images/Button_L.gif +0 -0
- data/doc/ex/images/Button_M.gif +0 -0
- data/doc/ex/images/Button_N.gif +0 -0
- data/doc/ex/images/Button_O.gif +0 -0
- data/doc/ex/images/Button_P.gif +0 -0
- data/doc/ex/images/Button_Q.gif +0 -0
- data/doc/ex/images/Button_R.gif +0 -0
- data/doc/ex/images/Button_S.gif +0 -0
- data/doc/ex/images/Button_T.gif +0 -0
- data/doc/ex/images/Button_U.gif +0 -0
- data/doc/ex/images/Button_V.gif +0 -0
- data/doc/ex/images/Button_W.gif +0 -0
- data/doc/ex/images/Button_X.gif +0 -0
- data/doc/ex/images/Button_Y.gif +0 -0
- data/doc/ex/images/Button_Z.gif +0 -0
- data/doc/ex/images/Cheetah.jpg +0 -0
- data/doc/ex/images/Coffee.wmf +0 -0
- data/doc/ex/images/Flower_Hat.jpg +0 -0
- data/doc/ex/images/Gold_Statue.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
- data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
- data/doc/ex/images/Leaf.miff +0 -0
- data/doc/ex/images/No.wmf +0 -0
- data/doc/ex/images/Polynesia.jpg +0 -0
- data/doc/ex/images/Red_Rocks.jpg +0 -0
- data/doc/ex/images/Rocks_On_Beach.miff +0 -0
- data/doc/ex/images/Shorts.jpg +0 -0
- data/doc/ex/images/Snake.wmf +0 -0
- data/doc/ex/images/Violin.jpg +0 -0
- data/doc/ex/images/Yellow_Rose.miff +0 -0
- data/doc/ex/images/big-duck.gif +0 -0
- data/doc/ex/images/duck.gif +0 -0
- data/doc/ex/images/duck0.gif +0 -0
- data/doc/ex/images/duck1.gif +0 -0
- data/doc/ex/images/duck10.gif +0 -0
- data/doc/ex/images/duck11.gif +0 -0
- data/doc/ex/images/duck12.gif +0 -0
- data/doc/ex/images/duck13.gif +0 -0
- data/doc/ex/images/duck14.gif +0 -0
- data/doc/ex/images/duck15.gif +0 -0
- data/doc/ex/images/duck2.gif +0 -0
- data/doc/ex/images/duck3.gif +0 -0
- data/doc/ex/images/duck4.gif +0 -0
- data/doc/ex/images/duck5.gif +0 -0
- data/doc/ex/images/duck6.gif +0 -0
- data/doc/ex/images/duck7.gif +0 -0
- data/doc/ex/images/duck8.gif +0 -0
- data/doc/ex/images/duck9.gif +0 -0
- data/doc/ex/images/graydient230x6.gif +0 -0
- data/doc/ex/images/logo400x83.gif +0 -0
- data/doc/ex/images/model.miff +0 -0
- data/doc/ex/images/notimplemented.gif +0 -0
- data/doc/ex/images/smile.miff +0 -0
- data/doc/ex/images/spin.gif +0 -0
- data/doc/ex/implode.rb +0 -34
- data/doc/ex/level.rb +0 -11
- data/doc/ex/level_colors.rb +0 -11
- data/doc/ex/line.rb +0 -42
- data/doc/ex/line01.rb +0 -23
- data/doc/ex/mask.rb +0 -36
- data/doc/ex/matte_fill_to_border.rb +0 -40
- data/doc/ex/matte_floodfill.rb +0 -33
- data/doc/ex/matte_replace.rb +0 -40
- data/doc/ex/median_filter.rb +0 -28
- data/doc/ex/modulate.rb +0 -11
- data/doc/ex/mono.rb +0 -23
- data/doc/ex/morph.rb +0 -26
- data/doc/ex/mosaic.rb +0 -35
- data/doc/ex/motion_blur.rb +0 -11
- data/doc/ex/negate.rb +0 -11
- data/doc/ex/negate_channel.rb +0 -9
- data/doc/ex/nested_rvg.rb +0 -21
- data/doc/ex/nonzero.rb +0 -43
- data/doc/ex/normalize.rb +0 -11
- data/doc/ex/oil_paint.rb +0 -11
- data/doc/ex/opacity.rb +0 -37
- data/doc/ex/ordered_dither.rb +0 -11
- data/doc/ex/path.rb +0 -64
- data/doc/ex/pattern1.rb +0 -25
- data/doc/ex/pattern2.rb +0 -26
- data/doc/ex/polaroid.rb +0 -28
- data/doc/ex/polygon.rb +0 -24
- data/doc/ex/polygon01.rb +0 -23
- data/doc/ex/polyline.rb +0 -23
- data/doc/ex/polyline01.rb +0 -23
- data/doc/ex/posterize.rb +0 -8
- data/doc/ex/preview.rb +0 -9
- data/doc/ex/qbezierpath.rb +0 -52
- data/doc/ex/quad01.rb +0 -36
- data/doc/ex/quantize-m.rb +0 -25
- data/doc/ex/radial_blur.rb +0 -9
- data/doc/ex/raise.rb +0 -8
- data/doc/ex/random_threshold_channel.rb +0 -13
- data/doc/ex/rect01.rb +0 -15
- data/doc/ex/rect02.rb +0 -22
- data/doc/ex/rectangle.rb +0 -35
- data/doc/ex/reduce_noise.rb +0 -28
- data/doc/ex/remap.rb +0 -12
- data/doc/ex/remap_images.rb +0 -21
- data/doc/ex/resize_to_fill.rb +0 -10
- data/doc/ex/resize_to_fit.rb +0 -10
- data/doc/ex/roll.rb +0 -9
- data/doc/ex/rotate.rb +0 -45
- data/doc/ex/rotate_f.rb +0 -14
- data/doc/ex/roundrect.rb +0 -34
- data/doc/ex/rubyname.rb +0 -30
- data/doc/ex/rvg_clippath.rb +0 -14
- data/doc/ex/rvg_linecap.rb +0 -43
- data/doc/ex/rvg_linejoin.rb +0 -41
- data/doc/ex/rvg_opacity.rb +0 -19
- data/doc/ex/rvg_pattern.rb +0 -26
- data/doc/ex/rvg_stroke_dasharray.rb +0 -12
- data/doc/ex/segment.rb +0 -11
- data/doc/ex/sepiatone.rb +0 -8
- data/doc/ex/shade.rb +0 -11
- data/doc/ex/shadow.rb +0 -31
- data/doc/ex/shave.rb +0 -15
- data/doc/ex/shear.rb +0 -10
- data/doc/ex/sketch.rb +0 -18
- data/doc/ex/skewx.rb +0 -52
- data/doc/ex/skewy.rb +0 -47
- data/doc/ex/smile.rb +0 -125
- data/doc/ex/solarize.rb +0 -11
- data/doc/ex/sparse_color.rb +0 -55
- data/doc/ex/splice.rb +0 -9
- data/doc/ex/spread.rb +0 -11
- data/doc/ex/stegano.rb +0 -55
- data/doc/ex/stroke_dasharray.rb +0 -43
- data/doc/ex/stroke_fill.rb +0 -11
- data/doc/ex/stroke_linecap.rb +0 -44
- data/doc/ex/stroke_linejoin.rb +0 -48
- data/doc/ex/stroke_width.rb +0 -49
- data/doc/ex/swirl.rb +0 -17
- data/doc/ex/text.rb +0 -37
- data/doc/ex/text01.rb +0 -17
- data/doc/ex/text_align.rb +0 -36
- data/doc/ex/text_antialias.rb +0 -38
- data/doc/ex/text_styles.rb +0 -21
- data/doc/ex/text_undercolor.rb +0 -28
- data/doc/ex/texture_fill_to_border.rb +0 -34
- data/doc/ex/texture_floodfill.rb +0 -32
- data/doc/ex/texturefill.rb +0 -25
- data/doc/ex/threshold.rb +0 -13
- data/doc/ex/to_blob.rb +0 -14
- data/doc/ex/translate.rb +0 -39
- data/doc/ex/transparent.rb +0 -38
- data/doc/ex/transpose.rb +0 -9
- data/doc/ex/transverse.rb +0 -9
- data/doc/ex/tref01.rb +0 -25
- data/doc/ex/triangle01.rb +0 -16
- data/doc/ex/trim.rb +0 -24
- data/doc/ex/tspan01.rb +0 -18
- data/doc/ex/tspan02.rb +0 -19
- data/doc/ex/tspan03.rb +0 -21
- data/doc/ex/unsharp_mask.rb +0 -28
- data/doc/ex/viewex.rb +0 -35
- data/doc/ex/vignette.rb +0 -12
- data/doc/ex/watermark.rb +0 -28
- data/doc/ex/wave.rb +0 -9
- data/doc/ex/wet_floor.rb +0 -59
- data/doc/ex/writing_mode01.rb +0 -27
- data/doc/ex/writing_mode02.rb +0 -26
- data/doc/ilist.html +0 -2056
- data/doc/image1.html +0 -4680
- data/doc/image2.html +0 -3665
- data/doc/image3.html +0 -4522
- data/doc/imageattrs.html +0 -1638
- data/doc/imusage.html +0 -514
- data/doc/index.html +0 -416
- data/doc/info.html +0 -1499
- data/doc/magick.html +0 -565
- data/doc/optequiv.html +0 -2435
- data/doc/rvg.html +0 -975
- data/doc/rvgclip.html +0 -248
- data/doc/rvggroup.html +0 -305
- data/doc/rvgimage.html +0 -289
- data/doc/rvgpattern.html +0 -475
- data/doc/rvgshape.html +0 -406
- data/doc/rvgstyle.html +0 -270
- data/doc/rvgtext.html +0 -465
- data/doc/rvgtspan.html +0 -238
- data/doc/rvgtut.html +0 -530
- data/doc/rvguse.html +0 -145
- data/doc/rvgxform.html +0 -294
- data/doc/scripts/doc.js +0 -22
- data/doc/scripts/stripeTables.js +0 -23
- data/doc/struct.html +0 -1339
- data/doc/usage.html +0 -1621
- data/examples/constitute.rb +0 -7
- data/examples/crop_with_gravity.rb +0 -46
- data/examples/demo.rb +0 -324
- data/examples/describe.rb +0 -44
- data/examples/find_similar_region.rb +0 -34
- data/examples/histogram.rb +0 -325
- data/examples/identify.rb +0 -187
- data/examples/image_opacity.rb +0 -29
- data/examples/import_export.rb +0 -31
- data/examples/pattern_fill.rb +0 -38
- data/examples/rotating_text.rb +0 -45
- data/examples/spinner.rb +0 -50
- data/examples/thumbnail.rb +0 -65
- data/examples/vignette.rb +0 -79
- data/ext/RMagick/MANIFEST +0 -358
- data/lib/RMagick.rb +0 -1962
- data/metaconfig +0 -7
- data/post-clean.rb +0 -12
- data/post-install.rb +0 -50
- data/post-setup.rb +0 -254
- data/setup.rb +0 -1585
- data/uninstall.rb +0 -76
data/ext/RMagick/rmagick.h
CHANGED
@@ -19,22 +19,39 @@
|
|
19
19
|
#include <assert.h>
|
20
20
|
#include <stdio.h>
|
21
21
|
#include <ctype.h>
|
22
|
-
#if defined(HAVE_STDINT_H)
|
23
|
-
#include <stdint.h>
|
24
|
-
#endif
|
25
22
|
#include <stdlib.h>
|
26
23
|
#include <math.h>
|
27
|
-
#include <time.h>
|
28
|
-
#if defined(HAVE_SYS_TYPES_H)
|
29
24
|
#include <sys/types.h>
|
30
|
-
#endif
|
31
25
|
#include "ruby.h"
|
32
|
-
#
|
33
|
-
|
26
|
+
#include "ruby/io.h"
|
27
|
+
|
28
|
+
#if defined(__MINGW32__)
|
29
|
+
// Ruby defines wrong format specifiers for MinGW. So this defines original macro in here.
|
30
|
+
#if SIZEOF_SIZE_T == SIZEOF_LONG
|
31
|
+
#define RMIuSIZE "lu"
|
32
|
+
#define RMIdSIZE "ld"
|
33
|
+
#define RMIsVALUE "li\v"
|
34
|
+
#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
|
35
|
+
#define RMIuSIZE "I64u"
|
36
|
+
#define RMIdSIZE "I64d"
|
37
|
+
#define RMIsVALUE "I64i\v"
|
38
|
+
#endif
|
34
39
|
#else
|
35
|
-
|
40
|
+
// Use constants defined in Ruby
|
41
|
+
#define RMIuSIZE PRIuSIZE
|
42
|
+
#define RMIdSIZE PRIdSIZE
|
43
|
+
#define RMIsVALUE PRIsVALUE
|
36
44
|
#endif
|
37
45
|
|
46
|
+
#if defined(__GNUC__)
|
47
|
+
#pragma GCC diagnostic push
|
48
|
+
#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
|
49
|
+
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
50
|
+
|
51
|
+
#if __GNUC__ > 6
|
52
|
+
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
53
|
+
#endif
|
54
|
+
#endif
|
38
55
|
|
39
56
|
// Undef Ruby's versions of these symbols
|
40
57
|
#undef PACKAGE_VERSION
|
@@ -44,21 +61,32 @@
|
|
44
61
|
#undef PACKAGE_TARNAME
|
45
62
|
#undef WORDS_BIGENDIAN
|
46
63
|
|
47
|
-
#include "
|
48
|
-
|
64
|
+
#include "extconf.h"
|
65
|
+
|
66
|
+
#if defined(IMAGEMAGICK_7)
|
67
|
+
#include "MagickCore/MagickCore.h"
|
68
|
+
#include "MagickCore/magick-config.h"
|
69
|
+
#else
|
70
|
+
#include "magick/MagickCore.h"
|
71
|
+
#include "magick/magick-config.h"
|
72
|
+
#endif
|
49
73
|
|
50
74
|
// Undef ImageMagick's versions of these symbols
|
51
75
|
#undef PACKAGE_STRING
|
52
76
|
|
53
77
|
|
54
|
-
#include "extconf.h"
|
55
|
-
|
56
|
-
|
57
78
|
//! For quoting preprocessor symbols
|
58
79
|
#define Q2(q) #q
|
59
80
|
//! For quoting preprocessor symbols
|
60
81
|
#define Q(q) Q2(q)
|
61
82
|
|
83
|
+
#ifdef __GNUC__
|
84
|
+
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
85
|
+
#define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
|
86
|
+
#else
|
87
|
+
#define ATTRIBUTE_UNUSED
|
88
|
+
#define ATTRIBUTE_NORETURN
|
89
|
+
#endif
|
62
90
|
|
63
91
|
//! Trace new image creation in bang methods
|
64
92
|
#define UPDATE_DATA_PTR(_obj_, _new_) \
|
@@ -68,78 +96,40 @@
|
|
68
96
|
|
69
97
|
|
70
98
|
// Handle Quantum <-> Ruby Numeric object conversion
|
71
|
-
#if (
|
99
|
+
#if (MAGICKCORE_QUANTUM_DEPTH == 8 || MAGICKCORE_QUANTUM_DEPTH == 16)
|
72
100
|
#define QUANTUM2NUM(q) INT2FIX((q)) /**< Quantum -> Ruby Numeric conversion */
|
73
101
|
#define NUM2QUANTUM(n) (Quantum)NUM2UINT((n)) /**< Quantum <- Ruby Numeric conversion */
|
74
|
-
#elif (
|
102
|
+
#elif (MAGICKCORE_QUANTUM_DEPTH == 32)
|
75
103
|
#define QUANTUM2NUM(q) UINT2NUM((q)) /**< Quantum -> Ruby Numeric conversion */
|
76
104
|
#define NUM2QUANTUM(n) (Quantum)NUM2UINT((n)) /**< Quntum <- Ruby Numeric conversion */
|
77
|
-
#elif (
|
105
|
+
#elif (MAGICKCORE_QUANTUM_DEPTH == 64)
|
78
106
|
#define QUANTUM2NUM(q) ULL2NUM((q)) /**< Quantum -> Ruby Numeric conversion */
|
79
107
|
#define NUM2QUANTUM(n) (Quantum)NUM2ULL((n)) /**< Quntum <- Ruby Numeric conversion */
|
80
108
|
#else
|
81
|
-
#error Specified
|
109
|
+
#error Specified MAGICKCORE_QUANTUM_DEPTH is not supported.
|
82
110
|
#endif
|
83
111
|
//! Convert user-supplied objects to Quantum
|
84
112
|
#define APP2QUANTUM(n) rm_app2quantum((n))
|
85
113
|
|
86
114
|
//! degrees to radians conversion
|
87
115
|
#undef DegreesToRadians // defined in ImageMagick.h in 6.0.2
|
88
|
-
#define DegreesToRadians(x) ((x)*3.14159265358979323846/180.0)
|
116
|
+
#define DegreesToRadians(x) ((x)*3.14159265358979323846/180.0)
|
89
117
|
|
90
118
|
//! pixel intensity calculation
|
91
119
|
#define PIXEL_INTENSITY(q) ((Quantum)(0.299*(q)->red + 0.587*(q)->green + 0.114*(q)->blue + 0.5))
|
92
120
|
|
93
121
|
//! find maximum of longs
|
94
|
-
#define LMAX(a,b) ((((long)(a))>((long)(b)))?((long)(a)):((long)(b)))
|
122
|
+
#define LMAX(a, b) ((((long)(a))>((long)(b)))?((long)(a)):((long)(b)))
|
95
123
|
//! find maximum of floats
|
96
|
-
#define FMAX(a,b) ((((double)(a))>((double)(b)))?((double)(a)):((double)(b)))
|
124
|
+
#define FMAX(a, b) ((((double)(a))>((double)(b)))?((double)(a)):((double)(b)))
|
97
125
|
//! find minimum of floats
|
98
|
-
#define FMIN(a,b) ((((double)(a))<=((double)(b)))?((double)(a)):((double)(b)))
|
126
|
+
#define FMIN(a, b) ((((double)(a))<=((double)(b)))?((double)(a)):((double)(b)))
|
99
127
|
|
100
128
|
#define RMAGICK_PI 3.14159265358979 /**< pi */
|
101
129
|
|
102
130
|
//! round to Quantum
|
103
131
|
#define ROUND_TO_QUANTUM(value) ((Quantum) ((value) > (Quantum)QuantumRange ? QuantumRange : (value) + 0.5))
|
104
132
|
|
105
|
-
|
106
|
-
// Ruby 1.9.0 changed the name to rb_frame_this_func
|
107
|
-
#if defined(HAVE_RB_FRAME_THIS_FUNC)
|
108
|
-
#define THIS_FUNC() rb_frame_this_func() /**< get the Ruby function being called */
|
109
|
-
#else
|
110
|
-
#define THIS_FUNC() rb_frame_last_func() /**< get the Ruby function being called */
|
111
|
-
#endif
|
112
|
-
|
113
|
-
// GetReadFile doesn't exist in Ruby 1.9.0
|
114
|
-
#if !defined(GetReadFile)
|
115
|
-
#define GetReadFile(fptr) rb_io_stdio_file(fptr) /**< Ruby read file pointer */
|
116
|
-
#define GetWriteFile(fptr) rb_io_stdio_file(fptr) /**< Ruby write file pointer */
|
117
|
-
#endif
|
118
|
-
|
119
|
-
// rb_io_t replaces OpenFile in Ruby 1.9.0
|
120
|
-
#if defined(HAVE_RB_IO_T)
|
121
|
-
#undef OpenFile
|
122
|
-
#define OpenFile rb_io_t /**< Ruby open file */
|
123
|
-
#endif
|
124
|
-
|
125
|
-
// These macros are required in 1.9.1 but aren't defined prior to 1.8.6.
|
126
|
-
#if !defined(RSTRING_LEN)
|
127
|
-
#define RSTRING_LEN(s) (RSTRING((s))->len) /**< Ruby string length */
|
128
|
-
#endif
|
129
|
-
#if !defined(RSTRING_PTR)
|
130
|
-
#define RSTRING_PTR(s) (RSTRING((s))->ptr) /**< Ruby string pointer */
|
131
|
-
#endif
|
132
|
-
|
133
|
-
// Backport these two macros to 1.8
|
134
|
-
#if !defined(RARRAY_LEN)
|
135
|
-
#define RARRAY_LEN(a) RARRAY((a))->len /**< Ruby array length */
|
136
|
-
#endif
|
137
|
-
// Matz says this macro is read-only! (see http://www.ruby-forum.com/topic/146072)
|
138
|
-
#if !defined(RARRAY_PTR)
|
139
|
-
#define RARRAY_PTR(a) RARRAY((a))->ptr /**< Ruby array pointer */
|
140
|
-
#endif
|
141
|
-
|
142
|
-
|
143
133
|
//! Convert a C string to a Ruby symbol. Used in marshal_dump/marshal_load methods
|
144
134
|
#define CSTR2SYM(s) ID2SYM(rb_intern(s))
|
145
135
|
//! Convert a C string to a Ruby String, or nil if the ptr is NULL
|
@@ -150,49 +140,53 @@
|
|
150
140
|
*/
|
151
141
|
#define OBJ_TO_MAGICK_STRING(f, obj) \
|
152
142
|
if ((obj) != Qnil)\
|
153
|
-
|
143
|
+
{\
|
144
|
+
VALUE str = rb_String(obj);\
|
145
|
+
magick_clone_string(&f, StringValueCStr(str));\
|
146
|
+
}\
|
154
147
|
else\
|
155
148
|
f = NULL;
|
156
149
|
|
157
150
|
|
158
|
-
/** ImageMagick 6.5.7 replaced DestroyConstitute with
|
159
|
-
* ConstituteComponentTerminus. Both have the same signature.
|
160
|
-
*/
|
161
|
-
#if defined(HAVE_CONSTITUTECOMPONENTTERMINUS)
|
162
|
-
#define DestroyConstitute(void) ConstituteComponentTerminus(void)
|
163
|
-
#endif
|
164
|
-
|
165
|
-
/** ImageMagick 6.5.9 replaced MagickLibSubversion with
|
166
|
-
* MagickLibAddendum.
|
167
|
-
*/
|
168
|
-
#if defined(HAVE_MAGICKLIBADDENDUM)
|
169
151
|
#define MagickLibSubversion MagickLibAddendum
|
170
|
-
#endif
|
171
|
-
|
172
|
-
/** IM 6.4.1 replaced AllocateImage with AcquireImage.
|
173
|
-
* Both have the same signature.
|
174
|
-
*/
|
175
|
-
#if !defined(HAVE_ACQUIREIMAGE)
|
176
|
-
#define AcquireImage(info) AllocateImage(info)
|
177
|
-
#endif
|
178
152
|
|
179
|
-
|
180
|
-
#if defined(
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
153
|
+
typedef ImageInfo Info; /**< Make type name match class name */
|
154
|
+
#if defined(IMAGEMAGICK_7)
|
155
|
+
typedef struct _QuantumPixelPacket
|
156
|
+
{
|
157
|
+
Quantum
|
158
|
+
red,
|
159
|
+
green,
|
160
|
+
blue,
|
161
|
+
alpha,
|
162
|
+
black;
|
163
|
+
} QuantumPixelPacket;
|
164
|
+
|
165
|
+
typedef QuantumPixelPacket Pixel;
|
166
|
+
typedef PixelInfo MagickPixel;
|
167
|
+
typedef PixelInfo PixelColor;
|
185
168
|
#else
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
169
|
+
typedef struct _RMagickPixelPacket
|
170
|
+
{
|
171
|
+
Quantum
|
172
|
+
red,
|
173
|
+
green,
|
174
|
+
blue,
|
175
|
+
opacity,
|
176
|
+
black;
|
177
|
+
} RMagickPixelPacket;
|
178
|
+
typedef RMagickPixelPacket Pixel;
|
179
|
+
typedef MagickPixelPacket MagickPixel;
|
180
|
+
typedef PixelPacket PixelColor;
|
181
|
+
typedef AlphaChannelType AlphaChannelOption;
|
182
|
+
typedef DistortImageMethod DistortMethod;
|
183
|
+
typedef FilterTypes FilterType;
|
184
|
+
typedef InterpolatePixelMethod PixelInterpolateMethod;
|
185
|
+
typedef ImageLayerMethod LayerMethod;
|
186
|
+
#define TransparentAlpha 0
|
187
|
+
#define IMAGEMAGICK_6 1
|
190
188
|
#endif
|
191
189
|
|
192
|
-
|
193
|
-
typedef ImageInfo Info; /**< Make type name match class name */
|
194
|
-
typedef PixelPacket Pixel; /**< Make type name match class name */
|
195
|
-
|
196
190
|
//! Montage
|
197
191
|
typedef struct
|
198
192
|
{
|
@@ -214,7 +208,7 @@ typedef struct
|
|
214
208
|
DrawInfo *info; /**< the DrawInfo struct */
|
215
209
|
VALUE primitives; /**< the primitive string */
|
216
210
|
struct TmpFile_Name *tmpfile_ary; /**< the tmp filenames */
|
217
|
-
|
211
|
+
PixelColor shadow_color; /**< PolaroidOptions#shadow_color */
|
218
212
|
} Draw; // make the type match the class name
|
219
213
|
|
220
214
|
// Enum
|
@@ -289,47 +283,28 @@ typedef enum _QuantumExpressionOperator
|
|
289
283
|
RShiftQuantumOperator, /**< rshift */
|
290
284
|
SubtractQuantumOperator, /**< subtract */
|
291
285
|
XorQuantumOperator, /**< xor */
|
292
|
-
#if defined(HAVE_ENUM_POWEVALUATEOPERATOR)
|
293
286
|
PowQuantumOperator, /**< pow */
|
294
|
-
#endif
|
295
|
-
#if defined(HAVE_ENUM_LOGEVALUATEOPERATOR)
|
296
287
|
LogQuantumOperator, /**< log */
|
297
|
-
#endif
|
298
|
-
#if defined(HAVE_ENUM_THRESHOLDEVALUATEOPERATOR)
|
299
288
|
ThresholdQuantumOperator, /**< threshold */
|
300
|
-
#endif
|
301
|
-
#if defined(HAVE_ENUM_THRESHOLDBLACKEVALUATEOPERATOR)
|
302
289
|
ThresholdBlackQuantumOperator, /**< threshold black */
|
303
|
-
#endif
|
304
|
-
#if defined(HAVE_ENUM_THRESHOLDWHITEEVALUATEOPERATOR)
|
305
290
|
ThresholdWhiteQuantumOperator, /**< threshold white */
|
306
|
-
#endif
|
307
|
-
#if defined(HAVE_ENUM_GAUSSIANNOISEEVALUATEOPERATOR)
|
308
291
|
GaussianNoiseQuantumOperator, /**< gaussian noise */
|
309
|
-
#endif
|
310
|
-
#if defined(HAVE_ENUM_IMPULSENOISEEVALUATEOPERATOR)
|
311
292
|
ImpulseNoiseQuantumOperator, /**< impulse noise */
|
312
|
-
#endif
|
313
|
-
#if defined(HAVE_ENUM_LAPLACIANNOISEEVALUATEOPERATOR)
|
314
293
|
LaplacianNoiseQuantumOperator, /**< laplacian noise */
|
315
|
-
#endif
|
316
|
-
#if defined(HAVE_ENUM_MULTIPLICATIVENOISEEVALUATEOPERATOR)
|
317
294
|
MultiplicativeNoiseQuantumOperator, /**< multiplicative noise */
|
318
|
-
#endif
|
319
|
-
#if defined(HAVE_ENUM_POISSONNOISEEVALUATEOPERATOR)
|
320
295
|
PoissonNoiseQuantumOperator, /**< poisson noise */
|
321
|
-
#endif
|
322
|
-
#if defined(HAVE_ENUM_UNIFORMNOISEEVALUATEOPERATOR)
|
323
296
|
UniformNoiseQuantumOperator, /**< uniform noise */
|
324
|
-
#endif
|
325
|
-
#if defined(HAVE_ENUM_COSINEEVALUATEOPERATOR)
|
326
297
|
CosineQuantumOperator, /**< cosine */
|
327
|
-
|
328
|
-
#if defined(HAVE_ENUM_SINEEVALUATEOPERATOR)
|
298
|
+
SetQuantumOperator, /**< set */
|
329
299
|
SineQuantumOperator, /**< sine */
|
330
|
-
|
331
|
-
|
332
|
-
|
300
|
+
AddModulusQuantumOperator, /**< add modulus */
|
301
|
+
MeanQuantumOperator, /**< mean */
|
302
|
+
AbsQuantumOperator, /**< abs */
|
303
|
+
ExponentialQuantumOperator, /**< exponential */
|
304
|
+
MedianQuantumOperator, /**< median */
|
305
|
+
SumQuantumOperator /**< sum */
|
306
|
+
#if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
|
307
|
+
, RootMeanSquareQuantumOperator /** root mean square */
|
333
308
|
#endif
|
334
309
|
} QuantumExpressionOperator ;
|
335
310
|
|
@@ -352,6 +327,7 @@ typedef enum _QuantumExpressionOperator
|
|
352
327
|
EXTERN VALUE Module_Magick;
|
353
328
|
EXTERN VALUE Class_ImageList;
|
354
329
|
EXTERN VALUE Class_Info;
|
330
|
+
EXTERN VALUE Class_KernelInfo;
|
355
331
|
EXTERN VALUE Class_Draw;
|
356
332
|
EXTERN VALUE Class_DrawOptions;
|
357
333
|
EXTERN VALUE Class_Image;
|
@@ -380,7 +356,7 @@ EXTERN VALUE Class_QuantumExpressionOperator;
|
|
380
356
|
// Enum classes
|
381
357
|
EXTERN VALUE Class_Enum;
|
382
358
|
EXTERN VALUE Class_AlignType;
|
383
|
-
EXTERN VALUE
|
359
|
+
EXTERN VALUE Class_AlphaChannelOption;
|
384
360
|
EXTERN VALUE Class_AnchorType;
|
385
361
|
EXTERN VALUE Class_ChannelType;
|
386
362
|
EXTERN VALUE Class_ClassType;
|
@@ -390,33 +366,32 @@ EXTERN VALUE Class_CompositeOperator;
|
|
390
366
|
EXTERN VALUE Class_CompressionType;
|
391
367
|
EXTERN VALUE Class_DecorationType;
|
392
368
|
EXTERN VALUE Class_DisposeType;
|
393
|
-
EXTERN VALUE
|
394
|
-
#if defined(HAVE_TYPE_DITHERMETHOD)
|
369
|
+
EXTERN VALUE Class_DistortMethod;
|
395
370
|
EXTERN VALUE Class_DitherMethod;
|
396
|
-
#endif
|
397
371
|
EXTERN VALUE Class_EndianType;
|
398
|
-
EXTERN VALUE
|
372
|
+
EXTERN VALUE Class_FilterType;
|
399
373
|
EXTERN VALUE Class_GravityType;
|
400
374
|
EXTERN VALUE Class_ImageType;
|
401
375
|
EXTERN VALUE Class_InterlaceType;
|
402
|
-
EXTERN VALUE
|
403
|
-
EXTERN VALUE CLASS_LAYERMETHODTYPE;
|
376
|
+
EXTERN VALUE Class_LayerMethod;
|
404
377
|
EXTERN VALUE Class_MagickFunction;
|
405
378
|
EXTERN VALUE Class_NoiseType;
|
406
379
|
EXTERN VALUE Class_OrientationType;
|
407
380
|
EXTERN VALUE Class_PaintMethod;
|
381
|
+
EXTERN VALUE Class_PixelInterpolateMethod;
|
408
382
|
EXTERN VALUE Class_PreviewType;
|
409
383
|
EXTERN VALUE Class_RenderingIntent;
|
410
384
|
EXTERN VALUE Class_ResolutionType;
|
411
|
-
#if defined(HAVE_SPARSECOLORIMAGE)
|
412
385
|
EXTERN VALUE Class_SparseColorMethod;
|
413
|
-
#endif
|
414
386
|
EXTERN VALUE Class_SpreadMethod;
|
415
387
|
EXTERN VALUE Class_StorageType;
|
416
388
|
EXTERN VALUE Class_StretchType;
|
417
389
|
EXTERN VALUE Class_StyleType;
|
418
390
|
EXTERN VALUE Class_WeightType;
|
419
391
|
EXTERN VALUE Class_VirtualPixelMethod;
|
392
|
+
EXTERN VALUE Class_GeometryFlags;
|
393
|
+
EXTERN VALUE Class_MorphologyMethod;
|
394
|
+
EXTERN VALUE Class_KernelInfoType;
|
420
395
|
|
421
396
|
/**
|
422
397
|
* Commonly-used IDs
|
@@ -427,61 +402,36 @@ EXTERN ID rm_ID_changed; /**< "changed" */
|
|
427
402
|
EXTERN ID rm_ID_cur_image; /**< "cur_image" */
|
428
403
|
EXTERN ID rm_ID_dup; /**< "dup" */
|
429
404
|
EXTERN ID rm_ID_fill; /**< "fill" */
|
430
|
-
EXTERN ID rm_ID_flag; /**< "flag" */
|
431
|
-
EXTERN ID rm_ID_from_s; /**< "from_s" */
|
432
405
|
EXTERN ID rm_ID_Geometry; /**< "Geometry" */
|
433
|
-
EXTERN ID rm_ID_GeometryValue; /**< "GeometryValue" */
|
434
|
-
EXTERN ID rm_ID_has_key_q; /**< "has_key?" */
|
435
406
|
EXTERN ID rm_ID_height; /**< "height" */
|
436
407
|
EXTERN ID rm_ID_initialize_copy; /**< "initialize_copy" */
|
437
|
-
EXTERN ID rm_ID_length; /**< "length" */
|
438
408
|
EXTERN ID rm_ID_notify_observers; /**< "notify_observers" */
|
439
409
|
EXTERN ID rm_ID_new; /**< "new" */
|
440
410
|
EXTERN ID rm_ID_push; /**< "push" */
|
441
|
-
EXTERN ID rm_ID_spaceship; /**< "<=>" */
|
442
|
-
EXTERN ID rm_ID_to_i; /**< "to_i" */
|
443
|
-
EXTERN ID rm_ID_to_s; /**< "to_s" */
|
444
411
|
EXTERN ID rm_ID_values; /**< "values" */
|
445
412
|
EXTERN ID rm_ID_width; /**< "width" */
|
446
|
-
|
447
|
-
EXTERN
|
413
|
+
|
414
|
+
EXTERN unsigned long long rm_main_thread_id;
|
448
415
|
|
449
416
|
#if !defined(min)
|
450
|
-
#define min(a,b) ((a)<(b)?(a):(b)) /**< min of two values */
|
417
|
+
#define min(a, b) ((a)<(b)?(a):(b)) /**< min of two values */
|
451
418
|
#endif
|
452
419
|
#if !defined(max)
|
453
|
-
#define max(a,b) ((a)>(b)?(a):(b)) /**< max of two values */
|
420
|
+
#define max(a, b) ((a)>(b)?(a):(b)) /**< max of two values */
|
454
421
|
#endif
|
455
422
|
|
456
423
|
/**
|
457
424
|
Handle warnings & errors
|
458
425
|
*/
|
459
426
|
//! Handle warnings & errors
|
460
|
-
#define CHECK_EXCEPTION() rm_check_exception(
|
427
|
+
#define CHECK_EXCEPTION() rm_check_exception(exception, NULL, RetainOnError)
|
461
428
|
|
462
429
|
|
463
|
-
/*
|
464
|
-
Call rb_define_method for an attribute accessor method
|
465
|
-
*/
|
466
|
-
//! attribute reader
|
467
|
-
#define DCL_ATTR_READER(class, attr) \
|
468
|
-
rb_define_method(Class_##class, #attr, class##_##attr, 0);
|
469
|
-
//! attribute writer
|
470
|
-
#define DCL_ATTR_WRITER(class, attr) \
|
471
|
-
rb_define_method(Class_##class, #attr "=", class##_##attr##_eq, 1);
|
472
|
-
//! attribute accessor
|
473
|
-
#define DCL_ATTR_ACCESSOR(class, attr) \
|
474
|
-
DCL_ATTR_READER(class, attr) \
|
475
|
-
DCL_ATTR_WRITER(class, attr)
|
476
|
-
//! Borrow another class' attribute writer definition
|
477
|
-
#define SHARE_ATTR_WRITER(to, from, attr) \
|
478
|
-
rb_define_method(Class_##to, #attr "=", from##_##attr##_eq, 1);
|
479
|
-
|
480
430
|
/*
|
481
431
|
Define simple attribute accessor methods (boolean, int, string, and double types)
|
482
432
|
*/
|
483
|
-
#define
|
484
|
-
#define
|
433
|
+
#define C_boolean_to_R_boolean(attr) (attr) ? Qtrue : Qfalse /**< C boolean -> Ruby boolean */
|
434
|
+
#define R_boolean_to_C_boolean(attr) RTEST(attr) /**< C boolean <- Ruby boolean */
|
485
435
|
#define C_int_to_R_int(attr) INT2FIX(attr) /**< C int -> Ruby int */
|
486
436
|
#define R_int_to_C_int(attr) NUM2INT(attr) /**< C int <- Ruby int */
|
487
437
|
#define C_long_to_R_long(attr) INT2NUM(attr) /**< C long -> Ruby long */
|
@@ -493,45 +443,51 @@ EXTERN ID rm_ID_y; /**< "y" */
|
|
493
443
|
#define R_dbl_to_C_dbl(attr) NUM2DBL(attr) /**< C double <- Ruby double */
|
494
444
|
|
495
445
|
//! define attribute reader
|
496
|
-
#define
|
497
|
-
VALUE class##_##attr(VALUE self)\
|
446
|
+
#define IMPLEMENT_ATTR_READER(class, attr, type) \
|
498
447
|
{\
|
499
448
|
class *ptr;\
|
500
449
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
501
|
-
|
450
|
+
rm_check_destroyed(self); \
|
502
451
|
}\
|
503
452
|
Data_Get_Struct(self, class, ptr);\
|
504
453
|
return C_##type##_to_R_##type(ptr->attr);\
|
505
454
|
}
|
506
455
|
|
507
456
|
//! define attribute reader when attribute name is different from the field name
|
508
|
-
#define
|
509
|
-
VALUE class##_##attr(VALUE self)\
|
457
|
+
#define IMPLEMENT_ATTR_READERF(class, attr, field, type) \
|
510
458
|
{\
|
511
459
|
class *ptr;\
|
512
|
-
|
460
|
+
rm_check_destroyed(self); \
|
513
461
|
Data_Get_Struct(self, class, ptr);\
|
514
462
|
return C_##type##_to_R_##type(ptr->field);\
|
515
463
|
}
|
516
464
|
|
517
465
|
//! define attribute writer
|
518
|
-
#define
|
519
|
-
VALUE class##_##attr##_eq(VALUE self, VALUE val)\
|
466
|
+
#define IMPLEMENT_ATTR_WRITER(class, attr, type) \
|
520
467
|
{\
|
521
468
|
class *ptr;\
|
522
469
|
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
523
|
-
|
470
|
+
rm_check_destroyed(self); \
|
524
471
|
}\
|
525
472
|
rb_check_frozen(self);\
|
526
473
|
Data_Get_Struct(self, class, ptr);\
|
527
474
|
ptr->attr = R_##type##_to_C_##type(val);\
|
475
|
+
return val;\
|
476
|
+
}
|
477
|
+
|
478
|
+
//! define attribute writer when attribute name is different from the field name
|
479
|
+
#define IMPLEMENT_ATTR_WRITERF(class, attr, field, type) \
|
480
|
+
{\
|
481
|
+
class *ptr;\
|
482
|
+
if (rb_obj_is_kind_of(self, Class_Image) == Qtrue) {\
|
483
|
+
rm_check_destroyed(self); \
|
484
|
+
}\
|
485
|
+
rb_check_frozen(self);\
|
486
|
+
Data_Get_Struct(self, class, ptr);\
|
487
|
+
ptr->field = R_##type##_to_C_##type(val);\
|
528
488
|
return self;\
|
529
489
|
}
|
530
490
|
|
531
|
-
//! define attribute accessor
|
532
|
-
#define DEF_ATTR_ACCESSOR(class, attr, type)\
|
533
|
-
DEF_ATTR_READER(class, attr, type)\
|
534
|
-
DEF_ATTR_WRITER(class, attr, type)
|
535
491
|
|
536
492
|
/*
|
537
493
|
* Declare attribute accessors
|
@@ -547,97 +503,14 @@ EXTERN ID rm_ID_y; /**< "y" */
|
|
547
503
|
ATTR_READER(class, attr)\
|
548
504
|
ATTR_WRITER(class, attr)
|
549
505
|
|
550
|
-
/*
|
551
|
-
* Define functions to get/set attributes in Image::Info that
|
552
|
-
* use the Get/SetImageOption API.
|
553
|
-
*/
|
554
|
-
//! Option attribute reader. For Image::Info.
|
555
|
-
#define OPTION_ATTR_READER(opt, key) \
|
556
|
-
VALUE Info_##opt(VALUE self)\
|
557
|
-
{\
|
558
|
-
return get_option(self, #key);\
|
559
|
-
}
|
560
|
-
//! Option attribute writer. For Image::Info.
|
561
|
-
#define OPTION_ATTR_WRITER(opt, key) \
|
562
|
-
VALUE Info_##opt##_eq(VALUE self, VALUE string)\
|
563
|
-
{\
|
564
|
-
return set_option(self, #key, string);\
|
565
|
-
}
|
566
|
-
//! Option attribute accessor. For Image::Info.
|
567
|
-
#define OPTION_ATTR_ACCESSOR(opt, key)\
|
568
|
-
OPTION_ATTR_READER(opt, key)\
|
569
|
-
OPTION_ATTR_WRITER(opt, key)
|
570
|
-
|
571
|
-
|
572
|
-
/*
|
573
|
-
* Declare Pixel channel attribute writers
|
574
|
-
*/
|
575
|
-
//! Pixel channel attribute writer.
|
576
|
-
#define DEF_PIXEL_CHANNEL_WRITER(_channel_) \
|
577
|
-
extern VALUE \
|
578
|
-
Pixel_##_channel_##_eq(VALUE self, VALUE v) \
|
579
|
-
{ \
|
580
|
-
Pixel *pixel; \
|
581
|
-
\
|
582
|
-
rb_check_frozen(self); \
|
583
|
-
Data_Get_Struct(self, Pixel, pixel); \
|
584
|
-
pixel->_channel_ = APP2QUANTUM(v); \
|
585
|
-
(void) rb_funcall(self, rm_ID_changed, 0); \
|
586
|
-
(void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
|
587
|
-
return QUANTUM2NUM((pixel->_channel_)); \
|
588
|
-
}
|
589
|
-
|
590
|
-
|
591
|
-
/*
|
592
|
-
* Declare Pixel CMYK channel attribute accessors
|
593
|
-
*/
|
594
|
-
//! Pixel CMYK channel attribute accessor.
|
595
|
-
#define DEF_PIXEL_CMYK_CHANNEL_ACCESSOR(_cmyk_channel_, _rgb_channel_) \
|
596
|
-
extern VALUE \
|
597
|
-
Pixel_##_cmyk_channel_##_eq(VALUE self, VALUE v) \
|
598
|
-
{ \
|
599
|
-
Pixel *pixel; \
|
600
|
-
\
|
601
|
-
rb_check_frozen(self); \
|
602
|
-
Data_Get_Struct(self, Pixel, pixel); \
|
603
|
-
pixel->_rgb_channel_ = APP2QUANTUM(v); \
|
604
|
-
(void) rb_funcall(self, rm_ID_changed, 0); \
|
605
|
-
(void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
|
606
|
-
return QUANTUM2NUM(pixel->_rgb_channel_); \
|
607
|
-
} \
|
608
|
-
\
|
609
|
-
extern VALUE \
|
610
|
-
Pixel_##_cmyk_channel_(VALUE self) \
|
611
|
-
{ \
|
612
|
-
Pixel *pixel; \
|
613
|
-
\
|
614
|
-
Data_Get_Struct(self, Pixel, pixel); \
|
615
|
-
return INT2NUM(pixel->_rgb_channel_); \
|
616
|
-
}
|
617
|
-
|
618
|
-
|
619
|
-
/*
|
620
|
-
* Enum constants - define a subclass of Enum for the specified enumeration.
|
621
|
-
* Define an instance of the subclass for each member in the enumeration.
|
622
|
-
* Initialize each instance with its name and value.
|
623
|
-
*/
|
624
|
-
//! define Ruby enum
|
625
|
-
#define DEF_ENUM(tag) {\
|
626
|
-
VALUE _cls, _enum;\
|
627
|
-
_cls = Class_##tag = rm_define_enum_type(#tag);
|
628
|
-
|
629
|
-
//! define Ruby enumerator elements
|
630
|
-
#define ENUMERATOR(val)\
|
631
|
-
_enum = rm_enum_new(_cls, ID2SYM(rb_intern(#val)), INT2NUM(val));\
|
632
|
-
rb_define_const(Module_Magick, #val, _enum);
|
633
|
-
//! end of an enumerator
|
634
|
-
#define END_ENUM }
|
635
506
|
|
636
507
|
//! Define a Magick module constant
|
637
|
-
#if
|
508
|
+
#if MAGICKCORE_QUANTUM_DEPTH == 64
|
638
509
|
#define DEF_CONST(constant) rb_define_const(Module_Magick, #constant, ULL2NUM(constant))
|
639
|
-
#
|
510
|
+
#define DEF_CONSTV(constant, val) rb_define_const(Module_Magick, #constant, ULL2NUM(val))
|
511
|
+
#else // MAGICKCORE_QUANTUM_DEPTH == 8, 16, 32
|
640
512
|
#define DEF_CONST(constant) rb_define_const(Module_Magick, #constant, UINT2NUM(constant))
|
513
|
+
#define DEF_CONSTV(constant, val) rb_define_const(Module_Magick, #constant, UINT2NUM(val))
|
641
514
|
#endif
|
642
515
|
|
643
516
|
|
@@ -646,15 +519,12 @@ Pixel_##_cmyk_channel_(VALUE self) \
|
|
646
519
|
do {\
|
647
520
|
MagickEnum *magick_enum;\
|
648
521
|
if (CLASS_OF(value) != Class_##type)\
|
649
|
-
rb_raise(rb_eTypeError, "wrong enumeration type - expected %s, got %s"\
|
650
|
-
|
522
|
+
rb_raise(rb_eTypeError, "wrong enumeration type - expected %s, got %s", \
|
523
|
+
rb_class2name(Class_##type), rb_class2name(CLASS_OF(value)));\
|
651
524
|
Data_Get_Struct(value, MagickEnum, magick_enum);\
|
652
525
|
e = (type)(magick_enum->val);\
|
653
526
|
} while(0)
|
654
527
|
|
655
|
-
//! create case statement, mapping enum to its name
|
656
|
-
#define ENUM_TO_NAME(_enum) case _enum: return #_enum;
|
657
|
-
|
658
528
|
|
659
529
|
// Method, external function declarations. These declarations are
|
660
530
|
// grouped by the source file in which the methods are defined.
|
@@ -756,12 +626,11 @@ extern VALUE ImageList_animate(int, VALUE *, VALUE);
|
|
756
626
|
extern VALUE ImageList_append(VALUE, VALUE);
|
757
627
|
extern VALUE ImageList_average(VALUE);
|
758
628
|
extern VALUE ImageList_coalesce(VALUE);
|
629
|
+
extern VALUE ImageList_combine(int, VALUE *, VALUE);
|
759
630
|
extern VALUE ImageList_composite_layers(int, VALUE *, VALUE);
|
760
631
|
extern VALUE ImageList_deconstruct(VALUE);
|
761
632
|
extern VALUE ImageList_display(VALUE);
|
762
633
|
extern VALUE ImageList_flatten_images(VALUE);
|
763
|
-
extern VALUE ImageList_fx(int, VALUE *, VALUE);
|
764
|
-
extern VALUE ImageList_map(int, VALUE *, VALUE);
|
765
634
|
extern VALUE ImageList_montage(VALUE);
|
766
635
|
extern VALUE ImageList_morph(VALUE, VALUE);
|
767
636
|
extern VALUE ImageList_mosaic(VALUE);
|
@@ -798,7 +667,6 @@ ATTR_ACCESSOR(Info, font)
|
|
798
667
|
ATTR_ACCESSOR(Info, format)
|
799
668
|
ATTR_ACCESSOR(Info, fuzz)
|
800
669
|
ATTR_ACCESSOR(Info, gravity)
|
801
|
-
ATTR_ACCESSOR(Info, group)
|
802
670
|
ATTR_ACCESSOR(Info, image_type)
|
803
671
|
ATTR_ACCESSOR(Info, interlace)
|
804
672
|
ATTR_ACCESSOR(Info, label)
|
@@ -810,7 +678,6 @@ ATTR_ACCESSOR(Info, orientation)
|
|
810
678
|
ATTR_ACCESSOR(Info, origin)
|
811
679
|
ATTR_ACCESSOR(Info, page)
|
812
680
|
ATTR_ACCESSOR(Info, pen)
|
813
|
-
// ATTR_ACCESSOR(Info, ping) obsolete
|
814
681
|
ATTR_ACCESSOR(Info, pointsize)
|
815
682
|
ATTR_ACCESSOR(Info, quality)
|
816
683
|
ATTR_ACCESSOR(Info, sampling_factor)
|
@@ -825,7 +692,6 @@ ATTR_ACCESSOR(Info, transparent_color)
|
|
825
692
|
ATTR_ACCESSOR(Info, undercolor)
|
826
693
|
ATTR_ACCESSOR(Info, units)
|
827
694
|
ATTR_ACCESSOR(Info, view)
|
828
|
-
//ATTR_ACCESSOR(Info, verbose)
|
829
695
|
|
830
696
|
extern VALUE Info_alloc(VALUE);
|
831
697
|
|
@@ -839,15 +705,26 @@ extern VALUE rm_info_new(void);
|
|
839
705
|
extern DisposeType rm_dispose_to_enum(const char *);
|
840
706
|
extern GravityType rm_gravity_to_enum(const char *);
|
841
707
|
|
708
|
+
// rmkinfo.c
|
709
|
+
|
710
|
+
extern VALUE KernelInfo_alloc(VALUE);
|
711
|
+
|
712
|
+
extern VALUE KernelInfo_initialize(VALUE, VALUE);
|
713
|
+
extern VALUE KernelInfo_unity_add(VALUE, VALUE);
|
714
|
+
extern VALUE KernelInfo_scale(VALUE, VALUE, VALUE);
|
715
|
+
extern VALUE KernelInfo_scale_geometry(VALUE, VALUE);
|
716
|
+
extern VALUE KernelInfo_clone(VALUE);
|
717
|
+
|
718
|
+
extern VALUE KernelInfo_builtin(VALUE, VALUE, VALUE);
|
719
|
+
|
720
|
+
|
842
721
|
// rmimage.c
|
843
|
-
ATTR_WRITER(Image, alpha)
|
844
722
|
ATTR_ACCESSOR(Image, background_color)
|
845
723
|
ATTR_READER(Image, base_columns)
|
846
724
|
ATTR_READER(Image, base_filename)
|
847
725
|
ATTR_READER(Image, base_rows)
|
848
726
|
ATTR_ACCESSOR(Image, bias)
|
849
727
|
ATTR_ACCESSOR(Image, black_point_compensation)
|
850
|
-
ATTR_ACCESSOR(Image, blur)
|
851
728
|
ATTR_ACCESSOR(Image, border_color)
|
852
729
|
ATTR_READER(Image, bounding_box)
|
853
730
|
ATTR_ACCESSOR(Image, chromaticity)
|
@@ -877,8 +754,6 @@ ATTR_ACCESSOR(Image, image_type)
|
|
877
754
|
ATTR_ACCESSOR(Image, interlace)
|
878
755
|
ATTR_ACCESSOR(Image, iptc_profile)
|
879
756
|
ATTR_ACCESSOR(Image, iterations)
|
880
|
-
ATTR_WRITER(Image, mask)
|
881
|
-
ATTR_ACCESSOR(Image, matte)
|
882
757
|
ATTR_ACCESSOR(Image, matte_color)
|
883
758
|
ATTR_READER(Image, mean_error_per_pixel)
|
884
759
|
ATTR_READER(Image, mime_type)
|
@@ -888,7 +763,6 @@ ATTR_READER(Image, normalized_mean_error)
|
|
888
763
|
ATTR_READER(Image, normalized_maximum_error)
|
889
764
|
ATTR_READER(Image, number_colors)
|
890
765
|
ATTR_ACCESSOR(Image, offset)
|
891
|
-
ATTR_WRITER(Image, opacity)
|
892
766
|
ATTR_ACCESSOR(Image, orientation)
|
893
767
|
ATTR_ACCESSOR(Image, page)
|
894
768
|
ATTR_ACCESSOR(Image, pixel_interpolation_method)
|
@@ -908,7 +782,7 @@ ATTR_ACCESSOR(Image, x_resolution)
|
|
908
782
|
ATTR_ACCESSOR(Image, y_resolution)
|
909
783
|
|
910
784
|
extern ChannelType extract_channels(int *, VALUE *);
|
911
|
-
extern void raise_ChannelType_error(VALUE);
|
785
|
+
extern void raise_ChannelType_error(VALUE) ATTRIBUTE_NORETURN;
|
912
786
|
extern void add_format_prefix(Info *, VALUE);
|
913
787
|
|
914
788
|
extern VALUE Image_alloc(VALUE);
|
@@ -950,6 +824,11 @@ extern VALUE Image_compare_channel(int, VALUE *, VALUE);
|
|
950
824
|
extern VALUE Image_channel_depth(int, VALUE *, VALUE);
|
951
825
|
extern VALUE Image_channel_extrema(int, VALUE *, VALUE);
|
952
826
|
extern VALUE Image_channel_mean(int, VALUE *, VALUE);
|
827
|
+
#if defined(HAVE_GETIMAGECHANNELENTROPY) || defined(IMAGEMAGICK_7)
|
828
|
+
extern VALUE Image_channel_entropy(int, VALUE *, VALUE);
|
829
|
+
#else
|
830
|
+
extern VALUE Image_channel_entropy(int, VALUE *, VALUE) ATTRIBUTE_NORETURN;
|
831
|
+
#endif
|
953
832
|
extern VALUE Image_charcoal(int, VALUE *, VALUE);
|
954
833
|
extern VALUE Image_chop(VALUE, VALUE, VALUE, VALUE, VALUE);
|
955
834
|
extern VALUE Image_clone(VALUE);
|
@@ -958,7 +837,6 @@ extern VALUE Image_color_flood_fill(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
|
958
837
|
extern VALUE Image_color_histogram(VALUE);
|
959
838
|
extern VALUE Image_colorize(int, VALUE *, VALUE);
|
960
839
|
extern VALUE Image_colormap(int, VALUE *, VALUE);
|
961
|
-
extern VALUE Image_combine(int, VALUE *, VALUE);
|
962
840
|
extern VALUE Image_composite(int, VALUE *, VALUE);
|
963
841
|
extern VALUE Image_composite_affine(VALUE, VALUE, VALUE);
|
964
842
|
extern VALUE Image_composite_bang(int, VALUE *, VALUE);
|
@@ -973,6 +851,8 @@ extern VALUE Image_contrast(int, VALUE *, VALUE);
|
|
973
851
|
extern VALUE Image_contrast_stretch_channel(int, VALUE *, VALUE);
|
974
852
|
extern VALUE Image_convolve(VALUE, VALUE, VALUE);
|
975
853
|
extern VALUE Image_convolve_channel(int, VALUE *, VALUE);
|
854
|
+
extern VALUE Image_morphology(VALUE, VALUE, VALUE, VALUE);
|
855
|
+
extern VALUE Image_morphology_channel(VALUE, VALUE, VALUE, VALUE, VALUE);
|
976
856
|
extern VALUE Image_copy(VALUE);
|
977
857
|
extern VALUE Image_crop(int, VALUE *, VALUE);
|
978
858
|
extern VALUE Image_crop_bang(int, VALUE *, VALUE);
|
@@ -1015,6 +895,7 @@ extern VALUE Image_flop_bang(VALUE);
|
|
1015
895
|
extern VALUE Image_frame(int, VALUE *, VALUE);
|
1016
896
|
extern VALUE Image_from_blob(VALUE, VALUE);
|
1017
897
|
extern VALUE Image_function_channel(int, VALUE *, VALUE);
|
898
|
+
extern VALUE Image_fx(int, VALUE *, VALUE);
|
1018
899
|
extern VALUE Image_gamma_channel(int, VALUE *, VALUE);
|
1019
900
|
extern VALUE Image_gamma_correct(int, VALUE *, VALUE);
|
1020
901
|
extern VALUE Image_gaussian_blur(int, VALUE *, VALUE);
|
@@ -1035,11 +916,10 @@ extern VALUE Image_liquid_rescale(int, VALUE *, VALUE);
|
|
1035
916
|
extern VALUE Image__load(VALUE, VALUE);
|
1036
917
|
extern VALUE Image_magnify(VALUE);
|
1037
918
|
extern VALUE Image_magnify_bang(VALUE);
|
1038
|
-
extern VALUE Image_map(int, VALUE *, VALUE);
|
1039
919
|
extern VALUE Image_marshal_dump(VALUE);
|
1040
920
|
extern VALUE Image_marshal_load(VALUE, VALUE);
|
1041
921
|
extern VALUE Image_mask(int, VALUE *, VALUE);
|
1042
|
-
extern VALUE Image_matte_flood_fill(
|
922
|
+
extern VALUE Image_matte_flood_fill(int, VALUE *, VALUE);
|
1043
923
|
extern VALUE Image_median_filter(int, VALUE *, VALUE);
|
1044
924
|
extern VALUE Image_minify(VALUE);
|
1045
925
|
extern VALUE Image_minify_bang(VALUE);
|
@@ -1075,6 +955,8 @@ extern VALUE Image_read_inline(VALUE, VALUE);
|
|
1075
955
|
extern VALUE Image_recolor(VALUE, VALUE);
|
1076
956
|
extern VALUE Image_reduce_noise(VALUE, VALUE);
|
1077
957
|
extern VALUE Image_remap(int, VALUE *, VALUE);
|
958
|
+
extern VALUE Image_resample(int, VALUE *, VALUE);
|
959
|
+
extern VALUE Image_resample_bang(int, VALUE *, VALUE);
|
1078
960
|
extern VALUE Image_resize(int, VALUE *, VALUE);
|
1079
961
|
extern VALUE Image_resize_bang(int, VALUE *, VALUE);
|
1080
962
|
extern VALUE Image_roll(VALUE, VALUE, VALUE);
|
@@ -1109,7 +991,6 @@ extern VALUE Image_stereo(VALUE, VALUE);
|
|
1109
991
|
extern VALUE Image_store_pixels(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
1110
992
|
extern VALUE Image_strip_bang(VALUE);
|
1111
993
|
extern VALUE Image_swirl(VALUE, VALUE);
|
1112
|
-
extern VALUE Image_sync_profiles(VALUE);
|
1113
994
|
extern VALUE Image_texture_flood_fill(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
1114
995
|
extern VALUE Image_threshold(VALUE, VALUE);
|
1115
996
|
extern VALUE Image_thumbnail(int, VALUE *, VALUE);
|
@@ -1157,7 +1038,7 @@ extern VALUE TextureFill_fill(VALUE, VALUE);
|
|
1157
1038
|
ATTR_ACCESSOR(Pixel, red)
|
1158
1039
|
ATTR_ACCESSOR(Pixel, green)
|
1159
1040
|
ATTR_ACCESSOR(Pixel, blue)
|
1160
|
-
ATTR_ACCESSOR(Pixel,
|
1041
|
+
ATTR_ACCESSOR(Pixel, alpha)
|
1161
1042
|
ATTR_ACCESSOR(Pixel, cyan)
|
1162
1043
|
ATTR_ACCESSOR(Pixel, magenta)
|
1163
1044
|
ATTR_ACCESSOR(Pixel, yellow)
|
@@ -1170,7 +1051,6 @@ extern VALUE Pixel_dup(VALUE);
|
|
1170
1051
|
extern VALUE Pixel_eql_q(VALUE, VALUE);
|
1171
1052
|
extern VALUE Pixel_fcmp(int, VALUE *, VALUE);
|
1172
1053
|
extern VALUE Pixel_from_color(VALUE, VALUE);
|
1173
|
-
extern VALUE Pixel_from_HSL(VALUE, VALUE);
|
1174
1054
|
extern VALUE Pixel_from_hsla(int, VALUE *, VALUE);
|
1175
1055
|
extern VALUE Pixel_hash(VALUE);
|
1176
1056
|
extern VALUE Pixel_initialize(int, VALUE *, VALUE);
|
@@ -1180,7 +1060,6 @@ extern VALUE Pixel_marshal_dump(VALUE);
|
|
1180
1060
|
extern VALUE Pixel_marshal_load(VALUE, VALUE);
|
1181
1061
|
extern VALUE Pixel_spaceship(VALUE, VALUE);
|
1182
1062
|
extern VALUE Pixel_to_color(int, VALUE *, VALUE);
|
1183
|
-
extern VALUE Pixel_to_HSL(VALUE);
|
1184
1063
|
extern VALUE Pixel_to_hsla(VALUE);
|
1185
1064
|
extern VALUE Pixel_to_s(VALUE);
|
1186
1065
|
|
@@ -1191,31 +1070,47 @@ extern VALUE Enum_initialize(VALUE, VALUE, VALUE);
|
|
1191
1070
|
extern VALUE Enum_to_s(VALUE);
|
1192
1071
|
extern VALUE Enum_to_i(VALUE);
|
1193
1072
|
extern VALUE Enum_spaceship(VALUE, VALUE);
|
1073
|
+
extern VALUE Enum_bitwise_or(VALUE, VALUE);
|
1194
1074
|
extern VALUE Enum_case_eq(VALUE, VALUE);
|
1195
1075
|
extern VALUE Enum_type_initialize(VALUE, VALUE, VALUE);
|
1076
|
+
extern VALUE Enum_find(VALUE class, int val);
|
1196
1077
|
extern VALUE Enum_type_each(VALUE);
|
1197
1078
|
extern VALUE rm_enum_new(VALUE, VALUE, VALUE);
|
1079
|
+
extern VALUE ClassType_find(ClassType);
|
1080
|
+
extern VALUE ColorspaceType_find(ColorspaceType);
|
1081
|
+
extern const char *ComplianceType_name(ComplianceType *);
|
1082
|
+
extern VALUE ComplianceType_find(ComplianceType);
|
1083
|
+
extern VALUE CompositeOperator_find(CompositeOperator);
|
1084
|
+
extern VALUE CompressionType_find(CompressionType);
|
1085
|
+
extern VALUE DisposeType_find(DisposeType);
|
1086
|
+
extern VALUE EndianType_find(EndianType);
|
1087
|
+
extern VALUE FilterType_find(FilterType);
|
1088
|
+
extern VALUE GravityType_find(GravityType);
|
1089
|
+
extern VALUE ImageType_find(ImageType);
|
1090
|
+
extern VALUE InterlaceType_find(InterlaceType);
|
1091
|
+
extern VALUE OrientationType_find(OrientationType);
|
1092
|
+
extern VALUE PixelInterpolateMethod_find(PixelInterpolateMethod);
|
1093
|
+
extern VALUE RenderingIntent_find(RenderingIntent);
|
1094
|
+
extern VALUE ResolutionType_find(ResolutionType);
|
1095
|
+
extern const char *StorageType_name(StorageType);
|
1096
|
+
extern VALUE StretchType_find(StretchType);
|
1097
|
+
extern const char *StretchType_name(StretchType);
|
1098
|
+
extern VALUE StyleType_find(StyleType);
|
1099
|
+
extern const char *StyleType_name(StyleType);
|
1100
|
+
extern VALUE VirtualPixelMethod_find(VirtualPixelMethod);
|
1198
1101
|
|
1199
1102
|
|
1200
1103
|
// rmstruct.c
|
1201
1104
|
extern VALUE ChromaticityInfo_to_s(VALUE);
|
1202
1105
|
extern VALUE ChromaticityInfo_new(ChromaticityInfo *);
|
1203
|
-
extern void
|
1204
|
-
extern void
|
1106
|
+
extern void Color_to_PixelColor(PixelColor *, VALUE);
|
1107
|
+
extern void Color_to_MagickPixel(Image *, MagickPixel *, VALUE);
|
1108
|
+
extern void Color_to_Pixel(Pixel *, VALUE);
|
1205
1109
|
extern VALUE Color_to_s(VALUE);
|
1206
1110
|
extern VALUE Import_ColorInfo(const ColorInfo *);
|
1207
|
-
extern VALUE ClassType_new(ClassType);
|
1208
|
-
extern VALUE ColorspaceType_new(ColorspaceType);
|
1209
|
-
extern VALUE CompositeOperator_new(CompositeOperator);
|
1210
|
-
extern VALUE CompressionType_new(CompressionType);
|
1211
|
-
extern VALUE DisposeType_new(DisposeType);
|
1212
|
-
extern VALUE EndianType_new(EndianType);
|
1213
|
-
extern VALUE FilterTypes_new(FilterTypes);
|
1214
|
-
extern VALUE GravityType_new(GravityType);
|
1215
1111
|
extern VALUE Font_to_s(VALUE);
|
1216
|
-
extern VALUE
|
1217
|
-
extern VALUE
|
1218
|
-
extern VALUE Pixel_from_MagickPixelPacket(const MagickPixelPacket *);
|
1112
|
+
extern VALUE Pixel_from_MagickPixel(const MagickPixel *);
|
1113
|
+
extern VALUE Pixel_from_PixelColor(const PixelColor *);
|
1219
1114
|
extern VALUE Pixel_from_PixelPacket(const PixelPacket *);
|
1220
1115
|
extern void Export_PointInfo(PointInfo *, VALUE);
|
1221
1116
|
extern VALUE Import_PointInfo(PointInfo *);
|
@@ -1223,16 +1118,12 @@ extern VALUE PrimaryInfo_to_s(VALUE);
|
|
1223
1118
|
extern VALUE Import_PrimaryInfo(PrimaryInfo *);
|
1224
1119
|
extern VALUE RectangleInfo_to_s(VALUE);
|
1225
1120
|
extern VALUE Import_RectangleInfo(RectangleInfo *);
|
1226
|
-
extern VALUE RenderingIntent_new(RenderingIntent);
|
1227
|
-
extern VALUE ResolutionType_new(ResolutionType);
|
1228
1121
|
extern VALUE SegmentInfo_to_s(VALUE);
|
1229
1122
|
extern VALUE Import_SegmentInfo(SegmentInfo *);
|
1230
1123
|
extern void Export_AffineMatrix(AffineMatrix *, VALUE);
|
1231
1124
|
extern VALUE Import_AffineMatrix(AffineMatrix *);
|
1232
1125
|
extern void Export_ChromaticityInfo(ChromaticityInfo *, VALUE);
|
1233
1126
|
extern void Export_ColorInfo(ColorInfo *, VALUE);
|
1234
|
-
extern VALUE InterpolatePixelMethod_new(InterpolatePixelMethod);
|
1235
|
-
extern VALUE OrientationType_new(OrientationType);
|
1236
1127
|
extern void Export_PrimaryInfo(PrimaryInfo *, VALUE);
|
1237
1128
|
extern void Export_RectangleInfo(RectangleInfo *, VALUE);
|
1238
1129
|
extern void Export_SegmentInfo(SegmentInfo *, VALUE);
|
@@ -1242,9 +1133,6 @@ extern VALUE Import_TypeInfo(const TypeInfo *);
|
|
1242
1133
|
extern VALUE TypeMetric_to_s(VALUE);
|
1243
1134
|
extern void Export_TypeInfo(TypeInfo *, VALUE);
|
1244
1135
|
extern VALUE Import_TypeMetric(TypeMetric *);
|
1245
|
-
extern const char *StorageType_name(StorageType);
|
1246
|
-
extern VALUE VirtualPixelMethod_new(VirtualPixelMethod);
|
1247
|
-
extern VALUE LAYERMETHODTYPE_NEW(LAYERMETHODTYPE);
|
1248
1136
|
|
1249
1137
|
|
1250
1138
|
// rmutil.c
|
@@ -1252,38 +1140,39 @@ extern VALUE ImageMagickError_initialize(int, VALUE *, VALUE);
|
|
1252
1140
|
extern void *magick_malloc(const size_t);
|
1253
1141
|
extern void *magick_safe_malloc(const size_t, const size_t);
|
1254
1142
|
extern void magick_free(void *);
|
1255
|
-
extern void *magick_realloc(void *, const size_t);
|
1256
1143
|
extern void *magick_safe_realloc(void *, const size_t, const size_t);
|
1257
1144
|
extern void magick_clone_string(char **, const char *);
|
1145
|
+
extern Image *rm_acquire_image(ImageInfo *);
|
1258
1146
|
extern VALUE rm_cur_image(VALUE);
|
1259
|
-
extern VALUE
|
1260
|
-
extern VALUE
|
1261
|
-
extern
|
1147
|
+
extern VALUE rm_pixelcolor_to_color_name(Image *, PixelColor *);
|
1148
|
+
extern VALUE rm_pixelcolor_to_color_name_info(Info *, PixelColor *);
|
1149
|
+
extern void rm_init_magickpixel(const Image *, MagickPixel *);
|
1150
|
+
extern void rm_set_magickpixel(MagickPixel *, const char *);
|
1151
|
+
extern VALUE rm_no_freeze(VALUE) ATTRIBUTE_NORETURN;
|
1262
1152
|
extern int rm_strcasecmp(const char *, const char *);
|
1263
1153
|
extern int rm_strncasecmp(const char *, const char *, size_t);
|
1154
|
+
extern size_t rm_strnlen_s(const char *, size_t);
|
1264
1155
|
extern void rm_check_ary_len(VALUE, long);
|
1156
|
+
extern VALUE rm_check_ary_type(VALUE ary);
|
1265
1157
|
extern Image *rm_check_destroyed(VALUE);
|
1266
1158
|
extern Image *rm_check_frozen(VALUE);
|
1267
|
-
extern VALUE rm_to_s(VALUE);
|
1268
1159
|
extern char *rm_str2cstr(VALUE, long *);
|
1269
1160
|
extern int rm_check_num2dbl(VALUE);
|
1270
1161
|
extern double rm_fuzz_to_dbl(VALUE);
|
1271
1162
|
extern Quantum rm_app2quantum(VALUE);
|
1272
|
-
extern double rm_percentage(VALUE,double);
|
1163
|
+
extern double rm_percentage(VALUE, double);
|
1273
1164
|
extern double rm_str_to_pct(VALUE);
|
1274
1165
|
extern VALUE rm_define_enum_type(const char *);
|
1275
|
-
extern void rm_write_temp_image(Image *, char
|
1166
|
+
extern void rm_write_temp_image(Image *, char *, size_t);
|
1276
1167
|
extern void rm_delete_temp_image(char *);
|
1277
|
-
extern void rm_not_implemented(void);
|
1168
|
+
extern void rm_not_implemented(void) ATTRIBUTE_NORETURN;
|
1278
1169
|
extern void rm_attr_write(VALUE, VALUE);
|
1279
|
-
extern void rm_get_geometry(VALUE, long *, long *, unsigned long *, unsigned long *, int *);
|
1280
1170
|
extern const char *rm_get_property(const Image *, const char *);
|
1281
1171
|
extern MagickBooleanType rm_set_property(Image *, const char *, const char *);
|
1282
1172
|
extern void rm_set_user_artifact(Image *, Info *);
|
1283
|
-
void rm_set_magick_pixel_packet(Pixel *, MagickPixelPacket *);
|
1284
1173
|
extern void rm_sync_image_options(Image *, Info *);
|
1285
1174
|
extern void rm_split(Image *);
|
1286
|
-
extern void rm_magick_error(const char
|
1175
|
+
extern void rm_magick_error(const char *);
|
1287
1176
|
|
1288
1177
|
//! whether to retain on errors
|
1289
1178
|
typedef enum
|
@@ -1292,7 +1181,12 @@ typedef enum
|
|
1292
1181
|
DestroyOnError = 1 /**< do not retain on error */
|
1293
1182
|
} ErrorRetention;
|
1294
1183
|
|
1295
|
-
|
1184
|
+
typedef enum
|
1185
|
+
{
|
1186
|
+
RetainExceptionRetention,
|
1187
|
+
DestroyExceptionRetention
|
1188
|
+
} ExceptionRetention;
|
1189
|
+
|
1296
1190
|
extern void rm_check_exception(ExceptionInfo *, Image *, ErrorRetention);
|
1297
1191
|
extern void rm_ensure_result(Image *);
|
1298
1192
|
extern Image *rm_clone_image(Image *);
|
@@ -1300,8 +1194,15 @@ extern MagickBooleanType rm_progress_monitor(const char *, const MagickOffsetTyp
|
|
1300
1194
|
extern VALUE rm_exif_by_entry(Image *);
|
1301
1195
|
extern VALUE rm_exif_by_number(Image *);
|
1302
1196
|
extern void rm_get_optional_arguments(VALUE);
|
1303
|
-
extern void rm_fatal_error_handler(const ExceptionType, const char *, const char *);
|
1197
|
+
extern void rm_fatal_error_handler(const ExceptionType, const char *, const char *) ATTRIBUTE_NORETURN;
|
1304
1198
|
extern void rm_error_handler(const ExceptionType, const char *, const char *);
|
1305
1199
|
extern void rm_warning_handler(const ExceptionType, const char *, const char *);
|
1200
|
+
extern MagickBooleanType rm_should_raise_exception(ExceptionInfo *, const ExceptionRetention);
|
1201
|
+
extern void rm_raise_exception(ExceptionInfo *);
|
1202
|
+
extern unsigned long long rm_current_thread_id();
|
1203
|
+
#if defined(IMAGEMAGICK_6)
|
1204
|
+
extern void rm_check_image_exception(Image *, ErrorRetention);
|
1205
|
+
#endif
|
1206
|
+
|
1306
1207
|
#endif
|
1307
1208
|
|