rmagick 3.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rmagick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.codeclimate.yml +63 -0
- 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 +79 -0
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/.rubocop.yml +24 -0
- data/.rubocop_todo.yml +151 -297
- data/.yardopts +5 -0
- data/CHANGELOG.md +233 -0
- data/CODE_OF_CONDUCT.md +122 -7
- data/CONTRIBUTING.md +14 -10
- data/README.md +326 -0
- data/Rakefile +16 -22
- data/before_install_linux.sh +22 -28
- data/before_install_osx.sh +57 -2
- data/ext/RMagick/extconf.rb +149 -105
- data/ext/RMagick/rmagick.c +77 -104
- data/ext/RMagick/rmagick.h +121 -103
- data/ext/RMagick/rmdraw.c +364 -436
- data/ext/RMagick/rmenum.c +106 -114
- data/ext/RMagick/rmfill.c +149 -70
- data/ext/RMagick/rmilist.c +225 -367
- data/ext/RMagick/rmimage.c +4751 -4405
- data/ext/RMagick/rminfo.c +574 -787
- data/ext/RMagick/rmkinfo.c +51 -121
- data/ext/RMagick/rmmain.c +454 -286
- data/ext/RMagick/rmmontage.c +64 -130
- data/ext/RMagick/rmpixel.c +488 -437
- data/ext/RMagick/rmstruct.c +83 -96
- data/ext/RMagick/rmutil.c +302 -214
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +138 -93
- 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 +12 -8
- 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 +10 -11
- metadata +52 -423
- 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/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 -42
- 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/lib/obsolete.rb +0 -66
- 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 -627
- data/test/Image2.rb +0 -1426
- data/test/Image3.rb +0 -1091
- data/test/ImageList1.rb +0 -858
- data/test/ImageList2.rb +0 -406
- data/test/Image_attributes.rb +0 -666
- data/test/Import_Export.rb +0 -115
- data/test/Info.rb +0 -444
- data/test/KernelInfo.rb +0 -67
- data/test/Magick.rb +0 -311
- data/test/Pixel.rb +0 -285
- 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/Obsolete.rb +0 -30
- data/test/lib/internal/Draw.rb +0 -823
- 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/lib/rmagick/version.rb
CHANGED
data/lib/rmagick_internal.rb
CHANGED
@@ -19,15 +19,39 @@ if RUBY_PLATFORM =~ /mingw/i
|
|
19
19
|
end
|
20
20
|
|
21
21
|
require 'English'
|
22
|
+
require 'observer'
|
22
23
|
require 'RMagick2.so'
|
23
|
-
require 'obsolete.rb'
|
24
24
|
|
25
25
|
module Magick
|
26
26
|
@formats = nil
|
27
27
|
@trace_proc = nil
|
28
28
|
@exit_block_set_up = nil
|
29
|
+
IMAGEMAGICK_VERSION = Magick::Magick_version.split[1].split('-').first
|
29
30
|
|
30
31
|
class << self
|
32
|
+
# Describes the image formats supported by ImageMagick.
|
33
|
+
# If the optional block is present, calls the block once for each image format.
|
34
|
+
# The first argument, +k+, is the format name. The second argument, +v+, is the
|
35
|
+
# properties string described below.
|
36
|
+
#
|
37
|
+
# - +B+ is "*" if the format has native blob support, or " " otherwise.
|
38
|
+
# - +R+ is "r" if ImageMagick can read that format, or "-" otherwise.
|
39
|
+
# - +W+ is "w" if ImageMagick can write that format, or "-" otherwise.
|
40
|
+
# - +A+ is "+" if the format supports multi-image files, or "-" otherwise.
|
41
|
+
#
|
42
|
+
# @overload formats
|
43
|
+
# @return [Hash] the formats hash
|
44
|
+
#
|
45
|
+
# @overload formats
|
46
|
+
# @yield [k, v]
|
47
|
+
# @yieldparam k [String] the format name
|
48
|
+
# @yieldparam v [String] the properties string
|
49
|
+
# @return [Magick]
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# p Magick.formats
|
53
|
+
# => {"3FR"=>" r-+", "3G2"=>" r-+", "3GP"=>" r-+", "A"=>"*rw+",
|
54
|
+
# ...
|
31
55
|
def formats
|
32
56
|
@formats ||= init_formats
|
33
57
|
|
@@ -39,17 +63,37 @@ module Magick
|
|
39
63
|
end
|
40
64
|
end
|
41
65
|
|
42
|
-
#
|
66
|
+
# If the Magick module attribute +trace_proc+ is set to a Proc object,
|
67
|
+
# RMagick calls the proc whenever an image is created or destroyed.
|
68
|
+
#
|
69
|
+
# You can use this proc to keep track of which images your program has created
|
70
|
+
# and which have been destroyed.
|
71
|
+
#
|
72
|
+
# @param p [Proc] The proc object.
|
73
|
+
# The following value will be passed into the proc object.
|
74
|
+
# - +which+ - A symbol that indicates which operation the proc is being called for.
|
75
|
+
# If the proc is called for an image creation, the value is +:c+.
|
76
|
+
# If called for an image destruction, the value is +:d+.
|
77
|
+
# - +description+ - A string describing the image. This is the same string that
|
78
|
+
# would be returned by calling the image's inspect method.
|
79
|
+
# - +id+ - A unique identifier for the image. This identifier is not the same as the object's +object_id+.
|
80
|
+
# - +method+ - The name of the method responsible for creating or destroying the image.
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Magick.trace_proc = proc do |which, description, id, method|
|
84
|
+
# ...
|
85
|
+
# end
|
86
|
+
#
|
87
|
+
# @deprecated Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.
|
43
88
|
def trace_proc=(p)
|
44
|
-
|
45
|
-
m.synchronize do
|
46
|
-
if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
|
47
|
-
at_exit { @trace_proc = nil }
|
48
|
-
@exit_block_set_up = true
|
49
|
-
end
|
89
|
+
warn 'Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.'
|
50
90
|
|
51
|
-
|
91
|
+
if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
|
92
|
+
at_exit { @trace_proc = nil }
|
93
|
+
@exit_block_set_up = true
|
52
94
|
end
|
95
|
+
|
96
|
+
@trace_proc = p
|
53
97
|
end
|
54
98
|
end
|
55
99
|
|
@@ -67,12 +111,14 @@ module Magick
|
|
67
111
|
|
68
112
|
class Geometry
|
69
113
|
FLAGS = ['', '%', '!', '<', '>', '@', '^']
|
70
|
-
RFLAGS = {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
114
|
+
RFLAGS = {
|
115
|
+
'%' => PercentGeometry,
|
116
|
+
'!' => AspectGeometry,
|
117
|
+
'<' => LessGeometry,
|
118
|
+
'>' => GreaterGeometry,
|
119
|
+
'@' => AreaGeometry,
|
120
|
+
'^' => MinimumGeometry
|
121
|
+
}
|
76
122
|
|
77
123
|
attr_accessor :width, :height, :x, :y, :flag
|
78
124
|
|
@@ -131,7 +177,7 @@ module Magick
|
|
131
177
|
str = ''
|
132
178
|
if @width > 0
|
133
179
|
fmt = @width.truncate == @width ? '%d' : '%.2f'
|
134
|
-
str <<
|
180
|
+
str << sprintf(fmt, @width)
|
135
181
|
str << '%' if @flag == PercentGeometry
|
136
182
|
end
|
137
183
|
|
@@ -139,10 +185,10 @@ module Magick
|
|
139
185
|
|
140
186
|
if @height > 0
|
141
187
|
fmt = @height.truncate == @height ? '%d' : '%.2f'
|
142
|
-
str <<
|
188
|
+
str << sprintf(fmt, @height)
|
143
189
|
str << '%' if @flag == PercentGeometry
|
144
190
|
end
|
145
|
-
str <<
|
191
|
+
str << sprintf('%+d%+d', @x, @y) if @x != 0 || @y != 0
|
146
192
|
str << FLAGS[@flag.to_i] if @flag != PercentGeometry
|
147
193
|
str
|
148
194
|
end
|
@@ -233,20 +279,23 @@ module Magick
|
|
233
279
|
# Apply coordinate transformations to support scaling (s), rotation (r),
|
234
280
|
# and translation (t). Angles are specified in radians.
|
235
281
|
def affine(sx, rx, ry, sy, tx, ty)
|
236
|
-
primitive 'affine ' +
|
282
|
+
primitive 'affine ' + sprintf('%g,%g,%g,%g,%g,%g', sx, rx, ry, sy, tx, ty)
|
237
283
|
end
|
238
284
|
|
239
285
|
# Set alpha (make transparent) in image according to the specified
|
240
286
|
# colorization rule
|
241
287
|
def alpha(x, y, method)
|
242
288
|
Kernel.raise ArgumentError, 'Unknown paint method' unless PAINT_METHOD_NAMES.key?(method.to_i)
|
243
|
-
|
289
|
+
name = Gem::Version.new(Magick::IMAGEMAGICK_VERSION) > Gem::Version.new('7.0.0') ? 'alpha ' : 'matte '
|
290
|
+
primitive name + sprintf('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
|
244
291
|
end
|
245
292
|
|
246
293
|
# Draw an arc.
|
247
294
|
def arc(start_x, start_y, end_x, end_y, start_degrees, end_degrees)
|
248
|
-
primitive 'arc ' +
|
249
|
-
|
295
|
+
primitive 'arc ' + sprintf(
|
296
|
+
'%g,%g %g,%g %g,%g',
|
297
|
+
start_x, start_y, end_x, end_y, start_degrees, end_degrees
|
298
|
+
)
|
250
299
|
end
|
251
300
|
|
252
301
|
# Draw a bezier curve.
|
@@ -256,12 +305,12 @@ module Magick
|
|
256
305
|
elsif points.length.odd?
|
257
306
|
Kernel.raise ArgumentError, 'odd number of arguments specified'
|
258
307
|
end
|
259
|
-
primitive 'bezier ' + points.map! { |x|
|
308
|
+
primitive 'bezier ' + points.map! { |x| sprintf('%g', x) }.join(',')
|
260
309
|
end
|
261
310
|
|
262
311
|
# Draw a circle
|
263
312
|
def circle(origin_x, origin_y, perim_x, perim_y)
|
264
|
-
primitive 'circle ' +
|
313
|
+
primitive 'circle ' + sprintf('%g,%g %g,%g', origin_x, origin_y, perim_x, perim_y)
|
265
314
|
end
|
266
315
|
|
267
316
|
# Invoke a clip-path defined by def_clip_path.
|
@@ -285,7 +334,7 @@ module Magick
|
|
285
334
|
# point, replace, floodfill, filltoborder,reset
|
286
335
|
def color(x, y, method)
|
287
336
|
Kernel.raise ArgumentError, "Unknown PaintMethod: #{method}" unless PAINT_METHOD_NAMES.key?(method.to_i)
|
288
|
-
primitive 'color ' +
|
337
|
+
primitive 'color ' + sprintf('%g,%g,%s', x, y, PAINT_METHOD_NAMES[method.to_i])
|
289
338
|
end
|
290
339
|
|
291
340
|
# Specify EITHER the text decoration (none, underline, overline,
|
@@ -316,8 +365,10 @@ module Magick
|
|
316
365
|
|
317
366
|
# Draw an ellipse
|
318
367
|
def ellipse(origin_x, origin_y, width, height, arc_start, arc_end)
|
319
|
-
primitive 'ellipse ' +
|
320
|
-
|
368
|
+
primitive 'ellipse ' + sprintf(
|
369
|
+
'%g,%g %g,%g %g,%g',
|
370
|
+
origin_x, origin_y, width, height, arc_start, arc_end
|
371
|
+
)
|
321
372
|
end
|
322
373
|
|
323
374
|
# Let anything through, but the only defined argument
|
@@ -383,7 +434,7 @@ module Magick
|
|
383
434
|
def image(composite, x, y, width, height, image_file_path)
|
384
435
|
Kernel.raise ArgumentError, 'Unknown composite' unless composite.is_a?(CompositeOperator)
|
385
436
|
composite_name = composite.to_s.sub!('CompositeOp', '')
|
386
|
-
primitive 'image ' +
|
437
|
+
primitive 'image ' + sprintf('%s %g,%g %g,%g %s', composite_name, x, y, width, height, enquote(image_file_path))
|
387
438
|
end
|
388
439
|
|
389
440
|
# IM 6.5.5-8 and later
|
@@ -424,15 +475,7 @@ module Magick
|
|
424
475
|
|
425
476
|
# Draw a line
|
426
477
|
def line(start_x, start_y, end_x, end_y)
|
427
|
-
primitive 'line ' +
|
428
|
-
end
|
429
|
-
|
430
|
-
# Set matte (make transparent) in image according to the specified
|
431
|
-
# colorization rule
|
432
|
-
def matte(x, y, method)
|
433
|
-
Kernel.warn 'Draw#matte is deprecated. Use Draw#alpha instead.'
|
434
|
-
Kernel.raise ArgumentError, 'Unknown paint method' unless PAINT_METHOD_NAMES.key?(method.to_i)
|
435
|
-
primitive 'matte ' + format('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
|
478
|
+
primitive 'line ' + sprintf('%g,%g %g,%g', start_x, start_y, end_x, end_y)
|
436
479
|
end
|
437
480
|
|
438
481
|
# Specify drawing fill and stroke opacities. If the value is a string
|
@@ -454,7 +497,7 @@ module Magick
|
|
454
497
|
# as the argument to the 'fill' or 'stroke' methods
|
455
498
|
def pattern(name, x, y, width, height)
|
456
499
|
push('defs')
|
457
|
-
push("pattern #{name} " +
|
500
|
+
push("pattern #{name} " + sprintf('%g %g %g %g', x, y, width, height))
|
458
501
|
push('graphic-context')
|
459
502
|
yield
|
460
503
|
ensure
|
@@ -465,13 +508,13 @@ module Magick
|
|
465
508
|
|
466
509
|
# Set point to fill color.
|
467
510
|
def point(x, y)
|
468
|
-
primitive 'point ' +
|
511
|
+
primitive 'point ' + sprintf('%g,%g', x, y)
|
469
512
|
end
|
470
513
|
|
471
514
|
# Specify the font size in points. Yes, the primitive is "font-size" but
|
472
515
|
# in other places this value is called the "pointsize". Give it both names.
|
473
516
|
def pointsize(points)
|
474
|
-
primitive 'font-size ' +
|
517
|
+
primitive 'font-size ' + sprintf('%g', points)
|
475
518
|
end
|
476
519
|
alias font_size pointsize
|
477
520
|
|
@@ -482,7 +525,7 @@ module Magick
|
|
482
525
|
elsif points.length.odd?
|
483
526
|
Kernel.raise ArgumentError, 'odd number of points specified'
|
484
527
|
end
|
485
|
-
primitive 'polygon ' + points.map! { |x|
|
528
|
+
primitive 'polygon ' + points.map! { |x| sprintf('%g', x) }.join(',')
|
486
529
|
end
|
487
530
|
|
488
531
|
# Draw a polyline
|
@@ -492,7 +535,7 @@ module Magick
|
|
492
535
|
elsif points.length.odd?
|
493
536
|
Kernel.raise ArgumentError, 'odd number of points specified'
|
494
537
|
end
|
495
|
-
primitive 'polyline ' + points.map! { |x|
|
538
|
+
primitive 'polyline ' + points.map! { |x| sprintf('%g', x) }.join(',')
|
496
539
|
end
|
497
540
|
|
498
541
|
# Return to the previously-saved set of whatever
|
@@ -526,32 +569,36 @@ module Magick
|
|
526
569
|
|
527
570
|
# Draw a rectangle
|
528
571
|
def rectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
|
529
|
-
primitive 'rectangle ' +
|
530
|
-
|
572
|
+
primitive 'rectangle ' + sprintf(
|
573
|
+
'%g,%g %g,%g',
|
574
|
+
upper_left_x, upper_left_y, lower_right_x, lower_right_y
|
575
|
+
)
|
531
576
|
end
|
532
577
|
|
533
578
|
# Specify coordinate space rotation. "angle" is measured in degrees
|
534
579
|
def rotate(angle)
|
535
|
-
primitive 'rotate ' +
|
580
|
+
primitive 'rotate ' + sprintf('%g', angle)
|
536
581
|
end
|
537
582
|
|
538
583
|
# Draw a rectangle with rounded corners
|
539
584
|
def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)
|
540
|
-
primitive 'roundrectangle ' +
|
541
|
-
|
585
|
+
primitive 'roundrectangle ' + sprintf(
|
586
|
+
'%g,%g,%g,%g,%g,%g',
|
587
|
+
center_x, center_y, width, height, corner_width, corner_height
|
588
|
+
)
|
542
589
|
end
|
543
590
|
|
544
591
|
# Specify scaling to be applied to coordinate space on subsequent drawing commands.
|
545
592
|
def scale(x, y)
|
546
|
-
primitive 'scale ' +
|
593
|
+
primitive 'scale ' + sprintf('%g,%g', x, y)
|
547
594
|
end
|
548
595
|
|
549
596
|
def skewx(angle)
|
550
|
-
primitive 'skewX ' +
|
597
|
+
primitive 'skewX ' + sprintf('%g', angle)
|
551
598
|
end
|
552
599
|
|
553
600
|
def skewy(angle)
|
554
|
-
primitive 'skewY ' +
|
601
|
+
primitive 'skewY ' + sprintf('%g', angle)
|
555
602
|
end
|
556
603
|
|
557
604
|
# Specify the object stroke, a color name or pattern name.
|
@@ -581,7 +628,7 @@ module Magick
|
|
581
628
|
|
582
629
|
# Specify the initial offset in the dash pattern
|
583
630
|
def stroke_dashoffset(value = 0)
|
584
|
-
primitive 'stroke-dashoffset ' +
|
631
|
+
primitive 'stroke-dashoffset ' + sprintf('%g', value)
|
585
632
|
end
|
586
633
|
|
587
634
|
def stroke_linecap(value)
|
@@ -608,7 +655,7 @@ module Magick
|
|
608
655
|
|
609
656
|
# Specify stroke (outline) width in pixels.
|
610
657
|
def stroke_width(pixels)
|
611
|
-
primitive 'stroke-width ' +
|
658
|
+
primitive 'stroke-width ' + sprintf('%g', pixels)
|
612
659
|
end
|
613
660
|
|
614
661
|
# Draw text at position x,y. Add quotes to text that is not already quoted.
|
@@ -626,7 +673,7 @@ module Magick
|
|
626
673
|
# escape existing braces, surround with braces
|
627
674
|
text = '{' + text.gsub(/[}]/) { |b| '\\' + b } + '}'
|
628
675
|
end
|
629
|
-
primitive 'text ' +
|
676
|
+
primitive 'text ' + sprintf('%g,%g %s', x, y, text)
|
630
677
|
end
|
631
678
|
|
632
679
|
# Specify text alignment relative to a given point
|
@@ -655,7 +702,7 @@ module Magick
|
|
655
702
|
# Specify center of coordinate space to use for subsequent drawing
|
656
703
|
# commands.
|
657
704
|
def translate(x, y)
|
658
|
-
primitive 'translate ' +
|
705
|
+
primitive 'translate ' + sprintf('%g,%g', x, y)
|
659
706
|
end
|
660
707
|
end # class Magick::Draw
|
661
708
|
|
@@ -863,7 +910,7 @@ module Magick
|
|
863
910
|
else
|
864
911
|
get_exif_by_number # ensure properties is populated with exif data
|
865
912
|
tag.each do |num|
|
866
|
-
rval = self[
|
913
|
+
rval = self[sprintf('#%04X', num.to_i)]
|
867
914
|
hash[num] = rval == 'unknown' ? nil : rval
|
868
915
|
end
|
869
916
|
end
|
@@ -1071,7 +1118,7 @@ module Magick
|
|
1071
1118
|
|
1072
1119
|
# Define a getter and a setter for each channel.
|
1073
1120
|
%i[red green blue opacity].each do |c|
|
1074
|
-
module_eval <<-END_EVAL
|
1121
|
+
module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
|
1075
1122
|
def #{c}
|
1076
1123
|
return collect { |p| p.#{c} }
|
1077
1124
|
end
|
@@ -1127,7 +1174,6 @@ module Magick
|
|
1127
1174
|
each { |x| @view[x] = rv.dup }
|
1128
1175
|
changed
|
1129
1176
|
notify_observers(self)
|
1130
|
-
nil
|
1131
1177
|
end
|
1132
1178
|
|
1133
1179
|
# A pixel has been modified. Tell the view.
|
@@ -1250,16 +1296,14 @@ module Magick
|
|
1250
1296
|
|
1251
1297
|
protected
|
1252
1298
|
|
1253
|
-
def
|
1299
|
+
def assert_image(obj)
|
1254
1300
|
Kernel.raise ArgumentError, "Magick::Image required (#{obj.class} given)" unless obj.is_a? Magick::Image
|
1255
|
-
true
|
1256
1301
|
end
|
1257
1302
|
|
1258
1303
|
# Ensure array is always an array of Magick::Image objects
|
1259
|
-
def
|
1304
|
+
def assert_image_array(ary)
|
1260
1305
|
Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
|
1261
|
-
ary.each { |obj|
|
1262
|
-
true
|
1306
|
+
ary.each { |obj| assert_image obj }
|
1263
1307
|
end
|
1264
1308
|
|
1265
1309
|
# Find old current image, update scene number
|
@@ -1291,7 +1335,7 @@ module Magick
|
|
1291
1335
|
if n.nil?
|
1292
1336
|
Kernel.raise IndexError, 'scene number out of bounds' unless @images.length.zero?
|
1293
1337
|
@scene = nil
|
1294
|
-
return
|
1338
|
+
return
|
1295
1339
|
elsif @images.length.zero?
|
1296
1340
|
Kernel.raise IndexError, 'scene number out of bounds'
|
1297
1341
|
end
|
@@ -1299,13 +1343,12 @@ module Magick
|
|
1299
1343
|
n = Integer(n)
|
1300
1344
|
Kernel.raise IndexError, 'scene number out of bounds' if n < 0 || n > length - 1
|
1301
1345
|
@scene = n
|
1302
|
-
@scene
|
1303
1346
|
end
|
1304
1347
|
|
1305
1348
|
# All the binary operators work the same way.
|
1306
1349
|
# 'other' should be either an ImageList or an Array
|
1307
1350
|
%w[& + - |].each do |op|
|
1308
|
-
module_eval <<-END_BINOPS
|
1351
|
+
module_eval <<-END_BINOPS, __FILE__, __LINE__ + 1
|
1309
1352
|
def #{op}(other)
|
1310
1353
|
ilist = self.class.new
|
1311
1354
|
begin
|
@@ -1315,7 +1358,7 @@ module Magick
|
|
1315
1358
|
end
|
1316
1359
|
current = get_current()
|
1317
1360
|
a.each do |image|
|
1318
|
-
|
1361
|
+
assert_image image
|
1319
1362
|
ilist << image
|
1320
1363
|
end
|
1321
1364
|
ilist.set_current current
|
@@ -1334,7 +1377,7 @@ module Magick
|
|
1334
1377
|
end
|
1335
1378
|
|
1336
1379
|
def <<(obj)
|
1337
|
-
|
1380
|
+
assert_image obj
|
1338
1381
|
@images << obj
|
1339
1382
|
@scene = @images.length - 1
|
1340
1383
|
self
|
@@ -1375,20 +1418,21 @@ module Magick
|
|
1375
1418
|
def []=(*args)
|
1376
1419
|
obj = @images.[]=(*args)
|
1377
1420
|
if obj && obj.respond_to?(:each)
|
1378
|
-
|
1421
|
+
assert_image_array(obj)
|
1379
1422
|
set_current obj.last.__id__
|
1380
1423
|
elsif obj
|
1381
|
-
|
1424
|
+
assert_image(obj)
|
1382
1425
|
set_current obj.__id__
|
1383
1426
|
else
|
1384
1427
|
set_current nil
|
1385
1428
|
end
|
1386
|
-
obj
|
1387
1429
|
end
|
1388
1430
|
|
1389
|
-
%i[
|
1390
|
-
|
1391
|
-
|
1431
|
+
%i[
|
1432
|
+
at each each_index empty? fetch
|
1433
|
+
first hash include? index length rindex sort!
|
1434
|
+
].each do |mth|
|
1435
|
+
module_eval <<-END_SIMPLE_DELEGATES, __FILE__, __LINE__ + 1
|
1392
1436
|
def #{mth}(*args, &block)
|
1393
1437
|
@images.#{mth}(*args, &block)
|
1394
1438
|
end
|
@@ -1410,7 +1454,7 @@ module Magick
|
|
1410
1454
|
# override Enumerable#collect
|
1411
1455
|
def collect(&block)
|
1412
1456
|
current = get_current
|
1413
|
-
a = @images.
|
1457
|
+
a = @images.map(&block)
|
1414
1458
|
ilist = self.class.new
|
1415
1459
|
a.each { |image| ilist << image }
|
1416
1460
|
ilist.set_current current
|
@@ -1418,8 +1462,8 @@ module Magick
|
|
1418
1462
|
end
|
1419
1463
|
|
1420
1464
|
def collect!(&block)
|
1421
|
-
@images.
|
1422
|
-
|
1465
|
+
@images.map!(&block)
|
1466
|
+
assert_image_array @images
|
1423
1467
|
self
|
1424
1468
|
end
|
1425
1469
|
|
@@ -1428,7 +1472,6 @@ module Magick
|
|
1428
1472
|
ditto = self.class.new
|
1429
1473
|
@images.each { |f| ditto << f.copy }
|
1430
1474
|
ditto.scene = @scene
|
1431
|
-
ditto.taint if tainted?
|
1432
1475
|
ditto
|
1433
1476
|
end
|
1434
1477
|
|
@@ -1439,6 +1482,7 @@ module Magick
|
|
1439
1482
|
end
|
1440
1483
|
|
1441
1484
|
# ImageList#map took over the "map" name. Use alternatives.
|
1485
|
+
alias map collect
|
1442
1486
|
alias __map__ collect
|
1443
1487
|
alias map! collect!
|
1444
1488
|
alias __map__! collect!
|
@@ -1463,7 +1507,7 @@ module Magick
|
|
1463
1507
|
end
|
1464
1508
|
|
1465
1509
|
def concat(other)
|
1466
|
-
|
1510
|
+
assert_image_array other
|
1467
1511
|
other.each { |image| @images << image }
|
1468
1512
|
@scene = length - 1
|
1469
1513
|
self
|
@@ -1477,7 +1521,7 @@ module Magick
|
|
1477
1521
|
end
|
1478
1522
|
|
1479
1523
|
def delete(obj, &block)
|
1480
|
-
|
1524
|
+
assert_image obj
|
1481
1525
|
current = get_current
|
1482
1526
|
a = @images.delete(obj, &block)
|
1483
1527
|
set_current current
|
@@ -1502,12 +1546,11 @@ module Magick
|
|
1502
1546
|
ditto = self.class.new
|
1503
1547
|
@images.each { |img| ditto << img }
|
1504
1548
|
ditto.scene = @scene
|
1505
|
-
ditto.taint if tainted?
|
1506
1549
|
ditto
|
1507
1550
|
end
|
1508
1551
|
|
1509
1552
|
def eql?(other)
|
1510
|
-
|
1553
|
+
assert_image_array other
|
1511
1554
|
eql = other.eql?(@images)
|
1512
1555
|
begin # "other" is another ImageList
|
1513
1556
|
eql &&= @scene == other.scene
|
@@ -1518,10 +1561,10 @@ module Magick
|
|
1518
1561
|
end
|
1519
1562
|
|
1520
1563
|
def fill(*args, &block)
|
1521
|
-
|
1564
|
+
assert_image args[0] unless block_given?
|
1522
1565
|
current = get_current
|
1523
1566
|
@images.fill(*args, &block)
|
1524
|
-
|
1567
|
+
assert_image_array self
|
1525
1568
|
set_current current
|
1526
1569
|
self
|
1527
1570
|
end
|
@@ -1529,7 +1572,7 @@ module Magick
|
|
1529
1572
|
# Override Enumerable's find_all
|
1530
1573
|
def find_all(&block)
|
1531
1574
|
current = get_current
|
1532
|
-
a = @images.
|
1575
|
+
a = @images.select(&block)
|
1533
1576
|
ilist = self.class.new
|
1534
1577
|
a.each { |image| ilist << image }
|
1535
1578
|
ilist.set_current current
|
@@ -1553,14 +1596,12 @@ module Magick
|
|
1553
1596
|
filenames.each do |f|
|
1554
1597
|
Magick::Image.read(f, &block).each { |n| @images << n }
|
1555
1598
|
end
|
1556
|
-
|
1557
|
-
|
1558
|
-
end
|
1559
|
-
self
|
1599
|
+
|
1600
|
+
@scene = length - 1 if length > 0 # last image in array
|
1560
1601
|
end
|
1561
1602
|
|
1562
1603
|
def insert(index, *args)
|
1563
|
-
args.each { |image|
|
1604
|
+
args.each { |image| assert_image image }
|
1564
1605
|
current = get_current
|
1565
1606
|
@images.insert(index, *args)
|
1566
1607
|
set_current current
|
@@ -1579,7 +1620,6 @@ module Magick
|
|
1579
1620
|
n = Integer(n)
|
1580
1621
|
Kernel.raise ArgumentError, 'iterations must be between 0 and 65535' if n < 0 || n > 65_535
|
1581
1622
|
@images.each { |f| f.iterations = n }
|
1582
|
-
self
|
1583
1623
|
end
|
1584
1624
|
|
1585
1625
|
def last(*args)
|
@@ -1660,7 +1700,7 @@ module Magick
|
|
1660
1700
|
|
1661
1701
|
def push(*objs)
|
1662
1702
|
objs.each do |image|
|
1663
|
-
|
1703
|
+
assert_image image
|
1664
1704
|
@images << image
|
1665
1705
|
end
|
1666
1706
|
@scene = length - 1
|
@@ -1696,7 +1736,7 @@ module Magick
|
|
1696
1736
|
end
|
1697
1737
|
|
1698
1738
|
def replace(other)
|
1699
|
-
|
1739
|
+
assert_image_array other
|
1700
1740
|
current = get_current
|
1701
1741
|
@images.clear
|
1702
1742
|
other.each { |image| @images << image }
|
@@ -1794,7 +1834,7 @@ module Magick
|
|
1794
1834
|
|
1795
1835
|
# @scene -> new object
|
1796
1836
|
def unshift(obj)
|
1797
|
-
|
1837
|
+
assert_image obj
|
1798
1838
|
@images.unshift(obj)
|
1799
1839
|
@scene = 0
|
1800
1840
|
self
|
@@ -1811,6 +1851,11 @@ module Magick
|
|
1811
1851
|
alias indices values_at
|
1812
1852
|
end # Magick::ImageList
|
1813
1853
|
|
1854
|
+
class Pixel
|
1855
|
+
# include Observable for Image::View class
|
1856
|
+
include Observable
|
1857
|
+
end
|
1858
|
+
|
1814
1859
|
# Collects non-specific optional method arguments
|
1815
1860
|
class OptionalMethodArguments
|
1816
1861
|
def initialize(img)
|
data/lib/rvg/clippath.rb
CHANGED
data/lib/rvg/container.rb
CHANGED
@@ -6,7 +6,8 @@ module Magick
|
|
6
6
|
class RVG
|
7
7
|
# Content is simply an Array with a deep_copy method.
|
8
8
|
# When unit-testing, it also has a deep_equal method.
|
9
|
-
|
9
|
+
# @private
|
10
|
+
class Content < Array
|
10
11
|
def deep_copy(h = {})
|
11
12
|
me = __id__
|
12
13
|
copy = h[me]
|
@@ -64,7 +65,8 @@ module Magick
|
|
64
65
|
yield(self) if block_given?
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
+
# @private
|
69
|
+
def add_primitives(gc)
|
68
70
|
gc.push
|
69
71
|
add_transform_primitives(gc)
|
70
72
|
add_style_primitives(gc)
|
@@ -73,13 +75,15 @@ module Magick
|
|
73
75
|
end
|
74
76
|
|
75
77
|
# Translate container according to #use arguments
|
76
|
-
|
78
|
+
# @private
|
79
|
+
def ref(x, y, _width, _height)
|
77
80
|
translate(x, y) if x != 0 || y != 0
|
78
81
|
end
|
79
82
|
|
80
83
|
# Append an arbitrary object to the group's content. Called
|
81
84
|
# by #use to insert a non-container object into a group.
|
82
|
-
|
85
|
+
# @private
|
86
|
+
def <<(obj)
|
83
87
|
@content << obj
|
84
88
|
end
|
85
89
|
end # class Group
|
@@ -113,7 +117,8 @@ module Magick
|
|
113
117
|
@element.ref(x, y, width, height)
|
114
118
|
end
|
115
119
|
|
116
|
-
|
120
|
+
# @private
|
121
|
+
def add_primitives(gc)
|
117
122
|
gc.push
|
118
123
|
add_transform_primitives(gc)
|
119
124
|
add_style_primitives(gc)
|