rmagick 4.0.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +14 -0
- data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
- data/.devcontainer/devcontainer.json +11 -0
- data/.devcontainer/setup-repo.sh +10 -0
- data/.devcontainer/setup-user.sh +45 -0
- data/.editorconfig +3 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.github/workflows/ci.yml +138 -0
- data/.gitignore +5 -1
- data/.rspec +1 -0
- data/.rubocop.yml +24 -0
- data/.rubocop_todo.yml +150 -297
- data/.yardopts +5 -0
- data/CHANGELOG.md +222 -0
- data/CODE_OF_CONDUCT.md +122 -7
- data/CONTRIBUTING.md +14 -10
- data/README.md +316 -0
- data/Rakefile +59 -93
- data/before_install_linux.sh +23 -29
- data/before_install_osx.sh +58 -2
- data/ext/RMagick/extconf.rb +191 -110
- data/ext/RMagick/rmagick.c +77 -104
- data/ext/RMagick/rmagick.h +138 -99
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/rmdraw.c +464 -526
- data/ext/RMagick/rmenum.c +132 -121
- data/ext/RMagick/rmfill.c +223 -83
- data/ext/RMagick/rmilist.c +360 -288
- data/ext/RMagick/rmimage.c +5550 -4318
- data/ext/RMagick/rminfo.c +637 -818
- data/ext/RMagick/rmkinfo.c +88 -92
- data/ext/RMagick/rmmain.c +462 -263
- data/ext/RMagick/rmmontage.c +105 -150
- data/ext/RMagick/rmpixel.c +554 -359
- data/ext/RMagick/rmstruct.c +81 -94
- data/ext/RMagick/rmutil.c +279 -270
- data/lib/rmagick/version.rb +3 -1
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +118 -104
- data/lib/rvg/clippath.rb +2 -1
- data/lib/rvg/container.rb +10 -5
- data/lib/rvg/describable.rb +1 -1
- data/lib/rvg/embellishable.rb +5 -4
- data/lib/rvg/misc.rb +15 -12
- data/lib/rvg/paint.rb +2 -1
- data/lib/rvg/pathdata.rb +12 -11
- data/lib/rvg/rvg.rb +10 -6
- data/lib/rvg/stylable.rb +9 -7
- data/lib/rvg/text.rb +11 -6
- data/lib/rvg/transformable.rb +3 -2
- data/lib/rvg/units.rb +1 -1
- data/rmagick.gemspec +13 -12
- metadata +63 -419
- data/.appveyor.yml +0 -45
- data/.circleci/config.yml +0 -56
- data/.ruby-version +0 -1
- data/.simplecov +0 -27
- data/.travis.yml +0 -62
- data/Doxyfile +0 -1514
- data/README.textile +0 -259
- data/benchmarks/memory/README.md +0 -50
- data/benchmarks/memory/image_new.rb +0 -8
- data/benchmarks/memory/rmagick.gnuplot +0 -16
- data/deprecated/RMagick.rb +0 -6
- data/doc/.cvsignore +0 -1
- 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 -3272
- data/doc/ex/InitialCoords.rb +0 -22
- data/doc/ex/NewCoordSys.rb +0 -30
- data/doc/ex/OrigCoordSys.rb +0 -16
- data/doc/ex/PreserveAspectRatio.rb +0 -204
- data/doc/ex/RotateScale.rb +0 -36
- data/doc/ex/Skew.rb +0 -38
- data/doc/ex/Use01.rb +0 -15
- data/doc/ex/Use02.rb +0 -20
- data/doc/ex/Use03.rb +0 -16
- data/doc/ex/ViewBox.rb +0 -31
- data/doc/ex/adaptive_threshold.rb +0 -9
- data/doc/ex/add_noise.rb +0 -16
- 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 -32
- data/doc/ex/arcs01.rb +0 -28
- data/doc/ex/arcs02.rb +0 -59
- data/doc/ex/average.rb +0 -15
- data/doc/ex/axes.rb +0 -64
- data/doc/ex/baseline_shift01.rb +0 -17
- data/doc/ex/bilevel_channel.rb +0 -8
- data/doc/ex/blur_image.rb +0 -12
- data/doc/ex/border.rb +0 -10
- data/doc/ex/bounding_box.rb +0 -42
- data/doc/ex/cbezier1.rb +0 -41
- data/doc/ex/cbezier2.rb +0 -41
- data/doc/ex/cbezier3.rb +0 -41
- data/doc/ex/cbezier4.rb +0 -42
- data/doc/ex/cbezier5.rb +0 -42
- data/doc/ex/cbezier6.rb +0 -53
- data/doc/ex/channel.rb +0 -25
- 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 -16
- data/doc/ex/clip_path.rb +0 -60
- data/doc/ex/coalesce.rb +0 -57
- 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 -47
- 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 -22
- data/doc/ex/composite.rb +0 -133
- data/doc/ex/composite_layers.rb +0 -52
- data/doc/ex/composite_tiled.rb +0 -21
- data/doc/ex/contrast.rb +0 -36
- data/doc/ex/crop.rb +0 -31
- data/doc/ex/crop_with_gravity.rb +0 -42
- data/doc/ex/cubic01.rb +0 -43
- data/doc/ex/cubic02.rb +0 -91
- data/doc/ex/cycle_colormap.rb +0 -21
- data/doc/ex/dissolve.rb +0 -12
- data/doc/ex/drawcomp.rb +0 -41
- 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 -21
- 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 -42
- data/doc/ex/fill_pattern.rb +0 -23
- 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 -32
- data/doc/ex/fonts.rb +0 -16
- data/doc/ex/frame.rb +0 -12
- data/doc/ex/gaussian_blur.rb +0 -11
- data/doc/ex/get_multiline_type_metrics.rb +0 -41
- data/doc/ex/get_pixels.rb +0 -45
- data/doc/ex/get_type_metrics.rb +0 -142
- data/doc/ex/gradientfill.rb +0 -27
- data/doc/ex/grav.rb +0 -45
- data/doc/ex/gravity.rb +0 -78
- data/doc/ex/group.rb +0 -26
- data/doc/ex/hatchfill.rb +0 -27
- data/doc/ex/image.rb +0 -44
- 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.png +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.png +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.png +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/image_with_profile.jpg +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 -41
- data/doc/ex/line01.rb +0 -21
- data/doc/ex/mask.rb +0 -35
- data/doc/ex/matte_fill_to_border.rb +0 -39
- data/doc/ex/matte_floodfill.rb +0 -32
- data/doc/ex/matte_replace.rb +0 -39
- 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 -25
- data/doc/ex/mosaic.rb +0 -37
- 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 -42
- 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 -63
- data/doc/ex/pattern1.rb +0 -25
- data/doc/ex/pattern2.rb +0 -26
- data/doc/ex/polaroid.rb +0 -26
- data/doc/ex/polygon.rb +0 -23
- data/doc/ex/polygon01.rb +0 -21
- data/doc/ex/polyline.rb +0 -22
- data/doc/ex/polyline01.rb +0 -21
- data/doc/ex/posterize.rb +0 -8
- data/doc/ex/preview.rb +0 -8
- data/doc/ex/qbezierpath.rb +0 -52
- data/doc/ex/quad01.rb +0 -34
- 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 -14
- data/doc/ex/rect02.rb +0 -20
- data/doc/ex/rectangle.rb +0 -34
- data/doc/ex/reduce_noise.rb +0 -28
- data/doc/ex/remap.rb +0 -11
- data/doc/ex/remap_images.rb +0 -19
- data/doc/ex/resize_to_fill.rb +0 -8
- data/doc/ex/resize_to_fit.rb +0 -8
- data/doc/ex/roll.rb +0 -9
- data/doc/ex/rotate.rb +0 -44
- data/doc/ex/rotate_f.rb +0 -14
- data/doc/ex/roundrect.rb +0 -33
- data/doc/ex/rubyname.rb +0 -30
- data/doc/ex/rvg_clippath.rb +0 -12
- data/doc/ex/rvg_linecap.rb +0 -42
- data/doc/ex/rvg_linejoin.rb +0 -40
- data/doc/ex/rvg_opacity.rb +0 -18
- data/doc/ex/rvg_pattern.rb +0 -26
- data/doc/ex/rvg_stroke_dasharray.rb +0 -11
- data/doc/ex/segment.rb +0 -11
- data/doc/ex/sepiatone.rb +0 -7
- data/doc/ex/shade.rb +0 -11
- data/doc/ex/shadow.rb +0 -30
- data/doc/ex/shave.rb +0 -15
- data/doc/ex/shear.rb +0 -10
- data/doc/ex/sketch.rb +0 -17
- data/doc/ex/skewx.rb +0 -51
- data/doc/ex/skewy.rb +0 -47
- data/doc/ex/smile.rb +0 -126
- data/doc/ex/solarize.rb +0 -11
- data/doc/ex/sparse_color.rb +0 -55
- data/doc/ex/splice.rb +0 -8
- data/doc/ex/spread.rb +0 -11
- data/doc/ex/stegano.rb +0 -54
- data/doc/ex/stroke_dasharray.rb +0 -42
- data/doc/ex/stroke_fill.rb +0 -10
- 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 -16
- data/doc/ex/text_align.rb +0 -36
- data/doc/ex/text_antialias.rb +0 -37
- data/doc/ex/text_styles.rb +0 -19
- 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 -24
- data/doc/ex/threshold.rb +0 -13
- data/doc/ex/to_blob.rb +0 -13
- 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 -24
- data/doc/ex/triangle01.rb +0 -15
- data/doc/ex/trim.rb +0 -23
- data/doc/ex/tspan01.rb +0 -17
- data/doc/ex/tspan02.rb +0 -17
- data/doc/ex/tspan03.rb +0 -19
- data/doc/ex/unsharp_mask.rb +0 -28
- data/doc/ex/viewex.rb +0 -33
- data/doc/ex/vignette.rb +0 -12
- data/doc/ex/watermark.rb +0 -27
- data/doc/ex/wave.rb +0 -9
- data/doc/ex/wet_floor.rb +0 -58
- data/doc/ex/writing_mode01.rb +0 -26
- 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 -570
- 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 -43
- data/examples/demo.rb +0 -323
- data/examples/describe.rb +0 -41
- data/examples/find_similar_region.rb +0 -34
- data/examples/histogram.rb +0 -312
- data/examples/identify.rb +0 -174
- data/examples/image_opacity.rb +0 -28
- data/examples/import_export.rb +0 -31
- data/examples/pattern_fill.rb +0 -37
- data/examples/rotating_text.rb +0 -45
- data/examples/spinner.rb +0 -49
- data/examples/thumbnail.rb +0 -64
- data/examples/vignette.rb +0 -78
- data/spec/rmagick/ImageList1_spec.rb +0 -24
- data/spec/rmagick/draw_spec.rb +0 -155
- data/spec/rmagick/image/blue_shift_spec.rb +0 -14
- data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
- data/spec/rmagick/image/composite_spec.rb +0 -72
- data/spec/rmagick/image/constitute_spec.rb +0 -13
- data/spec/rmagick/image/dispatch_spec.rb +0 -16
- data/spec/rmagick/image/from_blob_spec.rb +0 -12
- data/spec/rmagick/image/ping_spec.rb +0 -12
- data/spec/rmagick/image/properties_spec.rb +0 -27
- data/spec/rmagick/image/read_spec.rb +0 -28
- data/spec/spec_helper.rb +0 -10
- data/spec/support/issue_200/app.rb +0 -8
- data/test/Draw.rb +0 -351
- data/test/Enum.rb +0 -228
- data/test/Fill.rb +0 -93
- data/test/Image1.rb +0 -606
- data/test/Image2.rb +0 -1408
- data/test/Image3.rb +0 -1086
- data/test/ImageList1.rb +0 -858
- data/test/ImageList2.rb +0 -375
- data/test/Image_attributes.rb +0 -635
- data/test/Import_Export.rb +0 -111
- data/test/Info.rb +0 -436
- data/test/KernelInfo.rb +0 -59
- data/test/Magick.rb +0 -311
- data/test/Pixel.rb +0 -259
- data/test/PolaroidOptions.rb +0 -23
- data/test/Preview.rb +0 -26
- data/test/Struct.rb +0 -45
- data/test/appearance/Montage.rb +0 -26
- data/test/appearance/appearance_assertion.rb +0 -13
- data/test/appearance/expected/montage_border_color.jpg +0 -0
- data/test/cmyk.icm +0 -0
- data/test/lib/internal/Draw.rb +0 -811
- data/test/lib/internal/Geometry.rb +0 -98
- data/test/lib/internal/Magick.rb +0 -40
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +0 -49
- data/test/tmpnam_test.rb +0 -50
data/ext/RMagick/rmilist.c
CHANGED
@@ -16,27 +16,56 @@ static Image *clone_imagelist(Image *);
|
|
16
16
|
static Image *images_from_imagelist(VALUE);
|
17
17
|
static long imagelist_length(VALUE);
|
18
18
|
static long check_imagelist_length(VALUE);
|
19
|
-
static VALUE imagelist_scene_eq(VALUE, VALUE);
|
20
19
|
static void imagelist_push(VALUE, VALUE);
|
21
20
|
static VALUE ImageList_new(void);
|
22
21
|
|
23
22
|
|
23
|
+
DEFINE_GVL_STUB3(AppendImages, const Image *, const MagickBooleanType, ExceptionInfo *);
|
24
|
+
DEFINE_GVL_STUB5(CloneImage, const Image *, const size_t, const size_t, const MagickBooleanType, ExceptionInfo *);
|
25
|
+
DEFINE_GVL_STUB2(CloneImageList, const Image *, ExceptionInfo *);
|
26
|
+
DEFINE_GVL_STUB2(CoalesceImages, const Image *, ExceptionInfo *);
|
27
|
+
DEFINE_GVL_STUB2(DisposeImages, const Image *, ExceptionInfo *);
|
28
|
+
DEFINE_GVL_STUB3(EvaluateImages, const Image *, const MagickEvaluateOperator, ExceptionInfo *);
|
29
|
+
DEFINE_GVL_STUB4(ImagesToBlob, const ImageInfo *, Image *, size_t *, ExceptionInfo *);
|
30
|
+
DEFINE_GVL_STUB3(MergeImageLayers, Image *, const LayerMethod, ExceptionInfo *);
|
31
|
+
DEFINE_GVL_STUB3(MontageImages, const Image *, const MontageInfo *, ExceptionInfo *);
|
32
|
+
DEFINE_GVL_STUB3(MorphImages, const Image *, const size_t, ExceptionInfo *);
|
33
|
+
DEFINE_GVL_STUB2(OptimizeImageLayers, const Image *, ExceptionInfo *);
|
34
|
+
DEFINE_GVL_STUB2(OptimizePlusImageLayers, const Image *, ExceptionInfo *);
|
35
|
+
#if defined(IMAGEMAGICK_7)
|
36
|
+
DEFINE_GVL_STUB3(AnimateImages, const ImageInfo *, Image *, ExceptionInfo *);
|
37
|
+
DEFINE_GVL_STUB3(CombineImages, const Image *, const ColorspaceType, ExceptionInfo *);
|
38
|
+
DEFINE_GVL_STUB3(CompareImagesLayers, const Image *, const LayerMethod, ExceptionInfo *);
|
39
|
+
DEFINE_GVL_STUB3(QuantizeImages, const QuantizeInfo *, Image *, ExceptionInfo *);
|
40
|
+
DEFINE_GVL_STUB4(RemapImages, const QuantizeInfo *, Image *, const Image *, ExceptionInfo *);
|
41
|
+
DEFINE_GVL_STUB3(WriteImage, const ImageInfo *, Image *, ExceptionInfo *);
|
42
|
+
#else
|
43
|
+
DEFINE_GVL_STUB2(AnimateImages, const ImageInfo *, Image *);
|
44
|
+
DEFINE_GVL_STUB3(CombineImages, const Image *, const ChannelType, ExceptionInfo *);
|
45
|
+
DEFINE_GVL_STUB3(CompareImageLayers, const Image *, const ImageLayerMethod, ExceptionInfo *);
|
46
|
+
DEFINE_GVL_STUB2(DeconstructImages, const Image *, ExceptionInfo *);
|
47
|
+
DEFINE_GVL_STUB2(QuantizeImages, const QuantizeInfo *, Image *);
|
48
|
+
DEFINE_GVL_STUB3(RemapImages, const QuantizeInfo *, Image *, const Image *);
|
49
|
+
DEFINE_GVL_STUB2(WriteImage, const ImageInfo *, Image *);
|
50
|
+
#endif
|
24
51
|
|
52
|
+
DEFINE_GVL_VOID_STUB6(CompositeLayers, Image *, const CompositeOperator, Image *, const ssize_t, const ssize_t, ExceptionInfo *);
|
53
|
+
DEFINE_GVL_VOID_STUB2(OptimizeImageTransparency, const Image *, ExceptionInfo *);
|
54
|
+
DEFINE_GVL_VOID_STUB2(RemoveDuplicateLayers, Image **, ExceptionInfo *);
|
55
|
+
DEFINE_GVL_VOID_STUB2(RemoveZeroDelayLayers, Image **, ExceptionInfo *);
|
25
56
|
|
26
57
|
|
27
58
|
/**
|
28
59
|
* Repeatedly display the images in the images array to an XWindow screen. The
|
29
|
-
*
|
60
|
+
* +delay+ argument is the number of 1/100ths of a second (0 to 65535) to delay
|
30
61
|
* between images.
|
31
62
|
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
*
|
63
|
+
* @overload animate
|
64
|
+
*
|
65
|
+
* @overload animate(delay)
|
66
|
+
* @param delay [Numeric] the length of time between each image in an animation
|
35
67
|
*
|
36
|
-
* @
|
37
|
-
* @param argv array of input arguments
|
38
|
-
* @param self this object
|
39
|
-
* @return self
|
68
|
+
* @return [Magick::ImageList] self
|
40
69
|
*/
|
41
70
|
|
42
71
|
VALUE
|
@@ -46,6 +75,9 @@ ImageList_animate(int argc, VALUE *argv, VALUE self)
|
|
46
75
|
Info *info;
|
47
76
|
VALUE info_obj;
|
48
77
|
unsigned int delay;
|
78
|
+
#if defined(IMAGEMAGICK_7)
|
79
|
+
ExceptionInfo *exception;
|
80
|
+
#endif
|
49
81
|
|
50
82
|
if (argc == 1)
|
51
83
|
{
|
@@ -72,10 +104,20 @@ ImageList_animate(int argc, VALUE *argv, VALUE self)
|
|
72
104
|
}
|
73
105
|
}
|
74
106
|
|
75
|
-
|
76
|
-
|
77
|
-
|
107
|
+
TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
|
108
|
+
#if defined(IMAGEMAGICK_7)
|
109
|
+
exception = AcquireExceptionInfo();
|
110
|
+
GVL_STRUCT_TYPE(AnimateImages) args = { info, images, exception };
|
111
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AnimateImages), &args);
|
78
112
|
rm_split(images);
|
113
|
+
CHECK_EXCEPTION();
|
114
|
+
DestroyExceptionInfo(exception);
|
115
|
+
#else
|
116
|
+
GVL_STRUCT_TYPE(AnimateImages) args = { info, images };
|
117
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AnimateImages), &args);
|
118
|
+
rm_split(images);
|
119
|
+
rm_check_image_exception(images, RetainOnError);
|
120
|
+
#endif
|
79
121
|
|
80
122
|
RB_GC_GUARD(info_obj);
|
81
123
|
|
@@ -84,14 +126,10 @@ ImageList_animate(int argc, VALUE *argv, VALUE self)
|
|
84
126
|
|
85
127
|
|
86
128
|
/**
|
87
|
-
* Append all the images
|
88
|
-
*
|
89
|
-
* Ruby usage:
|
90
|
-
* - @verbatim ImageList#append(stack) @endverbatim
|
129
|
+
* Append all the images
|
91
130
|
*
|
92
|
-
* @param
|
93
|
-
* @
|
94
|
-
* @return a Frame object for the result
|
131
|
+
* @param stack_arg [Magick::ImageList] the stack of images
|
132
|
+
* @return [Magick::Image] a frame object for the result
|
95
133
|
*/
|
96
134
|
VALUE
|
97
135
|
ImageList_append(VALUE self, VALUE stack_arg)
|
@@ -108,25 +146,20 @@ ImageList_append(VALUE self, VALUE stack_arg)
|
|
108
146
|
stack = RTEST(stack_arg);
|
109
147
|
|
110
148
|
exception = AcquireExceptionInfo();
|
111
|
-
|
149
|
+
GVL_STRUCT_TYPE(AppendImages) args = { images, stack, exception };
|
150
|
+
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(AppendImages), &args);
|
112
151
|
rm_split(images);
|
113
152
|
rm_check_exception(exception, new_image, DestroyOnError);
|
114
|
-
|
115
|
-
|
116
|
-
rm_ensure_result(new_image);
|
153
|
+
DestroyExceptionInfo(exception);
|
117
154
|
|
118
155
|
return rm_image_new(new_image);
|
119
156
|
}
|
120
157
|
|
121
158
|
|
122
159
|
/**
|
123
|
-
* Average all images together
|
160
|
+
* Average all images together
|
124
161
|
*
|
125
|
-
*
|
126
|
-
* - @verbatim ImageList#average @endverbatim
|
127
|
-
*
|
128
|
-
* @param self this object
|
129
|
-
* @return a Frame object for the averaged image
|
162
|
+
* @return [Magick::Image] a frame object for the averaged image
|
130
163
|
*/
|
131
164
|
VALUE
|
132
165
|
ImageList_average(VALUE self)
|
@@ -138,30 +171,23 @@ ImageList_average(VALUE self)
|
|
138
171
|
images = images_from_imagelist(self);
|
139
172
|
|
140
173
|
exception = AcquireExceptionInfo();
|
141
|
-
|
142
|
-
|
174
|
+
GVL_STRUCT_TYPE(EvaluateImages) args = { images, MeanEvaluateOperator, exception };
|
175
|
+
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(EvaluateImages), &args);
|
143
176
|
rm_split(images);
|
144
177
|
rm_check_exception(exception, new_image, DestroyOnError);
|
145
|
-
|
146
|
-
|
147
|
-
rm_ensure_result(new_image);
|
178
|
+
DestroyExceptionInfo(exception);
|
148
179
|
|
149
180
|
return rm_image_new(new_image);
|
150
181
|
}
|
151
182
|
|
152
183
|
|
153
184
|
/**
|
154
|
-
*
|
155
|
-
*
|
156
|
-
* Ruby usage:
|
157
|
-
* - @verbatim ImageList#coalesce @endverbatim
|
185
|
+
* Composites a set of images while respecting any page offsets and disposal methods.
|
158
186
|
*
|
159
|
-
*
|
160
|
-
* - Respects the delay, matte, and start_loop fields in each image.
|
187
|
+
* - Respects the delay, matte, and start_loop fields in each image.
|
161
188
|
*
|
162
|
-
* @
|
163
|
-
*
|
164
|
-
* images array
|
189
|
+
* @return [Magick::ImageList] a new image with the coalesced image sequence return stored in the
|
190
|
+
* images array
|
165
191
|
*/
|
166
192
|
VALUE
|
167
193
|
ImageList_coalesce(VALUE self)
|
@@ -173,12 +199,11 @@ ImageList_coalesce(VALUE self)
|
|
173
199
|
images = images_from_imagelist(self);
|
174
200
|
|
175
201
|
exception = AcquireExceptionInfo();
|
176
|
-
|
202
|
+
GVL_STRUCT_TYPE(CoalesceImages) args = { images, exception };
|
203
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args);
|
177
204
|
rm_split(images);
|
178
205
|
rm_check_exception(exception, new_images, DestroyOnError);
|
179
|
-
|
180
|
-
|
181
|
-
rm_ensure_result(new_images);
|
206
|
+
DestroyExceptionInfo(exception);
|
182
207
|
|
183
208
|
return rm_imagelist_from_images(new_images);
|
184
209
|
}
|
@@ -187,22 +212,20 @@ ImageList_coalesce(VALUE self)
|
|
187
212
|
/**
|
188
213
|
* Combines the images using the specified colorspace.
|
189
214
|
*
|
190
|
-
*
|
191
|
-
* - @verbatim new_image = ImageList#combine @endverbatim
|
192
|
-
* - @verbatim new_image = ImageList#combine(colorspace) @endverbatim
|
215
|
+
* @overload combine
|
193
216
|
*
|
194
|
-
*
|
195
|
-
*
|
217
|
+
* @overload combine(colorspace)
|
218
|
+
* @param colorspace [Magick::ColorspaceType] the colorspace
|
196
219
|
*
|
197
|
-
* @
|
198
|
-
* @param argv array of input arguments
|
199
|
-
* @param self this object
|
200
|
-
* @return a new image
|
220
|
+
* @return [Magick::Image] a new image
|
201
221
|
*/
|
202
222
|
VALUE ImageList_combine(int argc, VALUE *argv, VALUE self)
|
203
223
|
{
|
224
|
+
#if defined(IMAGEMAGICK_6)
|
204
225
|
ChannelType channel;
|
205
|
-
ColorspaceType
|
226
|
+
ColorspaceType old_colorspace;
|
227
|
+
#endif
|
228
|
+
ColorspaceType colorspace;
|
206
229
|
long len;
|
207
230
|
Image *images, *new_image;
|
208
231
|
ExceptionInfo *exception;
|
@@ -222,6 +245,16 @@ VALUE ImageList_combine(int argc, VALUE *argv, VALUE self)
|
|
222
245
|
break;
|
223
246
|
}
|
224
247
|
|
248
|
+
#if defined(IMAGEMAGICK_7)
|
249
|
+
if (len > 5)
|
250
|
+
{
|
251
|
+
rb_raise(rb_eArgError, "invalid number of images in this image list");
|
252
|
+
}
|
253
|
+
if (len == 5 && colorspace != CMYKColorspace)
|
254
|
+
{
|
255
|
+
rb_raise(rb_eArgError, "invalid number of images in this image list");
|
256
|
+
}
|
257
|
+
#else
|
225
258
|
channel = RedChannel;
|
226
259
|
switch (len)
|
227
260
|
{
|
@@ -248,39 +281,42 @@ VALUE ImageList_combine(int argc, VALUE *argv, VALUE self)
|
|
248
281
|
rb_raise(rb_eArgError, "invalid number of images in this image list");
|
249
282
|
break;
|
250
283
|
}
|
284
|
+
#endif
|
251
285
|
|
252
286
|
images = images_from_imagelist(self);
|
287
|
+
exception = AcquireExceptionInfo();
|
288
|
+
#if defined(IMAGEMAGICK_6)
|
253
289
|
old_colorspace = images->colorspace;
|
254
290
|
SetImageColorspace(images, colorspace);
|
291
|
+
GVL_STRUCT_TYPE(CombineImages) args = { images, channel, exception };
|
292
|
+
#else
|
293
|
+
GVL_STRUCT_TYPE(CombineImages) args = { images, colorspace, exception };
|
294
|
+
#endif
|
295
|
+
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CombineImages), &args);
|
255
296
|
|
256
|
-
exception = AcquireExceptionInfo();
|
257
|
-
new_image = CombineImages(images, channel, exception);
|
258
297
|
rm_split(images);
|
298
|
+
#if defined(IMAGEMAGICK_6)
|
259
299
|
images->colorspace = old_colorspace;
|
300
|
+
#endif
|
260
301
|
rm_check_exception(exception, new_image, DestroyOnError);
|
261
|
-
|
262
|
-
|
263
|
-
rm_ensure_result(new_image);
|
302
|
+
DestroyExceptionInfo(exception);
|
264
303
|
|
265
304
|
return rm_image_new(new_image);
|
266
305
|
}
|
267
306
|
|
268
307
|
|
269
308
|
/**
|
270
|
-
*
|
309
|
+
* An image from source images is composited over an image from receiver's list until one list is finished.
|
271
310
|
*
|
272
|
-
*
|
273
|
-
*
|
274
|
-
* - @verbatim ImageList#composite_layers(images,operator) @endverbatim
|
311
|
+
* @overload composite_layers(images)
|
312
|
+
* @param images [Magick::ImageList] the source images
|
275
313
|
*
|
276
|
-
*
|
277
|
-
* - Default operator is OverCompositeOp
|
314
|
+
* @overload composite_layers(images, operator)
|
315
|
+
* - Default operator is {Magick::OverCompositeOp}
|
316
|
+
* @param images [Magick::ImageList] the source images
|
317
|
+
* @param operator [Magick::CompositeOperator] the operator
|
278
318
|
*
|
279
|
-
* @
|
280
|
-
* @param argv array of input arguments
|
281
|
-
* @param self this object
|
282
|
-
* @return a new imagelist
|
283
|
-
* @see mogrify.c in ImageMagick
|
319
|
+
* @return [Magick::ImageList] a new imagelist
|
284
320
|
*/
|
285
321
|
VALUE
|
286
322
|
ImageList_composite_layers(int argc, VALUE *argv, VALUE self)
|
@@ -310,20 +346,21 @@ ImageList_composite_layers(int argc, VALUE *argv, VALUE self)
|
|
310
346
|
|
311
347
|
source = images_from_imagelist(source_images);
|
312
348
|
|
313
|
-
SetGeometry(new_images
|
314
|
-
|
349
|
+
SetGeometry(new_images, &geometry);
|
350
|
+
ParseAbsoluteGeometry(new_images->geometry, &geometry);
|
315
351
|
|
316
352
|
geometry.width = source->page.width != 0 ? source->page.width : source->columns;
|
317
353
|
geometry.height = source->page.height != 0 ? source->page.height : source->rows;
|
318
|
-
GravityAdjustGeometry(new_images->page.width != 0 ? new_images->page.width : new_images->columns
|
319
|
-
|
320
|
-
|
354
|
+
GravityAdjustGeometry(new_images->page.width != 0 ? new_images->page.width : new_images->columns,
|
355
|
+
new_images->page.height != 0 ? new_images->page.height : new_images->rows,
|
356
|
+
new_images->gravity, &geometry);
|
321
357
|
|
322
358
|
exception = AcquireExceptionInfo();
|
323
|
-
CompositeLayers
|
359
|
+
GVL_STRUCT_TYPE(CompositeLayers) args = { new_images, operator, source, geometry.x, geometry.y, exception };
|
360
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompositeLayers), &args);
|
324
361
|
rm_split(source);
|
325
362
|
rm_check_exception(exception, new_images, DestroyOnError);
|
326
|
-
|
363
|
+
DestroyExceptionInfo(exception);
|
327
364
|
|
328
365
|
RB_GC_GUARD(source_images);
|
329
366
|
|
@@ -335,11 +372,7 @@ ImageList_composite_layers(int argc, VALUE *argv, VALUE self)
|
|
335
372
|
* Compare each image with the next in a sequence and returns the maximum
|
336
373
|
* bounding region of any pixel differences it discovers.
|
337
374
|
*
|
338
|
-
*
|
339
|
-
* - @verbatim ImageList#deconstruct @endverbatim
|
340
|
-
*
|
341
|
-
* @param self this object
|
342
|
-
* @return a new imagelist
|
375
|
+
* @return [Magick::ImageList] a new imagelist
|
343
376
|
*/
|
344
377
|
VALUE
|
345
378
|
ImageList_deconstruct(VALUE self)
|
@@ -349,12 +382,16 @@ ImageList_deconstruct(VALUE self)
|
|
349
382
|
|
350
383
|
images = images_from_imagelist(self);
|
351
384
|
exception = AcquireExceptionInfo();
|
352
|
-
|
385
|
+
#if defined(IMAGEMAGICK_7)
|
386
|
+
GVL_STRUCT_TYPE(CompareImagesLayers) args = { images, CompareAnyLayer, exception };
|
387
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImagesLayers), &args);
|
388
|
+
#else
|
389
|
+
GVL_STRUCT_TYPE(DeconstructImages) args = { images, exception };
|
390
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DeconstructImages), &args);
|
391
|
+
#endif
|
353
392
|
rm_split(images);
|
354
393
|
rm_check_exception(exception, new_images, DestroyOnError);
|
355
|
-
|
356
|
-
|
357
|
-
rm_ensure_result(new_images);
|
394
|
+
DestroyExceptionInfo(exception);
|
358
395
|
|
359
396
|
return rm_imagelist_from_images(new_images);
|
360
397
|
}
|
@@ -363,11 +400,7 @@ ImageList_deconstruct(VALUE self)
|
|
363
400
|
/**
|
364
401
|
* Display all the images to an X window screen.
|
365
402
|
*
|
366
|
-
*
|
367
|
-
* - @verbatim ImageList#display @endverbatim
|
368
|
-
*
|
369
|
-
* @param self this object
|
370
|
-
* @return self
|
403
|
+
* @return [Magick::ImageList] self
|
371
404
|
*/
|
372
405
|
VALUE
|
373
406
|
ImageList_display(VALUE self)
|
@@ -375,17 +408,27 @@ ImageList_display(VALUE self)
|
|
375
408
|
Image *images;
|
376
409
|
Info *info;
|
377
410
|
VALUE info_obj;
|
411
|
+
#if defined(IMAGEMAGICK_7)
|
412
|
+
ExceptionInfo *exception;
|
413
|
+
#endif
|
378
414
|
|
379
415
|
// Create a new Info object to use with this call
|
380
416
|
info_obj = rm_info_new();
|
381
|
-
|
417
|
+
TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
|
382
418
|
|
383
419
|
// Convert the images array to an images sequence.
|
384
420
|
images = images_from_imagelist(self);
|
385
|
-
|
386
|
-
|
421
|
+
#if defined(IMAGEMAGICK_7)
|
422
|
+
exception = AcquireExceptionInfo();
|
423
|
+
DisplayImages(info, images, exception);
|
424
|
+
rm_split(images);
|
425
|
+
CHECK_EXCEPTION();
|
426
|
+
DestroyExceptionInfo(exception);
|
427
|
+
#else
|
428
|
+
DisplayImages(info, images);
|
387
429
|
rm_split(images);
|
388
430
|
rm_check_image_exception(images, RetainOnError);
|
431
|
+
#endif
|
389
432
|
|
390
433
|
RB_GC_GUARD(info_obj);
|
391
434
|
|
@@ -396,14 +439,7 @@ ImageList_display(VALUE self)
|
|
396
439
|
/**
|
397
440
|
* Merge all the images into a single image.
|
398
441
|
*
|
399
|
-
*
|
400
|
-
* - @verbatim ImageList#flatten_images @endverbatim
|
401
|
-
*
|
402
|
-
* Notes:
|
403
|
-
* - Can't use "flatten" because that's an Array method
|
404
|
-
*
|
405
|
-
* @param self this object
|
406
|
-
* @return the new image
|
442
|
+
* @return [Magick::ImageList] the new image
|
407
443
|
*/
|
408
444
|
VALUE
|
409
445
|
ImageList_flatten_images(VALUE self)
|
@@ -414,30 +450,28 @@ ImageList_flatten_images(VALUE self)
|
|
414
450
|
images = images_from_imagelist(self);
|
415
451
|
exception = AcquireExceptionInfo();
|
416
452
|
|
417
|
-
|
453
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, FlattenLayer, exception };
|
454
|
+
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
418
455
|
|
419
456
|
rm_split(images);
|
420
457
|
rm_check_exception(exception, new_image, DestroyOnError);
|
421
|
-
|
422
|
-
|
423
|
-
rm_ensure_result(new_image);
|
458
|
+
DestroyExceptionInfo(exception);
|
424
459
|
|
425
460
|
return rm_image_new(new_image);
|
426
461
|
}
|
427
462
|
|
428
463
|
|
429
464
|
/**
|
430
|
-
*
|
465
|
+
* Tile one or more thumbnails across an image canvas.
|
431
466
|
*
|
432
|
-
*
|
433
|
-
* - @verbatim ImageList#montage <{parm block}> @endverbatim
|
467
|
+
* @overload montage
|
434
468
|
*
|
435
|
-
*
|
436
|
-
*
|
437
|
-
*
|
469
|
+
* @overload montage
|
470
|
+
* Creates {Magick::ImageList::Montage} object, yields to block
|
471
|
+
* if present in {Magick::ImageList::Montage} object's scope.
|
472
|
+
* @yield [Magick::ImageList::Montage]
|
438
473
|
*
|
439
|
-
* @
|
440
|
-
* @return a new image list
|
474
|
+
* @return [Magick::ImageList] a new image list
|
441
475
|
*/
|
442
476
|
VALUE
|
443
477
|
ImageList_montage(VALUE self)
|
@@ -447,16 +481,14 @@ ImageList_montage(VALUE self)
|
|
447
481
|
Image *new_images, *images;
|
448
482
|
ExceptionInfo *exception;
|
449
483
|
|
450
|
-
// Create a new instance of the Magick::Montage class
|
484
|
+
// Create a new instance of the Magick::ImageList::Montage class
|
451
485
|
montage_obj = rm_montage_new();
|
452
486
|
if (rb_block_given_p())
|
453
487
|
{
|
454
|
-
|
455
|
-
// object's attributes.
|
456
|
-
(void) rb_obj_instance_eval(0, NULL, montage_obj);
|
488
|
+
rb_yield(montage_obj);
|
457
489
|
}
|
458
490
|
|
459
|
-
|
491
|
+
TypedData_Get_Struct(montage_obj, Montage, &rm_montage_data_type, montage);
|
460
492
|
|
461
493
|
images = images_from_imagelist(self);
|
462
494
|
|
@@ -475,12 +507,11 @@ ImageList_montage(VALUE self)
|
|
475
507
|
exception = AcquireExceptionInfo();
|
476
508
|
|
477
509
|
// MontageImage can return more than one image.
|
478
|
-
|
510
|
+
GVL_STRUCT_TYPE(MontageImages) args = { images, montage->info, exception };
|
511
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MontageImages), &args);
|
479
512
|
rm_split(images);
|
480
513
|
rm_check_exception(exception, new_images, DestroyOnError);
|
481
|
-
|
482
|
-
|
483
|
-
rm_ensure_result(new_images);
|
514
|
+
DestroyExceptionInfo(exception);
|
484
515
|
|
485
516
|
RB_GC_GUARD(montage_obj);
|
486
517
|
|
@@ -490,17 +521,11 @@ ImageList_montage(VALUE self)
|
|
490
521
|
|
491
522
|
/**
|
492
523
|
* Requires a minimum of two images. The first image is transformed into the
|
493
|
-
* second by a number of intervening images as specified by "
|
494
|
-
*
|
495
|
-
* Ruby usage:
|
496
|
-
* - @verbatim ImageList#morph(number_images) @endverbatim
|
497
|
-
*
|
498
|
-
* Notes:
|
499
|
-
* - Sets \@scenes to 0
|
524
|
+
* second by a number of intervening images as specified by "nimages".
|
500
525
|
*
|
501
|
-
* @
|
502
|
-
* @param nimages the number of images
|
503
|
-
* @return a new image list with the images array set to the morph sequence.
|
526
|
+
* @note Sets +@scenes+ to 0
|
527
|
+
* @param nimages [Numeric] the number of images
|
528
|
+
* @return [Magick::ImageList] a new image list with the images array set to the morph sequence.
|
504
529
|
*/
|
505
530
|
VALUE
|
506
531
|
ImageList_morph(VALUE self, VALUE nimages)
|
@@ -519,12 +544,11 @@ ImageList_morph(VALUE self, VALUE nimages)
|
|
519
544
|
|
520
545
|
images = images_from_imagelist(self);
|
521
546
|
exception = AcquireExceptionInfo();
|
522
|
-
|
547
|
+
GVL_STRUCT_TYPE(MorphImages) args = { images, number_images, exception };
|
548
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MorphImages), &args);
|
523
549
|
rm_split(images);
|
524
550
|
rm_check_exception(exception, new_images, DestroyOnError);
|
525
|
-
|
526
|
-
|
527
|
-
rm_ensure_result(new_images);
|
551
|
+
DestroyExceptionInfo(exception);
|
528
552
|
|
529
553
|
return rm_imagelist_from_images(new_images);
|
530
554
|
}
|
@@ -533,11 +557,7 @@ ImageList_morph(VALUE self, VALUE nimages)
|
|
533
557
|
/**
|
534
558
|
* Merge all the images into a single image.
|
535
559
|
*
|
536
|
-
*
|
537
|
-
* - @verbatim ImageList#mosaic @endverbatim
|
538
|
-
*
|
539
|
-
* @param self this object
|
540
|
-
* @return the new image
|
560
|
+
* @return [Magick::Image] the new image
|
541
561
|
*/
|
542
562
|
VALUE
|
543
563
|
ImageList_mosaic(VALUE self)
|
@@ -548,27 +568,23 @@ ImageList_mosaic(VALUE self)
|
|
548
568
|
images = images_from_imagelist(self);
|
549
569
|
|
550
570
|
exception = AcquireExceptionInfo();
|
551
|
-
|
571
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, MosaicLayer, exception };
|
572
|
+
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
552
573
|
|
553
574
|
rm_split(images);
|
554
575
|
rm_check_exception(exception, new_image, DestroyOnError);
|
555
|
-
|
556
|
-
|
557
|
-
rm_ensure_result(new_image);
|
576
|
+
DestroyExceptionInfo(exception);
|
558
577
|
|
559
578
|
return rm_image_new(new_image);
|
560
579
|
}
|
561
580
|
|
562
581
|
|
563
582
|
/**
|
564
|
-
*
|
565
|
-
*
|
566
|
-
* Ruby usage:
|
567
|
-
* - @verbatim ImageList#optimize_layers(method) @endverbatim
|
583
|
+
* Optimizes or compares the images in the list.
|
584
|
+
* Equivalent to the -layers option in ImageMagick's mogrify command.
|
568
585
|
*
|
569
|
-
* @param
|
570
|
-
* @
|
571
|
-
* @return a new imagelist
|
586
|
+
* @param method [Magick::LayerMethod] the method to use
|
587
|
+
* @return [Magick::ImageList] a new imagelist
|
572
588
|
*/
|
573
589
|
VALUE
|
574
590
|
ImageList_optimize_layers(VALUE self, VALUE method)
|
@@ -587,79 +603,131 @@ ImageList_optimize_layers(VALUE self, VALUE method)
|
|
587
603
|
switch (mthd)
|
588
604
|
{
|
589
605
|
case CoalesceLayer:
|
590
|
-
|
606
|
+
{
|
607
|
+
GVL_STRUCT_TYPE(CoalesceImages) args = { images, exception };
|
608
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args);
|
609
|
+
}
|
591
610
|
break;
|
592
611
|
case DisposeLayer:
|
593
|
-
|
612
|
+
{
|
613
|
+
GVL_STRUCT_TYPE(DisposeImages) args = { images, exception };
|
614
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(DisposeImages), &args);
|
615
|
+
}
|
594
616
|
break;
|
595
617
|
case OptimizeTransLayer:
|
596
|
-
|
597
|
-
|
618
|
+
{
|
619
|
+
new_images = clone_imagelist(images);
|
620
|
+
GVL_STRUCT_TYPE(OptimizeImageTransparency) args = { new_images, exception };
|
621
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageTransparency), &args);
|
622
|
+
}
|
598
623
|
break;
|
599
624
|
case RemoveDupsLayer:
|
600
|
-
|
601
|
-
|
625
|
+
{
|
626
|
+
new_images = clone_imagelist(images);
|
627
|
+
GVL_STRUCT_TYPE(RemoveDuplicateLayers) args = { &new_images, exception };
|
628
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemoveDuplicateLayers), &args);
|
629
|
+
}
|
602
630
|
break;
|
603
631
|
case RemoveZeroLayer:
|
604
|
-
|
605
|
-
|
632
|
+
{
|
633
|
+
new_images = clone_imagelist(images);
|
634
|
+
GVL_STRUCT_TYPE(RemoveZeroDelayLayers) args = { &new_images, exception };
|
635
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemoveZeroDelayLayers), &args);
|
636
|
+
}
|
606
637
|
break;
|
607
638
|
case CompositeLayer:
|
608
639
|
rm_split(images);
|
609
|
-
|
640
|
+
DestroyExceptionInfo(exception);
|
610
641
|
rb_raise(rb_eNotImpError, "Magick::CompositeLayer is not supported. Use the composite_layers method instead.");
|
611
642
|
break;
|
612
643
|
// In 6.3.4-ish, OptimizeImageLayer replaced OptimizeLayer
|
613
644
|
case OptimizeImageLayer:
|
614
|
-
|
645
|
+
{
|
646
|
+
GVL_STRUCT_TYPE(OptimizeImageLayers) args = { images, exception };
|
647
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageLayers), &args);
|
648
|
+
}
|
615
649
|
break;
|
616
650
|
// and OptimizeLayer became a "General Purpose, GIF Animation Optimizer" (ref. mogrify.c)
|
617
651
|
case OptimizeLayer:
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
652
|
+
{
|
653
|
+
GVL_STRUCT_TYPE(CoalesceImages) args_CoalesceImages = { images, exception };
|
654
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CoalesceImages), &args_CoalesceImages);
|
655
|
+
rm_split(images);
|
656
|
+
rm_check_exception(exception, new_images, DestroyOnError);
|
657
|
+
|
658
|
+
GVL_STRUCT_TYPE(OptimizeImageLayers) args_OptimizeImageLayers = { new_images, exception };
|
659
|
+
new_images2 = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageLayers), &args_OptimizeImageLayers);
|
660
|
+
DestroyImageList(new_images);
|
661
|
+
rm_check_exception(exception, new_images2, DestroyOnError);
|
662
|
+
|
663
|
+
new_images = new_images2;
|
664
|
+
GVL_STRUCT_TYPE(OptimizeImageTransparency) args_OptimizeImageTransparency = { new_images, exception };
|
665
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizeImageTransparency), &args_OptimizeImageTransparency);
|
666
|
+
rm_check_exception(exception, new_images, DestroyOnError);
|
667
|
+
// mogrify supports -dither here. We don't.
|
668
|
+
GetQuantizeInfo(&quantize_info);
|
669
|
+
#if defined(IMAGEMAGICK_7)
|
670
|
+
GVL_STRUCT_TYPE(RemapImages) args_RemapImages = { &quantize_info, new_images, NULL, exception };
|
671
|
+
#else
|
672
|
+
GVL_STRUCT_TYPE(RemapImages) args_RemapImages = { &quantize_info, new_images, NULL };
|
673
|
+
#endif
|
674
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args_RemapImages);
|
675
|
+
|
676
|
+
}
|
630
677
|
break;
|
631
678
|
case OptimizePlusLayer:
|
632
|
-
|
679
|
+
{
|
680
|
+
GVL_STRUCT_TYPE(OptimizePlusImageLayers) args = { images, exception };
|
681
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(OptimizePlusImageLayers), &args);
|
682
|
+
}
|
633
683
|
break;
|
634
684
|
case CompareAnyLayer:
|
635
685
|
case CompareClearLayer:
|
636
686
|
case CompareOverlayLayer:
|
637
|
-
|
687
|
+
{
|
688
|
+
#if defined(IMAGEMAGICK_7)
|
689
|
+
GVL_STRUCT_TYPE(CompareImagesLayers) args = { images, mthd, exception };
|
690
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImagesLayers), &args);
|
691
|
+
#else
|
692
|
+
GVL_STRUCT_TYPE(CompareImageLayers) args = { images, mthd, exception };
|
693
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CompareImageLayers), &args);
|
694
|
+
#endif
|
695
|
+
}
|
638
696
|
break;
|
639
697
|
case MosaicLayer:
|
640
|
-
|
698
|
+
{
|
699
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
|
700
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
701
|
+
}
|
641
702
|
break;
|
642
703
|
case FlattenLayer:
|
643
|
-
|
704
|
+
{
|
705
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
|
706
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
707
|
+
}
|
644
708
|
break;
|
645
709
|
case MergeLayer:
|
646
|
-
|
710
|
+
{
|
711
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
|
712
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
713
|
+
}
|
647
714
|
break;
|
648
715
|
case TrimBoundsLayer:
|
649
|
-
|
716
|
+
{
|
717
|
+
GVL_STRUCT_TYPE(MergeImageLayers) args = { images, mthd, exception };
|
718
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(MergeImageLayers), &args);
|
719
|
+
}
|
650
720
|
break;
|
651
721
|
default:
|
652
722
|
rm_split(images);
|
653
|
-
|
723
|
+
DestroyExceptionInfo(exception);
|
654
724
|
rb_raise(rb_eArgError, "undefined layer method");
|
655
725
|
break;
|
656
726
|
}
|
657
727
|
|
658
728
|
rm_split(images);
|
659
729
|
rm_check_exception(exception, new_images, DestroyOnError);
|
660
|
-
|
661
|
-
|
662
|
-
rm_ensure_result(new_images);
|
730
|
+
DestroyExceptionInfo(exception);
|
663
731
|
|
664
732
|
return rm_imagelist_from_images(new_images);
|
665
733
|
}
|
@@ -698,22 +766,20 @@ VALUE
|
|
698
766
|
rm_imagelist_from_images(Image *images)
|
699
767
|
{
|
700
768
|
VALUE new_imagelist;
|
701
|
-
Image *image;
|
702
769
|
|
703
|
-
|
704
|
-
{
|
705
|
-
rb_bug("rm_imagelist_from_images called with NULL argument");
|
706
|
-
}
|
770
|
+
rm_ensure_result(images);
|
707
771
|
|
708
772
|
new_imagelist = ImageList_new();
|
709
773
|
|
710
774
|
while (images)
|
711
775
|
{
|
776
|
+
Image *image;
|
777
|
+
|
712
778
|
image = RemoveFirstImageFromList(&images);
|
713
779
|
imagelist_push(new_imagelist, rm_image_new(image));
|
714
780
|
}
|
715
781
|
|
716
|
-
|
782
|
+
rb_iv_set(new_imagelist, "@scene", INT2FIX(0));
|
717
783
|
|
718
784
|
RB_GC_GUARD(new_imagelist);
|
719
785
|
|
@@ -751,6 +817,9 @@ images_from_imagelist(VALUE imagelist)
|
|
751
817
|
if (head == image || GetPreviousImageInList(image) != NULL)
|
752
818
|
{
|
753
819
|
image = rm_clone_image(image);
|
820
|
+
|
821
|
+
// Wrap raw ImageMagick object by Ruby object to destroy using Ruby's GC.
|
822
|
+
rm_image_new(image);
|
754
823
|
}
|
755
824
|
AppendImageToList(&head, image);
|
756
825
|
}
|
@@ -762,24 +831,6 @@ images_from_imagelist(VALUE imagelist)
|
|
762
831
|
}
|
763
832
|
|
764
833
|
|
765
|
-
/**
|
766
|
-
* \@scene attribute writer.
|
767
|
-
*
|
768
|
-
* No Ruby usage (internal function)
|
769
|
-
*
|
770
|
-
* @param imagelist the imagelist
|
771
|
-
* @param scene the scene
|
772
|
-
* @return the scene
|
773
|
-
*/
|
774
|
-
static VALUE
|
775
|
-
imagelist_scene_eq(VALUE imagelist, VALUE scene)
|
776
|
-
{
|
777
|
-
rb_check_frozen(imagelist);
|
778
|
-
(void) rb_iv_set(imagelist, "@scene", scene);
|
779
|
-
return scene;
|
780
|
-
}
|
781
|
-
|
782
|
-
|
783
834
|
/**
|
784
835
|
* return the # of images in an imagelist.
|
785
836
|
*
|
@@ -838,7 +889,7 @@ static void
|
|
838
889
|
imagelist_push(VALUE imagelist, VALUE image)
|
839
890
|
{
|
840
891
|
rb_check_frozen(imagelist);
|
841
|
-
|
892
|
+
rb_funcall(imagelist, rm_ID_push, 1, image);
|
842
893
|
}
|
843
894
|
|
844
895
|
|
@@ -853,7 +904,7 @@ imagelist_push(VALUE imagelist, VALUE image)
|
|
853
904
|
static Image *
|
854
905
|
clone_imagelist(Image *images)
|
855
906
|
{
|
856
|
-
Image *new_imagelist = NULL, *image
|
907
|
+
Image *new_imagelist = NULL, *image;
|
857
908
|
ExceptionInfo *exception;
|
858
909
|
|
859
910
|
exception = AcquireExceptionInfo();
|
@@ -861,40 +912,32 @@ clone_imagelist(Image *images)
|
|
861
912
|
image = GetFirstImageInList(images);
|
862
913
|
while (image)
|
863
914
|
{
|
864
|
-
clone
|
915
|
+
Image *clone;
|
916
|
+
|
917
|
+
GVL_STRUCT_TYPE(CloneImage) args = { image, 0, 0, MagickTrue, exception };
|
918
|
+
clone = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImage), &args);
|
865
919
|
rm_check_exception(exception, new_imagelist, DestroyOnError);
|
866
920
|
AppendImageToList(&new_imagelist, clone);
|
867
921
|
image = GetNextImageInList(image);
|
868
922
|
}
|
869
923
|
|
870
|
-
|
924
|
+
DestroyExceptionInfo(exception);
|
871
925
|
return new_imagelist;
|
872
926
|
}
|
873
927
|
|
874
928
|
|
875
929
|
/**
|
876
|
-
*
|
877
|
-
*
|
878
|
-
*
|
879
|
-
*
|
880
|
-
*
|
881
|
-
*
|
882
|
-
*
|
883
|
-
*
|
884
|
-
*
|
885
|
-
*
|
886
|
-
*
|
887
|
-
* - Default number_colors is 256
|
888
|
-
* - Default coorspace is Magick::RGBColorsapce
|
889
|
-
* - Default dither is true
|
890
|
-
* - Default tree_depth is 0
|
891
|
-
* - Default measure_error is false
|
892
|
-
* - Sets \@scene to the same value as self.scene
|
893
|
-
*
|
894
|
-
* @param argc number of input arguments
|
895
|
-
* @param argv array of input arguments
|
896
|
-
* @param self this object
|
897
|
-
* @return a new ImageList with quantized images
|
930
|
+
* Analyzes the colors within a set of reference images and chooses a fixed number of colors to represent the set.
|
931
|
+
* The goal of the algorithm is to minimize the difference between the input and output images while minimizing the processing time.
|
932
|
+
*
|
933
|
+
* @overload quantize(number_colors = 256, colorspace = Magick::RGBColorsapce, dither = true, tree_depth = 0, measure_error = false)
|
934
|
+
* @param number_colors [Numeric] the maximum number of colors to use in the output images.
|
935
|
+
* @param colorspace [Magick::ColorspaceType] the colorspace to quantize in.
|
936
|
+
* @param dither [Magick::DitherMethod, Boolean] a DitherMethod value or true if you want apply dither.
|
937
|
+
* @param tree_depth [Numeric] specify the tree depth to use while quantizing.
|
938
|
+
* @param measure_error [Boolean] calculate quantization errors when quantizing the image.
|
939
|
+
* @return [Magick::ImageList] a new ImageList with quantized images
|
940
|
+
* @note Sets +@scene+ to the same value as +self.scene+
|
898
941
|
*/
|
899
942
|
VALUE
|
900
943
|
ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
@@ -914,6 +957,16 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
|
914
957
|
case 4:
|
915
958
|
quantize_info.tree_depth = (unsigned long)NUM2INT(argv[3]);
|
916
959
|
case 3:
|
960
|
+
#if defined(IMAGEMAGICK_7)
|
961
|
+
if (rb_obj_is_kind_of(argv[2], Class_DitherMethod))
|
962
|
+
{
|
963
|
+
VALUE_TO_ENUM(argv[2], quantize_info.dither_method, DitherMethod);
|
964
|
+
}
|
965
|
+
else
|
966
|
+
{
|
967
|
+
quantize_info.dither_method = RTEST(argv[2]) ? UndefinedDitherMethod : NoDitherMethod;
|
968
|
+
}
|
969
|
+
#else
|
917
970
|
if (rb_obj_is_kind_of(argv[2], Class_DitherMethod))
|
918
971
|
{
|
919
972
|
VALUE_TO_ENUM(argv[2], quantize_info.dither_method, DitherMethod);
|
@@ -923,6 +976,7 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
|
923
976
|
{
|
924
977
|
quantize_info.dither = (MagickBooleanType) RTEST(argv[2]);
|
925
978
|
}
|
979
|
+
#endif
|
926
980
|
case 2:
|
927
981
|
VALUE_TO_ENUM(argv[1], quantize_info.colorspace, ColorspaceType);
|
928
982
|
case 1:
|
@@ -938,16 +992,21 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
|
938
992
|
// Convert image array to image sequence, clone image sequence.
|
939
993
|
images = images_from_imagelist(self);
|
940
994
|
exception = AcquireExceptionInfo();
|
941
|
-
|
995
|
+
GVL_STRUCT_TYPE(CloneImageList) args_CloneImageList = { images, exception };
|
996
|
+
new_images = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(CloneImageList), &args_CloneImageList);
|
942
997
|
rm_split(images);
|
943
998
|
rm_check_exception(exception, new_images, DestroyOnError);
|
944
999
|
|
945
1000
|
rm_ensure_result(new_images);
|
946
1001
|
|
947
|
-
|
948
|
-
(
|
1002
|
+
#if defined(IMAGEMAGICK_7)
|
1003
|
+
GVL_STRUCT_TYPE(QuantizeImages) args_QuantizeImages = { &quantize_info, new_images, exception };
|
1004
|
+
#else
|
1005
|
+
GVL_STRUCT_TYPE(QuantizeImages) args_QuantizeImages = { &quantize_info, new_images };
|
1006
|
+
#endif
|
1007
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(QuantizeImages), &args_QuantizeImages);
|
949
1008
|
rm_check_exception(exception, new_images, DestroyOnError);
|
950
|
-
|
1009
|
+
DestroyExceptionInfo(exception);
|
951
1010
|
|
952
1011
|
// Create new ImageList object, convert mapped image sequence to images,
|
953
1012
|
// append to images array.
|
@@ -959,7 +1018,7 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
|
959
1018
|
|
960
1019
|
// Set @scene in new ImageList object to same value as in self.
|
961
1020
|
scene = rb_iv_get(self, "@scene");
|
962
|
-
|
1021
|
+
rb_iv_set(new_imagelist, "@scene", scene);
|
963
1022
|
|
964
1023
|
RB_GC_GUARD(new_imagelist);
|
965
1024
|
RB_GC_GUARD(scene);
|
@@ -969,29 +1028,23 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
|
|
969
1028
|
|
970
1029
|
|
971
1030
|
/**
|
972
|
-
*
|
973
|
-
*
|
974
|
-
*
|
975
|
-
*
|
976
|
-
*
|
977
|
-
*
|
978
|
-
*
|
979
|
-
*
|
980
|
-
* - Default remap_image is nil
|
981
|
-
* - Default dither_method is RiemersmaDitherMethod
|
982
|
-
* - Modifies images in-place.
|
983
|
-
*
|
984
|
-
* @param argc number of input arguments
|
985
|
-
* @param argv array of input arguments
|
986
|
-
* @param self this object
|
987
|
-
* @see Image_remap
|
1031
|
+
* Reduce the colors used in the image list to the set of colors in +remap_image+.
|
1032
|
+
*
|
1033
|
+
* @overload remap(remap_image = nil, dither_method = Magick::RiemersmaDitherMethod)
|
1034
|
+
* @param remap_image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1035
|
+
* imagelist, uses the current image.
|
1036
|
+
* @param dither_method [Magick::DitherMethod] a DitherMethod value.
|
1037
|
+
* @return [Magick::ImageList] self
|
1038
|
+
* @note Modifies images in-place.
|
988
1039
|
*/
|
989
1040
|
VALUE
|
990
1041
|
ImageList_remap(int argc, VALUE *argv, VALUE self)
|
991
1042
|
{
|
992
1043
|
Image *images, *remap_image = NULL;
|
993
1044
|
QuantizeInfo quantize_info;
|
994
|
-
|
1045
|
+
#if defined(IMAGEMAGICK_7)
|
1046
|
+
ExceptionInfo *exception;
|
1047
|
+
#endif
|
995
1048
|
|
996
1049
|
if (argc > 0 && argv[0] != Qnil)
|
997
1050
|
{
|
@@ -1005,7 +1058,9 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
|
|
1005
1058
|
if (argc > 1)
|
1006
1059
|
{
|
1007
1060
|
VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
|
1061
|
+
#if defined(IMAGEMAGICK_6)
|
1008
1062
|
quantize_info.dither = MagickTrue;
|
1063
|
+
#endif
|
1009
1064
|
}
|
1010
1065
|
if (argc > 2)
|
1011
1066
|
{
|
@@ -1014,9 +1069,19 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
|
|
1014
1069
|
|
1015
1070
|
images = images_from_imagelist(self);
|
1016
1071
|
|
1017
|
-
|
1018
|
-
|
1072
|
+
#if defined(IMAGEMAGICK_7)
|
1073
|
+
exception = AcquireExceptionInfo();
|
1074
|
+
GVL_STRUCT_TYPE(RemapImages) args = { &quantize_info, images, remap_image, exception };
|
1075
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args);
|
1076
|
+
rm_split(images);
|
1077
|
+
CHECK_EXCEPTION();
|
1078
|
+
DestroyExceptionInfo(exception);
|
1079
|
+
#else
|
1080
|
+
GVL_STRUCT_TYPE(RemapImages) args = { &quantize_info, images, remap_image };
|
1081
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RemapImages), &args);
|
1019
1082
|
rm_split(images);
|
1083
|
+
rm_check_image_exception(images, RetainOnError);
|
1084
|
+
#endif
|
1020
1085
|
|
1021
1086
|
return self;
|
1022
1087
|
}
|
@@ -1025,15 +1090,13 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
|
|
1025
1090
|
/**
|
1026
1091
|
* Return the imagelist as a blob (a String).
|
1027
1092
|
*
|
1028
|
-
*
|
1029
|
-
* - @verbatim ImageList#to_blob @endverbatim
|
1093
|
+
* @overload to_blob
|
1030
1094
|
*
|
1031
|
-
*
|
1032
|
-
*
|
1033
|
-
*
|
1095
|
+
* @overload to_blob
|
1096
|
+
* Runs an info parm block if present - the user can specify the image format and depth
|
1097
|
+
* @yield [Magick::Image::Info]
|
1034
1098
|
*
|
1035
|
-
* @
|
1036
|
-
* @return the blob
|
1099
|
+
* @return [String] the blob
|
1037
1100
|
*/
|
1038
1101
|
VALUE
|
1039
1102
|
ImageList_to_blob(VALUE self)
|
@@ -1047,13 +1110,13 @@ ImageList_to_blob(VALUE self)
|
|
1047
1110
|
ExceptionInfo *exception;
|
1048
1111
|
|
1049
1112
|
info_obj = rm_info_new();
|
1050
|
-
|
1113
|
+
TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
|
1051
1114
|
|
1052
1115
|
// Convert the images array to an images sequence.
|
1053
1116
|
images = images_from_imagelist(self);
|
1054
1117
|
|
1055
1118
|
exception = AcquireExceptionInfo();
|
1056
|
-
|
1119
|
+
SetImageInfo(info, MagickTrue, exception);
|
1057
1120
|
rm_check_exception(exception, images, RetainOnError);
|
1058
1121
|
|
1059
1122
|
if (*info->magick != '\0')
|
@@ -1061,7 +1124,7 @@ ImageList_to_blob(VALUE self)
|
|
1061
1124
|
Image *img;
|
1062
1125
|
for (img = images; img; img = GetNextImageInList(img))
|
1063
1126
|
{
|
1064
|
-
|
1127
|
+
strlcpy(img->magick, info->magick, sizeof(img->magick));
|
1065
1128
|
}
|
1066
1129
|
}
|
1067
1130
|
|
@@ -1074,7 +1137,8 @@ ImageList_to_blob(VALUE self)
|
|
1074
1137
|
// can happen is that there's only one image or the format
|
1075
1138
|
// doesn't support multi-image files.
|
1076
1139
|
info->adjoin = MagickTrue;
|
1077
|
-
|
1140
|
+
GVL_STRUCT_TYPE(ImagesToBlob) args = { info, images, &length, exception };
|
1141
|
+
blob = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(ImagesToBlob), &args);
|
1078
1142
|
if (blob && exception->severity >= ErrorException)
|
1079
1143
|
{
|
1080
1144
|
magick_free((void*)blob);
|
@@ -1082,8 +1146,8 @@ ImageList_to_blob(VALUE self)
|
|
1082
1146
|
length = 0;
|
1083
1147
|
}
|
1084
1148
|
rm_split(images);
|
1085
|
-
CHECK_EXCEPTION()
|
1086
|
-
|
1149
|
+
CHECK_EXCEPTION();
|
1150
|
+
DestroyExceptionInfo(exception);
|
1087
1151
|
|
1088
1152
|
|
1089
1153
|
if (length == 0 || !blob)
|
@@ -1107,12 +1171,7 @@ ImageList_to_blob(VALUE self)
|
|
1107
1171
|
* the images will be written as a single multi-image file. Otherwise each image
|
1108
1172
|
* will be written to a separate file.
|
1109
1173
|
*
|
1110
|
-
*
|
1111
|
-
* - @verbatim ImageList#write(file) @endverbatim
|
1112
|
-
*
|
1113
|
-
* @param self this object
|
1114
|
-
* @param file the file
|
1115
|
-
* @return self
|
1174
|
+
* @param file [File, String] the file
|
1116
1175
|
*/
|
1117
1176
|
VALUE
|
1118
1177
|
ImageList_write(VALUE self, VALUE file)
|
@@ -1125,7 +1184,7 @@ ImageList_write(VALUE self, VALUE file)
|
|
1125
1184
|
ExceptionInfo *exception;
|
1126
1185
|
|
1127
1186
|
info_obj = rm_info_new();
|
1128
|
-
|
1187
|
+
TypedData_Get_Struct(info_obj, Info, &rm_info_data_type, info);
|
1129
1188
|
|
1130
1189
|
|
1131
1190
|
if (TYPE(file) == T_FILE)
|
@@ -1134,8 +1193,8 @@ ImageList_write(VALUE self, VALUE file)
|
|
1134
1193
|
|
1135
1194
|
// Ensure file is open - raise error if not
|
1136
1195
|
GetOpenFile(file, fptr);
|
1137
|
-
#if defined(_WIN32)
|
1138
1196
|
add_format_prefix(info, fptr->pathv);
|
1197
|
+
#if defined(_WIN32)
|
1139
1198
|
SetImageInfoFile(info, NULL);
|
1140
1199
|
#else
|
1141
1200
|
SetImageInfoFile(info, rb_io_stdio_file(fptr));
|
@@ -1155,20 +1214,22 @@ ImageList_write(VALUE self, VALUE file)
|
|
1155
1214
|
for (scene = 0, img = images; img; img = GetNextImageInList(img))
|
1156
1215
|
{
|
1157
1216
|
img->scene = scene++;
|
1158
|
-
|
1217
|
+
strlcpy(img->filename, info->filename, sizeof(img->filename));
|
1159
1218
|
}
|
1160
1219
|
|
1161
1220
|
// Find out if the format supports multi-images files.
|
1162
1221
|
exception = AcquireExceptionInfo();
|
1163
|
-
|
1222
|
+
SetImageInfo(info, MagickTrue, exception);
|
1164
1223
|
rm_check_exception(exception, images, RetainOnError);
|
1165
1224
|
|
1166
1225
|
m = GetMagickInfo(info->magick, exception);
|
1167
1226
|
rm_check_exception(exception, images, RetainOnError);
|
1168
|
-
|
1227
|
+
#if defined(IMAGEMAGICK_6)
|
1228
|
+
DestroyExceptionInfo(exception);
|
1229
|
+
#endif
|
1169
1230
|
|
1170
1231
|
// Tell WriteImage if we want a multi-images file.
|
1171
|
-
if (imagelist_length(self) > 1L && GetMagickAdjoin(m))
|
1232
|
+
if (imagelist_length(self) > 1L && m && GetMagickAdjoin(m))
|
1172
1233
|
{
|
1173
1234
|
info->adjoin = MagickTrue;
|
1174
1235
|
}
|
@@ -1176,15 +1237,26 @@ ImageList_write(VALUE self, VALUE file)
|
|
1176
1237
|
for (img = images; img; img = GetNextImageInList(img))
|
1177
1238
|
{
|
1178
1239
|
rm_sync_image_options(img, info);
|
1179
|
-
|
1240
|
+
#if defined(IMAGEMAGICK_7)
|
1241
|
+
GVL_STRUCT_TYPE(WriteImage) args = { info, img, exception };
|
1242
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
|
1243
|
+
rm_check_exception(exception, img, RetainOnError);
|
1244
|
+
#else
|
1245
|
+
GVL_STRUCT_TYPE(WriteImage) args = { info, img };
|
1246
|
+
CALL_FUNC_WITHOUT_GVL(GVL_FUNC(WriteImage), &args);
|
1180
1247
|
// images will be split before raising an exception
|
1181
1248
|
rm_check_image_exception(images, RetainOnError);
|
1249
|
+
#endif
|
1182
1250
|
if (info->adjoin)
|
1183
1251
|
{
|
1184
1252
|
break;
|
1185
1253
|
}
|
1186
1254
|
}
|
1187
1255
|
|
1256
|
+
#if defined(IMAGEMAGICK_7)
|
1257
|
+
DestroyExceptionInfo(exception);
|
1258
|
+
#endif
|
1259
|
+
|
1188
1260
|
rm_split(images);
|
1189
1261
|
|
1190
1262
|
RB_GC_GUARD(info_obj);
|