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/ext/RMagick/rmdraw.c
CHANGED
@@ -18,19 +18,19 @@ static void destroy_Draw(void *);
|
|
18
18
|
static VALUE new_DrawOptions(void);
|
19
19
|
|
20
20
|
/** Method that gets type metrics */
|
21
|
-
|
21
|
+
#if defined(IMAGEMAGICK_7)
|
22
|
+
typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *, ExceptionInfo *);
|
23
|
+
#else
|
24
|
+
typedef MagickBooleanType (get_type_metrics_func_t)(Image *, const DrawInfo *, TypeMetric *);
|
25
|
+
#endif
|
22
26
|
static VALUE get_type_metrics(int, VALUE *, VALUE, get_type_metrics_func_t);
|
23
27
|
|
24
28
|
|
25
29
|
/**
|
26
|
-
* Set the affine matrix from an Magick::AffineMatrix.
|
30
|
+
* Set the affine matrix from an {Magick::AffineMatrix}.
|
27
31
|
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
* @param self this object
|
32
|
-
* @param matrix the affine matrix to set
|
33
|
-
* @return matrix
|
32
|
+
* @param matrix [Magick::AffineMatrix] the affine matrix
|
33
|
+
* @return [Magick::AffineMatrix] the given matrix
|
34
34
|
*/
|
35
35
|
VALUE
|
36
36
|
Draw_affine_eq(VALUE self, VALUE matrix)
|
@@ -45,14 +45,10 @@ Draw_affine_eq(VALUE self, VALUE matrix)
|
|
45
45
|
|
46
46
|
|
47
47
|
/**
|
48
|
-
* Set the text alignment.
|
49
|
-
*
|
50
|
-
* Ruby usage:
|
51
|
-
* - @verbatim Draw#align= @endverbatim
|
48
|
+
* Set the text alignment from an {Magick::AlignType}.
|
52
49
|
*
|
53
|
-
* @param
|
54
|
-
* @
|
55
|
-
* @return align
|
50
|
+
* @param align [Magick::AlignType] the text alignment
|
51
|
+
* @return [Magick::AlignType] the given align
|
56
52
|
*/
|
57
53
|
VALUE
|
58
54
|
Draw_align_eq(VALUE self, VALUE align)
|
@@ -67,14 +63,10 @@ Draw_align_eq(VALUE self, VALUE align)
|
|
67
63
|
|
68
64
|
|
69
65
|
/**
|
70
|
-
*
|
71
|
-
*
|
72
|
-
* Ruby usage:
|
73
|
-
* - @verbatim Draw#decorate= @endverbatim
|
66
|
+
* Set text decorate from an {Magick::DecorationType}.
|
74
67
|
*
|
75
|
-
* @param
|
76
|
-
* @
|
77
|
-
* @return decorate
|
68
|
+
* @param decorate [Magick::DecorationType] the decorate type
|
69
|
+
* @return [Magick::DecorationType] the given decorate
|
78
70
|
*/
|
79
71
|
VALUE
|
80
72
|
Draw_decorate_eq(VALUE self, VALUE decorate)
|
@@ -89,14 +81,10 @@ Draw_decorate_eq(VALUE self, VALUE decorate)
|
|
89
81
|
|
90
82
|
|
91
83
|
/**
|
92
|
-
*
|
84
|
+
* Set density.
|
93
85
|
*
|
94
|
-
*
|
95
|
-
*
|
96
|
-
*
|
97
|
-
* @param self this object
|
98
|
-
* @param density the density
|
99
|
-
* @return density
|
86
|
+
* @param density [String] the density
|
87
|
+
* @return [String] the given density
|
100
88
|
*/
|
101
89
|
VALUE
|
102
90
|
Draw_density_eq(VALUE self, VALUE density)
|
@@ -105,21 +93,17 @@ Draw_density_eq(VALUE self, VALUE density)
|
|
105
93
|
|
106
94
|
rb_check_frozen(self);
|
107
95
|
Data_Get_Struct(self, Draw, draw);
|
108
|
-
magick_clone_string(&draw->info->density,
|
96
|
+
magick_clone_string(&draw->info->density, StringValueCStr(density));
|
109
97
|
|
110
98
|
return density;
|
111
99
|
}
|
112
100
|
|
113
101
|
|
114
102
|
/**
|
115
|
-
*
|
116
|
-
*
|
117
|
-
* Ruby usage:
|
118
|
-
* - @verbatim Draw#encoding= @endverbatim
|
103
|
+
* Set text encoding.
|
119
104
|
*
|
120
|
-
* @param
|
121
|
-
* @
|
122
|
-
* @return encoding
|
105
|
+
* @param encoding [String] the encoding name
|
106
|
+
* @return [String] the given encoding name
|
123
107
|
*/
|
124
108
|
VALUE
|
125
109
|
Draw_encoding_eq(VALUE self, VALUE encoding)
|
@@ -128,21 +112,17 @@ Draw_encoding_eq(VALUE self, VALUE encoding)
|
|
128
112
|
|
129
113
|
rb_check_frozen(self);
|
130
114
|
Data_Get_Struct(self, Draw, draw);
|
131
|
-
magick_clone_string(&draw->info->encoding,
|
115
|
+
magick_clone_string(&draw->info->encoding, StringValueCStr(encoding));
|
132
116
|
|
133
117
|
return encoding;
|
134
118
|
}
|
135
119
|
|
136
120
|
|
137
121
|
/**
|
138
|
-
*
|
139
|
-
*
|
140
|
-
* Ruby usage:
|
141
|
-
* - @verbatim Draw#fill= @endverbatim
|
122
|
+
* Set fill color.
|
142
123
|
*
|
143
|
-
* @param
|
144
|
-
* @
|
145
|
-
* @return fill
|
124
|
+
* @param fill [Magick::Pixel, String] the fill color
|
125
|
+
* @return [Magick::Pixel, String] the given fill color
|
146
126
|
*/
|
147
127
|
VALUE
|
148
128
|
Draw_fill_eq(VALUE self, VALUE fill)
|
@@ -159,20 +139,16 @@ Draw_fill_eq(VALUE self, VALUE fill)
|
|
159
139
|
/**
|
160
140
|
* Accept an image as a fill pattern.
|
161
141
|
*
|
162
|
-
*
|
163
|
-
*
|
164
|
-
*
|
165
|
-
* @
|
166
|
-
* @
|
167
|
-
* @return pattern
|
168
|
-
* @see Draw_stroke_pattern_eq
|
169
|
-
* @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=
|
170
147
|
*/
|
171
148
|
VALUE
|
172
149
|
Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
173
150
|
{
|
174
151
|
Draw *draw;
|
175
|
-
Image *image;
|
176
152
|
|
177
153
|
rb_check_frozen(self);
|
178
154
|
Data_Get_Struct(self, Draw, draw);
|
@@ -186,6 +162,8 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
186
162
|
|
187
163
|
if (!NIL_P(pattern))
|
188
164
|
{
|
165
|
+
Image *image;
|
166
|
+
|
189
167
|
pattern = rm_cur_image(pattern);
|
190
168
|
image = rm_check_destroyed(pattern);
|
191
169
|
// Do not trace creation
|
@@ -197,14 +175,10 @@ Draw_fill_pattern_eq(VALUE self, VALUE pattern)
|
|
197
175
|
|
198
176
|
|
199
177
|
/**
|
200
|
-
*
|
201
|
-
*
|
202
|
-
* Ruby usage:
|
203
|
-
* - @verbatim Draw#font= @endverbatim
|
178
|
+
* Set the font name.
|
204
179
|
*
|
205
|
-
* @param
|
206
|
-
* @
|
207
|
-
* @return font
|
180
|
+
* @param font [String] the font name
|
181
|
+
* @return [String] the given font name
|
208
182
|
*/
|
209
183
|
VALUE
|
210
184
|
Draw_font_eq(VALUE self, VALUE font)
|
@@ -213,21 +187,17 @@ Draw_font_eq(VALUE self, VALUE font)
|
|
213
187
|
|
214
188
|
rb_check_frozen(self);
|
215
189
|
Data_Get_Struct(self, Draw, draw);
|
216
|
-
magick_clone_string(&draw->info->font,
|
190
|
+
magick_clone_string(&draw->info->font, StringValueCStr(font));
|
217
191
|
|
218
192
|
return font;
|
219
193
|
}
|
220
194
|
|
221
195
|
|
222
196
|
/**
|
223
|
-
*
|
224
|
-
*
|
225
|
-
* Ruby usage:
|
226
|
-
* - @verbatim Draw#family= @endverbatim
|
197
|
+
* Set the font family name.
|
227
198
|
*
|
228
|
-
* @param
|
229
|
-
* @
|
230
|
-
* @return family
|
199
|
+
* @param family [String] the font family name
|
200
|
+
* @return [String] the given family name
|
231
201
|
*/
|
232
202
|
VALUE
|
233
203
|
Draw_font_family_eq(VALUE self, VALUE family)
|
@@ -236,21 +206,17 @@ Draw_font_family_eq(VALUE self, VALUE family)
|
|
236
206
|
|
237
207
|
rb_check_frozen(self);
|
238
208
|
Data_Get_Struct(self, Draw, draw);
|
239
|
-
magick_clone_string(&draw->info->family,
|
209
|
+
magick_clone_string(&draw->info->family, StringValueCStr(family));
|
240
210
|
|
241
211
|
return family;
|
242
212
|
}
|
243
213
|
|
244
214
|
|
245
215
|
/**
|
246
|
-
*
|
216
|
+
* Set the stretch as spacing between text characters.
|
247
217
|
*
|
248
|
-
*
|
249
|
-
*
|
250
|
-
*
|
251
|
-
* @param self this object
|
252
|
-
* @param stretch the font_stretch
|
253
|
-
* @return stretch
|
218
|
+
* @param stretch [Magick::StretchType] the stretch type
|
219
|
+
* @return [Magick::StretchType] the given stretch type
|
254
220
|
*/
|
255
221
|
VALUE
|
256
222
|
Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
@@ -265,14 +231,10 @@ Draw_font_stretch_eq(VALUE self, VALUE stretch)
|
|
265
231
|
|
266
232
|
|
267
233
|
/**
|
268
|
-
*
|
234
|
+
* Set font style.
|
269
235
|
*
|
270
|
-
*
|
271
|
-
*
|
272
|
-
*
|
273
|
-
* @param self this object
|
274
|
-
* @param style the font_style
|
275
|
-
* @return style
|
236
|
+
* @param style [Magick::StyleType] the font style
|
237
|
+
* @return [Magick::StyleType] the given font style
|
276
238
|
*/
|
277
239
|
VALUE
|
278
240
|
Draw_font_style_eq(VALUE self, VALUE style)
|
@@ -287,18 +249,11 @@ Draw_font_style_eq(VALUE self, VALUE style)
|
|
287
249
|
|
288
250
|
|
289
251
|
/**
|
290
|
-
*
|
291
|
-
*
|
292
|
-
* Ruby usage:
|
293
|
-
* - @verbatim Draw#font_weight= @endverbatim
|
252
|
+
* Set font weight.
|
294
253
|
*
|
295
|
-
*
|
296
|
-
*
|
297
|
-
*
|
298
|
-
*
|
299
|
-
* @param self this object
|
300
|
-
* @param weight the font_weight
|
301
|
-
* @return weight
|
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
|
302
257
|
*/
|
303
258
|
VALUE
|
304
259
|
Draw_font_weight_eq(VALUE self, VALUE weight)
|
@@ -314,7 +269,7 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
314
269
|
w = FIX2INT(weight);
|
315
270
|
if (w < 100 || w > 900)
|
316
271
|
{
|
317
|
-
rb_raise(rb_eArgError, "invalid font weight (%
|
272
|
+
rb_raise(rb_eArgError, "invalid font weight (%"RMIuSIZE" given)", w);
|
318
273
|
}
|
319
274
|
draw->info->weight = w;
|
320
275
|
}
|
@@ -351,27 +306,21 @@ Draw_font_weight_eq(VALUE self, VALUE weight)
|
|
351
306
|
|
352
307
|
|
353
308
|
/**
|
354
|
-
*
|
355
|
-
*
|
356
|
-
*
|
357
|
-
*
|
358
|
-
*
|
359
|
-
*
|
360
|
-
*
|
361
|
-
*
|
362
|
-
*
|
363
|
-
*
|
364
|
-
*
|
365
|
-
*
|
366
|
-
*
|
367
|
-
*
|
368
|
-
*
|
369
|
-
* - SouthGravity text top-center placed at bottom-center
|
370
|
-
* - SouthEastGravity text top-right placed at bottom-right
|
371
|
-
*
|
372
|
-
* @param self this object
|
373
|
-
* @param grav the gravity
|
374
|
-
* @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
|
375
324
|
*/
|
376
325
|
VALUE
|
377
326
|
Draw_gravity_eq(VALUE self, VALUE grav)
|
@@ -387,17 +336,10 @@ Draw_gravity_eq(VALUE self, VALUE grav)
|
|
387
336
|
|
388
337
|
|
389
338
|
/**
|
390
|
-
*
|
339
|
+
* Set kerning as spacing between two letters.
|
391
340
|
*
|
392
|
-
*
|
393
|
-
*
|
394
|
-
*
|
395
|
-
* Notes:
|
396
|
-
* - New for ImageMagick 6.4.7-8
|
397
|
-
*
|
398
|
-
* @param self this object
|
399
|
-
* @param kerning the kerning
|
400
|
-
* @return kerning
|
341
|
+
* @param kerning [Float] the kerning
|
342
|
+
* @return [Float] the given kerning
|
401
343
|
*/
|
402
344
|
VALUE
|
403
345
|
Draw_kerning_eq(VALUE self, VALUE kerning)
|
@@ -412,17 +354,10 @@ Draw_kerning_eq(VALUE self, VALUE kerning)
|
|
412
354
|
|
413
355
|
|
414
356
|
/**
|
415
|
-
*
|
416
|
-
*
|
417
|
-
* Ruby usage:
|
418
|
-
* - @verbatim Draw#interline_spacing= @endverbatim
|
357
|
+
* Set spacing between two lines.
|
419
358
|
*
|
420
|
-
*
|
421
|
-
*
|
422
|
-
*
|
423
|
-
* @param self this object
|
424
|
-
* @param spacing the spacing
|
425
|
-
* @return spacing
|
359
|
+
* @param spacing [Float] the spacing
|
360
|
+
* @return [Float] the given spacing
|
426
361
|
*/
|
427
362
|
VALUE
|
428
363
|
Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
@@ -437,17 +372,10 @@ Draw_interline_spacing_eq(VALUE self, VALUE spacing)
|
|
437
372
|
|
438
373
|
|
439
374
|
/**
|
440
|
-
*
|
441
|
-
*
|
442
|
-
* Ruby usage:
|
443
|
-
* - @verbatim Draw#interword_spacing= @endverbatim
|
444
|
-
*
|
445
|
-
* Notes:
|
446
|
-
* - New for ImageMagick 6.4.8-0
|
375
|
+
* Set spacing between two words.
|
447
376
|
*
|
448
|
-
* @param
|
449
|
-
* @
|
450
|
-
* @return spacing
|
377
|
+
* @param spacing [Float] the spacing
|
378
|
+
* @return [Float] the given spacing
|
451
379
|
*/
|
452
380
|
VALUE
|
453
381
|
Draw_interword_spacing_eq(VALUE self, VALUE spacing)
|
@@ -477,13 +405,14 @@ static VALUE
|
|
477
405
|
image_to_str(Image *image)
|
478
406
|
{
|
479
407
|
VALUE dimg = Qnil;
|
480
|
-
unsigned char *blob;
|
481
|
-
size_t length;
|
482
|
-
Info *info;
|
483
|
-
ExceptionInfo *exception;
|
484
408
|
|
485
409
|
if (image)
|
486
410
|
{
|
411
|
+
unsigned char *blob;
|
412
|
+
size_t length;
|
413
|
+
Info *info;
|
414
|
+
ExceptionInfo *exception;
|
415
|
+
|
487
416
|
info = CloneImageInfo(NULL);
|
488
417
|
exception = AcquireExceptionInfo();
|
489
418
|
blob = ImageToBlob(info, image, &length, exception);
|
@@ -516,11 +445,12 @@ static
|
|
516
445
|
Image *str_to_image(VALUE str)
|
517
446
|
{
|
518
447
|
Image *image = NULL;
|
519
|
-
Info *info;
|
520
|
-
ExceptionInfo *exception;
|
521
448
|
|
522
449
|
if (str != Qnil)
|
523
450
|
{
|
451
|
+
Info *info;
|
452
|
+
ExceptionInfo *exception;
|
453
|
+
|
524
454
|
info = CloneImageInfo(NULL);
|
525
455
|
exception = AcquireExceptionInfo();
|
526
456
|
image = BlobToImage(info, RSTRING_PTR(str), RSTRING_LEN(str), exception);
|
@@ -534,21 +464,16 @@ Image *str_to_image(VALUE str)
|
|
534
464
|
|
535
465
|
|
536
466
|
/**
|
537
|
-
*
|
467
|
+
* Dump custom marshal for Draw objects.
|
538
468
|
*
|
539
|
-
* Ruby
|
540
|
-
*
|
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.
|
541
475
|
*
|
542
|
-
*
|
543
|
-
* - Instead of trying to replicate Ruby's support for cross-system
|
544
|
-
* marshalling, exploit it. Convert the Draw fields to Ruby objects and
|
545
|
-
* store them in a hash. Let Ruby marshal the hash.
|
546
|
-
* - Commented out code that dumps/loads fields that are used internally by
|
547
|
-
* ImageMagick and shouldn't be marshaled. I left the code as placeholders
|
548
|
-
* so I'll know which fields have been deliberately omitted.
|
549
|
-
*
|
550
|
-
* @param self this object
|
551
|
-
* @return the marshalled object (as a Ruby hash)
|
476
|
+
* @return [Hash] the marshalled object
|
552
477
|
* @todo Handle gradients when christy gets the new gradient support added (23Dec08)
|
553
478
|
*/
|
554
479
|
VALUE
|
@@ -608,7 +533,11 @@ Draw_marshal_dump(VALUE self)
|
|
608
533
|
// rb_hash_aset(ddraw, CSTR2SYM("clip_mask"), MAGICK_STRING_TO_OBJ(draw->info->clip_mask)); internal
|
609
534
|
// rb_hash_aset(ddraw, CSTR2SYM("bounds"), Import_SegmentInfo(&draw->info->bounds)); internal
|
610
535
|
rb_hash_aset(ddraw, CSTR2SYM("clip_units"), INT2FIX(draw->info->clip_units));
|
536
|
+
#if defined(IMAGEMAGICK_7)
|
537
|
+
rb_hash_aset(ddraw, CSTR2SYM("alpha"), QUANTUM2NUM(draw->info->alpha));
|
538
|
+
#else
|
611
539
|
rb_hash_aset(ddraw, CSTR2SYM("opacity"), QUANTUM2NUM(draw->info->opacity));
|
540
|
+
#endif
|
612
541
|
// rb_hash_aset(ddraw, CSTR2SYM("render"), draw->info->render ? Qtrue : Qfalse); internal
|
613
542
|
// rb_hash_aset(ddraw, CSTR2SYM("element_reference"), Qnil); // not used yet
|
614
543
|
// rb_hash_aset(ddraw, CSTR2SYM("debug"), draw->info->debug ? Qtrue : Qfalse);
|
@@ -624,17 +553,10 @@ Draw_marshal_dump(VALUE self)
|
|
624
553
|
|
625
554
|
|
626
555
|
/**
|
627
|
-
*
|
628
|
-
*
|
629
|
-
* Ruby usage:
|
630
|
-
* - @verbatim Draw#marshal_load @endverbatim
|
631
|
-
*
|
632
|
-
* Notes:
|
633
|
-
* - On entry all fields are all-bits-0
|
556
|
+
* Load the marshalled object
|
634
557
|
*
|
635
|
-
* @param
|
636
|
-
* @
|
637
|
-
* @return self, once marshalled
|
558
|
+
* @param ddraw [Hash] the marshalled object
|
559
|
+
* @return [Magick::Draw] self, once marshalled
|
638
560
|
*/
|
639
561
|
VALUE
|
640
562
|
Draw_marshal_load(VALUE self, VALUE ddraw)
|
@@ -643,7 +565,15 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
643
565
|
VALUE val;
|
644
566
|
|
645
567
|
Data_Get_Struct(self, Draw, draw);
|
568
|
+
|
569
|
+
if (draw->info == NULL)
|
570
|
+
{
|
571
|
+
ImageInfo *image_info;
|
646
572
|
|
573
|
+
image_info = CloneImageInfo(NULL);
|
574
|
+
draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
|
575
|
+
DestroyImageInfo(image_info);
|
576
|
+
}
|
647
577
|
OBJ_TO_MAGICK_STRING(draw->info->geometry, rb_hash_aref(ddraw, CSTR2SYM("geometry")));
|
648
578
|
|
649
579
|
//val = rb_hash_aref(ddraw, CSTR2SYM("viewbox"));
|
@@ -681,7 +611,11 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
681
611
|
Color_to_PixelColor(&draw->info->undercolor, val);
|
682
612
|
|
683
613
|
draw->info->clip_units = FIX2INT(rb_hash_aref(ddraw, CSTR2SYM("clip_units")));
|
614
|
+
#if defined(IMAGEMAGICK_7)
|
615
|
+
draw->info->alpha = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("alpha")));
|
616
|
+
#else
|
684
617
|
draw->info->opacity = NUM2QUANTUM(rb_hash_aref(ddraw, CSTR2SYM("opacity")));
|
618
|
+
#endif
|
685
619
|
draw->info->kerning = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("kerning")));
|
686
620
|
draw->info->interword_spacing = NUM2DBL(rb_hash_aref(ddraw, CSTR2SYM("interword_spacing")));
|
687
621
|
|
@@ -694,14 +628,10 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
|
|
694
628
|
|
695
629
|
|
696
630
|
/**
|
697
|
-
*
|
631
|
+
* Set point size to draw text.
|
698
632
|
*
|
699
|
-
*
|
700
|
-
*
|
701
|
-
*
|
702
|
-
* @param self this object
|
703
|
-
* @param pointsize the pointsize
|
704
|
-
* @return pointsize
|
633
|
+
* @param pointsize [Float] the pointsize
|
634
|
+
* @return [Float] the given pointsize
|
705
635
|
*/
|
706
636
|
VALUE
|
707
637
|
Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
@@ -716,19 +646,10 @@ Draw_pointsize_eq(VALUE self, VALUE pointsize)
|
|
716
646
|
|
717
647
|
|
718
648
|
/**
|
719
|
-
* Set rotation
|
720
|
-
*
|
721
|
-
* Ruby usage:
|
722
|
-
* - @verbatim Magick::Draw#rotation= @endverbatim
|
649
|
+
* Set rotation. The argument should be in degrees.
|
723
650
|
*
|
724
|
-
*
|
725
|
-
*
|
726
|
-
* - Taken from Magick++'s Magick::Image::annotate method.
|
727
|
-
* Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
|
728
|
-
*
|
729
|
-
* @param self this object
|
730
|
-
* @param deg the number of degrees
|
731
|
-
* @return deg
|
651
|
+
* @param deg [Float] the number of degrees
|
652
|
+
* @return [Float] the given degrees
|
732
653
|
*/
|
733
654
|
VALUE
|
734
655
|
Draw_rotation_eq(VALUE self, VALUE deg)
|
@@ -743,24 +664,19 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
743
664
|
degrees = NUM2DBL(deg);
|
744
665
|
if (fabs(degrees) > DBL_EPSILON)
|
745
666
|
{
|
746
|
-
affine
|
747
|
-
affine.
|
748
|
-
affine.
|
749
|
-
affine.
|
750
|
-
affine.
|
751
|
-
affine.
|
752
|
-
|
753
|
-
|
754
|
-
affine.sx=
|
755
|
-
affine.rx=
|
756
|
-
affine.ry=
|
757
|
-
affine.sy=
|
758
|
-
|
759
|
-
draw->info->affine.sx=current.sx*affine.sx+current.ry*affine.rx;
|
760
|
-
draw->info->affine.rx=current.rx*affine.sx+current.sy*affine.rx;
|
761
|
-
draw->info->affine.ry=current.sx*affine.ry+current.ry*affine.sy;
|
762
|
-
draw->info->affine.sy=current.rx*affine.ry+current.sy*affine.sy;
|
763
|
-
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;
|
764
680
|
}
|
765
681
|
|
766
682
|
return deg;
|
@@ -768,14 +684,10 @@ Draw_rotation_eq(VALUE self, VALUE deg)
|
|
768
684
|
|
769
685
|
|
770
686
|
/**
|
771
|
-
*
|
687
|
+
* Set stroke.
|
772
688
|
*
|
773
|
-
*
|
774
|
-
*
|
775
|
-
*
|
776
|
-
* @param self this object
|
777
|
-
* @param stroke the stroke
|
778
|
-
* @return stroke
|
689
|
+
* @param stroke [Magick::Pixel, String] the stroke
|
690
|
+
* @return [Magick::Pixel, String] the given stroke
|
779
691
|
*/
|
780
692
|
VALUE
|
781
693
|
Draw_stroke_eq(VALUE self, VALUE stroke)
|
@@ -792,19 +704,15 @@ Draw_stroke_eq(VALUE self, VALUE stroke)
|
|
792
704
|
/**
|
793
705
|
* Accept an image as a stroke pattern.
|
794
706
|
*
|
795
|
-
*
|
796
|
-
*
|
797
|
-
*
|
798
|
-
* @
|
799
|
-
* @param pattern the pattern
|
800
|
-
* @return pattern
|
801
|
-
* @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
|
802
711
|
*/
|
803
712
|
VALUE
|
804
713
|
Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
805
714
|
{
|
806
715
|
Draw *draw;
|
807
|
-
Image *image;
|
808
716
|
|
809
717
|
rb_check_frozen(self);
|
810
718
|
Data_Get_Struct(self, Draw, draw);
|
@@ -818,6 +726,8 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
818
726
|
|
819
727
|
if (!NIL_P(pattern))
|
820
728
|
{
|
729
|
+
Image *image;
|
730
|
+
|
821
731
|
// DestroyDrawInfo destroys the clone
|
822
732
|
pattern = rm_cur_image(pattern);
|
823
733
|
image = rm_check_destroyed(pattern);
|
@@ -830,14 +740,10 @@ Draw_stroke_pattern_eq(VALUE self, VALUE pattern)
|
|
830
740
|
|
831
741
|
|
832
742
|
/**
|
833
|
-
*
|
834
|
-
*
|
835
|
-
* Ruby usage:
|
836
|
-
* - @verbatim Draw#stroke_width= @endverbatim
|
743
|
+
* Set stroke width.
|
837
744
|
*
|
838
|
-
* @param
|
839
|
-
* @
|
840
|
-
* @return stroke_width
|
745
|
+
* @param stroke_width [Float] the stroke width
|
746
|
+
* @return [Float] the given stroke width
|
841
747
|
*/
|
842
748
|
VALUE
|
843
749
|
Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
@@ -852,14 +758,10 @@ Draw_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
852
758
|
|
853
759
|
|
854
760
|
/**
|
855
|
-
*
|
761
|
+
* Set whether to enable text antialias.
|
856
762
|
*
|
857
|
-
*
|
858
|
-
*
|
859
|
-
*
|
860
|
-
* @param self this object
|
861
|
-
* @param text_antialias the text_antialias
|
862
|
-
* @return text_antialias
|
763
|
+
* @param text_antialias [Boolean] true if enable text antialias
|
764
|
+
* @return [Boolean] the given value
|
863
765
|
*/
|
864
766
|
VALUE
|
865
767
|
Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
@@ -874,14 +776,10 @@ Draw_text_antialias_eq(VALUE self, VALUE text_antialias)
|
|
874
776
|
|
875
777
|
|
876
778
|
/**
|
877
|
-
*
|
878
|
-
*
|
879
|
-
* Ruby usage:
|
880
|
-
* - @verbatim Draw#tile= @endverbatim
|
779
|
+
* Accept an image as a fill pattern. This is alias of {Draw#fill_pattern=}.
|
881
780
|
*
|
882
|
-
* @param
|
883
|
-
* @
|
884
|
-
* @return image
|
781
|
+
* @param image [Magick::Image] the image to tile
|
782
|
+
* @return [Magick::Image] the given image
|
885
783
|
*/
|
886
784
|
VALUE
|
887
785
|
Draw_tile_eq(VALUE self, VALUE image)
|
@@ -891,14 +789,10 @@ Draw_tile_eq(VALUE self, VALUE image)
|
|
891
789
|
|
892
790
|
|
893
791
|
/**
|
894
|
-
*
|
895
|
-
*
|
896
|
-
* Ruby usage:
|
897
|
-
* - @verbatim Draw#undercolor= @endverbatim
|
792
|
+
* Set undercolor.
|
898
793
|
*
|
899
|
-
* @param
|
900
|
-
* @
|
901
|
-
* @return undercolor
|
794
|
+
* @param undercolor [Magick::Pixel, String] the undercolor
|
795
|
+
* @return [Magick::Pixel, String] the given undercolor
|
902
796
|
*/
|
903
797
|
VALUE
|
904
798
|
Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
@@ -915,21 +809,17 @@ Draw_undercolor_eq(VALUE self, VALUE undercolor)
|
|
915
809
|
/**
|
916
810
|
* Annotates an image with text.
|
917
811
|
*
|
918
|
-
*
|
919
|
-
*
|
920
|
-
*
|
921
|
-
*
|
922
|
-
*
|
923
|
-
*
|
924
|
-
*
|
925
|
-
* @param
|
926
|
-
* @param
|
927
|
-
* @param
|
928
|
-
* @
|
929
|
-
* @param x_arg x position
|
930
|
-
* @param y_arg y position
|
931
|
-
* @param text the annotation text
|
932
|
-
* @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
|
933
823
|
*/
|
934
824
|
VALUE Draw_annotate(
|
935
825
|
VALUE self,
|
@@ -946,6 +836,10 @@ VALUE Draw_annotate(
|
|
946
836
|
long x, y;
|
947
837
|
AffineMatrix keep;
|
948
838
|
char geometry_str[100];
|
839
|
+
char *embed_text;
|
840
|
+
#if defined(IMAGEMAGICK_7)
|
841
|
+
ExceptionInfo *exception;
|
842
|
+
#endif
|
949
843
|
|
950
844
|
// Save the affine matrix in case it is modified by
|
951
845
|
// Draw#rotation=
|
@@ -959,13 +853,39 @@ VALUE Draw_annotate(
|
|
959
853
|
// allowing the app a chance to modify the object's attributes
|
960
854
|
if (rb_block_given_p())
|
961
855
|
{
|
962
|
-
(
|
856
|
+
if (rb_proc_arity(rb_block_proc()) == 0)
|
857
|
+
{
|
858
|
+
// Run the block in self's context
|
859
|
+
rb_warn("passing a block without an image argument is deprecated");
|
860
|
+
rb_obj_instance_eval(0, NULL, self);
|
861
|
+
}
|
862
|
+
else
|
863
|
+
{
|
864
|
+
rb_yield(self);
|
865
|
+
}
|
963
866
|
}
|
964
867
|
|
965
868
|
// Translate & store in Draw structure
|
966
|
-
|
869
|
+
embed_text = StringValueCStr(text);
|
870
|
+
#if defined(IMAGEMAGICK_7)
|
871
|
+
exception = AcquireExceptionInfo();
|
872
|
+
draw->info->text = InterpretImageProperties(NULL, image, embed_text, exception);
|
873
|
+
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
874
|
+
{
|
875
|
+
if (draw->info->text)
|
876
|
+
{
|
877
|
+
magick_free(draw->info->text);
|
878
|
+
}
|
879
|
+
rm_raise_exception(exception);
|
880
|
+
}
|
881
|
+
#else
|
882
|
+
draw->info->text = InterpretImageProperties(NULL, image, embed_text);
|
883
|
+
#endif
|
967
884
|
if (!draw->info->text)
|
968
885
|
{
|
886
|
+
#if defined(IMAGEMAGICK_7)
|
887
|
+
DestroyExceptionInfo(exception);
|
888
|
+
#endif
|
969
889
|
rb_raise(rb_eArgError, "no text");
|
970
890
|
}
|
971
891
|
|
@@ -978,24 +898,33 @@ VALUE Draw_annotate(
|
|
978
898
|
|
979
899
|
if (width == 0 && height == 0)
|
980
900
|
{
|
981
|
-
|
901
|
+
snprintf(geometry_str, sizeof(geometry_str), "%+ld%+ld", x, y);
|
982
902
|
}
|
983
903
|
|
984
904
|
// WxH is non-zero
|
985
905
|
else
|
986
906
|
{
|
987
|
-
|
907
|
+
snprintf(geometry_str, sizeof(geometry_str), "%lux%lu%+ld%+ld", width, height, x, y);
|
988
908
|
}
|
989
909
|
|
990
910
|
magick_clone_string(&draw->info->geometry, geometry_str);
|
991
911
|
|
992
|
-
|
912
|
+
#if defined(IMAGEMAGICK_7)
|
913
|
+
AnnotateImage(image, draw->info, exception);
|
914
|
+
#else
|
915
|
+
AnnotateImage(image, draw->info);
|
916
|
+
#endif
|
993
917
|
|
994
918
|
magick_free(draw->info->text);
|
995
919
|
draw->info->text = NULL;
|
996
920
|
draw->info->affine = keep;
|
997
921
|
|
922
|
+
#if defined(IMAGEMAGICK_7)
|
923
|
+
CHECK_EXCEPTION();
|
924
|
+
DestroyExceptionInfo(exception);
|
925
|
+
#else
|
998
926
|
rm_check_image_exception(image, RetainOnError);
|
927
|
+
#endif
|
999
928
|
|
1000
929
|
return self;
|
1001
930
|
}
|
@@ -1004,13 +933,7 @@ VALUE Draw_annotate(
|
|
1004
933
|
/**
|
1005
934
|
* Clones this object.
|
1006
935
|
*
|
1007
|
-
*
|
1008
|
-
* - @verbatim Draw#clone @endverbatim
|
1009
|
-
*
|
1010
|
-
* @param self this object
|
1011
|
-
* @return the clone
|
1012
|
-
* @see Draw_dup
|
1013
|
-
* @see Draw_init_copy
|
936
|
+
* @return [Magick::Draw] the cloned object
|
1014
937
|
*/
|
1015
938
|
VALUE
|
1016
939
|
Draw_clone(VALUE self)
|
@@ -1030,21 +953,28 @@ Draw_clone(VALUE self)
|
|
1030
953
|
|
1031
954
|
|
1032
955
|
/**
|
1033
|
-
*
|
1034
|
-
*
|
1035
|
-
*
|
1036
|
-
*
|
1037
|
-
*
|
1038
|
-
*
|
1039
|
-
*
|
1040
|
-
*
|
1041
|
-
*
|
956
|
+
* Draw the image.
|
957
|
+
*
|
958
|
+
* @overload composite(x, y, width, height, image)
|
959
|
+
* @param x [Float] x position
|
960
|
+
* @param y [Float] y position
|
961
|
+
* @param width [Float] the width
|
962
|
+
* @param height [Float] the height
|
963
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
964
|
+
* imagelist, uses the current image.
|
965
|
+
*
|
966
|
+
* @overload composite(x, y, width, height, image, operator = Magick::OverCompositeOp)
|
967
|
+
* - The "image" argument can be either an ImageList object or an Image
|
1042
968
|
* argument.
|
1043
|
-
*
|
1044
|
-
*
|
1045
|
-
*
|
1046
|
-
*
|
1047
|
-
*
|
969
|
+
* @param x [Float] x position
|
970
|
+
* @param y [Float] y position
|
971
|
+
* @param width [Float] the width
|
972
|
+
* @param height [Float] the height
|
973
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
974
|
+
* imagelist, uses the current image.
|
975
|
+
* @param operator [Magick::CompositeOperator] the operator
|
976
|
+
*
|
977
|
+
* @return [Magick::Draw] self
|
1048
978
|
*/
|
1049
979
|
VALUE
|
1050
980
|
Draw_composite(int argc, VALUE *argv, VALUE self)
|
@@ -1089,22 +1019,22 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1089
1019
|
Data_Get_Struct(self, Draw, draw);
|
1090
1020
|
|
1091
1021
|
// Create a temp copy of the composite image
|
1092
|
-
rm_write_temp_image(comp_img, name);
|
1022
|
+
rm_write_temp_image(comp_img, name, sizeof(name));
|
1093
1023
|
|
1094
1024
|
// Add the temp filename to the filename array.
|
1095
1025
|
// Use Magick storage since we need to keep the list around
|
1096
1026
|
// until destroy_Draw is called.
|
1097
|
-
tmpfile_name = magick_malloc(sizeof(struct TmpFile_Name)+
|
1027
|
+
tmpfile_name = magick_malloc(sizeof(struct TmpFile_Name) + rm_strnlen_s(name, sizeof(name)));
|
1098
1028
|
strcpy(tmpfile_name->name, name);
|
1099
1029
|
tmpfile_name->next = draw->tmpfile_ary;
|
1100
1030
|
draw->tmpfile_ary = tmpfile_name;
|
1101
1031
|
|
1102
1032
|
// Form the drawing primitive
|
1103
|
-
|
1033
|
+
snprintf(primitive, sizeof(primitive), "image %s %g,%g,%g,%g '%s'", op, x, y, width, height, name);
|
1104
1034
|
|
1105
1035
|
|
1106
1036
|
// Send "primitive" to self.
|
1107
|
-
|
1037
|
+
rb_funcall(self, rb_intern("primitive"), 1, rb_str_new2(primitive));
|
1108
1038
|
|
1109
1039
|
RB_GC_GUARD(image);
|
1110
1040
|
|
@@ -1115,18 +1045,18 @@ Draw_composite(int argc, VALUE *argv, VALUE self)
|
|
1115
1045
|
/**
|
1116
1046
|
* Execute the stored drawing primitives on the current image.
|
1117
1047
|
*
|
1118
|
-
*
|
1119
|
-
*
|
1120
|
-
*
|
1121
|
-
* @param self this object
|
1122
|
-
* @param image_arg the image argument
|
1123
|
-
* @return self
|
1048
|
+
* @param image_arg [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1049
|
+
* imagelist, uses the current image.
|
1050
|
+
* @return [Magick::Draw] self
|
1124
1051
|
*/
|
1125
1052
|
VALUE
|
1126
1053
|
Draw_draw(VALUE self, VALUE image_arg)
|
1127
1054
|
{
|
1128
1055
|
Draw *draw;
|
1129
1056
|
Image *image;
|
1057
|
+
#if defined(IMAGEMAGICK_7)
|
1058
|
+
ExceptionInfo *exception;
|
1059
|
+
#endif
|
1130
1060
|
|
1131
1061
|
image_arg = rm_cur_image(image_arg);
|
1132
1062
|
image = rm_check_frozen(image_arg);
|
@@ -1138,31 +1068,35 @@ Draw_draw(VALUE self, VALUE image_arg)
|
|
1138
1068
|
}
|
1139
1069
|
|
1140
1070
|
// Point the DrawInfo structure at the current set of primitives.
|
1141
|
-
magick_clone_string(&(draw->info->primitive),
|
1071
|
+
magick_clone_string(&(draw->info->primitive), StringValueCStr(draw->primitives));
|
1142
1072
|
|
1143
|
-
|
1144
|
-
|
1073
|
+
#if defined(IMAGEMAGICK_7)
|
1074
|
+
exception = AcquireExceptionInfo();
|
1075
|
+
DrawImage(image, draw->info, exception);
|
1076
|
+
#else
|
1077
|
+
DrawImage(image, draw->info);
|
1078
|
+
#endif
|
1145
1079
|
|
1146
1080
|
magick_free(draw->info->primitive);
|
1147
1081
|
draw->info->primitive = NULL;
|
1148
1082
|
|
1083
|
+
#if defined(IMAGEMAGICK_7)
|
1084
|
+
CHECK_EXCEPTION();
|
1085
|
+
DestroyExceptionInfo(exception);
|
1086
|
+
#else
|
1087
|
+
rm_check_image_exception(image, RetainOnError);
|
1088
|
+
#endif
|
1089
|
+
|
1149
1090
|
return self;
|
1150
1091
|
}
|
1151
1092
|
|
1152
1093
|
|
1153
1094
|
/**
|
1154
|
-
*
|
1155
|
-
*
|
1156
|
-
* Ruby usage:
|
1157
|
-
* - @verbatim Draw#dup @endverbatim
|
1095
|
+
* Duplicate a Draw object.
|
1158
1096
|
*
|
1159
|
-
*
|
1160
|
-
* - Constructs a new Draw object, then calls initialize_copy.
|
1097
|
+
* - Constructs a new Draw object, then calls initialize_copy.
|
1161
1098
|
*
|
1162
|
-
* @
|
1163
|
-
* @return the duplicate
|
1164
|
-
* @see Draw_clone
|
1165
|
-
* @see Draw_init_copy
|
1099
|
+
* @return [Magick::Draw] the duplicated object
|
1166
1100
|
*/
|
1167
1101
|
VALUE
|
1168
1102
|
Draw_dup(VALUE self)
|
@@ -1173,11 +1107,6 @@ Draw_dup(VALUE self)
|
|
1173
1107
|
draw = ALLOC(Draw);
|
1174
1108
|
memset(draw, 0, sizeof(Draw));
|
1175
1109
|
dup = Data_Wrap_Struct(CLASS_OF(self), mark_Draw, destroy_Draw, draw);
|
1176
|
-
if (rb_obj_tainted(self))
|
1177
|
-
{
|
1178
|
-
(void)rb_obj_taint(dup);
|
1179
|
-
}
|
1180
|
-
|
1181
1110
|
RB_GC_GUARD(dup);
|
1182
1111
|
|
1183
1112
|
return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
|
@@ -1187,19 +1116,19 @@ Draw_dup(VALUE self)
|
|
1187
1116
|
/**
|
1188
1117
|
* Returns measurements for a given font and text string.
|
1189
1118
|
*
|
1190
|
-
*
|
1191
|
-
*
|
1192
|
-
*
|
1119
|
+
* - If the image argument has been omitted, use a dummy image, but make sure
|
1120
|
+
* the text has none of the special characters that refer to image
|
1121
|
+
* attributes.
|
1193
1122
|
*
|
1194
|
-
*
|
1195
|
-
*
|
1196
|
-
* the text has none of the special characters that refer to image
|
1197
|
-
* attributes.
|
1123
|
+
* @overload get_type_metrics(text)
|
1124
|
+
* @param text [String] The string to be rendered.
|
1198
1125
|
*
|
1199
|
-
* @
|
1200
|
-
*
|
1201
|
-
*
|
1202
|
-
*
|
1126
|
+
* @overload get_type_metrics(image, text)
|
1127
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1128
|
+
* imagelist, uses the current image.
|
1129
|
+
* @param text [String] The string to be rendered.
|
1130
|
+
*
|
1131
|
+
* @return [Magick::TypeMetric] The information for a specific string if rendered on a image.
|
1203
1132
|
*/
|
1204
1133
|
VALUE
|
1205
1134
|
Draw_get_type_metrics(
|
@@ -1214,19 +1143,19 @@ Draw_get_type_metrics(
|
|
1214
1143
|
/**
|
1215
1144
|
* Returns measurements for a given font and text string.
|
1216
1145
|
*
|
1217
|
-
*
|
1218
|
-
*
|
1219
|
-
*
|
1146
|
+
* - If the image argument has been omitted, use a dummy image, but make sure
|
1147
|
+
* the text has none of the special characters that refer to image
|
1148
|
+
* attributes.
|
1220
1149
|
*
|
1221
|
-
*
|
1222
|
-
*
|
1223
|
-
* the text has none of the special characters that refer to image
|
1224
|
-
* attributes.
|
1150
|
+
* @overload get_multiline_type_metrics(text)
|
1151
|
+
* @param text [String] The string to be rendered.
|
1225
1152
|
*
|
1226
|
-
* @
|
1227
|
-
*
|
1228
|
-
*
|
1229
|
-
*
|
1153
|
+
* @overload Draw#get_multiline_type_metrics(image, text)
|
1154
|
+
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
1155
|
+
* imagelist, uses the current image.
|
1156
|
+
* @param text [String] The string to be rendered.
|
1157
|
+
*
|
1158
|
+
* @return [Magick::TypeMetric] The information for a specific string if rendered on a image.
|
1230
1159
|
*/
|
1231
1160
|
VALUE
|
1232
1161
|
Draw_get_multiline_type_metrics(
|
@@ -1241,14 +1170,8 @@ Draw_get_multiline_type_metrics(
|
|
1241
1170
|
/**
|
1242
1171
|
* Initialize clone, dup methods.
|
1243
1172
|
*
|
1244
|
-
* Ruby usage:
|
1245
|
-
* - @verbatim Draw#initialize_copy @endverbatim
|
1246
|
-
*
|
1247
|
-
* @param self this object
|
1248
1173
|
* @param orig the original object
|
1249
|
-
* @return self
|
1250
|
-
* @see Draw_clone
|
1251
|
-
* @see Draw_dup
|
1174
|
+
* @return [Magick::Draw] self
|
1252
1175
|
*/
|
1253
1176
|
VALUE Draw_init_copy(VALUE self, VALUE orig)
|
1254
1177
|
{
|
@@ -1275,11 +1198,7 @@ VALUE Draw_init_copy(VALUE self, VALUE orig)
|
|
1275
1198
|
/**
|
1276
1199
|
* Initialize Draw object.
|
1277
1200
|
*
|
1278
|
-
*
|
1279
|
-
* - @verbatim Draw#initialize <{ info initializers }> @endverbatim
|
1280
|
-
*
|
1281
|
-
* @param self this object
|
1282
|
-
* @return self
|
1201
|
+
* @return [Magick::Draw] self
|
1283
1202
|
*/
|
1284
1203
|
VALUE
|
1285
1204
|
Draw_initialize(VALUE self)
|
@@ -1303,12 +1222,8 @@ Draw_initialize(VALUE self)
|
|
1303
1222
|
/**
|
1304
1223
|
* Display the primitives.
|
1305
1224
|
*
|
1306
|
-
* Ruby
|
1307
|
-
*
|
1308
|
-
*
|
1309
|
-
* @param self this object
|
1310
|
-
* @return the draw primitives or the Ruby string "(no primitives defined)" if
|
1311
|
-
* they are not defined
|
1225
|
+
* @return [String] the draw primitives or the Ruby string "(no primitives defined)"
|
1226
|
+
* if they are not defined
|
1312
1227
|
*/
|
1313
1228
|
VALUE
|
1314
1229
|
Draw_inspect(VALUE self)
|
@@ -1323,13 +1238,7 @@ Draw_inspect(VALUE self)
|
|
1323
1238
|
/**
|
1324
1239
|
* Create a new Draw object.
|
1325
1240
|
*
|
1326
|
-
*
|
1327
|
-
* - @verbatim Draw.new @endverbatim
|
1328
|
-
* - @verbatim Draw.allocate @endverbatim
|
1329
|
-
*
|
1330
|
-
* @param class the Ruby Draw class
|
1331
|
-
* @return a new Draw object
|
1332
|
-
* @throw ImageMagickError if no memory
|
1241
|
+
* @return [Magick::Draw] a new Draw object
|
1333
1242
|
*/
|
1334
1243
|
VALUE Draw_alloc(VALUE class)
|
1335
1244
|
{
|
@@ -1349,12 +1258,8 @@ VALUE Draw_alloc(VALUE class)
|
|
1349
1258
|
/**
|
1350
1259
|
* Add a drawing primitive to the list of primitives in the Draw object.
|
1351
1260
|
*
|
1352
|
-
*
|
1353
|
-
*
|
1354
|
-
*
|
1355
|
-
* @param self this object
|
1356
|
-
* @param primitive the primitive to add
|
1357
|
-
* @return self
|
1261
|
+
* @param primitive [String] the primitive to add
|
1262
|
+
* @return [Magick::Draw] self
|
1358
1263
|
*/
|
1359
1264
|
VALUE
|
1360
1265
|
Draw_primitive(VALUE self, VALUE primitive)
|
@@ -1408,17 +1313,18 @@ static void
|
|
1408
1313
|
destroy_Draw(void *drawptr)
|
1409
1314
|
{
|
1410
1315
|
Draw *draw = (Draw *)drawptr;
|
1411
|
-
struct TmpFile_Name *tmpfile_name;
|
1412
1316
|
|
1413
1317
|
if (draw->info)
|
1414
1318
|
{
|
1415
|
-
|
1319
|
+
DestroyDrawInfo(draw->info);
|
1416
1320
|
draw->info = NULL;
|
1417
1321
|
}
|
1418
1322
|
|
1419
1323
|
// Erase any temporary image files.
|
1420
1324
|
while (draw->tmpfile_ary)
|
1421
1325
|
{
|
1326
|
+
struct TmpFile_Name *tmpfile_name;
|
1327
|
+
|
1422
1328
|
tmpfile_name = draw->tmpfile_ary;
|
1423
1329
|
draw->tmpfile_ary = draw->tmpfile_ary->next;
|
1424
1330
|
rm_delete_temp_image(tmpfile_name->name);
|
@@ -1446,16 +1352,10 @@ new_DrawOptions(void)
|
|
1446
1352
|
/**
|
1447
1353
|
* Create a DrawOptions object.
|
1448
1354
|
*
|
1449
|
-
*
|
1450
|
-
*
|
1451
|
-
* - @verbatim DrawOptions#new @endverbatim
|
1355
|
+
* - The DrawOptions class is the same as the Draw class except is has only
|
1356
|
+
* the attribute writer functions
|
1452
1357
|
*
|
1453
|
-
*
|
1454
|
-
* - The DrawOptions class is the same as the Draw class except is has only
|
1455
|
-
* the attribute writer functions
|
1456
|
-
*
|
1457
|
-
* @param class the Ruby DrawOptions class
|
1458
|
-
* @return a new DrawOptions object
|
1358
|
+
* @return [Magick::Image::DrawOptions] a new DrawOptions object
|
1459
1359
|
*/
|
1460
1360
|
VALUE
|
1461
1361
|
DrawOptions_alloc(VALUE class)
|
@@ -1476,11 +1376,7 @@ DrawOptions_alloc(VALUE class)
|
|
1476
1376
|
/**
|
1477
1377
|
* Initialize a DrawOptions object.
|
1478
1378
|
*
|
1479
|
-
*
|
1480
|
-
* - @verbatim DrawOptions#initialize @endverbatim
|
1481
|
-
*
|
1482
|
-
* @param self this object
|
1483
|
-
* @return self
|
1379
|
+
* @return [Magick::Image::DrawOptions] self
|
1484
1380
|
*/
|
1485
1381
|
VALUE
|
1486
1382
|
DrawOptions_initialize(VALUE self)
|
@@ -1498,8 +1394,16 @@ DrawOptions_initialize(VALUE self)
|
|
1498
1394
|
|
1499
1395
|
if (rb_block_given_p())
|
1500
1396
|
{
|
1501
|
-
|
1502
|
-
|
1397
|
+
if (rb_proc_arity(rb_block_proc()) == 0)
|
1398
|
+
{
|
1399
|
+
// Run the block in self's context
|
1400
|
+
rb_warn("passing a block without an image argument is deprecated");
|
1401
|
+
rb_obj_instance_eval(0, NULL, self);
|
1402
|
+
}
|
1403
|
+
else
|
1404
|
+
{
|
1405
|
+
rb_yield(self);
|
1406
|
+
}
|
1503
1407
|
}
|
1504
1408
|
|
1505
1409
|
return self;
|
@@ -1507,18 +1411,12 @@ DrawOptions_initialize(VALUE self)
|
|
1507
1411
|
|
1508
1412
|
|
1509
1413
|
/**
|
1510
|
-
* Allocate a new Magick::PolaroidOptions object.
|
1414
|
+
* Allocate a new Magick::Image::PolaroidOptions object.
|
1511
1415
|
*
|
1512
|
-
*
|
1513
|
-
*
|
1514
|
-
* - @verbatim Magick::PolaroidOptions#new @endverbatim
|
1416
|
+
* - Internally a PolaroidOptions object is the same as a Draw object. The
|
1417
|
+
* methods are implemented by Draw methods in rmdraw.c.
|
1515
1418
|
*
|
1516
|
-
*
|
1517
|
-
* - Internally a PolaroidOptions object is the same as a Draw object. The
|
1518
|
-
* methods are implemented by Draw methods in rmdraw.c.
|
1519
|
-
*
|
1520
|
-
* @param class the Ruby PoloradoidOptions class
|
1521
|
-
* @return a new DrawOptions object
|
1419
|
+
* @return [Magick::Image::PolaroidOptions] a new PolaroidOptions object
|
1522
1420
|
*/
|
1523
1421
|
VALUE
|
1524
1422
|
PolaroidOptions_alloc(VALUE class)
|
@@ -1532,8 +1430,8 @@ PolaroidOptions_alloc(VALUE class)
|
|
1532
1430
|
draw = ALLOC(Draw);
|
1533
1431
|
memset(draw, 0, sizeof(*draw));
|
1534
1432
|
|
1535
|
-
draw->info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
|
1536
|
-
(void)
|
1433
|
+
draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
|
1434
|
+
(void) DestroyImageInfo(image_info);
|
1537
1435
|
|
1538
1436
|
polaroid_obj = Data_Wrap_Struct(class, NULL, destroy_Draw, draw);
|
1539
1437
|
|
@@ -1544,13 +1442,11 @@ PolaroidOptions_alloc(VALUE class)
|
|
1544
1442
|
|
1545
1443
|
|
1546
1444
|
/**
|
1547
|
-
*
|
1445
|
+
* Initialize a PolaroidOptions object.
|
1548
1446
|
*
|
1549
|
-
*
|
1550
|
-
*
|
1551
|
-
*
|
1552
|
-
* @param self this object
|
1553
|
-
* @return self
|
1447
|
+
* @yield [self]
|
1448
|
+
* @yieldparam self [Magick::Image::PolaroidOptions] self
|
1449
|
+
* @return [Magick::Image::PolaroidOptions] self
|
1554
1450
|
*/
|
1555
1451
|
VALUE
|
1556
1452
|
PolaroidOptions_initialize(VALUE self)
|
@@ -1562,17 +1458,26 @@ PolaroidOptions_initialize(VALUE self)
|
|
1562
1458
|
Data_Get_Struct(self, Draw, draw);
|
1563
1459
|
|
1564
1460
|
exception = AcquireExceptionInfo();
|
1565
|
-
|
1566
|
-
CHECK_EXCEPTION()
|
1567
|
-
|
1568
|
-
CHECK_EXCEPTION()
|
1461
|
+
QueryColorCompliance("gray75", AllCompliance, &draw->shadow_color, exception);
|
1462
|
+
CHECK_EXCEPTION();
|
1463
|
+
QueryColorCompliance("#dfdfdf", AllCompliance, &draw->info->border_color, exception);
|
1464
|
+
CHECK_EXCEPTION();
|
1569
1465
|
DestroyExceptionInfo(exception);
|
1570
1466
|
|
1571
1467
|
if (rb_block_given_p())
|
1572
1468
|
{
|
1573
|
-
|
1574
|
-
|
1469
|
+
if (rb_proc_arity(rb_block_proc()) == 0)
|
1470
|
+
{
|
1471
|
+
// Run the block in self's context
|
1472
|
+
rb_warn("passing a block without an image argument is deprecated");
|
1473
|
+
rb_obj_instance_eval(0, NULL, self);
|
1474
|
+
}
|
1475
|
+
else
|
1476
|
+
{
|
1477
|
+
rb_yield(self);
|
1478
|
+
}
|
1575
1479
|
}
|
1480
|
+
|
1576
1481
|
return self;
|
1577
1482
|
}
|
1578
1483
|
|
@@ -1594,12 +1499,8 @@ rm_polaroid_new(void)
|
|
1594
1499
|
/**
|
1595
1500
|
* Set the shadow color attribute.
|
1596
1501
|
*
|
1597
|
-
*
|
1598
|
-
*
|
1599
|
-
*
|
1600
|
-
* @param self this object
|
1601
|
-
* @param shadow the shadow color
|
1602
|
-
* @return shadow
|
1502
|
+
* @param shadow [Magick::Pixel, String] the shadow color
|
1503
|
+
* @return [Magick::Pixel, String] the given shadow color
|
1603
1504
|
*/
|
1604
1505
|
VALUE
|
1605
1506
|
PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
@@ -1614,14 +1515,10 @@ PolaroidOptions_shadow_color_eq(VALUE self, VALUE shadow)
|
|
1614
1515
|
|
1615
1516
|
|
1616
1517
|
/**
|
1617
|
-
* Set the border color
|
1618
|
-
*
|
1619
|
-
* Ruby usage:
|
1620
|
-
* - @verbatim PolaroidOptions#border_color= @endverbatim
|
1518
|
+
* Set the border color.
|
1621
1519
|
*
|
1622
|
-
* @param
|
1623
|
-
* @
|
1624
|
-
* @return border
|
1520
|
+
* @param border [Magick::Pixel, String] the border color
|
1521
|
+
* @return [Magick::Pixel, String] the given border color
|
1625
1522
|
*/
|
1626
1523
|
VALUE
|
1627
1524
|
PolaroidOptions_border_color_eq(VALUE self, VALUE border)
|
@@ -1648,11 +1545,11 @@ get_dummy_tm_img(VALUE klass)
|
|
1648
1545
|
{
|
1649
1546
|
#define DUMMY_IMG_CLASS_VAR "@@_dummy_img_"
|
1650
1547
|
VALUE dummy_img = 0;
|
1651
|
-
Info *info;
|
1652
|
-
Image *image;
|
1653
1548
|
|
1654
1549
|
if (rb_cvar_defined(klass, rb_intern(DUMMY_IMG_CLASS_VAR)) != Qtrue)
|
1655
1550
|
{
|
1551
|
+
Info *info;
|
1552
|
+
Image *image;
|
1656
1553
|
|
1657
1554
|
info = CloneImageInfo(NULL);
|
1658
1555
|
if (!info)
|
@@ -1660,7 +1557,7 @@ get_dummy_tm_img(VALUE klass)
|
|
1660
1557
|
rb_raise(rb_eNoMemError, "not enough memory to continue");
|
1661
1558
|
}
|
1662
1559
|
image = rm_acquire_image(info);
|
1663
|
-
|
1560
|
+
DestroyImageInfo(info);
|
1664
1561
|
|
1665
1562
|
if (!image)
|
1666
1563
|
{
|
@@ -1708,6 +1605,9 @@ get_type_metrics(
|
|
1708
1605
|
char *text = NULL;
|
1709
1606
|
long text_l;
|
1710
1607
|
unsigned int okay;
|
1608
|
+
#if defined(IMAGEMAGICK_7)
|
1609
|
+
ExceptionInfo *exception;
|
1610
|
+
#endif
|
1711
1611
|
|
1712
1612
|
switch (argc)
|
1713
1613
|
{
|
@@ -1731,25 +1631,53 @@ get_type_metrics(
|
|
1731
1631
|
}
|
1732
1632
|
|
1733
1633
|
Data_Get_Struct(self, Draw, draw);
|
1634
|
+
#if defined(IMAGEMAGICK_7)
|
1635
|
+
exception = AcquireExceptionInfo();
|
1636
|
+
draw->info->text = InterpretImageProperties(NULL, image, text, exception);
|
1637
|
+
if (rm_should_raise_exception(exception, RetainExceptionRetention))
|
1638
|
+
{
|
1639
|
+
if (draw->info->text)
|
1640
|
+
{
|
1641
|
+
magick_free(draw->info->text);
|
1642
|
+
}
|
1643
|
+
rm_raise_exception(exception);
|
1644
|
+
}
|
1645
|
+
#else
|
1734
1646
|
draw->info->text = InterpretImageProperties(NULL, image, text);
|
1647
|
+
#endif
|
1735
1648
|
if (!draw->info->text)
|
1736
1649
|
{
|
1650
|
+
#if defined(IMAGEMAGICK_7)
|
1651
|
+
DestroyExceptionInfo(exception);
|
1652
|
+
#endif
|
1737
1653
|
rb_raise(rb_eArgError, "no text to measure");
|
1738
1654
|
}
|
1739
1655
|
|
1656
|
+
#if defined(IMAGEMAGICK_7)
|
1657
|
+
okay = (*getter)(image, draw->info, &metrics, exception);
|
1658
|
+
#else
|
1740
1659
|
okay = (*getter)(image, draw->info, &metrics);
|
1660
|
+
#endif
|
1741
1661
|
|
1742
1662
|
magick_free(draw->info->text);
|
1743
1663
|
draw->info->text = NULL;
|
1744
1664
|
|
1745
1665
|
if (!okay)
|
1746
1666
|
{
|
1667
|
+
#if defined(IMAGEMAGICK_7)
|
1668
|
+
CHECK_EXCEPTION();
|
1669
|
+
DestroyExceptionInfo(exception);
|
1670
|
+
#else
|
1747
1671
|
rm_check_image_exception(image, RetainOnError);
|
1672
|
+
#endif
|
1748
1673
|
|
1749
1674
|
// Shouldn't get here...
|
1750
1675
|
rb_raise(rb_eRuntimeError, "Can't measure text. Are the fonts installed? "
|
1751
1676
|
"Is the FreeType library installed?");
|
1752
1677
|
}
|
1678
|
+
#if defined(IMAGEMAGICK_7)
|
1679
|
+
DestroyExceptionInfo(exception);
|
1680
|
+
#endif
|
1753
1681
|
|
1754
1682
|
RB_GC_GUARD(t);
|
1755
1683
|
|