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/rminfo.c
CHANGED
@@ -13,33 +13,10 @@
|
|
13
13
|
#include "rmagick.h"
|
14
14
|
|
15
15
|
|
16
|
-
/*
|
17
|
-
* Define functions to get/set attributes in Image::Info that
|
18
|
-
* use the Get/SetImageOption API.
|
19
|
-
*/
|
20
|
-
//! Option attribute reader. For Image::Info.
|
21
|
-
#define OPTION_ATTR_READER(opt, key) \
|
22
|
-
VALUE Info_##opt(VALUE self)\
|
23
|
-
{\
|
24
|
-
return get_option(self, #key);\
|
25
|
-
}
|
26
|
-
//! Option attribute writer. For Image::Info.
|
27
|
-
#define OPTION_ATTR_WRITER(opt, key) \
|
28
|
-
VALUE Info_##opt##_eq(VALUE self, VALUE string)\
|
29
|
-
{\
|
30
|
-
return set_option(self, #key, string);\
|
31
|
-
}
|
32
|
-
//! Option attribute accessor. For Image::Info.
|
33
|
-
#define OPTION_ATTR_ACCESSOR(opt, key)\
|
34
|
-
OPTION_ATTR_READER(opt, key)\
|
35
|
-
OPTION_ATTR_WRITER(opt, key)
|
36
|
-
|
37
|
-
|
38
16
|
/**
|
39
17
|
* Return the value of the specified option.
|
40
18
|
*
|
41
|
-
* Ruby usage
|
42
|
-
* - @verbatim Info#get_option(key) @endverbatim
|
19
|
+
* No Ruby usage (internal function)
|
43
20
|
*
|
44
21
|
* @param self this object
|
45
22
|
* @param key the option key
|
@@ -65,8 +42,7 @@ get_option(VALUE self, const char *key)
|
|
65
42
|
* Set the specified option to this value. If the value is nil just unset any
|
66
43
|
* current value.
|
67
44
|
*
|
68
|
-
* Ruby usage
|
69
|
-
* - @verbatim Info#set_option(key,string) @endverbatim
|
45
|
+
* No Ruby usage (internal function)
|
70
46
|
*
|
71
47
|
* @param self this object
|
72
48
|
* @param key the option key
|
@@ -77,18 +53,19 @@ static VALUE
|
|
77
53
|
set_option(VALUE self, const char *key, VALUE string)
|
78
54
|
{
|
79
55
|
Info *info;
|
80
|
-
char *value;
|
81
56
|
|
82
57
|
Data_Get_Struct(self, Info, info);
|
83
58
|
|
84
59
|
if (NIL_P(string))
|
85
60
|
{
|
86
|
-
|
61
|
+
DeleteImageOption(info, key);
|
87
62
|
}
|
88
63
|
else
|
89
64
|
{
|
90
|
-
value
|
91
|
-
|
65
|
+
char *value;
|
66
|
+
|
67
|
+
value = StringValueCStr(string);
|
68
|
+
SetImageOption(info, key, value);
|
92
69
|
}
|
93
70
|
return string;
|
94
71
|
}
|
@@ -110,29 +87,30 @@ set_option(VALUE self, const char *key, VALUE string)
|
|
110
87
|
static VALUE set_color_option(VALUE self, const char *option, VALUE color)
|
111
88
|
{
|
112
89
|
Info *info;
|
113
|
-
char *name;
|
114
90
|
PixelColor pp;
|
115
|
-
ExceptionInfo *exception;
|
116
91
|
MagickBooleanType okay;
|
117
92
|
|
118
93
|
Data_Get_Struct(self, Info, info);
|
119
94
|
|
120
95
|
if (NIL_P(color))
|
121
96
|
{
|
122
|
-
|
97
|
+
DeleteImageOption(info, option);
|
123
98
|
}
|
124
99
|
else
|
125
100
|
{
|
126
|
-
name
|
101
|
+
char *name;
|
102
|
+
ExceptionInfo *exception;
|
103
|
+
|
104
|
+
name = StringValueCStr(color);
|
127
105
|
exception = AcquireExceptionInfo();
|
128
106
|
okay = QueryColorCompliance(name, AllCompliance, &pp, exception);
|
129
|
-
|
107
|
+
DestroyExceptionInfo(exception);
|
130
108
|
if (!okay)
|
131
109
|
{
|
132
110
|
rb_raise(rb_eArgError, "invalid color name `%s'", name);
|
133
111
|
}
|
134
112
|
|
135
|
-
|
113
|
+
SetImageOption(info, option, name);
|
136
114
|
}
|
137
115
|
|
138
116
|
return color;
|
@@ -188,81 +166,79 @@ static VALUE get_dbl_option(VALUE self, const char *option)
|
|
188
166
|
static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
|
189
167
|
{
|
190
168
|
Info *info;
|
191
|
-
char buff[50];
|
192
|
-
double d;
|
193
|
-
long n;
|
194
|
-
int len;
|
195
169
|
|
196
170
|
Data_Get_Struct(self, Info, info);
|
197
171
|
|
198
172
|
if (NIL_P(value))
|
199
173
|
{
|
200
|
-
|
174
|
+
DeleteImageOption(info, option);
|
201
175
|
}
|
202
176
|
else
|
203
177
|
{
|
178
|
+
char buff[50];
|
179
|
+
double d;
|
180
|
+
int len;
|
181
|
+
long n;
|
182
|
+
|
204
183
|
d = NUM2DBL(value);
|
205
184
|
n = floor(d);
|
206
185
|
if (d == n)
|
207
186
|
{
|
208
|
-
len =
|
187
|
+
len = snprintf(buff, sizeof(buff), "%-10ld", n);
|
209
188
|
}
|
210
189
|
else
|
211
190
|
{
|
212
|
-
len =
|
191
|
+
len = snprintf(buff, sizeof(buff), "%-10.2f", d);
|
213
192
|
}
|
214
193
|
memset(buff+len, '\0', sizeof(buff)-len);
|
215
|
-
|
194
|
+
SetImageOption(info, option, buff);
|
216
195
|
}
|
217
196
|
|
218
197
|
return value;
|
219
198
|
}
|
220
199
|
|
221
200
|
|
222
|
-
#if 0
|
223
201
|
/**
|
224
|
-
*
|
202
|
+
* Get antialias value
|
225
203
|
*
|
226
|
-
*
|
227
|
-
*
|
228
|
-
* @param pp the pixel packet
|
229
|
-
* @param name pointer to the name
|
230
|
-
* @return the name
|
204
|
+
* @return [Boolean] true if antialias is enabled
|
231
205
|
*/
|
232
|
-
|
206
|
+
VALUE
|
207
|
+
Info_antialias(VALUE self)
|
233
208
|
{
|
234
|
-
|
235
|
-
|
236
|
-
rm_init_magickpixel(NULL, &mpp);
|
237
|
-
rm_set_magick_pixel_packet(pp, &mpp);
|
238
|
-
(void) GetColorTuple(&mpp, MagickTrue, name);
|
239
|
-
return name;
|
209
|
+
IMPLEMENT_ATTR_READER(Info, antialias, boolean);
|
240
210
|
}
|
241
|
-
#endif
|
242
|
-
|
243
211
|
|
244
|
-
|
212
|
+
/**
|
213
|
+
* Set antialias value
|
214
|
+
*
|
215
|
+
* @param val [Boolean] true or false
|
216
|
+
* @return [Boolean] the given value
|
217
|
+
*/
|
218
|
+
VALUE
|
219
|
+
Info_antialias_eq(VALUE self, VALUE val)
|
220
|
+
{
|
221
|
+
IMPLEMENT_ATTR_WRITER(Info, antialias, boolean);
|
222
|
+
}
|
245
223
|
|
246
224
|
/** Maximum length of a format (@see Info_aref) */
|
247
225
|
#define MAX_FORMAT_LEN 60
|
248
226
|
|
249
227
|
/**
|
250
|
-
* Get the value of
|
228
|
+
* Get the value of the specified option for the specified format.
|
251
229
|
*
|
252
|
-
*
|
253
|
-
*
|
254
|
-
*
|
230
|
+
* - The 2 argument form is the original form. Added support for a single
|
231
|
+
* argument after ImageMagick started using Set/GetImageOption for options
|
232
|
+
* that aren't represented by fields in the ImageInfo structure.
|
255
233
|
*
|
256
|
-
*
|
257
|
-
*
|
258
|
-
*
|
259
|
-
* that aren't represented by fields in the ImageInfo structure.
|
234
|
+
* @overload [](format, key)
|
235
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
236
|
+
* @param key [String] A string that identifies the option.
|
260
237
|
*
|
261
|
-
* @
|
262
|
-
*
|
263
|
-
*
|
264
|
-
* @return the option
|
265
|
-
* @see Info_aset
|
238
|
+
* @overload [](key)
|
239
|
+
* @param key [String] A string that identifies the option.
|
240
|
+
*
|
241
|
+
* @return [String] The value of the option.
|
266
242
|
*/
|
267
243
|
VALUE
|
268
244
|
Info_aref(int argc, VALUE *argv, VALUE self)
|
@@ -287,8 +263,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
287
263
|
break;
|
288
264
|
|
289
265
|
case 1:
|
290
|
-
|
291
|
-
fkey[sizeof(fkey)-1] = '\0';
|
266
|
+
strlcpy(fkey, StringValueCStr(argv[0]), sizeof(fkey));
|
292
267
|
break;
|
293
268
|
|
294
269
|
default:
|
@@ -309,26 +284,23 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
309
284
|
|
310
285
|
|
311
286
|
/**
|
312
|
-
*
|
287
|
+
* Define an option. An alternative to {Info#define}.
|
288
|
+
* Use this method to set options for reading or writing certain image formats.
|
313
289
|
*
|
314
|
-
*
|
315
|
-
*
|
316
|
-
* - @verbatim Info[key]= @endverbatim
|
290
|
+
* - Essentially the same function as {Info#define} but paired with {Info#[]}
|
291
|
+
* - If the value is nil it is equivalent to {Info#undefine}.
|
317
292
|
*
|
318
|
-
*
|
319
|
-
*
|
320
|
-
*
|
321
|
-
*
|
322
|
-
*
|
323
|
-
*
|
324
|
-
*
|
325
|
-
* @
|
326
|
-
* @
|
327
|
-
* @
|
328
|
-
* @
|
329
|
-
* @see Info_aref
|
330
|
-
* @see Info_define
|
331
|
-
* @see Info_undefine
|
293
|
+
* @overload []=(format, key)
|
294
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
295
|
+
* @param key [String] A string that identifies the option.
|
296
|
+
*
|
297
|
+
* @overload []=(key)
|
298
|
+
* @param key [String] A string that identifies the option.
|
299
|
+
*
|
300
|
+
* @return [Magick::Image::Info] self
|
301
|
+
* @see #[]
|
302
|
+
* @see #define
|
303
|
+
* @see #undefine
|
332
304
|
*/
|
333
305
|
VALUE
|
334
306
|
Info_aset(int argc, VALUE *argv, VALUE self)
|
@@ -338,8 +310,6 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
338
310
|
char *format_p, *key_p, *value_p = NULL;
|
339
311
|
long format_l, key_l;
|
340
312
|
char ckey[MaxTextExtent];
|
341
|
-
unsigned int okay;
|
342
|
-
|
343
313
|
|
344
314
|
Data_Get_Struct(self, Info, info);
|
345
315
|
|
@@ -354,14 +324,13 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
354
324
|
rb_raise(rb_eArgError, "%.60s:%.1024s not defined - too long", format_p, key_p);
|
355
325
|
}
|
356
326
|
|
357
|
-
|
327
|
+
snprintf(ckey, sizeof(ckey), "%.60s:%.*s", format_p, (int)(sizeof(ckey)-MAX_FORMAT_LEN), key_p);
|
358
328
|
|
359
329
|
value = argv[2];
|
360
330
|
break;
|
361
331
|
|
362
332
|
case 2:
|
363
|
-
|
364
|
-
ckey[sizeof(ckey)-1] = '\0';
|
333
|
+
strlcpy(ckey, StringValueCStr(argv[0]), sizeof(ckey));
|
365
334
|
|
366
335
|
value = argv[1];
|
367
336
|
break;
|
@@ -373,13 +342,15 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
373
342
|
|
374
343
|
if (NIL_P(value))
|
375
344
|
{
|
376
|
-
|
345
|
+
DeleteImageOption(info, ckey);
|
377
346
|
}
|
378
347
|
else
|
379
348
|
{
|
349
|
+
unsigned int okay;
|
350
|
+
|
380
351
|
/* Allow any argument that supports to_s */
|
381
|
-
value =
|
382
|
-
value_p =
|
352
|
+
value = rb_String(value);
|
353
|
+
value_p = StringValueCStr(value);
|
383
354
|
|
384
355
|
okay = SetImageOption(info, ckey, value_p);
|
385
356
|
if (!okay)
|
@@ -396,13 +367,9 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
396
367
|
|
397
368
|
|
398
369
|
/**
|
399
|
-
* Get the attenuate
|
400
|
-
*
|
401
|
-
* Ruby usage:
|
402
|
-
* - @verbatim Info#attenuate @endverbatim
|
370
|
+
* Get the attenuate value.
|
403
371
|
*
|
404
|
-
* @
|
405
|
-
* @return the attenuate
|
372
|
+
* @return [Float] the attenuate
|
406
373
|
*/
|
407
374
|
VALUE
|
408
375
|
Info_attenuate(VALUE self)
|
@@ -412,14 +379,10 @@ Info_attenuate(VALUE self)
|
|
412
379
|
|
413
380
|
|
414
381
|
/**
|
415
|
-
* Set the attenuate
|
382
|
+
* Set the attenuate value.
|
416
383
|
*
|
417
|
-
*
|
418
|
-
*
|
419
|
-
*
|
420
|
-
* @param self this object
|
421
|
-
* @param value the attenuate
|
422
|
-
* @return self
|
384
|
+
* @param value [Float] the attenuate
|
385
|
+
* @return [Float] the attenuate
|
423
386
|
*/
|
424
387
|
VALUE
|
425
388
|
Info_attenuate_eq(VALUE self, VALUE value)
|
@@ -429,13 +392,9 @@ Info_attenuate_eq(VALUE self, VALUE value)
|
|
429
392
|
|
430
393
|
|
431
394
|
/**
|
432
|
-
* Get the authenticate
|
395
|
+
* Get the authenticate value.
|
433
396
|
*
|
434
|
-
*
|
435
|
-
* - @verbatim Info#authenticate @endverbatim
|
436
|
-
*
|
437
|
-
* @param self this object
|
438
|
-
* @return the authenticate
|
397
|
+
* @return [String] the authenticate
|
439
398
|
*/
|
440
399
|
VALUE
|
441
400
|
Info_authenticate(VALUE self)
|
@@ -452,14 +411,10 @@ Info_authenticate(VALUE self)
|
|
452
411
|
|
453
412
|
|
454
413
|
/**
|
455
|
-
* Set the authenticate
|
456
|
-
*
|
457
|
-
* Ruby usage:
|
458
|
-
* - @verbatim Info#authenticate= @endverbatim
|
414
|
+
* Set the authenticate value.
|
459
415
|
*
|
460
|
-
* @param
|
461
|
-
* @
|
462
|
-
* @return passwd_arg
|
416
|
+
* @param passwd_arg [String] the authenticating password
|
417
|
+
* @return [String] the given value
|
463
418
|
*/
|
464
419
|
VALUE
|
465
420
|
Info_authenticate_eq(VALUE self, VALUE passwd_arg)
|
@@ -471,7 +426,7 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
|
|
471
426
|
|
472
427
|
if (!NIL_P(passwd_arg))
|
473
428
|
{
|
474
|
-
passwd =
|
429
|
+
passwd = StringValueCStr(passwd_arg);
|
475
430
|
}
|
476
431
|
|
477
432
|
#if defined(IMAGEMAGICK_7)
|
@@ -502,12 +457,8 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
|
|
502
457
|
/**
|
503
458
|
* Return the name of the background color as a String
|
504
459
|
*
|
505
|
-
*
|
506
|
-
*
|
507
|
-
*
|
508
|
-
* @param self this object
|
509
|
-
* @return the name of the background color
|
510
|
-
* @see Image_background_color
|
460
|
+
* @return [String] the name of the background color
|
461
|
+
* @see Image#background_color
|
511
462
|
*/
|
512
463
|
VALUE
|
513
464
|
Info_background_color(VALUE self)
|
@@ -522,38 +473,25 @@ Info_background_color(VALUE self)
|
|
522
473
|
/**
|
523
474
|
* Set the background color.
|
524
475
|
*
|
525
|
-
*
|
526
|
-
*
|
527
|
-
*
|
528
|
-
* Notes:
|
529
|
-
* - Color should be a string
|
530
|
-
*
|
531
|
-
* @param self this object
|
532
|
-
* @param bc_arg the background color
|
533
|
-
* @return bc_arg
|
534
|
-
* @throw ArgumentError
|
476
|
+
* @param bc_arg [Magick::Pixel, String] the background color
|
477
|
+
* @return [Magick::Pixel, String] the given color
|
535
478
|
*/
|
536
479
|
VALUE
|
537
480
|
Info_background_color_eq(VALUE self, VALUE bc_arg)
|
538
481
|
{
|
539
482
|
Info *info;
|
540
|
-
//char colorname[MaxTextExtent];
|
541
483
|
|
542
484
|
Data_Get_Struct(self, Info, info);
|
543
485
|
Color_to_PixelColor(&info->background_color, bc_arg);
|
544
|
-
|
486
|
+
|
545
487
|
return bc_arg;
|
546
488
|
}
|
547
489
|
|
548
490
|
/**
|
549
491
|
* Return the name of the border color as a String.
|
550
492
|
*
|
551
|
-
*
|
552
|
-
*
|
553
|
-
*
|
554
|
-
* @param self this object
|
555
|
-
* @return the border color
|
556
|
-
* @see Image_border_color
|
493
|
+
* @return [String] the border color name
|
494
|
+
* @see Image#border_color
|
557
495
|
*/
|
558
496
|
VALUE
|
559
497
|
Info_border_color(VALUE self)
|
@@ -567,39 +505,26 @@ Info_border_color(VALUE self)
|
|
567
505
|
/**
|
568
506
|
* set the border color
|
569
507
|
*
|
570
|
-
*
|
571
|
-
*
|
572
|
-
*
|
573
|
-
* Notes:
|
574
|
-
* - Color should be a string
|
575
|
-
*
|
576
|
-
* @param self this object
|
577
|
-
* @param bc_arg the border color
|
578
|
-
* @return bc_arg
|
579
|
-
* @throw ArgumentError
|
508
|
+
* @param bc_arg [Magick::Pixel, String] the border color
|
509
|
+
* @return [Magick::Pixel, String] the given color
|
580
510
|
*/
|
581
511
|
VALUE
|
582
512
|
Info_border_color_eq(VALUE self, VALUE bc_arg)
|
583
513
|
{
|
584
514
|
Info *info;
|
585
|
-
//char colorname[MaxTextExtent];
|
586
515
|
|
587
516
|
Data_Get_Struct(self, Info, info);
|
588
517
|
Color_to_PixelColor(&info->border_color, bc_arg);
|
589
|
-
|
518
|
+
|
590
519
|
return bc_arg;
|
591
520
|
}
|
592
521
|
|
593
522
|
|
594
523
|
|
595
524
|
/**
|
596
|
-
*
|
525
|
+
* Get a caption of image
|
597
526
|
*
|
598
|
-
*
|
599
|
-
* - @verbatim Info#caption @endverbatim
|
600
|
-
*
|
601
|
-
* @param self this object
|
602
|
-
* @return the caption
|
527
|
+
* @return [String] the caption
|
603
528
|
*/
|
604
529
|
VALUE
|
605
530
|
Info_caption(VALUE self)
|
@@ -610,14 +535,10 @@ Info_caption(VALUE self)
|
|
610
535
|
|
611
536
|
|
612
537
|
/**
|
613
|
-
*
|
614
|
-
*
|
615
|
-
* Ruby usage:
|
616
|
-
* - @verbatim Info#caption= @endverbatim
|
538
|
+
* Assigns a caption to an image.
|
617
539
|
*
|
618
|
-
* @param
|
619
|
-
* @
|
620
|
-
* @return self
|
540
|
+
* @param caption [String] the caption
|
541
|
+
* @return [String] the given value
|
621
542
|
*/
|
622
543
|
VALUE
|
623
544
|
Info_caption_eq(VALUE self, VALUE caption)
|
@@ -629,19 +550,13 @@ Info_caption_eq(VALUE self, VALUE caption)
|
|
629
550
|
/**
|
630
551
|
* Set the channels
|
631
552
|
*
|
632
|
-
*
|
633
|
-
*
|
634
|
-
* - @verbatim Info#channel(channel) @endverbatim
|
635
|
-
* - @verbatim Info#channel(channel, ...) @endverbatim
|
553
|
+
* @overload channel(channel = Magick::AllChannels)
|
554
|
+
* @param channel [Magick::ChannelType] the channel
|
636
555
|
*
|
637
|
-
*
|
638
|
-
*
|
639
|
-
* - Thanks to Douglas Sellers.
|
556
|
+
* @overload channel(*channels)
|
557
|
+
* @param channels [Magick::ChannelType] the multiple arguments of channel
|
640
558
|
*
|
641
|
-
* @
|
642
|
-
* @param argv array of input arguments
|
643
|
-
* @param self this object
|
644
|
-
* @return self
|
559
|
+
* @return [Magick::Image::Info] self
|
645
560
|
*/
|
646
561
|
VALUE
|
647
562
|
Info_channel(int argc, VALUE *argv, VALUE self)
|
@@ -667,11 +582,7 @@ Info_channel(int argc, VALUE *argv, VALUE self)
|
|
667
582
|
/**
|
668
583
|
* Get the colorspace type.
|
669
584
|
*
|
670
|
-
*
|
671
|
-
* - @verbatim Info#colorspace @endverbatim
|
672
|
-
*
|
673
|
-
* @param self this object
|
674
|
-
* @return the colorspace type
|
585
|
+
* @return [Magick::ColorspaceType] the colorspace type
|
675
586
|
*/
|
676
587
|
VALUE
|
677
588
|
Info_colorspace(VALUE self)
|
@@ -685,13 +596,8 @@ Info_colorspace(VALUE self)
|
|
685
596
|
/**
|
686
597
|
* Set the colorspace type
|
687
598
|
*
|
688
|
-
*
|
689
|
-
*
|
690
|
-
*
|
691
|
-
* @param self this object
|
692
|
-
* @param colorspace the colorspace type
|
693
|
-
* @return colorspace
|
694
|
-
* @throw ArgumentError
|
599
|
+
* @param colorspace [Magick::ColorspaceType] the colorspace type
|
600
|
+
* @return [Magick::ColorspaceType] the given colorspace
|
695
601
|
*/
|
696
602
|
VALUE
|
697
603
|
Info_colorspace_eq(VALUE self, VALUE colorspace)
|
@@ -703,16 +609,31 @@ Info_colorspace_eq(VALUE self, VALUE colorspace)
|
|
703
609
|
return colorspace;
|
704
610
|
}
|
705
611
|
|
706
|
-
|
612
|
+
/**
|
613
|
+
* Get the comment.
|
614
|
+
*
|
615
|
+
* @return [String] the comment
|
616
|
+
*/
|
617
|
+
VALUE Info_comment(VALUE self)
|
618
|
+
{
|
619
|
+
return get_option(self, "Comment");
|
620
|
+
}
|
621
|
+
|
622
|
+
/**
|
623
|
+
* Set the comment
|
624
|
+
*
|
625
|
+
* @param string [String] the comment
|
626
|
+
* @return [String] the given comment
|
627
|
+
*/
|
628
|
+
VALUE Info_comment_eq(VALUE self, VALUE string)
|
629
|
+
{
|
630
|
+
return set_option(self, "Comment", string);
|
631
|
+
}
|
707
632
|
|
708
633
|
/**
|
709
634
|
* Get the compression type.
|
710
635
|
*
|
711
|
-
*
|
712
|
-
* - @verbatim Info#compression @endverbatim
|
713
|
-
*
|
714
|
-
* @param self this object
|
715
|
-
* @return the compression type
|
636
|
+
* @return [Magick::CompressionType] the compression type
|
716
637
|
*/
|
717
638
|
VALUE
|
718
639
|
Info_compression(VALUE self)
|
@@ -726,13 +647,8 @@ Info_compression(VALUE self)
|
|
726
647
|
/**
|
727
648
|
* Set the compression type
|
728
649
|
*
|
729
|
-
*
|
730
|
-
*
|
731
|
-
*
|
732
|
-
* @param self this object
|
733
|
-
* @param type the compression type
|
734
|
-
* @return type
|
735
|
-
* @throw ArgumentError
|
650
|
+
* @param type [Magick::CompressionType] the compression type
|
651
|
+
* @return [Magick::CompressionType] the given type
|
736
652
|
*/
|
737
653
|
VALUE
|
738
654
|
Info_compression_eq(VALUE self, VALUE type)
|
@@ -745,20 +661,14 @@ Info_compression_eq(VALUE self, VALUE type)
|
|
745
661
|
}
|
746
662
|
|
747
663
|
/**
|
748
|
-
*
|
664
|
+
* Define an option.
|
749
665
|
*
|
750
|
-
*
|
751
|
-
*
|
752
|
-
*
|
666
|
+
* @overload Info#define(format, key, value = "")
|
667
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
668
|
+
* @param key [String] A string that identifies the option.
|
669
|
+
* @param value [String] A value of option
|
753
670
|
*
|
754
|
-
*
|
755
|
-
* - Default value is the empty string
|
756
|
-
* - This is the only method in Info that is not an attribute accessor.
|
757
|
-
*
|
758
|
-
* @param argc number of input arguments
|
759
|
-
* @param argv array of input arguments
|
760
|
-
* @param self this object
|
761
|
-
* @return self
|
671
|
+
* @return [Magick::Image::Info] self
|
762
672
|
*/
|
763
673
|
VALUE
|
764
674
|
Info_define(int argc, VALUE *argv, VALUE self)
|
@@ -778,7 +688,7 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
778
688
|
case 3:
|
779
689
|
/* Allow any argument that supports to_s */
|
780
690
|
fmt_arg = rb_String(argv[2]);
|
781
|
-
value = (const char *)
|
691
|
+
value = (const char *)StringValueCStr(fmt_arg);
|
782
692
|
case 2:
|
783
693
|
key = rm_str2cstr(argv[1], &key_l);
|
784
694
|
format = rm_str2cstr(argv[0], &format_l);
|
@@ -791,9 +701,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
791
701
|
{
|
792
702
|
rb_raise(rb_eArgError, "%.20s:%.20s not defined - format or key too long", format, key);
|
793
703
|
}
|
794
|
-
(
|
704
|
+
snprintf(ckey, sizeof(ckey), "%s:%s", format, key);
|
795
705
|
|
796
|
-
|
706
|
+
DeleteImageOption(info, ckey);
|
797
707
|
okay = SetImageOption(info, ckey, value);
|
798
708
|
if (!okay)
|
799
709
|
{
|
@@ -807,16 +717,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
807
717
|
}
|
808
718
|
|
809
719
|
/**
|
810
|
-
* Get the delay
|
811
|
-
*
|
812
|
-
* Ruby usage:
|
813
|
-
* - @verbatim Info#delay @endverbatim
|
814
|
-
*
|
815
|
-
* Notes:
|
816
|
-
* - Convert from string to numeric
|
720
|
+
* Get the delay value.
|
817
721
|
*
|
818
|
-
* @
|
819
|
-
* @return the delay
|
722
|
+
* @return [Numeric, nil] the delay
|
820
723
|
*/
|
821
724
|
VALUE
|
822
725
|
Info_delay(VALUE self)
|
@@ -824,13 +727,14 @@ Info_delay(VALUE self)
|
|
824
727
|
Info *info;
|
825
728
|
const char *delay;
|
826
729
|
char *p;
|
827
|
-
long d;
|
828
730
|
|
829
731
|
Data_Get_Struct(self, Info, info);
|
830
732
|
|
831
733
|
delay = GetImageOption(info, "delay");
|
832
734
|
if (delay)
|
833
735
|
{
|
736
|
+
long d;
|
737
|
+
|
834
738
|
d = strtol(delay, &p, 10);
|
835
739
|
if (*p != '\0')
|
836
740
|
{
|
@@ -856,71 +760,58 @@ arg_is_integer(VALUE arg)
|
|
856
760
|
}
|
857
761
|
|
858
762
|
/**
|
859
|
-
* Set the delay
|
860
|
-
*
|
861
|
-
* Ruby usage:
|
862
|
-
* - @verbatim Info#delay= @endverbatim
|
863
|
-
*
|
864
|
-
* Notes:
|
865
|
-
* - Convert from numeric value to string.
|
763
|
+
* Set the delay value.
|
866
764
|
*
|
867
|
-
* @param
|
868
|
-
* @
|
869
|
-
* @return string
|
765
|
+
* @param string [String] the delay
|
766
|
+
* @return [String] the given value
|
870
767
|
*/
|
871
768
|
VALUE
|
872
769
|
Info_delay_eq(VALUE self, VALUE string)
|
873
770
|
{
|
874
771
|
Info *info;
|
875
|
-
int delay;
|
876
772
|
int not_num;
|
877
|
-
char dstr[20];
|
878
773
|
|
879
774
|
Data_Get_Struct(self, Info, info);
|
880
775
|
|
881
776
|
if (NIL_P(string))
|
882
777
|
{
|
883
|
-
|
778
|
+
DeleteImageOption(info, "delay");
|
884
779
|
}
|
885
780
|
else
|
886
781
|
{
|
782
|
+
char dstr[20];
|
783
|
+
int delay;
|
784
|
+
|
887
785
|
not_num = 0;
|
888
|
-
|
786
|
+
rb_protect(arg_is_integer, string, ¬_num);
|
889
787
|
if (not_num)
|
890
788
|
{
|
891
789
|
rb_raise(rb_eTypeError, "failed to convert %s into Integer", rb_class2name(CLASS_OF(string)));
|
892
790
|
}
|
893
791
|
delay = NUM2INT(string);
|
894
|
-
|
895
|
-
|
792
|
+
snprintf(dstr, sizeof(dstr), "%d", delay);
|
793
|
+
SetImageOption(info, "delay", dstr);
|
896
794
|
}
|
897
795
|
return string;
|
898
796
|
}
|
899
797
|
|
900
798
|
/**
|
901
|
-
* Get the density
|
799
|
+
* Get the density value
|
902
800
|
*
|
903
|
-
*
|
904
|
-
* - @verbatim Info#density @endverbatim
|
905
|
-
*
|
906
|
-
* @param self this object
|
907
|
-
* @return the density
|
801
|
+
* @return [String] the density
|
908
802
|
*/
|
909
|
-
|
803
|
+
VALUE
|
804
|
+
Info_density(VALUE self)
|
805
|
+
{
|
806
|
+
IMPLEMENT_ATTR_READER(Info, density, str);
|
807
|
+
}
|
910
808
|
|
911
809
|
/**
|
912
|
-
* Set the text rendering density
|
913
|
-
*
|
914
|
-
* Ruby usage:
|
915
|
-
* - @verbatim Info#density= @endverbatim
|
810
|
+
* Set the text rendering density geometry
|
916
811
|
*
|
917
|
-
*
|
918
|
-
*
|
919
|
-
*
|
920
|
-
* @param self this object
|
921
|
-
* @param density_arg the density
|
922
|
-
* @return density_arg
|
923
|
-
* @throw ArgumentError
|
812
|
+
* @param density_arg [String] the density
|
813
|
+
* @return [String] the given value
|
814
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
924
815
|
*/
|
925
816
|
VALUE
|
926
817
|
Info_density_eq(VALUE self, VALUE density_arg)
|
@@ -938,8 +829,8 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
938
829
|
return self;
|
939
830
|
}
|
940
831
|
|
941
|
-
density =
|
942
|
-
dens =
|
832
|
+
density = rb_String(density_arg);
|
833
|
+
dens = StringValueCStr(density);
|
943
834
|
if (!IsGeometry(dens))
|
944
835
|
{
|
945
836
|
rb_raise(rb_eArgError, "invalid density geometry: %s", dens);
|
@@ -953,26 +844,21 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
953
844
|
}
|
954
845
|
|
955
846
|
/**
|
956
|
-
* Get the depth
|
847
|
+
* Get the depth value
|
957
848
|
*
|
958
|
-
*
|
959
|
-
* - @verbatim Info#depth @endverbatim
|
960
|
-
*
|
961
|
-
* @param self this object
|
962
|
-
* @return the depth
|
849
|
+
* @return [Numeric] the depth
|
963
850
|
*/
|
964
|
-
|
851
|
+
VALUE
|
852
|
+
Info_depth(VALUE self)
|
853
|
+
{
|
854
|
+
IMPLEMENT_ATTR_READER(Info, depth, int);
|
855
|
+
}
|
965
856
|
|
966
857
|
/**
|
967
|
-
* Set the depth (8, 16, 32).
|
968
|
-
*
|
969
|
-
* Ruby usage:
|
970
|
-
* - @verbatim Info#depth= @endverbatim
|
858
|
+
* Set the depth (8, 16, 32, 64).
|
971
859
|
*
|
972
|
-
* @param
|
973
|
-
* @
|
974
|
-
* @return depth
|
975
|
-
* @throw ArgumentError
|
860
|
+
* @param depth [Numeric] the depth
|
861
|
+
* @return [Numeric] the given depth
|
976
862
|
*/
|
977
863
|
VALUE
|
978
864
|
Info_depth_eq(VALUE self, VALUE depth)
|
@@ -1055,17 +941,12 @@ DisposeType rm_dispose_to_enum(const char *name)
|
|
1055
941
|
* Retrieve the dispose option string and convert it to a DisposeType
|
1056
942
|
* enumerator.
|
1057
943
|
*
|
1058
|
-
*
|
1059
|
-
* - @verbatim Info#dispose @endverbatim
|
1060
|
-
*
|
1061
|
-
* @param self this object
|
1062
|
-
* @return a DisposeType enumerator
|
944
|
+
* @return [Magick::DisposeType] a DisposeType enumerator
|
1063
945
|
*/
|
1064
946
|
VALUE
|
1065
947
|
Info_dispose(VALUE self)
|
1066
948
|
{
|
1067
949
|
Info *info;
|
1068
|
-
int x;
|
1069
950
|
ID dispose_id;
|
1070
951
|
const char *dispose;
|
1071
952
|
|
@@ -1074,10 +955,10 @@ Info_dispose(VALUE self)
|
|
1074
955
|
dispose_id = rb_intern("UndefinedDispose");
|
1075
956
|
|
1076
957
|
// Map the dispose option string to a DisposeType enumerator.
|
1077
|
-
dispose=GetImageOption(info, "dispose");
|
958
|
+
dispose = GetImageOption(info, "dispose");
|
1078
959
|
if (dispose)
|
1079
960
|
{
|
1080
|
-
for (x = 0; x < N_DISPOSE_OPTIONS; x++)
|
961
|
+
for (int x = 0; x < N_DISPOSE_OPTIONS; x++)
|
1081
962
|
{
|
1082
963
|
if (strcmp(dispose, Dispose_Option[x].string) == 0)
|
1083
964
|
{
|
@@ -1093,12 +974,8 @@ Info_dispose(VALUE self)
|
|
1093
974
|
/**
|
1094
975
|
* Convert a DisposeType enumerator into the equivalent dispose option string.
|
1095
976
|
*
|
1096
|
-
*
|
1097
|
-
*
|
1098
|
-
*
|
1099
|
-
* @param self this object
|
1100
|
-
* @param disp the DisposeType enumerator
|
1101
|
-
* @return disp
|
977
|
+
* @param disp [Magic::DisposeType] the DisposeType enumerator
|
978
|
+
* @return [Magic::DisposeType] the given value
|
1102
979
|
*/
|
1103
980
|
VALUE
|
1104
981
|
Info_dispose_eq(VALUE self, VALUE disp)
|
@@ -1112,7 +989,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1112
989
|
|
1113
990
|
if (NIL_P(disp))
|
1114
991
|
{
|
1115
|
-
|
992
|
+
DeleteImageOption(info, "dispose");
|
1116
993
|
return self;
|
1117
994
|
}
|
1118
995
|
|
@@ -1128,21 +1005,38 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1128
1005
|
}
|
1129
1006
|
}
|
1130
1007
|
|
1131
|
-
|
1008
|
+
SetImageOption(info, "dispose", option);
|
1132
1009
|
return disp;
|
1133
1010
|
}
|
1134
1011
|
|
1135
|
-
|
1136
|
-
|
1012
|
+
/**
|
1013
|
+
* Get dither value
|
1014
|
+
*
|
1015
|
+
* @return [Boolean] true if dither is enabled
|
1016
|
+
*/
|
1017
|
+
VALUE
|
1018
|
+
Info_dither(VALUE self)
|
1019
|
+
{
|
1020
|
+
IMPLEMENT_ATTR_READER(Info, dither, boolean);
|
1021
|
+
}
|
1137
1022
|
|
1138
1023
|
/**
|
1139
|
-
*
|
1024
|
+
* Set dither value
|
1140
1025
|
*
|
1141
|
-
*
|
1142
|
-
*
|
1026
|
+
* @param val [Boolean] true if dither will be enabled
|
1027
|
+
* @return [Boolean] true if dither is enabled
|
1028
|
+
*/
|
1029
|
+
VALUE
|
1030
|
+
Info_dither_eq(VALUE self, VALUE val)
|
1031
|
+
{
|
1032
|
+
IMPLEMENT_ATTR_WRITER(Info, dither, boolean);
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* Get the endian value.
|
1143
1038
|
*
|
1144
|
-
* @
|
1145
|
-
* @return the endian (Magick::MSBEndian or Magick::LSBEndian)
|
1039
|
+
* @return [Magick::EndianType] the endian
|
1146
1040
|
*/
|
1147
1041
|
VALUE
|
1148
1042
|
Info_endian(VALUE self)
|
@@ -1155,14 +1049,10 @@ Info_endian(VALUE self)
|
|
1155
1049
|
|
1156
1050
|
|
1157
1051
|
/**
|
1158
|
-
* Set the endian
|
1052
|
+
* Set the endian value.
|
1159
1053
|
*
|
1160
|
-
*
|
1161
|
-
*
|
1162
|
-
*
|
1163
|
-
* @param self this object
|
1164
|
-
* @param endian the endian (Magick::MSBEndian or Magick::LSBEndian)
|
1165
|
-
* @return endian
|
1054
|
+
* @param endian [Magick::EndianType] the endian
|
1055
|
+
* @return [Magick::EndianType] the given endian
|
1166
1056
|
*/
|
1167
1057
|
VALUE
|
1168
1058
|
Info_endian_eq(VALUE self, VALUE endian)
|
@@ -1182,32 +1072,23 @@ Info_endian_eq(VALUE self, VALUE endian)
|
|
1182
1072
|
|
1183
1073
|
|
1184
1074
|
/**
|
1185
|
-
* Get the extract
|
1186
|
-
*
|
1187
|
-
* Ruby usage:
|
1188
|
-
* - @verbatim Info#extract @endverbatim
|
1075
|
+
* Get the extract geometry, e.g. "200x200+100+100"
|
1189
1076
|
*
|
1190
|
-
*
|
1191
|
-
*
|
1192
|
-
*
|
1193
|
-
* @param self this object
|
1194
|
-
* @return the extract string
|
1077
|
+
* @return [String] the extract string
|
1078
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1195
1079
|
*/
|
1196
|
-
|
1080
|
+
VALUE
|
1081
|
+
Info_extract(VALUE self)
|
1082
|
+
{
|
1083
|
+
IMPLEMENT_ATTR_READER(Info, extract, str);
|
1084
|
+
}
|
1197
1085
|
|
1198
1086
|
/**
|
1199
|
-
* Set the extract
|
1087
|
+
* Set the extract geometry.
|
1200
1088
|
*
|
1201
|
-
*
|
1202
|
-
*
|
1203
|
-
*
|
1204
|
-
* Notes:
|
1205
|
-
* - Defined for ImageMagick 5.5.6 and later
|
1206
|
-
*
|
1207
|
-
* @param self this object
|
1208
|
-
* @param extract_arg the extract string
|
1209
|
-
* @return extract_arg
|
1210
|
-
* @throw ArgumentError
|
1089
|
+
* @param extract_arg [String] the extract string
|
1090
|
+
* @return [String] the given value
|
1091
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1211
1092
|
*/
|
1212
1093
|
VALUE
|
1213
1094
|
Info_extract_eq(VALUE self, VALUE extract_arg)
|
@@ -1225,8 +1106,8 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1225
1106
|
return self;
|
1226
1107
|
}
|
1227
1108
|
|
1228
|
-
extract =
|
1229
|
-
extr =
|
1109
|
+
extract = rb_String(extract_arg);
|
1110
|
+
extr = StringValueCStr(extract);
|
1230
1111
|
if (!IsGeometry(extr))
|
1231
1112
|
{
|
1232
1113
|
rb_raise(rb_eArgError, "invalid extract geometry: %s", extr);
|
@@ -1241,17 +1122,11 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1241
1122
|
|
1242
1123
|
|
1243
1124
|
/**
|
1244
|
-
* Get the "filename".
|
1245
|
-
*
|
1246
|
-
* Ruby usage:
|
1247
|
-
* - @verbatim Info#filename @endverbatim
|
1248
|
-
*
|
1249
|
-
* Notes:
|
1250
|
-
* - Only used for Image_capture
|
1125
|
+
* Get the "filename" value.
|
1251
1126
|
*
|
1252
|
-
* @
|
1253
|
-
* @
|
1254
|
-
* @see
|
1127
|
+
* @return [String] the file name ("" if filename not set)
|
1128
|
+
* @note Only used for Image#capture
|
1129
|
+
* @see Image#capture
|
1255
1130
|
*/
|
1256
1131
|
VALUE
|
1257
1132
|
Info_filename(VALUE self)
|
@@ -1263,37 +1138,32 @@ Info_filename(VALUE self)
|
|
1263
1138
|
}
|
1264
1139
|
|
1265
1140
|
/**
|
1266
|
-
* Set the "filename".
|
1267
|
-
*
|
1268
|
-
* Ruby usage:
|
1269
|
-
* - @verbatim Info#filename= @endverbatim
|
1141
|
+
* Set the "filename" value.
|
1270
1142
|
*
|
1271
|
-
*
|
1272
|
-
*
|
1273
|
-
*
|
1274
|
-
* @
|
1275
|
-
* @param filename the filename
|
1276
|
-
* @return filename
|
1277
|
-
* @see Image_capture
|
1143
|
+
* @param filename [String] the file name
|
1144
|
+
* @return [String] the given file name
|
1145
|
+
* @note Only used for Image#capture
|
1146
|
+
* @see Image#capture
|
1278
1147
|
*/
|
1279
1148
|
VALUE
|
1280
1149
|
Info_filename_eq(VALUE self, VALUE filename)
|
1281
1150
|
{
|
1282
1151
|
Info *info;
|
1283
|
-
char *fname;
|
1284
1152
|
|
1285
1153
|
Data_Get_Struct(self, Info, info);
|
1286
1154
|
|
1287
1155
|
// Allow "nil" - remove current filename
|
1288
|
-
if (NIL_P(filename) ||
|
1156
|
+
if (NIL_P(filename) || StringValueCStr(filename) == NULL)
|
1289
1157
|
{
|
1290
1158
|
info->filename[0] = '\0';
|
1291
1159
|
}
|
1292
1160
|
else
|
1293
1161
|
{
|
1162
|
+
char *fname;
|
1163
|
+
|
1294
1164
|
// Otherwise copy in filename
|
1295
|
-
fname =
|
1296
|
-
|
1165
|
+
fname = StringValueCStr(filename);
|
1166
|
+
strlcpy(info->filename, fname, sizeof(info->filename));
|
1297
1167
|
}
|
1298
1168
|
return filename;
|
1299
1169
|
}
|
@@ -1302,11 +1172,7 @@ Info_filename_eq(VALUE self, VALUE filename)
|
|
1302
1172
|
/**
|
1303
1173
|
* Return the fill color as a String.
|
1304
1174
|
*
|
1305
|
-
*
|
1306
|
-
* - @verbatim Info#fill @endverbatim
|
1307
|
-
*
|
1308
|
-
* @param self this object
|
1309
|
-
* @return the fill color
|
1175
|
+
* @return [String] the fill color
|
1310
1176
|
*/
|
1311
1177
|
VALUE
|
1312
1178
|
Info_fill(VALUE self)
|
@@ -1317,13 +1183,8 @@ Info_fill(VALUE self)
|
|
1317
1183
|
/**
|
1318
1184
|
* Set the fill color
|
1319
1185
|
*
|
1320
|
-
*
|
1321
|
-
*
|
1322
|
-
*
|
1323
|
-
* @param self this object
|
1324
|
-
* @param color the fill color (as a String)
|
1325
|
-
* @return self
|
1326
|
-
* @throw ArgumentError
|
1186
|
+
* @param color [String] the fill color
|
1187
|
+
* @return [String] the given value
|
1327
1188
|
*/
|
1328
1189
|
VALUE
|
1329
1190
|
Info_fill_eq(VALUE self, VALUE color)
|
@@ -1335,39 +1196,36 @@ Info_fill_eq(VALUE self, VALUE color)
|
|
1335
1196
|
/**
|
1336
1197
|
* Get the text font.
|
1337
1198
|
*
|
1338
|
-
*
|
1339
|
-
* - @verbatim Info#font @endverbatim
|
1340
|
-
*
|
1341
|
-
* @param self this object
|
1342
|
-
* @return the font
|
1199
|
+
* @return [String] the font
|
1343
1200
|
*/
|
1344
|
-
|
1201
|
+
VALUE
|
1202
|
+
Info_font(VALUE self)
|
1203
|
+
{
|
1204
|
+
IMPLEMENT_ATTR_READER(Info, font, str);
|
1205
|
+
}
|
1345
1206
|
|
1346
1207
|
/**
|
1347
1208
|
* Set the text font.
|
1348
1209
|
*
|
1349
|
-
*
|
1350
|
-
*
|
1351
|
-
*
|
1352
|
-
* @param self this object
|
1353
|
-
* @param font_arg the font (as a String)
|
1354
|
-
* @return font_arg
|
1210
|
+
* @param font_arg [String] the font
|
1211
|
+
* @return [String] the given font
|
1355
1212
|
*/
|
1356
1213
|
VALUE
|
1357
1214
|
Info_font_eq(VALUE self, VALUE font_arg)
|
1358
1215
|
{
|
1359
1216
|
Info *info;
|
1360
|
-
char *font;
|
1361
1217
|
|
1362
1218
|
Data_Get_Struct(self, Info, info);
|
1363
|
-
if (NIL_P(font_arg) ||
|
1219
|
+
if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
|
1364
1220
|
{
|
1365
1221
|
magick_free(info->font);
|
1366
1222
|
info->font = NULL;
|
1367
1223
|
}
|
1368
1224
|
else
|
1369
1225
|
{
|
1370
|
-
font
|
1226
|
+
char *font;
|
1227
|
+
|
1228
|
+
font = StringValueCStr(font_arg);
|
1371
1229
|
magick_clone_string(&info->font, font);
|
1372
1230
|
}
|
1373
1231
|
return font_arg;
|
@@ -1376,24 +1234,21 @@ Info_font_eq(VALUE self, VALUE font_arg)
|
|
1376
1234
|
/**
|
1377
1235
|
* Return the image encoding format.
|
1378
1236
|
*
|
1379
|
-
*
|
1380
|
-
* - @verbatim Info#format @endverbatim
|
1381
|
-
*
|
1382
|
-
* @param self this object
|
1383
|
-
* @return the encoding format
|
1237
|
+
* @return [String, nil] the encoding format
|
1384
1238
|
*/
|
1385
1239
|
VALUE Info_format(VALUE self)
|
1386
1240
|
{
|
1387
1241
|
Info *info;
|
1388
|
-
const MagickInfo *magick_info ;
|
1389
|
-
ExceptionInfo *exception;
|
1390
1242
|
|
1391
1243
|
Data_Get_Struct(self, Info, info);
|
1392
1244
|
if (*info->magick)
|
1393
1245
|
{
|
1246
|
+
const MagickInfo *magick_info;
|
1247
|
+
ExceptionInfo *exception;
|
1248
|
+
|
1394
1249
|
exception = AcquireExceptionInfo();
|
1395
1250
|
magick_info = GetMagickInfo(info->magick, exception);
|
1396
|
-
|
1251
|
+
DestroyExceptionInfo(exception);
|
1397
1252
|
|
1398
1253
|
return magick_info ? rb_str_new2(magick_info->name) : Qnil;
|
1399
1254
|
}
|
@@ -1404,12 +1259,8 @@ VALUE Info_format(VALUE self)
|
|
1404
1259
|
/**
|
1405
1260
|
* Set the image encoding format.
|
1406
1261
|
*
|
1407
|
-
*
|
1408
|
-
*
|
1409
|
-
*
|
1410
|
-
* @param self this object
|
1411
|
-
* @param magick the encoding format
|
1412
|
-
* @return magick
|
1262
|
+
* @param magick [String] the encoding format
|
1263
|
+
* @return [String] the given format
|
1413
1264
|
*/
|
1414
1265
|
VALUE
|
1415
1266
|
Info_format_eq(VALUE self, VALUE magick)
|
@@ -1421,47 +1272,44 @@ Info_format_eq(VALUE self, VALUE magick)
|
|
1421
1272
|
|
1422
1273
|
Data_Get_Struct(self, Info, info);
|
1423
1274
|
|
1424
|
-
mgk =
|
1275
|
+
mgk = StringValueCStr(magick);
|
1425
1276
|
|
1426
1277
|
exception = AcquireExceptionInfo();
|
1427
1278
|
m = GetMagickInfo(mgk, exception);
|
1428
|
-
CHECK_EXCEPTION()
|
1429
|
-
|
1279
|
+
CHECK_EXCEPTION();
|
1280
|
+
DestroyExceptionInfo(exception);
|
1430
1281
|
|
1431
1282
|
if (!m)
|
1432
1283
|
{
|
1433
1284
|
rb_raise(rb_eArgError, "unknown format: %s", mgk);
|
1434
1285
|
}
|
1435
1286
|
|
1436
|
-
|
1287
|
+
strlcpy(info->magick, m->name, sizeof(info->magick));
|
1437
1288
|
return magick;
|
1438
1289
|
}
|
1439
1290
|
|
1440
1291
|
/**
|
1441
1292
|
* Get the fuzz.
|
1442
1293
|
*
|
1443
|
-
*
|
1444
|
-
*
|
1445
|
-
*
|
1446
|
-
* @param self this object
|
1447
|
-
* @return the fuzz
|
1448
|
-
* @see Image_fuzz
|
1294
|
+
* @return [Float] the fuzz
|
1295
|
+
* @see Image#fuzz
|
1449
1296
|
*/
|
1450
|
-
|
1297
|
+
VALUE
|
1298
|
+
Info_fuzz(VALUE self)
|
1299
|
+
{
|
1300
|
+
IMPLEMENT_ATTR_READER(Info, fuzz, dbl);
|
1301
|
+
}
|
1451
1302
|
|
1452
1303
|
/**
|
1453
1304
|
* Set the fuzz.
|
1454
1305
|
*
|
1455
|
-
*
|
1456
|
-
*
|
1457
|
-
*
|
1458
|
-
*
|
1459
|
-
* @param self this object
|
1460
|
-
* @param fuzz the fuzz
|
1461
|
-
* @return fuzz
|
1462
|
-
* @see Image_fuzz_eq
|
1306
|
+
* @param fuzz [Float, String] the fuzz with Float or
|
1307
|
+
* percent format "xx%" with String
|
1308
|
+
* @return [Float, String] the given value
|
1309
|
+
* @see Image#fuzz=
|
1463
1310
|
*/
|
1464
|
-
VALUE
|
1311
|
+
VALUE
|
1312
|
+
Info_fuzz_eq(VALUE self, VALUE fuzz)
|
1465
1313
|
{
|
1466
1314
|
Info *info;
|
1467
1315
|
|
@@ -1524,17 +1372,12 @@ GravityType rm_gravity_to_enum(const char *name)
|
|
1524
1372
|
/**
|
1525
1373
|
* Return the value of the gravity option as a GravityType enumerator.
|
1526
1374
|
*
|
1527
|
-
*
|
1528
|
-
* - @verbatim Info#gravity @endverbatim
|
1529
|
-
*
|
1530
|
-
* @param self this object
|
1531
|
-
* @return the gravity enumerator
|
1375
|
+
* @return [Magick::GravityType] the gravity enumerator
|
1532
1376
|
*/
|
1533
1377
|
VALUE Info_gravity(VALUE self)
|
1534
1378
|
{
|
1535
1379
|
Info *info;
|
1536
1380
|
const char *gravity;
|
1537
|
-
int x;
|
1538
1381
|
ID gravity_id;
|
1539
1382
|
|
1540
1383
|
Data_Get_Struct(self, Info, info);
|
@@ -1542,10 +1385,10 @@ VALUE Info_gravity(VALUE self)
|
|
1542
1385
|
gravity_id = rb_intern("UndefinedGravity");
|
1543
1386
|
|
1544
1387
|
// Map the gravity option string to a GravityType enumerator.
|
1545
|
-
gravity=GetImageOption(info, "gravity");
|
1388
|
+
gravity = GetImageOption(info, "gravity");
|
1546
1389
|
if (gravity)
|
1547
1390
|
{
|
1548
|
-
for (x = 0; x < N_GRAVITY_OPTIONS; x++)
|
1391
|
+
for (int x = 0; x < N_GRAVITY_OPTIONS; x++)
|
1549
1392
|
{
|
1550
1393
|
if (strcmp(gravity, Gravity_Option[x].string) == 0)
|
1551
1394
|
{
|
@@ -1562,12 +1405,8 @@ VALUE Info_gravity(VALUE self)
|
|
1562
1405
|
* Convert a GravityType enum to a gravity option name and store in the Info
|
1563
1406
|
* structure.
|
1564
1407
|
*
|
1565
|
-
*
|
1566
|
-
*
|
1567
|
-
*
|
1568
|
-
* @param self this object
|
1569
|
-
* @param grav the gravity enumerator
|
1570
|
-
* @return grav
|
1408
|
+
* @param grav [Magick::GravityType] the gravity enumerator
|
1409
|
+
* @return [Magick::GravityType] the given gravity
|
1571
1410
|
*/
|
1572
1411
|
VALUE
|
1573
1412
|
Info_gravity_eq(VALUE self, VALUE grav)
|
@@ -1581,7 +1420,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1581
1420
|
|
1582
1421
|
if (NIL_P(grav))
|
1583
1422
|
{
|
1584
|
-
|
1423
|
+
DeleteImageOption(info, "gravity");
|
1585
1424
|
return self;
|
1586
1425
|
}
|
1587
1426
|
|
@@ -1597,7 +1436,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1597
1436
|
}
|
1598
1437
|
}
|
1599
1438
|
|
1600
|
-
|
1439
|
+
SetImageOption(info, "gravity", option);
|
1601
1440
|
return grav;
|
1602
1441
|
}
|
1603
1442
|
|
@@ -1605,11 +1444,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1605
1444
|
/**
|
1606
1445
|
* Get the classification type.
|
1607
1446
|
*
|
1608
|
-
*
|
1609
|
-
* - @verbatim Info#image_type @endverbatim
|
1610
|
-
*
|
1611
|
-
* @param self this object
|
1612
|
-
* @return the classification type
|
1447
|
+
* @return [Magick::ImageType] the classification type
|
1613
1448
|
*/
|
1614
1449
|
VALUE
|
1615
1450
|
Info_image_type(VALUE self)
|
@@ -1623,13 +1458,8 @@ Info_image_type(VALUE self)
|
|
1623
1458
|
/**
|
1624
1459
|
* Set the classification type.
|
1625
1460
|
*
|
1626
|
-
*
|
1627
|
-
*
|
1628
|
-
*
|
1629
|
-
* @param self this object
|
1630
|
-
* @param type the classification type
|
1631
|
-
* @return type
|
1632
|
-
* @throw ArgumentError
|
1461
|
+
* @param type [Magick::ImageType] the classification type
|
1462
|
+
* @return [Magick::ImageType] the given type
|
1633
1463
|
*/
|
1634
1464
|
VALUE
|
1635
1465
|
Info_image_type_eq(VALUE self, VALUE type)
|
@@ -1644,11 +1474,7 @@ Info_image_type_eq(VALUE self, VALUE type)
|
|
1644
1474
|
/**
|
1645
1475
|
* Get the interlace type.
|
1646
1476
|
*
|
1647
|
-
*
|
1648
|
-
* - @verbatim Info#interlace @endverbatim
|
1649
|
-
*
|
1650
|
-
* @param self this object
|
1651
|
-
* @return the interlace type
|
1477
|
+
* @return [Magick::InterlaceType] the interlace type
|
1652
1478
|
*/
|
1653
1479
|
VALUE
|
1654
1480
|
Info_interlace(VALUE self)
|
@@ -1662,13 +1488,8 @@ Info_interlace(VALUE self)
|
|
1662
1488
|
/**
|
1663
1489
|
* Set the interlace type
|
1664
1490
|
*
|
1665
|
-
*
|
1666
|
-
*
|
1667
|
-
*
|
1668
|
-
* @param self this object
|
1669
|
-
* @param inter the interlace type
|
1670
|
-
* @return inter
|
1671
|
-
* @throw ArgumentError
|
1491
|
+
* @param inter [Magick::InterlaceType] the interlace type
|
1492
|
+
* @return [Magick::InterlaceType] the given interlace
|
1672
1493
|
*/
|
1673
1494
|
VALUE
|
1674
1495
|
Info_interlace_eq(VALUE self, VALUE inter)
|
@@ -1680,17 +1501,32 @@ Info_interlace_eq(VALUE self, VALUE inter)
|
|
1680
1501
|
return inter;
|
1681
1502
|
}
|
1682
1503
|
|
1683
|
-
|
1504
|
+
/**
|
1505
|
+
* Get the label.
|
1506
|
+
*
|
1507
|
+
* @return [String] the label
|
1508
|
+
*/
|
1509
|
+
VALUE Info_label(VALUE self)
|
1510
|
+
{
|
1511
|
+
return get_option(self, "Label");
|
1512
|
+
}
|
1684
1513
|
|
1685
1514
|
/**
|
1686
|
-
*
|
1515
|
+
* Set the label.
|
1687
1516
|
*
|
1688
|
-
*
|
1689
|
-
*
|
1517
|
+
* @param string [String] the label
|
1518
|
+
* @return [String] the given label
|
1519
|
+
*/
|
1520
|
+
VALUE Info_label_eq(VALUE self, VALUE string)
|
1521
|
+
{
|
1522
|
+
return set_option(self, "Label", string);
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
/**
|
1526
|
+
* Return the name of the matte color as a String.
|
1690
1527
|
*
|
1691
|
-
* @
|
1692
|
-
* @
|
1693
|
-
* @see Image_matte_color
|
1528
|
+
* @return [String] the name of the matte color
|
1529
|
+
* @see Image#matte_color
|
1694
1530
|
*/
|
1695
1531
|
VALUE
|
1696
1532
|
Info_matte_color(VALUE self)
|
@@ -1704,36 +1540,26 @@ Info_matte_color(VALUE self)
|
|
1704
1540
|
/**
|
1705
1541
|
* Set the matte color.
|
1706
1542
|
*
|
1707
|
-
*
|
1708
|
-
*
|
1709
|
-
*
|
1710
|
-
* @param self this object
|
1711
|
-
* @param matte_arg the name of the matte as a String
|
1712
|
-
* @return matte_arg
|
1713
|
-
* @throw ArgumentError
|
1543
|
+
* @param matte_arg [Magick::Pixel, String] the name of the matte as a String
|
1544
|
+
* @return [Magick::Pixel, String] the given value
|
1714
1545
|
*/
|
1715
1546
|
VALUE
|
1716
1547
|
Info_matte_color_eq(VALUE self, VALUE matte_arg)
|
1717
1548
|
{
|
1718
1549
|
Info *info;
|
1719
|
-
//char colorname[MaxTextExtent];
|
1720
1550
|
|
1721
1551
|
Data_Get_Struct(self, Info, info);
|
1722
1552
|
Color_to_PixelColor(&info->matte_color, matte_arg);
|
1723
|
-
|
1553
|
+
|
1724
1554
|
return matte_arg;
|
1725
1555
|
}
|
1726
1556
|
|
1727
1557
|
/**
|
1728
1558
|
* Establish a progress monitor.
|
1729
1559
|
*
|
1730
|
-
*
|
1731
|
-
*
|
1732
|
-
*
|
1733
|
-
* @param self this object
|
1734
|
-
* @param monitor the monitor
|
1735
|
-
* @return monitor
|
1736
|
-
* @see Image_monitor_eq
|
1560
|
+
* @param monitor [Proc] the monitor
|
1561
|
+
* @return [Proc] monitor
|
1562
|
+
* @see Image#monitor=
|
1737
1563
|
*/
|
1738
1564
|
VALUE
|
1739
1565
|
Info_monitor_eq(VALUE self, VALUE monitor)
|
@@ -1748,27 +1574,62 @@ Info_monitor_eq(VALUE self, VALUE monitor)
|
|
1748
1574
|
}
|
1749
1575
|
else
|
1750
1576
|
{
|
1751
|
-
|
1577
|
+
SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
|
1752
1578
|
}
|
1753
1579
|
|
1754
1580
|
return monitor;
|
1755
1581
|
}
|
1756
1582
|
|
1583
|
+
/**
|
1584
|
+
* Get the monochrome value.
|
1585
|
+
*
|
1586
|
+
* @return [Boolean] true or false
|
1587
|
+
*/
|
1588
|
+
VALUE
|
1589
|
+
Info_monochrome(VALUE self)
|
1590
|
+
{
|
1591
|
+
IMPLEMENT_ATTR_READER(Info, monochrome, boolean);
|
1592
|
+
}
|
1757
1593
|
|
1594
|
+
/**
|
1595
|
+
* Set the monochrome value.
|
1596
|
+
*
|
1597
|
+
* @param val [Boolean] true or false
|
1598
|
+
* @return [Boolean] the given value
|
1599
|
+
*/
|
1600
|
+
VALUE
|
1601
|
+
Info_monochrome_eq(VALUE self, VALUE val)
|
1602
|
+
{
|
1603
|
+
IMPLEMENT_ATTR_WRITER(Info, monochrome, boolean);
|
1604
|
+
}
|
1758
1605
|
|
1606
|
+
/**
|
1607
|
+
* Get the scene number of an image or the first image in a sequence.
|
1608
|
+
*
|
1609
|
+
* @return [Numeric] the scene number
|
1610
|
+
*/
|
1611
|
+
VALUE
|
1612
|
+
Info_number_scenes(VALUE self)
|
1613
|
+
{
|
1614
|
+
IMPLEMENT_ATTR_READER(Info, number_scenes, ulong);
|
1615
|
+
}
|
1759
1616
|
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1617
|
+
/**
|
1618
|
+
* Set the scene number of an image or the first image in a sequence.
|
1619
|
+
*
|
1620
|
+
* @param val [Numeric] the scene number
|
1621
|
+
* @return [Numeric] the given value
|
1622
|
+
*/
|
1623
|
+
VALUE
|
1624
|
+
Info_number_scenes_eq(VALUE self, VALUE val)
|
1625
|
+
{
|
1626
|
+
IMPLEMENT_ATTR_WRITER(Info, number_scenes, ulong);
|
1627
|
+
}
|
1763
1628
|
|
1764
1629
|
/**
|
1765
1630
|
* Return the orientation attribute as an OrientationType enum value.
|
1766
1631
|
*
|
1767
|
-
*
|
1768
|
-
* - @verbatim Info#orientation @endverbatim
|
1769
|
-
*
|
1770
|
-
* @param self this object
|
1771
|
-
* @return the orientation
|
1632
|
+
* @return [Magick::OrientationType] the orientation
|
1772
1633
|
*/
|
1773
1634
|
VALUE
|
1774
1635
|
Info_orientation(VALUE self)
|
@@ -1783,13 +1644,8 @@ Info_orientation(VALUE self)
|
|
1783
1644
|
/**
|
1784
1645
|
* Set the Orientation type.
|
1785
1646
|
*
|
1786
|
-
*
|
1787
|
-
*
|
1788
|
-
*
|
1789
|
-
* @param self this object
|
1790
|
-
* @param inter the orientation type as an OrientationType enum value
|
1791
|
-
* @return inter
|
1792
|
-
* @throw ArgumentError
|
1647
|
+
* @param inter [Magick::OrientationType] the orientation type as an OrientationType enum value
|
1648
|
+
* @return [Magick::OrientationType] the given value
|
1793
1649
|
*/
|
1794
1650
|
VALUE
|
1795
1651
|
Info_orientation_eq(VALUE self, VALUE inter)
|
@@ -1805,11 +1661,8 @@ Info_orientation_eq(VALUE self, VALUE inter)
|
|
1805
1661
|
/**
|
1806
1662
|
* Return origin geometry.
|
1807
1663
|
*
|
1808
|
-
*
|
1809
|
-
*
|
1810
|
-
*
|
1811
|
-
* @param self this object
|
1812
|
-
* @return the origin geometry
|
1664
|
+
* @return [String] the origin geometry
|
1665
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1813
1666
|
*/
|
1814
1667
|
VALUE
|
1815
1668
|
Info_origin(VALUE self)
|
@@ -1828,12 +1681,12 @@ Info_origin(VALUE self)
|
|
1828
1681
|
* Set origin geometry. Argument may be a Geometry object as well as a geometry
|
1829
1682
|
* string.
|
1830
1683
|
*
|
1831
|
-
*
|
1832
|
-
*
|
1684
|
+
* The geometry format is
|
1685
|
+
* +-x+-y
|
1833
1686
|
*
|
1834
|
-
* @param
|
1835
|
-
* @
|
1836
|
-
* @
|
1687
|
+
* @param origin_arg [String] the origin geometry
|
1688
|
+
* @return [String] the given value
|
1689
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1837
1690
|
*/
|
1838
1691
|
VALUE
|
1839
1692
|
Info_origin_eq(VALUE self, VALUE origin_arg)
|
@@ -1846,12 +1699,12 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1846
1699
|
|
1847
1700
|
if (NIL_P(origin_arg))
|
1848
1701
|
{
|
1849
|
-
|
1702
|
+
DeleteImageOption(info, "origin");
|
1850
1703
|
return self;
|
1851
1704
|
}
|
1852
1705
|
|
1853
|
-
origin_str =
|
1854
|
-
origin = GetPageGeometry(
|
1706
|
+
origin_str = rb_String(origin_arg);
|
1707
|
+
origin = GetPageGeometry(StringValueCStr(origin_str));
|
1855
1708
|
|
1856
1709
|
if (IsGeometry(origin) == MagickFalse)
|
1857
1710
|
{
|
@@ -1859,7 +1712,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1859
1712
|
rb_raise(rb_eArgError, "invalid origin geometry");
|
1860
1713
|
}
|
1861
1714
|
|
1862
|
-
|
1715
|
+
SetImageOption(info, "origin", origin);
|
1863
1716
|
magick_free(origin);
|
1864
1717
|
|
1865
1718
|
RB_GC_GUARD(origin_str);
|
@@ -1871,11 +1724,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1871
1724
|
/**
|
1872
1725
|
* Get the Postscript page geometry.
|
1873
1726
|
*
|
1874
|
-
*
|
1875
|
-
* - @verbatim Info_page @endverbatim
|
1876
|
-
*
|
1877
|
-
* @param self this object
|
1878
|
-
* @return the page geometry
|
1727
|
+
* @return [String] the page geometry
|
1879
1728
|
*/
|
1880
1729
|
VALUE
|
1881
1730
|
Info_page(VALUE self)
|
@@ -1891,12 +1740,9 @@ Info_page(VALUE self)
|
|
1891
1740
|
* Store the Postscript page geometry. Argument may be a Geometry object as well
|
1892
1741
|
* as a geometry string.
|
1893
1742
|
*
|
1894
|
-
*
|
1895
|
-
*
|
1896
|
-
*
|
1897
|
-
* @param self this object
|
1898
|
-
* @param page_arg the geometry
|
1899
|
-
* @return page_arg
|
1743
|
+
* @param page_arg [String] the geometry
|
1744
|
+
* @return [String] the given value
|
1745
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1900
1746
|
*/
|
1901
1747
|
VALUE
|
1902
1748
|
Info_page_eq(VALUE self, VALUE page_arg)
|
@@ -1912,8 +1758,8 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1912
1758
|
info->page = NULL;
|
1913
1759
|
return self;
|
1914
1760
|
}
|
1915
|
-
geom_str =
|
1916
|
-
geometry=GetPageGeometry(
|
1761
|
+
geom_str = rb_String(page_arg);
|
1762
|
+
geometry = GetPageGeometry(StringValueCStr(geom_str));
|
1917
1763
|
if (*geometry == '\0')
|
1918
1764
|
{
|
1919
1765
|
magick_free(info->page);
|
@@ -1927,17 +1773,56 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1927
1773
|
return page_arg;
|
1928
1774
|
}
|
1929
1775
|
|
1930
|
-
|
1931
|
-
|
1776
|
+
/**
|
1777
|
+
* Get the point size.
|
1778
|
+
*
|
1779
|
+
* @return [Float] the point size
|
1780
|
+
*/
|
1781
|
+
VALUE
|
1782
|
+
Info_pointsize(VALUE self)
|
1783
|
+
{
|
1784
|
+
IMPLEMENT_ATTR_READER(Info, pointsize, dbl);
|
1785
|
+
}
|
1932
1786
|
|
1933
1787
|
/**
|
1934
|
-
*
|
1788
|
+
* Set the point size.
|
1935
1789
|
*
|
1936
|
-
*
|
1937
|
-
*
|
1790
|
+
* @param val [Float] the point size
|
1791
|
+
* @return [Float] the given value
|
1792
|
+
*/
|
1793
|
+
VALUE
|
1794
|
+
Info_pointsize_eq(VALUE self, VALUE val)
|
1795
|
+
{
|
1796
|
+
IMPLEMENT_ATTR_WRITER(Info, pointsize, dbl);
|
1797
|
+
}
|
1798
|
+
|
1799
|
+
/**
|
1800
|
+
* Get the compression level for JPEG, etc.
|
1938
1801
|
*
|
1939
|
-
* @
|
1940
|
-
|
1802
|
+
* @return [Numeric] the compression level
|
1803
|
+
*/
|
1804
|
+
VALUE
|
1805
|
+
Info_quality(VALUE self)
|
1806
|
+
{
|
1807
|
+
IMPLEMENT_ATTR_READER(Info, quality, ulong);
|
1808
|
+
}
|
1809
|
+
|
1810
|
+
/**
|
1811
|
+
* Get the compression level for JPEG, etc.
|
1812
|
+
*
|
1813
|
+
* @param val [Numeric] the compression level
|
1814
|
+
* @return [Numeric] the given value
|
1815
|
+
*/
|
1816
|
+
VALUE
|
1817
|
+
Info_quality_eq(VALUE self, VALUE val)
|
1818
|
+
{
|
1819
|
+
IMPLEMENT_ATTR_WRITER(Info, quality, ulong);
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
/**
|
1823
|
+
* Get sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
|
1824
|
+
*
|
1825
|
+
* @return [String, nil] the sampling factors
|
1941
1826
|
*/
|
1942
1827
|
VALUE
|
1943
1828
|
Info_sampling_factor(VALUE self)
|
@@ -1958,12 +1843,8 @@ Info_sampling_factor(VALUE self)
|
|
1958
1843
|
/**
|
1959
1844
|
* Set sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
|
1960
1845
|
*
|
1961
|
-
*
|
1962
|
-
*
|
1963
|
-
*
|
1964
|
-
* @param self this object
|
1965
|
-
* @param sampling_factor the sampling factors
|
1966
|
-
* @return sampling_factor
|
1846
|
+
* @param sampling_factor [String] the sampling factors
|
1847
|
+
* @return [String] the given value
|
1967
1848
|
*/
|
1968
1849
|
VALUE
|
1969
1850
|
Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
@@ -1996,11 +1877,7 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
|
1996
1877
|
/**
|
1997
1878
|
* Get the scene number.
|
1998
1879
|
*
|
1999
|
-
*
|
2000
|
-
* - @verbatim Info#scene @endverbatim
|
2001
|
-
*
|
2002
|
-
* @param self this object
|
2003
|
-
* @return the scene number
|
1880
|
+
* @return [Numeric] the scene number
|
2004
1881
|
*/
|
2005
1882
|
VALUE
|
2006
1883
|
Info_scene(VALUE self)
|
@@ -2015,12 +1892,8 @@ Info_scene(VALUE self)
|
|
2015
1892
|
/**
|
2016
1893
|
* Set the scene number.
|
2017
1894
|
*
|
2018
|
-
*
|
2019
|
-
*
|
2020
|
-
*
|
2021
|
-
* @param self this object
|
2022
|
-
* @param scene the scene number
|
2023
|
-
* @return scene
|
1895
|
+
* @param scene [Numeric] the scene number
|
1896
|
+
* @return [Numeric] the given value
|
2024
1897
|
*/
|
2025
1898
|
VALUE
|
2026
1899
|
Info_scene_eq(VALUE self, VALUE scene)
|
@@ -2031,8 +1904,8 @@ Info_scene_eq(VALUE self, VALUE scene)
|
|
2031
1904
|
Data_Get_Struct(self, Info, info);
|
2032
1905
|
info->scene = NUM2ULONG(scene);
|
2033
1906
|
|
2034
|
-
|
2035
|
-
|
1907
|
+
snprintf(buf, sizeof(buf), "%"RMIuSIZE"", info->scene);
|
1908
|
+
SetImageOption(info, "scene", buf);
|
2036
1909
|
|
2037
1910
|
return scene;
|
2038
1911
|
}
|
@@ -2041,40 +1914,37 @@ Info_scene_eq(VALUE self, VALUE scene)
|
|
2041
1914
|
/**
|
2042
1915
|
* Get the server name.
|
2043
1916
|
*
|
2044
|
-
*
|
2045
|
-
* - @verbatim Info#server_name @endverbatim
|
2046
|
-
*
|
2047
|
-
* @param self this object
|
2048
|
-
* @return the server name
|
1917
|
+
* @return [String] the server name
|
2049
1918
|
*/
|
2050
|
-
|
1919
|
+
VALUE
|
1920
|
+
Info_server_name(VALUE self)
|
1921
|
+
{
|
1922
|
+
IMPLEMENT_ATTR_READER(Info, server_name, str);
|
1923
|
+
}
|
2051
1924
|
|
2052
1925
|
|
2053
1926
|
/**
|
2054
1927
|
* Set the server name.
|
2055
1928
|
*
|
2056
|
-
*
|
2057
|
-
*
|
2058
|
-
*
|
2059
|
-
* @param self this object
|
2060
|
-
* @param server_arg the server name as a String
|
2061
|
-
* @return server_arg
|
1929
|
+
* @param server_arg [String] the server name
|
1930
|
+
* @return [String] the given value
|
2062
1931
|
*/
|
2063
1932
|
VALUE
|
2064
1933
|
Info_server_name_eq(VALUE self, VALUE server_arg)
|
2065
1934
|
{
|
2066
1935
|
Info *info;
|
2067
|
-
char *server;
|
2068
1936
|
|
2069
1937
|
Data_Get_Struct(self, Info, info);
|
2070
|
-
if (NIL_P(server_arg) ||
|
1938
|
+
if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
|
2071
1939
|
{
|
2072
1940
|
magick_free(info->server_name);
|
2073
1941
|
info->server_name = NULL;
|
2074
1942
|
}
|
2075
1943
|
else
|
2076
1944
|
{
|
2077
|
-
server
|
1945
|
+
char *server;
|
1946
|
+
|
1947
|
+
server = StringValueCStr(server_arg);
|
2078
1948
|
magick_clone_string(&info->server_name, server);
|
2079
1949
|
}
|
2080
1950
|
return server_arg;
|
@@ -2083,25 +1953,21 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
|
|
2083
1953
|
/**
|
2084
1954
|
* Get ths size
|
2085
1955
|
*
|
2086
|
-
*
|
2087
|
-
*
|
2088
|
-
*
|
2089
|
-
* @param self this object
|
2090
|
-
* @return the size as a Geometry object
|
1956
|
+
* @return [String] the size as a Geometry object
|
1957
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2091
1958
|
*/
|
2092
|
-
|
1959
|
+
VALUE
|
1960
|
+
Info_size(VALUE self)
|
1961
|
+
{
|
1962
|
+
IMPLEMENT_ATTR_READER(Info, size, str);
|
1963
|
+
}
|
2093
1964
|
|
2094
1965
|
/**
|
2095
|
-
* Set the size (either as a Geometry object or a Geometry string
|
2096
|
-
* WxH{+-}x{+-}y)
|
2097
|
-
*
|
2098
|
-
* Ruby usage:
|
2099
|
-
* - @verbatim Info#size= @endverbatim
|
1966
|
+
* Set the size (either as a Geometry object or a Geometry string
|
2100
1967
|
*
|
2101
|
-
* @param
|
2102
|
-
* @
|
2103
|
-
* @
|
2104
|
-
* @throw ArgumentError
|
1968
|
+
* @param size_arg [String] the size
|
1969
|
+
* @return [String] the given value
|
1970
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2105
1971
|
*/
|
2106
1972
|
VALUE
|
2107
1973
|
Info_size_eq(VALUE self, VALUE size_arg)
|
@@ -2119,8 +1985,8 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
2119
1985
|
return self;
|
2120
1986
|
}
|
2121
1987
|
|
2122
|
-
size =
|
2123
|
-
sz =
|
1988
|
+
size = rb_String(size_arg);
|
1989
|
+
sz = StringValueCStr(size);
|
2124
1990
|
if (!IsGeometry(sz))
|
2125
1991
|
{
|
2126
1992
|
rb_raise(rb_eArgError, "invalid size geometry: %s", sz);
|
@@ -2137,11 +2003,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
2137
2003
|
/**
|
2138
2004
|
* Return the stroke color as a String.
|
2139
2005
|
*
|
2140
|
-
*
|
2141
|
-
* - @verbatim Info#stroke @endverbatim
|
2142
|
-
*
|
2143
|
-
* @param self this object
|
2144
|
-
* @return the stroke color
|
2006
|
+
* @return [String] the stroke color
|
2145
2007
|
*/
|
2146
2008
|
VALUE
|
2147
2009
|
Info_stroke(VALUE self)
|
@@ -2152,13 +2014,8 @@ Info_stroke(VALUE self)
|
|
2152
2014
|
/**
|
2153
2015
|
* Set the stroke color
|
2154
2016
|
*
|
2155
|
-
*
|
2156
|
-
*
|
2157
|
-
*
|
2158
|
-
* @param self this object
|
2159
|
-
* @param color the stroke color as a String
|
2160
|
-
* @return self
|
2161
|
-
* @throw ArgumentError
|
2017
|
+
* @param color [String] the stroke color
|
2018
|
+
* @return [String] the given value
|
2162
2019
|
*/
|
2163
2020
|
VALUE
|
2164
2021
|
Info_stroke_eq(VALUE self, VALUE color)
|
@@ -2168,16 +2025,9 @@ Info_stroke_eq(VALUE self, VALUE color)
|
|
2168
2025
|
|
2169
2026
|
|
2170
2027
|
/**
|
2171
|
-
*
|
2172
|
-
*
|
2173
|
-
* Ruby usage:
|
2174
|
-
* - @verbatim Info#stroke_width @endverbatim
|
2028
|
+
* Get stroke width.
|
2175
2029
|
*
|
2176
|
-
*
|
2177
|
-
* - Supported in ImageMagick >= 6.3.2-6
|
2178
|
-
*
|
2179
|
-
* @param self this object
|
2180
|
-
* @return the stroke width
|
2030
|
+
* @return [Float] the stroke width
|
2181
2031
|
*/
|
2182
2032
|
VALUE
|
2183
2033
|
Info_stroke_width(VALUE self)
|
@@ -2187,17 +2037,10 @@ Info_stroke_width(VALUE self)
|
|
2187
2037
|
|
2188
2038
|
|
2189
2039
|
/**
|
2190
|
-
*
|
2191
|
-
*
|
2192
|
-
* Ruby usage:
|
2193
|
-
* - @verbatim Info#stroke_width= @endverbatim
|
2194
|
-
*
|
2195
|
-
* Notes:
|
2196
|
-
* - Supported in ImageMagick >= 6.3.2-6
|
2040
|
+
* Set stroke width.
|
2197
2041
|
*
|
2198
|
-
* @param
|
2199
|
-
* @
|
2200
|
-
* @return self
|
2042
|
+
* @param stroke_width [Float] the stroke width
|
2043
|
+
* @return [Float] the given value
|
2201
2044
|
*/
|
2202
2045
|
VALUE
|
2203
2046
|
Info_stroke_width_eq(VALUE self, VALUE stroke_width)
|
@@ -2209,12 +2052,8 @@ Info_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
2209
2052
|
/**
|
2210
2053
|
* Set name of texture to tile onto the image background.
|
2211
2054
|
*
|
2212
|
-
*
|
2213
|
-
*
|
2214
|
-
*
|
2215
|
-
* @param self this object
|
2216
|
-
* @param texture the name of the texture image
|
2217
|
-
* @return texture
|
2055
|
+
* @param texture [Magick::Image] the texture image
|
2056
|
+
* @return [Magick::Image] the given image
|
2218
2057
|
*/
|
2219
2058
|
VALUE
|
2220
2059
|
Info_texture_eq(VALUE self, VALUE texture)
|
@@ -2241,7 +2080,7 @@ Info_texture_eq(VALUE self, VALUE texture)
|
|
2241
2080
|
|
2242
2081
|
// Create a temp copy of the texture and store its name in the texture field
|
2243
2082
|
image = rm_check_destroyed(texture);
|
2244
|
-
rm_write_temp_image(image, name);
|
2083
|
+
rm_write_temp_image(image, name, sizeof(name));
|
2245
2084
|
|
2246
2085
|
magick_clone_string(&info->texture, name);
|
2247
2086
|
|
@@ -2250,14 +2089,36 @@ Info_texture_eq(VALUE self, VALUE texture)
|
|
2250
2089
|
|
2251
2090
|
|
2252
2091
|
/**
|
2253
|
-
*
|
2092
|
+
* Return tile_offset geometry.
|
2254
2093
|
*
|
2255
|
-
*
|
2256
|
-
*
|
2094
|
+
* @return [String, nil] the tile offset
|
2095
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2096
|
+
*/
|
2097
|
+
VALUE
|
2098
|
+
Info_tile_offset(VALUE self)
|
2099
|
+
{
|
2100
|
+
Info *info;
|
2101
|
+
const char *tile_offset;
|
2102
|
+
|
2103
|
+
Data_Get_Struct(self, Info, info);
|
2104
|
+
|
2105
|
+
tile_offset = GetImageOption(info, "tile-offset");
|
2106
|
+
|
2107
|
+
if (!tile_offset)
|
2108
|
+
{
|
2109
|
+
return Qnil;
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
return rb_str_new2(tile_offset);
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
|
2116
|
+
/**
|
2117
|
+
* Set tile offset geometry.
|
2257
2118
|
*
|
2258
|
-
* @param
|
2259
|
-
* @
|
2260
|
-
* @
|
2119
|
+
* @param offset [String] the offset geometry
|
2120
|
+
* @return [String] the given value
|
2121
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2261
2122
|
*/
|
2262
2123
|
VALUE
|
2263
2124
|
Info_tile_offset_eq(VALUE self, VALUE offset)
|
@@ -2266,8 +2127,8 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
2266
2127
|
VALUE offset_str;
|
2267
2128
|
char *tile_offset;
|
2268
2129
|
|
2269
|
-
offset_str =
|
2270
|
-
tile_offset =
|
2130
|
+
offset_str = rb_String(offset);
|
2131
|
+
tile_offset = StringValueCStr(offset_str);
|
2271
2132
|
if (!IsGeometry(tile_offset))
|
2272
2133
|
{
|
2273
2134
|
rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
|
@@ -2275,8 +2136,8 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
2275
2136
|
|
2276
2137
|
Data_Get_Struct(self, Info, info);
|
2277
2138
|
|
2278
|
-
|
2279
|
-
|
2139
|
+
DeleteImageOption(info, "tile-offset");
|
2140
|
+
SetImageOption(info, "tile-offset", tile_offset);
|
2280
2141
|
|
2281
2142
|
RB_GC_GUARD(offset_str);
|
2282
2143
|
|
@@ -2285,14 +2146,10 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
2285
2146
|
|
2286
2147
|
|
2287
2148
|
/**
|
2288
|
-
* Return the name of the transparent color
|
2289
|
-
*
|
2290
|
-
* Ruby usage:
|
2291
|
-
* - @verbatim Info#transparent_color @endverbatim
|
2149
|
+
* Return the name of the transparent color.
|
2292
2150
|
*
|
2293
|
-
* @
|
2294
|
-
* @
|
2295
|
-
* @see Image_transparent_color
|
2151
|
+
* @return [String] the name of the transparent color
|
2152
|
+
* @see Image#transparent_color
|
2296
2153
|
*/
|
2297
2154
|
VALUE
|
2298
2155
|
Info_transparent_color(VALUE self)
|
@@ -2307,65 +2164,27 @@ Info_transparent_color(VALUE self)
|
|
2307
2164
|
/**
|
2308
2165
|
* Set the transparent color.
|
2309
2166
|
*
|
2310
|
-
*
|
2311
|
-
*
|
2312
|
-
*
|
2313
|
-
* @param self this object
|
2314
|
-
* @param tc_arg the transparent color as a String
|
2315
|
-
* @return tc_arg
|
2316
|
-
* @throw ArgumentError
|
2167
|
+
* @param tc_arg [String] the transparent color
|
2168
|
+
* @return [Magick::Pixel, String] the given value
|
2317
2169
|
*/
|
2318
2170
|
VALUE
|
2319
2171
|
Info_transparent_color_eq(VALUE self, VALUE tc_arg)
|
2320
2172
|
{
|
2321
2173
|
Info *info;
|
2322
|
-
//char colorname[MaxTextExtent];
|
2323
2174
|
|
2324
2175
|
Data_Get_Struct(self, Info, info);
|
2325
2176
|
Color_to_PixelColor(&info->transparent_color, tc_arg);
|
2326
|
-
//SetImageOption(info, "transparent", pixel_packet_to_hexname(&info->transparent_color, colorname));
|
2327
|
-
return tc_arg;
|
2328
|
-
}
|
2329
|
-
|
2330
|
-
|
2331
|
-
/**
|
2332
|
-
* Return tile_offset attribute values.
|
2333
|
-
*
|
2334
|
-
* Ruby usage:
|
2335
|
-
* - @verbatim Image::Info#tile_offset @endverbatim
|
2336
|
-
*
|
2337
|
-
* @param self this object
|
2338
|
-
* @return the tile offset
|
2339
|
-
*/
|
2340
|
-
VALUE
|
2341
|
-
Info_tile_offset(VALUE self)
|
2342
|
-
{
|
2343
|
-
Info *info;
|
2344
|
-
const char *tile_offset;
|
2345
|
-
|
2346
|
-
Data_Get_Struct(self, Info, info);
|
2347
|
-
|
2348
|
-
tile_offset = GetImageOption(info, "tile-offset");
|
2349
2177
|
|
2350
|
-
|
2351
|
-
{
|
2352
|
-
return Qnil;
|
2353
|
-
}
|
2354
|
-
|
2355
|
-
return rb_str_new2(tile_offset);
|
2178
|
+
return tc_arg;
|
2356
2179
|
}
|
2357
2180
|
|
2358
2181
|
|
2359
2182
|
/**
|
2360
2183
|
* Undefine image option.
|
2361
2184
|
*
|
2362
|
-
*
|
2363
|
-
*
|
2364
|
-
*
|
2365
|
-
* @param self this object
|
2366
|
-
* @param format the format
|
2367
|
-
* @param key the key
|
2368
|
-
* @return self
|
2185
|
+
* @param format [String] the format
|
2186
|
+
* @param key [String] the key
|
2187
|
+
* @return [Magick::Info] self
|
2369
2188
|
*/
|
2370
2189
|
VALUE
|
2371
2190
|
Info_undefine(VALUE self, VALUE format, VALUE key)
|
@@ -2386,20 +2205,16 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
|
|
2386
2205
|
snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
|
2387
2206
|
|
2388
2207
|
Data_Get_Struct(self, Info, info);
|
2389
|
-
|
2208
|
+
DeleteImageOption(info, fkey);
|
2390
2209
|
|
2391
2210
|
return self;
|
2392
2211
|
}
|
2393
2212
|
|
2394
2213
|
|
2395
2214
|
/**
|
2396
|
-
* Return the undercolor color
|
2397
|
-
*
|
2398
|
-
* Ruby usage:
|
2399
|
-
* - @verbatim Info#undercolor @endverbatim
|
2215
|
+
* Return the undercolor color.
|
2400
2216
|
*
|
2401
|
-
* @
|
2402
|
-
* @return the undercolor
|
2217
|
+
* @return [String] the undercolor
|
2403
2218
|
*/
|
2404
2219
|
VALUE
|
2405
2220
|
Info_undercolor(VALUE self)
|
@@ -2410,13 +2225,8 @@ Info_undercolor(VALUE self)
|
|
2410
2225
|
/**
|
2411
2226
|
* Set the undercolor color.
|
2412
2227
|
*
|
2413
|
-
*
|
2414
|
-
*
|
2415
|
-
*
|
2416
|
-
* @param self this object
|
2417
|
-
* @param color the undercolor color as a String
|
2418
|
-
* @return self
|
2419
|
-
* @throw ArgumentError
|
2228
|
+
* @param color [String] the undercolor color
|
2229
|
+
* @return [String] the given value
|
2420
2230
|
*/
|
2421
2231
|
VALUE
|
2422
2232
|
Info_undercolor_eq(VALUE self, VALUE color)
|
@@ -2427,11 +2237,7 @@ Info_undercolor_eq(VALUE self, VALUE color)
|
|
2427
2237
|
/**
|
2428
2238
|
* Get the resolution type.
|
2429
2239
|
*
|
2430
|
-
*
|
2431
|
-
* - @verbatim Info#units @endverbatim
|
2432
|
-
*
|
2433
|
-
* @param self this object
|
2434
|
-
* @return the resolution type
|
2240
|
+
* @return [Magick::ResolutionType] the resolution type
|
2435
2241
|
*/
|
2436
2242
|
VALUE
|
2437
2243
|
Info_units(VALUE self)
|
@@ -2445,13 +2251,8 @@ Info_units(VALUE self)
|
|
2445
2251
|
/**
|
2446
2252
|
* Set the resolution type
|
2447
2253
|
*
|
2448
|
-
*
|
2449
|
-
*
|
2450
|
-
*
|
2451
|
-
* @param self this object
|
2452
|
-
* @param units the resolution type
|
2453
|
-
* @return units
|
2454
|
-
* @throw ArgumentError
|
2254
|
+
* @param units [Magick::ResolutionType] the resolution type
|
2255
|
+
* @return [Magick::ResolutionType] the given value
|
2455
2256
|
*/
|
2456
2257
|
VALUE
|
2457
2258
|
Info_units_eq(VALUE self, VALUE units)
|
@@ -2466,11 +2267,7 @@ Info_units_eq(VALUE self, VALUE units)
|
|
2466
2267
|
/**
|
2467
2268
|
* Get FlashPix viewing parameters.
|
2468
2269
|
*
|
2469
|
-
*
|
2470
|
-
* - @verbatim Info#view @endverbatim
|
2471
|
-
*
|
2472
|
-
* @param self this object.
|
2473
|
-
* @return the viewing parameters
|
2270
|
+
* @return [String] the viewing parameters
|
2474
2271
|
*/
|
2475
2272
|
VALUE
|
2476
2273
|
Info_view(VALUE self)
|
@@ -2488,12 +2285,8 @@ Info_view(VALUE self)
|
|
2488
2285
|
/**
|
2489
2286
|
* Set FlashPix viewing parameters.
|
2490
2287
|
*
|
2491
|
-
*
|
2492
|
-
*
|
2493
|
-
*
|
2494
|
-
* @param self this object
|
2495
|
-
* @param view_arg the viewing parameters
|
2496
|
-
* @return view_arg
|
2288
|
+
* @param view_arg [String] the viewing parameters
|
2289
|
+
* @return [String] the given value
|
2497
2290
|
*/
|
2498
2291
|
VALUE
|
2499
2292
|
Info_view_eq(VALUE self, VALUE view_arg)
|
@@ -2505,7 +2298,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
|
|
2505
2298
|
|
2506
2299
|
if (!NIL_P(view_arg))
|
2507
2300
|
{
|
2508
|
-
view =
|
2301
|
+
view = StringValueCStr(view_arg);
|
2509
2302
|
}
|
2510
2303
|
|
2511
2304
|
#if defined(IMAGEMAGICK_7)
|
@@ -2533,7 +2326,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
|
|
2533
2326
|
|
2534
2327
|
|
2535
2328
|
/**
|
2536
|
-
* If there is a texture image, delete it before destroying the
|
2329
|
+
* If there is a texture image, delete it before destroying the Image::Info
|
2537
2330
|
* structure.
|
2538
2331
|
*
|
2539
2332
|
* No Ruby usage (internal function)
|
@@ -2552,12 +2345,12 @@ destroy_Info(void *infoptr)
|
|
2552
2345
|
info->texture = NULL;
|
2553
2346
|
}
|
2554
2347
|
|
2555
|
-
|
2348
|
+
DestroyImageInfo(info);
|
2556
2349
|
}
|
2557
2350
|
|
2558
2351
|
|
2559
2352
|
/**
|
2560
|
-
* Create an
|
2353
|
+
* Create an Image::Info object.
|
2561
2354
|
*
|
2562
2355
|
* No Ruby usage (internal function)
|
2563
2356
|
*
|
@@ -2609,10 +2402,11 @@ rm_info_new(void)
|
|
2609
2402
|
/**
|
2610
2403
|
* If an initializer block is present, run it.
|
2611
2404
|
*
|
2612
|
-
*
|
2613
|
-
*
|
2405
|
+
* @overload initialize
|
2406
|
+
*
|
2407
|
+
* @overload initialize
|
2408
|
+
* @yield []
|
2614
2409
|
*
|
2615
|
-
* @param self this object
|
2616
2410
|
* @return self
|
2617
2411
|
*/
|
2618
2412
|
VALUE
|
@@ -2621,7 +2415,7 @@ Info_initialize(VALUE self)
|
|
2621
2415
|
if (rb_block_given_p())
|
2622
2416
|
{
|
2623
2417
|
// Run the block in self's context
|
2624
|
-
|
2418
|
+
rb_obj_instance_eval(0, NULL, self);
|
2625
2419
|
}
|
2626
2420
|
return self;
|
2627
2421
|
}
|