rmagick 4.1.0.rc2 → 4.1.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/.editorconfig +3 -0
- data/.github/workflows/ci.yml +148 -0
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/.rubocop.yml +24 -0
- data/.rubocop_todo.yml +80 -270
- data/.yardopts +5 -0
- data/CHANGELOG.md +63 -0
- data/CONTRIBUTING.md +14 -10
- data/README.md +292 -0
- data/Rakefile +16 -22
- data/before_install_linux.sh +22 -32
- data/before_install_osx.sh +56 -2
- data/ext/RMagick/extconf.rb +100 -94
- data/ext/RMagick/rmagick.c +77 -104
- data/ext/RMagick/rmagick.h +74 -70
- data/ext/RMagick/rmdraw.c +261 -444
- data/ext/RMagick/rmenum.c +96 -113
- data/ext/RMagick/rmfill.c +46 -77
- data/ext/RMagick/rmilist.c +136 -244
- data/ext/RMagick/rmimage.c +3395 -4166
- data/ext/RMagick/rminfo.c +531 -737
- data/ext/RMagick/rmkinfo.c +21 -87
- data/ext/RMagick/rmmain.c +405 -245
- data/ext/RMagick/rmmontage.c +60 -126
- data/ext/RMagick/rmpixel.c +401 -345
- data/ext/RMagick/rmstruct.c +62 -88
- data/ext/RMagick/rmutil.c +112 -218
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +128 -77
- 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 +8 -4
- 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 +7 -6
- metadata +31 -421
- data/.appveyor.yml +0 -57
- data/.circleci/config.yml +0 -56
- data/.ruby-version +0 -1
- data/.simplecov +0 -27
- data/.travis.yml +0 -64
- 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 -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/dissolve_spec.rb +0 -54
- 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 -9
- 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/rmdraw.c
CHANGED
@@ -27,14 +27,10 @@ static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t);
|
|
27
27
|
|
28
28
|
|
29
29
|
/**
|
30
|
-
* Set the affine matrix from an Magick::AffineMatrix.
|
30
|
+
* Set the affine matrix from an {Magick::AffineMatrix}.
|
31
31
|
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
*
|
35
|
-
* @param self this object
|
36
|
-
* @param matrix the affine matrix to set
|
37
|
-
* @return matrix
|
32
|
+
* @param matrix [Magick::AffineMatrix] the affine matrix
|
33
|
+
* @return [Magick::AffineMatrix] the given matrix
|
38
34
|
*/
|
39
35
|
VALUE
|
40
36
|
Draw_affine_eq(VALUE self, VALUE matrix)
|
@@ -49,14 +45,10 @@ Draw_affine_eq(VALUE self, VALUE matrix)
|
|
49
45
|
|
50
46
|
|
51
47
|
/**
|
52
|
-
* Set the text alignment.
|
53
|
-
*
|
54
|
-
* Ruby usage:
|
55
|
-
* - @verbatim Draw#align= @endverbatim
|
48
|
+
* Set the text alignment from an {Magick::AlignType}.
|
56
49
|
*
|
57
|
-
* @param
|
58
|
-
* @
|
59
|
-
* @return align
|
50
|
+
* @param align [Magick::AlignType] the text alignment
|
51
|
+
* @return [Magick::AlignType] the given align
|
60
52
|
*/
|
61
53
|
VALUE
|
62
54
|
Draw_align_eq(VALUE self, VALUE align)
|
@@ -71,14 +63,10 @@ Draw_align_eq(VALUE self, VALUE align)
|
|
71
63
|
|
72
64
|
|
73
65
|
/**
|
74
|
-
*
|
75
|
-
*
|
76
|
-
* Ruby usage:
|
77
|
-
* - @verbatim Draw#decorate= @endverbatim
|
66
|
+
* Set text decorate from an {Magick::DecorationType}.
|
78
67
|
*
|
79
|
-
* @param
|
80
|
-
* @
|
81
|
-
* @return decorate
|
68
|
+
* @param decorate [Magick::DecorationType] the decorate type
|
69
|
+
* @return [Magick::DecorationType] the given decorate
|
82
70
|
*/
|
83
71
|
VALUE
|
84
72
|
Draw_decorate_eq(VALUE self, VALUE decorate)
|
@@ -93,14 +81,10 @@ Draw_decorate_eq(VALUE self, VALUE decorate)
|
|
93
81
|
|
94
82
|
|
95
83
|
/**
|
96
|
-
*
|
97
|
-
*
|
98
|
-
* Ruby usage:
|
99
|
-
* - @verbatim Draw#density= @endverbatim
|
84
|
+
* Set density.
|
100
85
|
*
|
101
|
-
* @param
|
102
|
-
* @
|
103
|
-
* @return density
|
86
|
+
* @param density [String] the density
|
87
|
+
* @return [String] the given density
|
104
88
|
*/
|
105
89
|
VALUE
|
106
90
|
Draw_density_eq(VALUE self, VALUE density)
|
@@ -109,21 +93,17 @@ Draw_density_eq(VALUE self, VALUE density)
|
|
109
93
|
|
110
94
|
rb_check_frozen(self);
|
111
95
|
Data_Get_Struct(self, Draw, draw);
|
112
|
-
magick_clone_string(&draw->info->density,
|
96
|
+
magick_clone_string(&draw->info->density, StringValueCStr(density));
|
113
97
|
|
114
98
|
return density;
|
115
99
|
}
|
116
100
|
|
117
101
|
|
118
102
|
/**
|
119
|
-
*
|
120
|
-
*
|
121
|
-
* Ruby usage:
|
122
|
-
* - @verbatim Draw#encoding= @endverbatim
|
103
|
+
* Set text encoding.
|
123
104
|
*
|
124
|
-
* @param
|
125
|
-
* @
|
126
|
-
* @return encoding
|
105
|
+
* @param encoding [String] the encoding name
|
106
|
+
* @return [String] the given encoding name
|
127
107
|
*/
|
128
108
|
VALUE
|
129
109
|
Draw_encoding_eq(VALUE self, VALUE encoding)
|
@@ -132,21 +112,17 @@ Draw_encoding_eq(VALUE self, VALUE encoding)
|
|
132
112
|
|
133
113
|
rb_check_frozen(self);
|
134
114
|
Data_Get_Struct(self, Draw, draw);
|
135
|
-
magick_clone_string(&draw->info->encoding,
|
115
|
+
magick_clone_string(&draw->info->encoding, StringValueCStr(encoding));
|
136
116
|
|
137
117
|
return encoding;
|
138
118
|
}
|
139
119
|
|
140
120
|
|
141
121
|
/**
|
142
|
-
*
|
143
|
-
*
|
144
|
-
* Ruby usage:
|
145
|
-
* - @verbatim Draw#fill= @endverbatim
|
122
|
+
* Set fill color.
|
146
123
|
*
|
147
|
-
* @param
|
148
|
-
* @
|
149
|
-
* @return fill
|
124
|
+
* @param fill [Magick::Pixel, String] the fill color
|
125
|
+
* @return [Magick::Pixel, String] the given fill color
|
150
126
|
*/
|
151
127
|
VALUE
|
152
128
|
Draw_fill_eq(VALUE self, VALUE fill)
|
@@ -163,20 +139,16 @@ Draw_fill_eq(VALUE self, VALUE fill)
|
|
163
139
|
/**
|
164
140
|
* Accept an image as a fill pattern.
|
165
141
|
*
|
166
|
-
*
|
167
|
-
*
|
168
|
-
*
|
169
|
-
* @
|
170
|
-
* @
|
171
|
-
* @return pattern
|
172
|
-
* @see Draw_stroke_pattern_eq
|
173
|
-
* @see Draw_tile_eq
|
142
|
+
* @param pattern [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
143
|
+
* imagelist, uses the current image.
|
144
|
+
* @return [Magick::Image] the given pattern image
|
145
|
+
* @see #stroke_pattern=
|
146
|
+
* @see #tile=
|
174
147
|
*/
|
175
148
|
VALUE
|
176
149
|
Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
177
150
|
{
|
178
151
|
Draw *draw;
|
179
|
-
Image *image;
|
180
152
|
|
181
153
|
rb_check_frozen(self);
|
182
154
|
Data_Get_Struct(self, Draw, draw);
|
@@ -190,6 +162,8 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
190
162
|
|
191
163
|
if (!NIL_P(pattern))
|
192
164
|
{
|
165
|
+
Image *image;
|
166
|
+
|
193
167
|
pattern = rm_cur_image(pattern);
|
194
168
|
image = rm_check_destroyed(pattern);
|
195
169
|
// Do not trace creation
|
@@ -201,14 +175,10 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
201
175
|
|
202
176
|
|
203
177
|
/**
|
204
|
-
*
|
178
|
+
* Set the font name.
|
205
179
|
*
|
206
|
-
*
|
207
|
-
*
|
208
|
-
*
|
209
|
-
* @param self this object
|
210
|
-
* @param font the font
|
211
|
-
* @return font
|
180
|
+
* @param font [String] the font name
|
181
|
+
* @return [String] the given font name
|
212
182
|
*/
|
213
183
|
VALUE
|
214
184
|
Draw_font_eq(VALUE self, VALUE font)
|
@@ -217,21 +187,17 @@ Draw_font_eq(VALUE self, VALUE font)
|
|
217
187
|
|
218
188
|
rb_check_frozen(self);
|
219
189
|
Data_Get_Struct(self, Draw, draw);
|
220
|
-
magick_clone_string(&draw->info->font,
|
190
|
+
magick_clone_string(&draw->info->font, StringValueCStr(font));
|
221
191
|
|
222
192
|
return font;
|
223
193
|
}
|
224
194
|
|
225
195
|
|
226
196
|
/**
|
227
|
-
*
|
197
|
+
* Set the font family name.
|
228
198
|
*
|
229
|
-
*
|
230
|
-
*
|
231
|
-
*
|
232
|
-
* @param self this object
|
233
|
-
* @param family the family
|
234
|
-
* @return family
|
199
|
+
* @param family [String] the font family name
|
200
|
+
* @return [String] the given family name
|
235
201
|
*/
|
236
202
|
VALUE
|
237
203
|
Draw_font_family_eq(VALUE self, VALUE family)
|
@@ -240,21 +206,17 @@ Draw_font_family_eq(VALUE self, VALUE family)
|
|
240
206
|
|
241
207
|
rb_check_frozen(self);
|
242
208
|
Data_Get_Struct(self, Draw, draw);
|
243
|
-
magick_clone_string(&draw->info->family,
|
209
|
+
magick_clone_string(&draw->info->family, StringValueCStr(family));
|
244
210
|
|
245
211
|
return family;
|
246
212
|
}
|
247
213
|
|
248
214
|
|
249
215
|
/**
|
250
|
-
*
|
251
|
-
*
|
252
|
-
* Ruby usage:
|
253
|
-
* - @verbatim Draw#font_stretch= @endverbatim
|
216
|
+
* Set the stretch as spacing between text characters.
|
254
217
|
*
|
255
|
-
* @param
|
256
|
-
* @
|
257
|
-
* @return stretch
|
218
|
+
* @param stretch [Magick::StretchType] the stretch type
|
219
|
+
* @return [Magick::StretchType] the given stretch type
|
258
220
|
*/
|
259
221
|
VALUE
|
260
222
|
Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
@@ -269,14 +231,10 @@ Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
|
269
231
|
|
270
232
|
|
271
233
|
/**
|
272
|
-
*
|
273
|
-
*
|
274
|
-
* Ruby usage:
|
275
|
-
* - @verbatim Draw#font_style= @endverbatim
|
234
|
+
* Set font style.
|
276
235
|
*
|
277
|
-
* @param
|
278
|
-
* @
|
279
|
-
* @return style
|
236
|
+
* @param style [Magick::StyleType] the font style
|
237
|
+
* @return [Magick::StyleType] the given font style
|
280
238
|
*/
|
281
239
|
VALUE
|
282
240
|
Draw_font_style_eq(VALUE self, VALUE style)
|
@@ -291,18 +249,11 @@ Draw_font_style_eq(VALUE self, VALUE style)
|
|
291
249
|
|
292
250
|
|
293
251
|
/**
|
294
|
-
*
|
295
|
-
*
|
296
|
-
* Ruby usage:
|
297
|
-
* - @verbatim Draw#font_weight= @endverbatim
|
298
|
-
*
|
299
|
-
* Notes:
|
300
|
-
* - The font weight can be one of the font weight constants or a number
|
301
|
-
* between 100 and 900
|
252
|
+
* Set font weight.
|
302
253
|
*
|
303
|
-
* @param
|
304
|
-
* @
|
305
|
-
* @
|
254
|
+
* @param weight [Magick::WeightType, Numeric] the font weight
|
255
|
+
* @return [Magick::WeightType, Numeric] the given font weight
|
256
|
+
* @note The font weight can be one of the font weight constants or a number between 100 and 900
|
306
257
|
*/
|
307
258
|
VALUE
|
308
259
|
Draw_font_weight_eq(VALUE self, VALUE weight)
|
@@ -318,7 +269,7 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
318
269
|
w = FIX2INT(weight);
|
319
270
|
if (w < 100 || w > 900)
|
320
271
|
{
|
321
|
-
rb_raise(rb_eArgError, "invalid font weight (%
|
272
|
+
rb_raise(rb_eArgError, "invalid font weight (%"RMIuSIZE" given)", w);
|
322
273
|
}
|
323
274
|
draw->info->weight = w;
|
324
275
|
}
|
@@ -355,27 +306,21 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
355
306
|
|
356
307
|
|
357
308
|
/**
|
358
|
-
*
|
359
|
-
*
|
360
|
-
*
|
361
|
-
*
|
362
|
-
*
|
363
|
-
*
|
364
|
-
*
|
365
|
-
*
|
366
|
-
*
|
367
|
-
*
|
368
|
-
*
|
369
|
-
*
|
370
|
-
*
|
371
|
-
*
|
372
|
-
*
|
373
|
-
* - SouthGravity text top-center placed at bottom-center
|
374
|
-
* - SouthEastGravity text top-right placed at bottom-right
|
375
|
-
*
|
376
|
-
* @param self this object
|
377
|
-
* @param grav the gravity
|
378
|
-
* @return grav
|
309
|
+
* Set gravity to draw text.
|
310
|
+
* Gravity affects text placement in bounding area according to rules:
|
311
|
+
*
|
312
|
+
* - +NorthWestGravity+ - text bottom-left corner placed at top-left
|
313
|
+
* - +NorthGravity+ - text bottom-center placed at top-center
|
314
|
+
* - +NorthEastGravity+ - text bottom-right corner placed at top-right
|
315
|
+
* - +WestGravity+ - text left-center placed at left-center
|
316
|
+
* - +CenterGravity+ - text center placed at center
|
317
|
+
* - +EastGravity+ - text right-center placed at right-center
|
318
|
+
* - +SouthWestGravity+ - text top-left placed at bottom-left
|
319
|
+
* - +SouthGravity+ - text top-center placed at bottom-center
|
320
|
+
* - +SouthEastGravity+ - text top-right placed at bottom-right
|
321
|
+
*
|
322
|
+
* @param grav [Magick::GravityType] this gravity type
|
323
|
+
* @return [Magick::GravityType] the given gravity type
|
379
324
|
*/
|
380
325
|
VALUE
|
381
326
|
Draw_gravity_eq(VALUE self, VALUE grav)
|
@@ -391,17 +336,10 @@ Draw_gravity_eq(VALUE self, VALUE grav)
|
|
391
336
|
|
392
337
|
|
393
338
|
/**
|
394
|
-
*
|
395
|
-
*
|
396
|
-
* Ruby usage:
|
397
|
-
* - @verbatim Draw#gravity=float @endverbatim
|
398
|
-
*
|
399
|
-
* Notes:
|
400
|
-
* - New for ImageMagick 6.4.7-8
|
339
|
+
* Set kerning as spacing between two letters.
|
401
340
|
*
|
402
|
-
* @param
|
403
|
-
* @
|
404
|
-
* @return kerning
|
341
|
+
* @param kerning [Float] the kerning
|
342
|
+
* @return [Float] the given kerning
|
405
343
|
*/
|
406
344
|
VALUE
|
407
345
|
Draw_kerning_eq(VALUE self, VALUE kerning)
|
@@ -416,17 +354,10 @@ Draw_kerning_eq(VALUE self, VALUE kerning)
|
|
416
354
|
|
417
355
|
|
418
356
|
/**
|
419
|
-
*
|
420
|
-
*
|
421
|
-
* Ruby usage:
|
422
|
-
* - @verbatim Draw#interline_spacing= @endverbatim
|
357
|
+
* Set spacing between two lines.
|
423
358
|
*
|
424
|
-
*
|
425
|
-
*
|
426
|
-
*
|
427
|
-
* @param self this object
|
428
|
-
* @param spacing the spacing
|
429
|
-
* @return spacing
|
359
|
+
* @param spacing [Float] the spacing
|
360
|
+
* @return [Float] the given spacing
|
430
361
|
*/
|
431
362
|
VALUE
|
432
363
|
Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
@@ -441,17 +372,10 @@ Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
|
441
372
|
|
442
373
|
|
443
374
|
/**
|
444
|
-
*
|
375
|
+
* Set spacing between two words.
|
445
376
|
*
|
446
|
-
*
|
447
|
-
*
|
448
|
-
*
|
449
|
-
* Notes:
|
450
|
-
* - New for ImageMagick 6.4.8-0
|
451
|
-
*
|
452
|
-
* @param self this object
|
453
|
-
* @param spacing the spacing
|
454
|
-
* @return spacing
|
377
|
+
* @param spacing [Float] the spacing
|
378
|
+
* @return [Float] the given spacing
|
455
379
|
*/
|
456
380
|
VALUE
|
457
381
|
Draw_interword_spacing_eq(VALUE self, VALUE spacing)
|
@@ -481,13 +405,14 @@ static VALUE
|
|
481
405
|
image_to_str(Image *image)
|
482
406
|
{
|
483
407
|
VALUE dimg = Qnil;
|
484
|
-
unsigned char *blob;
|
485
|
-
size_t length;
|
486
|
-
Info *info;
|
487
|
-
ExceptionInfo *exception;
|
488
408
|
|
489
409
|
if (image)
|
490
410
|
{
|
411
|
+
unsigned char *blob;
|
412
|
+
size_t length;
|
413
|
+
Info *info;
|
414
|
+
ExceptionInfo *exception;
|
415
|
+
|
491
416
|
info = CloneImageInfo(NULL);
|
492
417
|
exception = AcquireExceptionInfo();
|
493
418
|
blob = ImageToBlob(info, image, &length, exception);
|
@@ -520,11 +445,12 @@ static
|
|
520
445
|
Image *str_to_image(VALUE str)
|
521
446
|
{
|
522
447
|
Image *image = NULL;
|
523
|
-
Info *info;
|
524
|
-
ExceptionInfo *exception;
|
525
448
|
|
526
449
|
if (str != Qnil)
|
527
450
|
{
|
451
|
+
Info *info;
|
452
|
+
ExceptionInfo *exception;
|
453
|
+
|
528
454
|
info = CloneImageInfo(NULL);
|
529
455
|
exception = AcquireExceptionInfo();
|
530
456
|
image = BlobToImage(info, RSTRING_PTR(str), RSTRING_LEN(str), exception);
|
@@ -538,21 +464,16 @@ Image *str_to_image(VALUE str)
|
|
538
464
|
|
539
465
|
|
540
466
|
/**
|
541
|
-
*
|
467
|
+
* Dump custom marshal for Draw objects.
|
542
468
|
*
|
543
|
-
* Ruby
|
544
|
-
*
|
469
|
+
* - Instead of trying to replicate Ruby's support for cross-system
|
470
|
+
* marshalling, exploit it. Convert the Draw fields to Ruby objects and
|
471
|
+
* store them in a hash. Let Ruby marshal the hash.
|
472
|
+
* - Commented out code that dumps/loads fields that are used internally by
|
473
|
+
* ImageMagick and shouldn't be marshaled. I left the code as placeholders
|
474
|
+
* so I'll know which fields have been deliberately omitted.
|
545
475
|
*
|
546
|
-
*
|
547
|
-
* - Instead of trying to replicate Ruby's support for cross-system
|
548
|
-
* marshalling, exploit it. Convert the Draw fields to Ruby objects and
|
549
|
-
* store them in a hash. Let Ruby marshal the hash.
|
550
|
-
* - Commented out code that dumps/loads fields that are used internally by
|
551
|
-
* ImageMagick and shouldn't be marshaled. I left the code as placeholders
|
552
|
-
* so I'll know which fields have been deliberately omitted.
|
553
|
-
*
|
554
|
-
* @param self this object
|
555
|
-
* @return the marshalled object (as a Ruby hash)
|
476
|
+
* @return [Hash] the marshalled object
|
556
477
|
* @todo Handle gradients when christy gets the new gradient support added (23Dec08)
|
557
478
|
*/
|
558
479
|
VALUE
|
@@ -632,17 +553,10 @@ Draw_marshal_dump(VALUE self)
|
|
632
553
|
|
633
554
|
|
634
555
|
/**
|
635
|
-
*
|
636
|
-
*
|
637
|
-
* Ruby usage:
|
638
|
-
* - @verbatim Draw#marshal_load @endverbatim
|
639
|
-
*
|
640
|
-
* Notes:
|
641
|
-
* - On entry all fields are all-bits-0
|
556
|
+
* Load the marshalled object
|
642
557
|
*
|
643
|
-
* @param
|
644
|
-
* @
|
645
|
-
* @return self, once marshalled
|
558
|
+
* @param ddraw [Hash] the marshalled object
|
559
|
+
* @return [Magick::Draw] self, once marshalled
|
646
560
|
*/
|
647
561
|
VALUE
|
648
562
|
Draw_marshal_load(VALUE self, VALUE ddraw)
|
@@ -651,7 +565,15 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
651
565
|
VALUE val;
|
652
566
|
|
653
567
|
Data_Get_Struct(self, Draw, draw);
|
568
|
+
|
569
|
+
if (draw->info == NULL)
|
570
|
+
{
|
571
|
+
ImageInfo *image_info;
|
654
572
|
|
573
|
+
image_info = CloneImageInfo(NULL);
|
574
|
+
draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
|
575
|
+
DestroyImageInfo(image_info);
|
576
|
+
}
|
655
577
|
OBJ_TO_MAGICK_STRING(draw->info->geometry, rb_hash_aref(ddraw, CSTR2SYM("geometry")));
|
656
578
|
|
657
579
|
//val = rb_hash_aref(ddraw, CSTR2SYM("viewbox"));
|
@@ -706,14 +628,10 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
706
628
|
|
707
629
|
|
708
630
|
/**
|
709
|
-
*
|
710
|
-
*
|
711
|
-
* Ruby usage:
|
712
|
-
* - @verbatim Draw#pointsize= @endverbatim
|
631
|
+
* Set point size to draw text.
|
713
632
|
*
|
714
|
-
* @param
|
715
|
-
* @
|
716
|
-
* @return pointsize
|
633
|
+
* @param pointsize [Float] the pointsize
|
634
|
+
* @return [Float] the given pointsize
|
717
635
|
*/
|
718
636
|
VALUE
|
719
637
|
Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
@@ -728,19 +646,10 @@ Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
|
728
646
|
|
729
647
|
|
730
648
|
/**
|
731
|
-
* Set rotation
|
732
|
-
*
|
733
|
-
* Ruby usage:
|
734
|
-
* - @verbatim Magick::Draw#rotation= @endverbatim
|
735
|
-
*
|
736
|
-
* Notes:
|
737
|
-
* - Argument should be in degrees
|
738
|
-
* - Taken from Magick++'s Magick::Image::annotate method.
|
739
|
-
* Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
|
649
|
+
* Set rotation. The argument should be in degrees.
|
740
650
|
*
|
741
|
-
* @param
|
742
|
-
* @
|
743
|
-
* @return deg
|
651
|
+
* @param deg [Float] the number of degrees
|
652
|
+
* @return [Float] the given degrees
|
744
653
|
*/
|
745
654
|
VALUE
|
746
655
|
Draw_rotation_eq(VALUE self, VALUE deg)
|
@@ -755,24 +664,19 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
755
664
|
degrees = NUM2DBL(deg);
|
756
665
|
if (fabs(degrees) > DBL_EPSILON)
|
757
666
|
{
|
758
|
-
affine
|
759
|
-
affine.
|
760
|
-
affine.
|
761
|
-
affine.
|
762
|
-
affine.
|
763
|
-
affine.
|
764
|
-
|
765
|
-
|
766
|
-
affine.sx=
|
767
|
-
affine.rx=
|
768
|
-
affine.ry=
|
769
|
-
affine.sy=
|
770
|
-
|
771
|
-
draw->info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
|
772
|
-
draw->info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
|
773
|
-
draw->info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
|
774
|
-
draw->info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
|
775
|
-
draw->info->affine.tx=current.sx*affine.tx+current.ry*affine.ty+current.tx;
|
667
|
+
current = draw->info->affine;
|
668
|
+
affine.sx = cos(DegreesToRadians(fmod(degrees, 360.0)));
|
669
|
+
affine.rx = sin(DegreesToRadians(fmod(degrees, 360.0)));
|
670
|
+
affine.tx = 0.0;
|
671
|
+
affine.ry = (-sin(DegreesToRadians(fmod(degrees, 360.0))));
|
672
|
+
affine.sy = cos(DegreesToRadians(fmod(degrees, 360.0)));
|
673
|
+
affine.ty = 0.0;
|
674
|
+
|
675
|
+
draw->info->affine.sx = current.sx*affine.sx+current.ry*affine.rx;
|
676
|
+
draw->info->affine.rx = current.rx*affine.sx+current.sy*affine.rx;
|
677
|
+
draw->info->affine.ry = current.sx*affine.ry+current.ry*affine.sy;
|
678
|
+
draw->info->affine.sy = current.rx*affine.ry+current.sy*affine.sy;
|
679
|
+
draw->info->affine.tx = current.sx*affine.tx+current.ry*affine.ty+current.tx;
|
776
680
|
}
|
777
681
|
|
778
682
|
return deg;
|
@@ -780,14 +684,10 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
780
684
|
|
781
685
|
|
782
686
|
/**
|
783
|
-
*
|
784
|
-
*
|
785
|
-
* Ruby usage:
|
786
|
-
* - @verbatim Draw#stroke= @endverbatim
|
687
|
+
* Set stroke.
|
787
688
|
*
|
788
|
-
* @param
|
789
|
-
* @
|
790
|
-
* @return stroke
|
689
|
+
* @param stroke [Magick::Pixel, String] the stroke
|
690
|
+
* @return [Magick::Pixel, String] the given stroke
|
791
691
|
*/
|
792
692
|
VALUE
|
793
693
|
Draw_stroke_eq(VALUE self, VALUE stroke)
|
@@ -804,19 +704,15 @@ Draw_stroke_eq(VALUE self, VALUE stroke)
|
|
804
704
|
/**
|
805
705
|
* Accept an image as a stroke pattern.
|
806
706
|
*
|
807
|
-
*
|
808
|
-
*
|
809
|
-
*
|
810
|
-
* @
|
811
|
-
* @param pattern the pattern
|
812
|
-
* @return pattern
|
813
|
-
* @see Draw_fill_pattern_eq
|
707
|
+
* @param pattern [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
708
|
+
* imagelist, uses the current image.
|
709
|
+
* @return [Magick::Image] the given pattern
|
710
|
+
* @see #fill_pattern
|
814
711
|
*/
|
815
712
|
VALUE
|
816
713
|
Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
817
714
|
{
|
818
715
|
Draw *draw;
|
819
|
-
Image *image;
|
820
716
|
|
821
717
|
rb_check_frozen(self);
|
822
718
|
Data_Get_Struct(self, Draw, draw);
|
@@ -830,6 +726,8 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
830
726
|
|
831
727
|
if (!NIL_P(pattern))
|
832
728
|
{
|
729
|
+
Image *image;
|
730
|
+
|
833
731
|
// DestroyDrawInfo destroys the clone
|
834
732
|
pattern = rm_cur_image(pattern);
|
835
733
|
image = rm_check_destroyed(pattern);
|
@@ -842,14 +740,10 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
842
740
|
|
843
741
|
|
844
742
|
/**
|
845
|
-
*
|
743
|
+
* Set stroke width.
|
846
744
|
*
|
847
|
-
*
|
848
|
-
*
|
849
|
-
*
|
850
|
-
* @param self this object
|
851
|
-
* @param stroke_width the stroke_width
|
852
|
-
* @return stroke_width
|
745
|
+
* @param stroke_width [Float] the stroke width
|
746
|
+
* @return [Float] the given stroke width
|
853
747
|
*/
|
854
748
|
VALUE
|
855
749
|
Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
@@ -864,14 +758,10 @@ Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
864
758
|
|
865
759
|
|
866
760
|
/**
|
867
|
-
*
|
761
|
+
* Set whether to enable text antialias.
|
868
762
|
*
|
869
|
-
*
|
870
|
-
*
|
871
|
-
*
|
872
|
-
* @param self this object
|
873
|
-
* @param text_antialias the text_antialias
|
874
|
-
* @return text_antialias
|
763
|
+
* @param text_antialias [Boolean] true if enable text antialias
|
764
|
+
* @return [Boolean] the given value
|
875
765
|
*/
|
876
766
|
VALUE
|
877
767
|
Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
@@ -886,14 +776,10 @@ Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
|
886
776
|
|
887
777
|
|
888
778
|
/**
|
889
|
-
*
|
890
|
-
*
|
891
|
-
* Ruby usage:
|
892
|
-
* - @verbatim Draw#tile= @endverbatim
|
779
|
+
* Accept an image as a fill pattern. This is alias of {Draw#fill_pattern=}.
|
893
780
|
*
|
894
|
-
* @param
|
895
|
-
* @
|
896
|
-
* @return image
|
781
|
+
* @param image [Magick::Image] the image to tile
|
782
|
+
* @return [Magick::Image] the given image
|
897
783
|
*/
|
898
784
|
VALUE
|
899
785
|
Draw_tile_eq(VALUE self, VALUE image)
|
@@ -903,14 +789,10 @@ Draw_tile_eq(VALUE self, VALUE image)
|
|
903
789
|
|
904
790
|
|
905
791
|
/**
|
906
|
-
*
|
907
|
-
*
|
908
|
-
* Ruby usage:
|
909
|
-
* - @verbatim Draw#undercolor= @endverbatim
|
792
|
+
* Set undercolor.
|
910
793
|
*
|
911
|
-
* @param
|
912
|
-
* @
|
913
|
-
* @return undercolor
|
794
|
+
* @param undercolor [Magick::Pixel, String] the undercolor
|
795
|
+
* @return [Magick::Pixel, String] the given undercolor
|
914
796
|
*/
|
915
797
|
VALUE
|
916
798
|
Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
@@ -927,21 +809,17 @@ Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
|
927
809
|
/**
|
928
810
|
* Annotates an image with text.
|
929
811
|
*
|
930
|
-
*
|
931
|
-
*
|
932
|
-
*
|
933
|
-
*
|
934
|
-
*
|
935
|
-
*
|
936
|
-
*
|
937
|
-
* @param
|
938
|
-
* @param
|
939
|
-
* @param
|
940
|
-
* @
|
941
|
-
* @param x_arg x position
|
942
|
-
* @param y_arg y position
|
943
|
-
* @param text the annotation text
|
944
|
-
* @return self
|
812
|
+
* - Additional Draw attribute methods may be called in the optional block,
|
813
|
+
* which is executed in the context of an Draw object.
|
814
|
+
*
|
815
|
+
* @param image_arg [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
816
|
+
* imagelist, uses the current image.
|
817
|
+
* @param width_arg [Numeric] the width
|
818
|
+
* @param height_arg [Numeric] the height
|
819
|
+
* @param x_arg [Numeric] x position
|
820
|
+
* @param y_arg [Numeric] y position
|
821
|
+
* @param text [String] the annotation text
|
822
|
+
* @return [Magick::Draw] self
|
945
823
|
*/
|
946
824
|
VALUE Draw_annotate(
|
947
825
|
VALUE self,
|
@@ -958,6 +836,7 @@ VALUE Draw_annotate(
|
|
958
836
|
long x, y;
|
959
837
|
AffineMatrix keep;
|
960
838
|
char geometry_str[100];
|
839
|
+
char *embed_text;
|
961
840
|
#if defined(IMAGEMAGICK_7)
|
962
841
|
ExceptionInfo *exception;
|
963
842
|
#endif
|
@@ -974,13 +853,14 @@ VALUE Draw_annotate(
|
|
974
853
|
// allowing the app a chance to modify the object's attributes
|
975
854
|
if (rb_block_given_p())
|
976
855
|
{
|
977
|
-
|
856
|
+
rb_obj_instance_eval(0, NULL, self);
|
978
857
|
}
|
979
858
|
|
980
859
|
// Translate & store in Draw structure
|
860
|
+
embed_text = StringValueCStr(text);
|
981
861
|
#if defined(IMAGEMAGICK_7)
|
982
862
|
exception = AcquireExceptionInfo();
|
983
|
-
draw->info->text = InterpretImageProperties(NULL, image,
|
863
|
+
draw->info->text = InterpretImageProperties(NULL, image, embed_text, exception);
|
984
864
|
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
985
865
|
{
|
986
866
|
if (draw->info->text)
|
@@ -990,12 +870,12 @@ VALUE Draw_annotate(
|
|
990
870
|
rm_raise_exception(exception);
|
991
871
|
}
|
992
872
|
#else
|
993
|
-
draw->info->text = InterpretImageProperties(NULL, image,
|
873
|
+
draw->info->text = InterpretImageProperties(NULL, image, embed_text);
|
994
874
|
#endif
|
995
875
|
if (!draw->info->text)
|
996
876
|
{
|
997
877
|
#if defined(IMAGEMAGICK_7)
|
998
|
-
|
878
|
+
DestroyExceptionInfo(exception);
|
999
879
|
#endif
|
1000
880
|
rb_raise(rb_eArgError, "no text");
|
1001
881
|
}
|
@@ -1009,21 +889,21 @@ VALUE Draw_annotate(
|
|
1009
889
|
|
1010
890
|
if (width == 0 && height == 0)
|
1011
891
|
{
|
1012
|
-
|
892
|
+
snprintf(geometry_str, sizeof(geometry_str), "%+ld%+ld", x, y);
|
1013
893
|
}
|
1014
894
|
|
1015
895
|
// WxH is non-zero
|
1016
896
|
else
|
1017
897
|
{
|
1018
|
-
|
898
|
+
snprintf(geometry_str, sizeof(geometry_str), "%lux%lu%+ld%+ld", width, height, x, y);
|
1019
899
|
}
|
1020
900
|
|
1021
901
|
magick_clone_string(&draw->info->geometry, geometry_str);
|
1022
902
|
|
1023
903
|
#if defined(IMAGEMAGICK_7)
|
1024
|
-
|
904
|
+
AnnotateImage(image, draw->info, exception);
|
1025
905
|
#else
|
1026
|
-
|
906
|
+
AnnotateImage(image, draw->info);
|
1027
907
|
#endif
|
1028
908
|
|
1029
909
|
magick_free(draw->info->text);
|
@@ -1031,8 +911,8 @@ VALUE Draw_annotate(
|
|
1031
911
|
draw->info->affine = keep;
|
1032
912
|
|
1033
913
|
#if defined(IMAGEMAGICK_7)
|
1034
|
-
CHECK_EXCEPTION()
|
1035
|
-
|
914
|
+
CHECK_EXCEPTION();
|
915
|
+
DestroyExceptionInfo(exception);
|
1036
916
|
#else
|
1037
917
|
rm_check_image_exception(image, RetainOnError);
|
1038
918
|
#endif
|
@@ -1044,13 +924,7 @@ VALUE Draw_annotate(
|
|
1044
924
|
/**
|
1045
925
|
* Clones this object.
|
1046
926
|
*
|
1047
|
-
*
|
1048
|
-
* - @verbatim Draw#clone @endverbatim
|
1049
|
-
*
|
1050
|
-
* @param self this object
|
1051
|
-
* @return the clone
|
1052
|
-
* @see Draw_dup
|
1053
|
-
* @see Draw_init_copy
|
927
|
+
* @return [Magick::Draw] the cloned object
|
1054
928
|
*/
|
1055
929
|
VALUE
|
1056
930
|
Draw_clone(VALUE self)
|
@@ -1070,21 +944,28 @@ Draw_clone(VALUE self)
|
|
1070
944
|
|
1071
945
|
|
1072
946
|
/**
|
1073
|
-
*
|
1074
|
-
*
|
1075
|
-
*
|
1076
|
-
*
|
1077
|
-
*
|
1078
|
-
*
|
1079
|
-
*
|
1080
|
-
*
|
1081
|
-
*
|
947
|
+
* Draw the image.
|
948
|
+
*
|
949
|
+
* @overload composite(x, y, width, height, image)
|
950
|
+
* @param x [Float] x position
|
951
|
+
* @param y [Float] y position
|
952
|
+
* @param width [Float] the width
|
953
|
+
* @param height [Float] the height
|
954
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
955
|
+
* imagelist, uses the current image.
|
956
|
+
*
|
957
|
+
* @overload composite(x, y, width, height, image, operator = Magick::OverCompositeOp)
|
958
|
+
* - The "image" argument can be either an ImageList object or an Image
|
1082
959
|
* argument.
|
1083
|
-
*
|
1084
|
-
*
|
1085
|
-
*
|
1086
|
-
*
|
1087
|
-
*
|
960
|
+
* @param x [Float] x position
|
961
|
+
* @param y [Float] y position
|
962
|
+
* @param width [Float] the width
|
963
|
+
* @param height [Float] the height
|
964
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
965
|
+
* imagelist, uses the current image.
|
966
|
+
* @param operator [Magick::CompositeOperator] the operator
|
967
|
+
*
|
968
|
+
* @return [Magick::Draw] self
|
1088
969
|
*/
|
1089
970
|
VALUE
|
1090
971
|
Draw_composite(int argc, VALUE *argv, VALUE self)
|
@@ -1129,22 +1010,22 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1129
1010
|
Data_Get_Struct(self, Draw, draw);
|
1130
1011
|
|
1131
1012
|
// Create a temp copy of the composite image
|
1132
|
-
rm_write_temp_image(comp_img, name);
|
1013
|
+
rm_write_temp_image(comp_img, name, sizeof(name));
|
1133
1014
|
|
1134
1015
|
// Add the temp filename to the filename array.
|
1135
1016
|
// Use Magick storage since we need to keep the list around
|
1136
1017
|
// until destroy_Draw is called.
|
1137
|
-
tmpfile_name = magick_malloc(sizeof(struct TmpFile_Name)+
|
1018
|
+
tmpfile_name = magick_malloc(sizeof(struct TmpFile_Name) + rm_strnlen_s(name, sizeof(name)));
|
1138
1019
|
strcpy(tmpfile_name->name, name);
|
1139
1020
|
tmpfile_name->next = draw->tmpfile_ary;
|
1140
1021
|
draw->tmpfile_ary = tmpfile_name;
|
1141
1022
|
|
1142
1023
|
// Form the drawing primitive
|
1143
|
-
|
1024
|
+
snprintf(primitive, sizeof(primitive), "image %s %g,%g,%g,%g '%s'", op, x, y, width, height, name);
|
1144
1025
|
|
1145
1026
|
|
1146
1027
|
// Send "primitive" to self.
|
1147
|
-
|
1028
|
+
rb_funcall(self, rb_intern("primitive"), 1, rb_str_new2(primitive));
|
1148
1029
|
|
1149
1030
|
RB_GC_GUARD(image);
|
1150
1031
|
|
@@ -1155,12 +1036,9 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1155
1036
|
/**
|
1156
1037
|
* Execute the stored drawing primitives on the current image.
|
1157
1038
|
*
|
1158
|
-
*
|
1159
|
-
*
|
1160
|
-
*
|
1161
|
-
* @param self this object
|
1162
|
-
* @param image_arg the image argument
|
1163
|
-
* @return self
|
1039
|
+
* @param image_arg [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1040
|
+
* imagelist, uses the current image.
|
1041
|
+
* @return [Magick::Draw] self
|
1164
1042
|
*/
|
1165
1043
|
VALUE
|
1166
1044
|
Draw_draw(VALUE self, VALUE image_arg)
|
@@ -1181,21 +1059,21 @@ Draw_draw(VALUE self, VALUE image_arg)
|
|
1181
1059
|
}
|
1182
1060
|
|
1183
1061
|
// Point the DrawInfo structure at the current set of primitives.
|
1184
|
-
magick_clone_string(&(draw->info->primitive),
|
1062
|
+
magick_clone_string(&(draw->info->primitive), StringValueCStr(draw->primitives));
|
1185
1063
|
|
1186
1064
|
#if defined(IMAGEMAGICK_7)
|
1187
1065
|
exception = AcquireExceptionInfo();
|
1188
|
-
|
1066
|
+
DrawImage(image, draw->info, exception);
|
1189
1067
|
#else
|
1190
|
-
|
1068
|
+
DrawImage(image, draw->info);
|
1191
1069
|
#endif
|
1192
1070
|
|
1193
1071
|
magick_free(draw->info->primitive);
|
1194
1072
|
draw->info->primitive = NULL;
|
1195
1073
|
|
1196
1074
|
#if defined(IMAGEMAGICK_7)
|
1197
|
-
CHECK_EXCEPTION()
|
1198
|
-
|
1075
|
+
CHECK_EXCEPTION();
|
1076
|
+
DestroyExceptionInfo(exception);
|
1199
1077
|
#else
|
1200
1078
|
rm_check_image_exception(image, RetainOnError);
|
1201
1079
|
#endif
|
@@ -1205,18 +1083,11 @@ Draw_draw(VALUE self, VALUE image_arg)
|
|
1205
1083
|
|
1206
1084
|
|
1207
1085
|
/**
|
1208
|
-
*
|
1209
|
-
*
|
1210
|
-
* Ruby usage:
|
1211
|
-
* - @verbatim Draw#dup @endverbatim
|
1086
|
+
* Duplicate a Draw object.
|
1212
1087
|
*
|
1213
|
-
*
|
1214
|
-
* - Constructs a new Draw object, then calls initialize_copy.
|
1088
|
+
* - Constructs a new Draw object, then calls initialize_copy.
|
1215
1089
|
*
|
1216
|
-
* @
|
1217
|
-
* @return the duplicate
|
1218
|
-
* @see Draw_clone
|
1219
|
-
* @see Draw_init_copy
|
1090
|
+
* @return [Magick::Draw] the duplicated object
|
1220
1091
|
*/
|
1221
1092
|
VALUE
|
1222
1093
|
Draw_dup(VALUE self)
|
@@ -1227,11 +1098,6 @@ Draw_dup(VALUE self)
|
|
1227
1098
|
draw = ALLOC(Draw);
|
1228
1099
|
memset(draw, 0, sizeof(Draw));
|
1229
1100
|
dup = Data_Wrap_Struct(CLASS_OF(self), mark_Draw, destroy_Draw, draw);
|
1230
|
-
if (rb_obj_tainted(self))
|
1231
|
-
{
|
1232
|
-
(void)rb_obj_taint(dup);
|
1233
|
-
}
|
1234
|
-
|
1235
1101
|
RB_GC_GUARD(dup);
|
1236
1102
|
|
1237
1103
|
return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
|
@@ -1241,19 +1107,19 @@ Draw_dup(VALUE self)
|
|
1241
1107
|
/**
|
1242
1108
|
* Returns measurements for a given font and text string.
|
1243
1109
|
*
|
1244
|
-
*
|
1245
|
-
*
|
1246
|
-
*
|
1110
|
+
* - If the image argument has been omitted, use a dummy image, but make sure
|
1111
|
+
* the text has none of the special characters that refer to image
|
1112
|
+
* attributes.
|
1247
1113
|
*
|
1248
|
-
*
|
1249
|
-
*
|
1250
|
-
* the text has none of the special characters that refer to image
|
1251
|
-
* attributes.
|
1114
|
+
* @overload get_type_metrics(text)
|
1115
|
+
* @param text [String] The string to be rendered.
|
1252
1116
|
*
|
1253
|
-
* @
|
1254
|
-
*
|
1255
|
-
*
|
1256
|
-
*
|
1117
|
+
* @overload get_type_metrics(image, text)
|
1118
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1119
|
+
* imagelist, uses the current image.
|
1120
|
+
* @param text [String] The string to be rendered.
|
1121
|
+
*
|
1122
|
+
* @return [Magick::TypeMetric] The information for a specific string if rendered on a image.
|
1257
1123
|
*/
|
1258
1124
|
VALUE
|
1259
1125
|
Draw_get_type_metrics(
|
@@ -1268,19 +1134,19 @@ Draw_get_type_metrics(
|
|
1268
1134
|
/**
|
1269
1135
|
* Returns measurements for a given font and text string.
|
1270
1136
|
*
|
1271
|
-
*
|
1272
|
-
*
|
1273
|
-
*
|
1137
|
+
* - If the image argument has been omitted, use a dummy image, but make sure
|
1138
|
+
* the text has none of the special characters that refer to image
|
1139
|
+
* attributes.
|
1274
1140
|
*
|
1275
|
-
*
|
1276
|
-
*
|
1277
|
-
* the text has none of the special characters that refer to image
|
1278
|
-
* attributes.
|
1141
|
+
* @overload get_multiline_type_metrics(text)
|
1142
|
+
* @param text [String] The string to be rendered.
|
1279
1143
|
*
|
1280
|
-
* @
|
1281
|
-
*
|
1282
|
-
*
|
1283
|
-
*
|
1144
|
+
* @overload Draw#get_multiline_type_metrics(image, text)
|
1145
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1146
|
+
* imagelist, uses the current image.
|
1147
|
+
* @param text [String] The string to be rendered.
|
1148
|
+
*
|
1149
|
+
* @return [Magick::TypeMetric] The information for a specific string if rendered on a image.
|
1284
1150
|
*/
|
1285
1151
|
VALUE
|
1286
1152
|
Draw_get_multiline_type_metrics(
|
@@ -1295,14 +1161,8 @@ Draw_get_multiline_type_metrics(
|
|
1295
1161
|
/**
|
1296
1162
|
* Initialize clone, dup methods.
|
1297
1163
|
*
|
1298
|
-
* Ruby usage:
|
1299
|
-
* - @verbatim Draw#initialize_copy @endverbatim
|
1300
|
-
*
|
1301
|
-
* @param self this object
|
1302
1164
|
* @param orig the original object
|
1303
|
-
* @return self
|
1304
|
-
* @see Draw_clone
|
1305
|
-
* @see Draw_dup
|
1165
|
+
* @return [Magick::Draw] self
|
1306
1166
|
*/
|
1307
1167
|
VALUE Draw_init_copy(VALUE self, VALUE orig)
|
1308
1168
|
{
|
@@ -1329,11 +1189,7 @@ VALUE Draw_init_copy(VALUE self, VALUE orig)
|
|
1329
1189
|
/**
|
1330
1190
|
* Initialize Draw object.
|
1331
1191
|
*
|
1332
|
-
*
|
1333
|
-
* - @verbatim Draw#initialize <{ info initializers }> @endverbatim
|
1334
|
-
*
|
1335
|
-
* @param self this object
|
1336
|
-
* @return self
|
1192
|
+
* @return [Magick::Draw] self
|
1337
1193
|
*/
|
1338
1194
|
VALUE
|
1339
1195
|
Draw_initialize(VALUE self)
|
@@ -1357,12 +1213,8 @@ Draw_initialize(VALUE self)
|
|
1357
1213
|
/**
|
1358
1214
|
* Display the primitives.
|
1359
1215
|
*
|
1360
|
-
* Ruby
|
1361
|
-
*
|
1362
|
-
*
|
1363
|
-
* @param self this object
|
1364
|
-
* @return the draw primitives or the Ruby string "(no primitives defined)" if
|
1365
|
-
* they are not defined
|
1216
|
+
* @return [String] the draw primitives or the Ruby string "(no primitives defined)"
|
1217
|
+
* if they are not defined
|
1366
1218
|
*/
|
1367
1219
|
VALUE
|
1368
1220
|
Draw_inspect(VALUE self)
|
@@ -1377,13 +1229,7 @@ Draw_inspect(VALUE self)
|
|
1377
1229
|
/**
|
1378
1230
|
* Create a new Draw object.
|
1379
1231
|
*
|
1380
|
-
*
|
1381
|
-
* - @verbatim Draw.new @endverbatim
|
1382
|
-
* - @verbatim Draw.allocate @endverbatim
|
1383
|
-
*
|
1384
|
-
* @param class the Ruby Draw class
|
1385
|
-
* @return a new Draw object
|
1386
|
-
* @throw ImageMagickError if no memory
|
1232
|
+
* @return [Magick::Draw] a new Draw object
|
1387
1233
|
*/
|
1388
1234
|
VALUE Draw_alloc(VALUE class)
|
1389
1235
|
{
|
@@ -1403,12 +1249,8 @@ VALUE Draw_alloc(VALUE class)
|
|
1403
1249
|
/**
|
1404
1250
|
* Add a drawing primitive to the list of primitives in the Draw object.
|
1405
1251
|
*
|
1406
|
-
*
|
1407
|
-
*
|
1408
|
-
*
|
1409
|
-
* @param self this object
|
1410
|
-
* @param primitive the primitive to add
|
1411
|
-
* @return self
|
1252
|
+
* @param primitive [String] the primitive to add
|
1253
|
+
* @return [Magick::Draw] self
|
1412
1254
|
*/
|
1413
1255
|
VALUE
|
1414
1256
|
Draw_primitive(VALUE self, VALUE primitive)
|
@@ -1462,17 +1304,18 @@ static void
|
|
1462
1304
|
destroy_Draw(void *drawptr)
|
1463
1305
|
{
|
1464
1306
|
Draw *draw = (Draw *)drawptr;
|
1465
|
-
struct TmpFile_Name *tmpfile_name;
|
1466
1307
|
|
1467
1308
|
if (draw->info)
|
1468
1309
|
{
|
1469
|
-
|
1310
|
+
DestroyDrawInfo(draw->info);
|
1470
1311
|
draw->info = NULL;
|
1471
1312
|
}
|
1472
1313
|
|
1473
1314
|
// Erase any temporary image files.
|
1474
1315
|
while (draw->tmpfile_ary)
|
1475
1316
|
{
|
1317
|
+
struct TmpFile_Name *tmpfile_name;
|
1318
|
+
|
1476
1319
|
tmpfile_name = draw->tmpfile_ary;
|
1477
1320
|
draw->tmpfile_ary = draw->tmpfile_ary->next;
|
1478
1321
|
rm_delete_temp_image(tmpfile_name->name);
|
@@ -1500,16 +1343,10 @@ new_DrawOptions(void)
|
|
1500
1343
|
/**
|
1501
1344
|
* Create a DrawOptions object.
|
1502
1345
|
*
|
1503
|
-
*
|
1504
|
-
*
|
1505
|
-
* - @verbatim DrawOptions#new @endverbatim
|
1506
|
-
*
|
1507
|
-
* Notes:
|
1508
|
-
* - The DrawOptions class is the same as the Draw class except is has only
|
1509
|
-
* the attribute writer functions
|
1346
|
+
* - The DrawOptions class is the same as the Draw class except is has only
|
1347
|
+
* the attribute writer functions
|
1510
1348
|
*
|
1511
|
-
* @
|
1512
|
-
* @return a new DrawOptions object
|
1349
|
+
* @return [Magick::Image::DrawOptions] a new DrawOptions object
|
1513
1350
|
*/
|
1514
1351
|
VALUE
|
1515
1352
|
DrawOptions_alloc(VALUE class)
|
@@ -1530,11 +1367,7 @@ DrawOptions_alloc(VALUE class)
|
|
1530
1367
|
/**
|
1531
1368
|
* Initialize a DrawOptions object.
|
1532
1369
|
*
|
1533
|
-
*
|
1534
|
-
* - @verbatim DrawOptions#initialize @endverbatim
|
1535
|
-
*
|
1536
|
-
* @param self this object
|
1537
|
-
* @return self
|
1370
|
+
* @return [Magick::Image::DrawOptions] self
|
1538
1371
|
*/
|
1539
1372
|
VALUE
|
1540
1373
|
DrawOptions_initialize(VALUE self)
|
@@ -1553,7 +1386,7 @@ DrawOptions_initialize(VALUE self)
|
|
1553
1386
|
if (rb_block_given_p())
|
1554
1387
|
{
|
1555
1388
|
// Run the block in self's context
|
1556
|
-
|
1389
|
+
rb_obj_instance_eval(0, NULL, self);
|
1557
1390
|
}
|
1558
1391
|
|
1559
1392
|
return self;
|
@@ -1561,18 +1394,12 @@ DrawOptions_initialize(VALUE self)
|
|
1561
1394
|
|
1562
1395
|
|
1563
1396
|
/**
|
1564
|
-
* Allocate a new Magick::PolaroidOptions object.
|
1397
|
+
* Allocate a new Magick::Image::PolaroidOptions object.
|
1565
1398
|
*
|
1566
|
-
*
|
1567
|
-
*
|
1568
|
-
* - @verbatim Magick::PolaroidOptions#new @endverbatim
|
1399
|
+
* - Internally a PolaroidOptions object is the same as a Draw object. The
|
1400
|
+
* methods are implemented by Draw methods in rmdraw.c.
|
1569
1401
|
*
|
1570
|
-
*
|
1571
|
-
* - Internally a PolaroidOptions object is the same as a Draw object. The
|
1572
|
-
* methods are implemented by Draw methods in rmdraw.c.
|
1573
|
-
*
|
1574
|
-
* @param class the Ruby PoloradoidOptions class
|
1575
|
-
* @return a new DrawOptions object
|
1402
|
+
* @return [Magick::Image::PolaroidOptions] a new PolaroidOptions object
|
1576
1403
|
*/
|
1577
1404
|
VALUE
|
1578
1405
|
PolaroidOptions_alloc(VALUE class)
|
@@ -1586,8 +1413,8 @@ PolaroidOptions_alloc(VALUE class)
|
|
1586
1413
|
draw = ALLOC(Draw);
|
1587
1414
|
memset(draw, 0, sizeof(*draw));
|
1588
1415
|
|
1589
|
-
draw->info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
|
1590
|
-
(void)
|
1416
|
+
draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
|
1417
|
+
(void) DestroyImageInfo(image_info);
|
1591
1418
|
|
1592
1419
|
polaroid_obj = Data_Wrap_Struct(class, NULL, destroy_Draw, draw);
|
1593
1420
|
|
@@ -1598,13 +1425,11 @@ PolaroidOptions_alloc(VALUE class)
|
|
1598
1425
|
|
1599
1426
|
|
1600
1427
|
/**
|
1601
|
-
*
|
1428
|
+
* Initialize a PolaroidOptions object.
|
1602
1429
|
*
|
1603
|
-
*
|
1604
|
-
*
|
1605
|
-
*
|
1606
|
-
* @param self this object
|
1607
|
-
* @return self
|
1430
|
+
* @yield [self]
|
1431
|
+
* @yieldparam self [Magick::Image::PolaroidOptions] self
|
1432
|
+
* @return [Magick::Image::PolaroidOptions] self
|
1608
1433
|
*/
|
1609
1434
|
VALUE
|
1610
1435
|
PolaroidOptions_initialize(VALUE self)
|
@@ -1616,16 +1441,16 @@ PolaroidOptions_initialize(VALUE self)
|
|
1616
1441
|
Data_Get_Struct(self, Draw, draw);
|
1617
1442
|
|
1618
1443
|
exception = AcquireExceptionInfo();
|
1619
|
-
|
1620
|
-
CHECK_EXCEPTION()
|
1621
|
-
|
1622
|
-
CHECK_EXCEPTION()
|
1444
|
+
QueryColorCompliance("gray75", AllCompliance, &draw->shadow_color, exception);
|
1445
|
+
CHECK_EXCEPTION();
|
1446
|
+
QueryColorCompliance("#dfdfdf", AllCompliance, &draw->info->border_color, exception);
|
1447
|
+
CHECK_EXCEPTION();
|
1623
1448
|
DestroyExceptionInfo(exception);
|
1624
1449
|
|
1625
1450
|
if (rb_block_given_p())
|
1626
1451
|
{
|
1627
1452
|
// Run the block in self's context
|
1628
|
-
|
1453
|
+
rb_obj_instance_eval(0, NULL, self);
|
1629
1454
|
}
|
1630
1455
|
return self;
|
1631
1456
|
}
|
@@ -1648,12 +1473,8 @@ rm_polaroid_new(void)
|
|
1648
1473
|
/**
|
1649
1474
|
* Set the shadow color attribute.
|
1650
1475
|
*
|
1651
|
-
*
|
1652
|
-
*
|
1653
|
-
*
|
1654
|
-
* @param self this object
|
1655
|
-
* @param shadow the shadow color
|
1656
|
-
* @return shadow
|
1476
|
+
* @param shadow [Magick::Pixel, String] the shadow color
|
1477
|
+
* @return [Magick::Pixel, String] the given shadow color
|
1657
1478
|
*/
|
1658
1479
|
VALUE
|
1659
1480
|
PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
@@ -1668,14 +1489,10 @@ PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
|
1668
1489
|
|
1669
1490
|
|
1670
1491
|
/**
|
1671
|
-
* Set the border color
|
1492
|
+
* Set the border color.
|
1672
1493
|
*
|
1673
|
-
*
|
1674
|
-
*
|
1675
|
-
*
|
1676
|
-
* @param self this object
|
1677
|
-
* @param border the border color
|
1678
|
-
* @return border
|
1494
|
+
* @param border [Magick::Pixel, String] the border color
|
1495
|
+
* @return [Magick::Pixel, String] the given border color
|
1679
1496
|
*/
|
1680
1497
|
VALUE
|
1681
1498
|
PolaroidOptions_border_color_eq(VALUE self, VALUE border)
|
@@ -1702,11 +1519,11 @@ get_dummy_tm_img(VALUE klass)
|
|
1702
1519
|
{
|
1703
1520
|
#define DUMMY_IMG_CLASS_VAR "@@_dummy_img_"
|
1704
1521
|
VALUE dummy_img = 0;
|
1705
|
-
Info *info;
|
1706
|
-
Image *image;
|
1707
1522
|
|
1708
1523
|
if (rb_cvar_defined(klass, rb_intern(DUMMY_IMG_CLASS_VAR)) != Qtrue)
|
1709
1524
|
{
|
1525
|
+
Info *info;
|
1526
|
+
Image *image;
|
1710
1527
|
|
1711
1528
|
info = CloneImageInfo(NULL);
|
1712
1529
|
if (!info)
|
@@ -1714,7 +1531,7 @@ get_dummy_tm_img(VALUE klass)
|
|
1714
1531
|
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
1715
1532
|
}
|
1716
1533
|
image = rm_acquire_image(info);
|
1717
|
-
|
1534
|
+
DestroyImageInfo(info);
|
1718
1535
|
|
1719
1536
|
if (!image)
|
1720
1537
|
{
|
@@ -1805,7 +1622,7 @@ get_type_metrics(
|
|
1805
1622
|
if (!draw->info->text)
|
1806
1623
|
{
|
1807
1624
|
#if defined(IMAGEMAGICK_7)
|
1808
|
-
|
1625
|
+
DestroyExceptionInfo(exception);
|
1809
1626
|
#endif
|
1810
1627
|
rb_raise(rb_eArgError, "no text to measure");
|
1811
1628
|
}
|
@@ -1822,8 +1639,8 @@ get_type_metrics(
|
|
1822
1639
|
if (!okay)
|
1823
1640
|
{
|
1824
1641
|
#if defined(IMAGEMAGICK_7)
|
1825
|
-
CHECK_EXCEPTION()
|
1826
|
-
|
1642
|
+
CHECK_EXCEPTION();
|
1643
|
+
DestroyExceptionInfo(exception);
|
1827
1644
|
#else
|
1828
1645
|
rm_check_image_exception(image, RetainOnError);
|
1829
1646
|
#endif
|
@@ -1833,7 +1650,7 @@ get_type_metrics(
|
|
1833
1650
|
"Is the FreeType library installed?");
|
1834
1651
|
}
|
1835
1652
|
#if defined(IMAGEMAGICK_7)
|
1836
|
-
|
1653
|
+
DestroyExceptionInfo(exception);
|
1837
1654
|
#endif
|
1838
1655
|
|
1839
1656
|
RB_GC_GUARD(t);
|