rmagick 2.16.0 → 5.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 +5 -5
- 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 +5 -1
- data/.rspec +1 -0
- data/.rubocop.yml +37 -340
- data/.rubocop_todo.yml +448 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +435 -0
- data/CODE_OF_CONDUCT.md +122 -7
- data/CONTRIBUTING.md +37 -6
- data/Gemfile +0 -6
- data/README.md +317 -0
- data/Rakefile +37 -35
- data/before_install_linux.sh +65 -28
- data/before_install_osx.sh +58 -2
- data/ext/RMagick/extconf.rb +286 -393
- data/ext/RMagick/rmagick.c +106 -111
- data/ext/RMagick/rmagick.h +235 -331
- data/ext/RMagick/rmagick_gvl.h +224 -0
- data/ext/RMagick/rmdraw.c +484 -842
- data/ext/RMagick/rmenum.c +316 -755
- data/ext/RMagick/rmfill.c +281 -191
- data/ext/RMagick/rmilist.c +450 -455
- data/ext/RMagick/rmimage.c +6247 -5289
- data/ext/RMagick/rminfo.c +721 -894
- data/ext/RMagick/rmkinfo.c +228 -0
- data/ext/RMagick/rmmain.c +727 -519
- data/ext/RMagick/rmmontage.c +127 -172
- data/ext/RMagick/rmpixel.c +638 -431
- data/ext/RMagick/rmstruct.c +102 -282
- data/ext/RMagick/rmutil.c +450 -363
- data/lib/rmagick/version.rb +5 -4
- data/lib/rmagick.rb +2 -0
- data/lib/rmagick_internal.rb +349 -413
- data/lib/rvg/clippath.rb +3 -4
- data/lib/rvg/container.rb +30 -22
- data/lib/rvg/deep_equal.rb +11 -11
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +63 -68
- data/lib/rvg/misc.rb +136 -139
- data/lib/rvg/paint.rb +2 -1
- data/lib/rvg/pathdata.rb +7 -8
- data/lib/rvg/rvg.rb +47 -46
- data/lib/rvg/stretchable.rb +22 -28
- data/lib/rvg/stylable.rb +12 -10
- data/lib/rvg/text.rb +169 -165
- data/lib/rvg/transformable.rb +17 -16
- data/lib/rvg/units.rb +5 -5
- data/rmagick.gemspec +16 -39
- metadata +118 -395
- data/.hound.yml +0 -2
- data/.simplecov +0 -27
- data/.travis.yml +0 -74
- data/Doxyfile +0 -1514
- data/README.textile +0 -251
- data/deprecated/RMagick.rb +0 -6
- data/doc/.cvsignore +0 -1
- data/doc/comtasks.html +0 -287
- data/doc/constants.html +0 -1581
- data/doc/css/doc.css +0 -299
- data/doc/css/popup.css +0 -34
- data/doc/css/ref.css +0 -67
- data/doc/draw.html +0 -3272
- data/doc/ex/InitialCoords.rb +0 -22
- data/doc/ex/NewCoordSys.rb +0 -30
- data/doc/ex/OrigCoordSys.rb +0 -16
- data/doc/ex/PreserveAspectRatio.rb +0 -204
- data/doc/ex/RotateScale.rb +0 -36
- data/doc/ex/Skew.rb +0 -38
- data/doc/ex/Use01.rb +0 -15
- data/doc/ex/Use02.rb +0 -20
- data/doc/ex/Use03.rb +0 -16
- data/doc/ex/ViewBox.rb +0 -31
- data/doc/ex/adaptive_threshold.rb +0 -9
- data/doc/ex/add_noise.rb +0 -16
- data/doc/ex/affine.rb +0 -48
- data/doc/ex/affine_transform.rb +0 -20
- data/doc/ex/arc.rb +0 -49
- data/doc/ex/arcpath.rb +0 -32
- data/doc/ex/arcs01.rb +0 -28
- data/doc/ex/arcs02.rb +0 -59
- data/doc/ex/average.rb +0 -15
- data/doc/ex/axes.rb +0 -64
- data/doc/ex/baseline_shift01.rb +0 -17
- data/doc/ex/bilevel_channel.rb +0 -8
- data/doc/ex/blur_image.rb +0 -12
- data/doc/ex/border.rb +0 -10
- data/doc/ex/bounding_box.rb +0 -42
- data/doc/ex/cbezier1.rb +0 -41
- data/doc/ex/cbezier2.rb +0 -41
- data/doc/ex/cbezier3.rb +0 -41
- data/doc/ex/cbezier4.rb +0 -42
- data/doc/ex/cbezier5.rb +0 -42
- data/doc/ex/cbezier6.rb +0 -53
- data/doc/ex/channel.rb +0 -25
- data/doc/ex/charcoal.rb +0 -12
- data/doc/ex/chop.rb +0 -29
- data/doc/ex/circle.rb +0 -33
- data/doc/ex/circle01.rb +0 -16
- data/doc/ex/clip_path.rb +0 -60
- data/doc/ex/coalesce.rb +0 -57
- data/doc/ex/color_fill_to_border.rb +0 -29
- data/doc/ex/color_floodfill.rb +0 -28
- data/doc/ex/color_histogram.rb +0 -47
- data/doc/ex/color_reset.rb +0 -11
- data/doc/ex/colorize.rb +0 -16
- data/doc/ex/colors.rb +0 -64
- data/doc/ex/compose_mask.rb +0 -22
- data/doc/ex/composite.rb +0 -133
- data/doc/ex/composite_layers.rb +0 -53
- 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 -42
- 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 -20
- 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 -47
- data/doc/ex/get_type_metrics.rb +0 -141
- data/doc/ex/gradientfill.rb +0 -27
- data/doc/ex/grav.rb +0 -45
- data/doc/ex/gravity.rb +0 -80
- 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.wmf +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.wmf +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.wmf +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 -35
- 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 -27
- 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 -125
- data/doc/ex/solarize.rb +0 -11
- data/doc/ex/sparse_color.rb +0 -54
- data/doc/ex/splice.rb +0 -8
- data/doc/ex/spread.rb +0 -11
- data/doc/ex/stegano.rb +0 -55
- 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 -565
- 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 -324
- data/examples/describe.rb +0 -43
- data/examples/find_similar_region.rb +0 -34
- data/examples/histogram.rb +0 -321
- data/examples/identify.rb +0 -185
- data/examples/image_opacity.rb +0 -29
- data/examples/import_export.rb +0 -31
- data/examples/pattern_fill.rb +0 -38
- data/examples/rotating_text.rb +0 -44
- 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 -156
- data/spec/rmagick/image/blue_shift_spec.rb +0 -16
- data/spec/rmagick/image/composite_spec.rb +0 -140
- data/spec/rmagick/image/constitute_spec.rb +0 -15
- data/spec/rmagick/image/dispatch_spec.rb +0 -18
- data/spec/rmagick/image/from_blob_spec.rb +0 -14
- data/spec/rmagick/image/ping_spec.rb +0 -14
- data/spec/rmagick/image/properties_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -4
- data/test/Image1.rb +0 -565
- data/test/Image2.rb +0 -1304
- data/test/Image3.rb +0 -1030
- data/test/ImageList1.rb +0 -806
- data/test/ImageList2.rb +0 -385
- data/test/Image_attributes.rb +0 -697
- data/test/Import_Export.rb +0 -121
- data/test/Info.rb +0 -345
- data/test/Magick.rb +0 -321
- data/test/Pixel.rb +0 -116
- data/test/Preview.rb +0 -57
- data/test/cmyk.icm +0 -0
- data/test/srgb.icm +0 -0
- data/test/test_all_basic.rb +0 -38
- data/test/tmpnam_test.rb +0 -50
- data/wercker.yml +0 -10
data/ext/RMagick/rminfo.c
CHANGED
@@ -12,15 +12,21 @@
|
|
12
12
|
|
13
13
|
#include "rmagick.h"
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
static void Info_free(void *infoptr);
|
16
|
+
static size_t Info_memsize(const void *infoptr);
|
17
|
+
|
18
|
+
const rb_data_type_t rm_info_data_type = {
|
19
|
+
"Magick::Image::Info",
|
20
|
+
{ NULL, Info_free, Info_memsize, },
|
21
|
+
0, 0,
|
22
|
+
RUBY_TYPED_FROZEN_SHAREABLE,
|
23
|
+
};
|
17
24
|
|
18
25
|
|
19
26
|
/**
|
20
27
|
* Return the value of the specified option.
|
21
28
|
*
|
22
|
-
* Ruby usage
|
23
|
-
* - @verbatim Info#get_option(key) @endverbatim
|
29
|
+
* No Ruby usage (internal function)
|
24
30
|
*
|
25
31
|
* @param self this object
|
26
32
|
* @param key the option key
|
@@ -32,7 +38,7 @@ get_option(VALUE self, const char *key)
|
|
32
38
|
Info *info;
|
33
39
|
const char *value;
|
34
40
|
|
35
|
-
|
41
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
36
42
|
|
37
43
|
value = GetImageOption(info, key);
|
38
44
|
if (value)
|
@@ -46,32 +52,32 @@ get_option(VALUE self, const char *key)
|
|
46
52
|
* Set the specified option to this value. If the value is nil just unset any
|
47
53
|
* current value.
|
48
54
|
*
|
49
|
-
* Ruby usage
|
50
|
-
* - @verbatim Info#set_option(key,string) @endverbatim
|
55
|
+
* No Ruby usage (internal function)
|
51
56
|
*
|
52
57
|
* @param self this object
|
53
58
|
* @param key the option key
|
54
59
|
* @param string the value
|
55
|
-
* @return
|
60
|
+
* @return string
|
56
61
|
*/
|
57
62
|
static VALUE
|
58
63
|
set_option(VALUE self, const char *key, VALUE string)
|
59
64
|
{
|
60
65
|
Info *info;
|
61
|
-
char *value;
|
62
66
|
|
63
|
-
|
67
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
64
68
|
|
65
69
|
if (NIL_P(string))
|
66
70
|
{
|
67
|
-
(
|
71
|
+
DeleteImageOption(info, key);
|
68
72
|
}
|
69
73
|
else
|
70
74
|
{
|
71
|
-
value
|
72
|
-
|
75
|
+
char *value;
|
76
|
+
|
77
|
+
value = StringValueCStr(string);
|
78
|
+
SetImageOption(info, key, value);
|
73
79
|
}
|
74
|
-
return
|
80
|
+
return string;
|
75
81
|
}
|
76
82
|
|
77
83
|
|
@@ -81,43 +87,43 @@ set_option(VALUE self, const char *key, VALUE string)
|
|
81
87
|
* No Ruby usage (internal function)
|
82
88
|
*
|
83
89
|
* Notes:
|
84
|
-
* - Call
|
90
|
+
* - Call QueryColorCompliance to validate color name.
|
85
91
|
*
|
86
92
|
* @param self this object
|
87
93
|
* @param option the option
|
88
94
|
* @param color the color name
|
89
|
-
* @return
|
95
|
+
* @return color
|
90
96
|
*/
|
91
97
|
static VALUE set_color_option(VALUE self, const char *option, VALUE color)
|
92
98
|
{
|
93
99
|
Info *info;
|
94
|
-
|
95
|
-
PixelPacket pp;
|
96
|
-
ExceptionInfo *exception;
|
100
|
+
PixelColor pp;
|
97
101
|
MagickBooleanType okay;
|
98
102
|
|
99
|
-
|
103
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
100
104
|
|
101
105
|
if (NIL_P(color))
|
102
106
|
{
|
103
|
-
(
|
107
|
+
DeleteImageOption(info, option);
|
104
108
|
}
|
105
109
|
else
|
106
110
|
{
|
111
|
+
char *name;
|
112
|
+
ExceptionInfo *exception;
|
113
|
+
|
114
|
+
name = StringValueCStr(color);
|
107
115
|
exception = AcquireExceptionInfo();
|
108
|
-
|
109
|
-
|
110
|
-
(void) DestroyExceptionInfo(exception);
|
116
|
+
okay = QueryColorCompliance(name, AllCompliance, &pp, exception);
|
117
|
+
DestroyExceptionInfo(exception);
|
111
118
|
if (!okay)
|
112
119
|
{
|
113
120
|
rb_raise(rb_eArgError, "invalid color name `%s'", name);
|
114
121
|
}
|
115
122
|
|
116
|
-
(
|
117
|
-
(void) SetImageOption(info, option, name);
|
123
|
+
SetImageOption(info, option, name);
|
118
124
|
}
|
119
125
|
|
120
|
-
return
|
126
|
+
return color;
|
121
127
|
}
|
122
128
|
|
123
129
|
|
@@ -140,7 +146,7 @@ static VALUE get_dbl_option(VALUE self, const char *option)
|
|
140
146
|
double d;
|
141
147
|
long n;
|
142
148
|
|
143
|
-
|
149
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
144
150
|
|
145
151
|
value = GetImageOption(info, option);
|
146
152
|
if (!value)
|
@@ -165,87 +171,84 @@ static VALUE get_dbl_option(VALUE self, const char *option)
|
|
165
171
|
* @param self this object
|
166
172
|
* @param option the option name
|
167
173
|
* @param value the value
|
168
|
-
* @return
|
174
|
+
* @return value
|
169
175
|
*/
|
170
176
|
static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
|
171
177
|
{
|
172
178
|
Info *info;
|
173
|
-
char buff[50];
|
174
|
-
double d;
|
175
|
-
long n;
|
176
|
-
int len;
|
177
179
|
|
178
|
-
|
180
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
179
181
|
|
180
182
|
if (NIL_P(value))
|
181
183
|
{
|
182
|
-
(
|
184
|
+
DeleteImageOption(info, option);
|
183
185
|
}
|
184
186
|
else
|
185
187
|
{
|
188
|
+
char buff[50];
|
189
|
+
double d;
|
190
|
+
int len;
|
191
|
+
long n;
|
192
|
+
|
186
193
|
d = NUM2DBL(value);
|
187
194
|
n = floor(d);
|
188
195
|
if (d == n)
|
189
196
|
{
|
190
|
-
len =
|
197
|
+
len = snprintf(buff, sizeof(buff), "%-10ld", n);
|
191
198
|
}
|
192
199
|
else
|
193
200
|
{
|
194
|
-
len =
|
201
|
+
len = snprintf(buff, sizeof(buff), "%-10.2f", d);
|
195
202
|
}
|
196
203
|
memset(buff+len, '\0', sizeof(buff)-len);
|
197
|
-
(
|
198
|
-
(void) SetImageOption(info, option, buff);
|
204
|
+
SetImageOption(info, option, buff);
|
199
205
|
}
|
200
206
|
|
201
|
-
return
|
207
|
+
return value;
|
202
208
|
}
|
203
209
|
|
204
210
|
|
205
|
-
#if 0
|
206
211
|
/**
|
207
|
-
*
|
208
|
-
*
|
209
|
-
* No Ruby usage (internal function)
|
212
|
+
* Get antialias value
|
210
213
|
*
|
211
|
-
* @
|
212
|
-
* @param name pointer to the name
|
213
|
-
* @return the name
|
214
|
+
* @return [Boolean] true if antialias is enabled
|
214
215
|
*/
|
215
|
-
|
216
|
+
VALUE
|
217
|
+
Info_antialias(VALUE self)
|
216
218
|
{
|
217
|
-
|
218
|
-
|
219
|
-
GetMagickPixelPacket(NULL, &mpp);
|
220
|
-
rm_set_magick_pixel_packet(pp, &mpp);
|
221
|
-
(void) GetColorTuple(&mpp, MagickTrue, name);
|
222
|
-
return name;
|
219
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, antialias, boolean, &rm_info_data_type);
|
223
220
|
}
|
224
|
-
#endif
|
225
221
|
|
226
|
-
|
227
|
-
|
222
|
+
/**
|
223
|
+
* Set antialias value
|
224
|
+
*
|
225
|
+
* @param val [Boolean] true or false
|
226
|
+
* @return [Boolean] the given value
|
227
|
+
*/
|
228
|
+
VALUE
|
229
|
+
Info_antialias_eq(VALUE self, VALUE val)
|
230
|
+
{
|
231
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, antialias, boolean, &rm_info_data_type);
|
232
|
+
}
|
228
233
|
|
229
234
|
/** Maximum length of a format (@see Info_aref) */
|
230
235
|
#define MAX_FORMAT_LEN 60
|
231
236
|
|
232
237
|
/**
|
233
|
-
* Get the value of
|
238
|
+
* Get the value of the specified option for the specified format.
|
234
239
|
*
|
235
|
-
*
|
236
|
-
*
|
237
|
-
*
|
240
|
+
* - The 2 argument form is the original form. Added support for a single
|
241
|
+
* argument after ImageMagick started using Set/GetImageOption for options
|
242
|
+
* that aren't represented by fields in the ImageInfo structure.
|
238
243
|
*
|
239
|
-
*
|
240
|
-
*
|
241
|
-
*
|
242
|
-
* that aren't represented by fields in the ImageInfo structure.
|
244
|
+
* @overload [](format, key)
|
245
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
246
|
+
* @param key [String] A string that identifies the option.
|
243
247
|
*
|
244
|
-
* @
|
245
|
-
*
|
246
|
-
*
|
247
|
-
* @return the option
|
248
|
-
* @see Info_aset
|
248
|
+
* @overload [](key)
|
249
|
+
* @param key [String] A string that identifies the option.
|
250
|
+
*
|
251
|
+
* @return [String] The value of the option.
|
249
252
|
*/
|
250
253
|
VALUE
|
251
254
|
Info_aref(int argc, VALUE *argv, VALUE self)
|
@@ -266,12 +269,11 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
266
269
|
rb_raise(rb_eArgError, "can't reference %.60s:%.1024s - too long", format_p, key_p);
|
267
270
|
}
|
268
271
|
|
269
|
-
|
272
|
+
snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
|
270
273
|
break;
|
271
274
|
|
272
275
|
case 1:
|
273
|
-
|
274
|
-
fkey[sizeof(fkey)-1] = '\0';
|
276
|
+
strlcpy(fkey, StringValueCStr(argv[0]), sizeof(fkey));
|
275
277
|
break;
|
276
278
|
|
277
279
|
default:
|
@@ -280,7 +282,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
280
282
|
|
281
283
|
}
|
282
284
|
|
283
|
-
|
285
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
284
286
|
value = GetImageOption(info, fkey);
|
285
287
|
if (!value)
|
286
288
|
{
|
@@ -292,26 +294,23 @@ Info_aref(int argc, VALUE *argv, VALUE self)
|
|
292
294
|
|
293
295
|
|
294
296
|
/**
|
295
|
-
*
|
297
|
+
* Define an option. An alternative to {Info#define}.
|
298
|
+
* Use this method to set options for reading or writing certain image formats.
|
296
299
|
*
|
297
|
-
*
|
298
|
-
*
|
299
|
-
* - @verbatim Info[key]= @endverbatim
|
300
|
+
* - Essentially the same function as {Info#define} but paired with {Info#[]}
|
301
|
+
* - If the value is nil it is equivalent to {Info#undefine}.
|
300
302
|
*
|
301
|
-
*
|
302
|
-
*
|
303
|
-
*
|
304
|
-
*
|
305
|
-
*
|
306
|
-
*
|
307
|
-
*
|
308
|
-
* @
|
309
|
-
* @
|
310
|
-
* @
|
311
|
-
* @
|
312
|
-
* @see Info_aref
|
313
|
-
* @see Info_define
|
314
|
-
* @see Info_undefine
|
303
|
+
* @overload []=(format, key)
|
304
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
305
|
+
* @param key [String] A string that identifies the option.
|
306
|
+
*
|
307
|
+
* @overload []=(key)
|
308
|
+
* @param key [String] A string that identifies the option.
|
309
|
+
*
|
310
|
+
* @return [Magick::Image::Info] self
|
311
|
+
* @see #[]
|
312
|
+
* @see #define
|
313
|
+
* @see #undefine
|
315
314
|
*/
|
316
315
|
VALUE
|
317
316
|
Info_aset(int argc, VALUE *argv, VALUE self)
|
@@ -321,10 +320,8 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
321
320
|
char *format_p, *key_p, *value_p = NULL;
|
322
321
|
long format_l, key_l;
|
323
322
|
char ckey[MaxTextExtent];
|
324
|
-
unsigned int okay;
|
325
323
|
|
326
|
-
|
327
|
-
Data_Get_Struct(self, Info, info);
|
324
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
328
325
|
|
329
326
|
switch (argc)
|
330
327
|
{
|
@@ -337,14 +334,13 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
337
334
|
rb_raise(rb_eArgError, "%.60s:%.1024s not defined - too long", format_p, key_p);
|
338
335
|
}
|
339
336
|
|
340
|
-
(
|
337
|
+
snprintf(ckey, sizeof(ckey), "%.60s:%.*s", format_p, (int)(sizeof(ckey)-MAX_FORMAT_LEN), key_p);
|
341
338
|
|
342
339
|
value = argv[2];
|
343
340
|
break;
|
344
341
|
|
345
342
|
case 2:
|
346
|
-
|
347
|
-
ckey[sizeof(ckey)-1] = '\0';
|
343
|
+
strlcpy(ckey, StringValueCStr(argv[0]), sizeof(ckey));
|
348
344
|
|
349
345
|
value = argv[1];
|
350
346
|
break;
|
@@ -356,15 +352,16 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
356
352
|
|
357
353
|
if (NIL_P(value))
|
358
354
|
{
|
359
|
-
(
|
355
|
+
DeleteImageOption(info, ckey);
|
360
356
|
}
|
361
357
|
else
|
362
358
|
{
|
359
|
+
unsigned int okay;
|
360
|
+
|
363
361
|
/* Allow any argument that supports to_s */
|
364
|
-
value =
|
365
|
-
value_p =
|
362
|
+
value = rb_String(value);
|
363
|
+
value_p = StringValueCStr(value);
|
366
364
|
|
367
|
-
(void) RemoveImageOption(info, ckey);
|
368
365
|
okay = SetImageOption(info, ckey, value_p);
|
369
366
|
if (!okay)
|
370
367
|
{
|
@@ -380,13 +377,9 @@ Info_aset(int argc, VALUE *argv, VALUE self)
|
|
380
377
|
|
381
378
|
|
382
379
|
/**
|
383
|
-
* Get the attenuate
|
380
|
+
* Get the attenuate value.
|
384
381
|
*
|
385
|
-
*
|
386
|
-
* - @verbatim Info#attenuate @endverbatim
|
387
|
-
*
|
388
|
-
* @param self this object
|
389
|
-
* @return the attenuate
|
382
|
+
* @return [Float] the attenuate
|
390
383
|
*/
|
391
384
|
VALUE
|
392
385
|
Info_attenuate(VALUE self)
|
@@ -396,14 +389,10 @@ Info_attenuate(VALUE self)
|
|
396
389
|
|
397
390
|
|
398
391
|
/**
|
399
|
-
* Set the attenuate
|
392
|
+
* Set the attenuate value.
|
400
393
|
*
|
401
|
-
*
|
402
|
-
*
|
403
|
-
*
|
404
|
-
* @param self this object
|
405
|
-
* @param value the attenuate
|
406
|
-
* @return self
|
394
|
+
* @param value [Float] the attenuate
|
395
|
+
* @return [Float] the attenuate
|
407
396
|
*/
|
408
397
|
VALUE
|
409
398
|
Info_attenuate_eq(VALUE self, VALUE value)
|
@@ -413,170 +402,139 @@ Info_attenuate_eq(VALUE self, VALUE value)
|
|
413
402
|
|
414
403
|
|
415
404
|
/**
|
416
|
-
* Get the authenticate
|
417
|
-
*
|
418
|
-
* Ruby usage:
|
419
|
-
* - @verbatim Info#authenticate @endverbatim
|
405
|
+
* Get the authenticate value.
|
420
406
|
*
|
421
|
-
* @
|
422
|
-
* @return the authenticate
|
407
|
+
* @return [String] the authenticate
|
423
408
|
*/
|
424
409
|
VALUE
|
425
410
|
Info_authenticate(VALUE self)
|
426
411
|
{
|
427
412
|
Info *info;
|
428
413
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
{
|
436
|
-
return Qnil;
|
437
|
-
}
|
414
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
415
|
+
#if defined(IMAGEMAGICK_7)
|
416
|
+
return C_str_to_R_str(GetImageOption(info, "authenticate"));
|
417
|
+
#else
|
418
|
+
return C_str_to_R_str(info->authenticate);
|
419
|
+
#endif
|
438
420
|
}
|
439
421
|
|
440
422
|
|
441
423
|
/**
|
442
|
-
* Set the authenticate
|
424
|
+
* Set the authenticate value.
|
443
425
|
*
|
444
|
-
*
|
445
|
-
*
|
446
|
-
*
|
447
|
-
* @param self this object
|
448
|
-
* @param passwd the authenticating password
|
449
|
-
* @return self
|
426
|
+
* @param passwd_arg [String] the authenticating password
|
427
|
+
* @return [String] the given value
|
450
428
|
*/
|
451
429
|
VALUE
|
452
|
-
Info_authenticate_eq(VALUE self, VALUE
|
430
|
+
Info_authenticate_eq(VALUE self, VALUE passwd_arg)
|
453
431
|
{
|
454
432
|
Info *info;
|
455
|
-
char *
|
456
|
-
long passwd_l = 0;
|
433
|
+
char *passwd = NULL;
|
457
434
|
|
458
|
-
|
435
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
459
436
|
|
460
|
-
if (!NIL_P(
|
437
|
+
if (!NIL_P(passwd_arg))
|
461
438
|
{
|
462
|
-
|
439
|
+
passwd = StringValueCStr(passwd_arg);
|
463
440
|
}
|
464
441
|
|
442
|
+
#if defined(IMAGEMAGICK_7)
|
443
|
+
if (passwd)
|
444
|
+
{
|
445
|
+
SetImageOption(info, "authenticate", passwd);
|
446
|
+
}
|
447
|
+
else
|
448
|
+
{
|
449
|
+
RemoveImageOption(info, "authenticate");
|
450
|
+
}
|
451
|
+
#else
|
465
452
|
if (info->authenticate)
|
466
453
|
{
|
467
454
|
magick_free(info->authenticate);
|
468
455
|
info->authenticate = NULL;
|
469
456
|
}
|
470
|
-
if (
|
457
|
+
if (passwd)
|
471
458
|
{
|
472
|
-
magick_clone_string(&info->authenticate,
|
459
|
+
magick_clone_string(&info->authenticate, passwd);
|
473
460
|
}
|
461
|
+
#endif
|
474
462
|
|
475
|
-
return
|
463
|
+
return passwd_arg;
|
476
464
|
}
|
477
465
|
|
478
466
|
|
479
467
|
/**
|
480
468
|
* Return the name of the background color as a String
|
481
469
|
*
|
482
|
-
*
|
483
|
-
*
|
484
|
-
*
|
485
|
-
* @param self this object
|
486
|
-
* @return the name of the background color
|
487
|
-
* @see Image_background_color
|
470
|
+
* @return [String] the name of the background color
|
471
|
+
* @see Image#background_color
|
488
472
|
*/
|
489
473
|
VALUE
|
490
474
|
Info_background_color(VALUE self)
|
491
475
|
{
|
492
476
|
Info *info;
|
493
477
|
|
494
|
-
|
495
|
-
return
|
478
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
479
|
+
return rm_pixelcolor_to_color_name_info(info, &info->background_color);
|
496
480
|
}
|
497
481
|
|
498
482
|
|
499
483
|
/**
|
500
484
|
* Set the background color.
|
501
485
|
*
|
502
|
-
*
|
503
|
-
*
|
504
|
-
*
|
505
|
-
* Notes:
|
506
|
-
* - Color should be a string
|
507
|
-
*
|
508
|
-
* @param self this object
|
509
|
-
* @param bc_arg the background color
|
510
|
-
* @return self
|
511
|
-
* @throw ArgumentError
|
486
|
+
* @param bc_arg [Magick::Pixel, String] the background color
|
487
|
+
* @return [Magick::Pixel, String] the given color
|
512
488
|
*/
|
513
489
|
VALUE
|
514
490
|
Info_background_color_eq(VALUE self, VALUE bc_arg)
|
515
491
|
{
|
516
492
|
Info *info;
|
517
|
-
//char colorname[MaxTextExtent];
|
518
493
|
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
return
|
494
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
495
|
+
Color_to_PixelColor(&info->background_color, bc_arg);
|
496
|
+
|
497
|
+
return bc_arg;
|
523
498
|
}
|
524
499
|
|
525
500
|
/**
|
526
501
|
* Return the name of the border color as a String.
|
527
502
|
*
|
528
|
-
*
|
529
|
-
*
|
530
|
-
*
|
531
|
-
* @param self this object
|
532
|
-
* @return the border color
|
533
|
-
* @see Image_border_color
|
503
|
+
* @return [String] the border color name
|
504
|
+
* @see Image#border_color
|
534
505
|
*/
|
535
506
|
VALUE
|
536
507
|
Info_border_color(VALUE self)
|
537
508
|
{
|
538
509
|
Info *info;
|
539
510
|
|
540
|
-
|
541
|
-
return
|
511
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
512
|
+
return rm_pixelcolor_to_color_name_info(info, &info->border_color);
|
542
513
|
}
|
543
514
|
|
544
515
|
/**
|
545
516
|
* set the border color
|
546
517
|
*
|
547
|
-
*
|
548
|
-
*
|
549
|
-
*
|
550
|
-
* Notes:
|
551
|
-
* - Color should be a string
|
552
|
-
*
|
553
|
-
* @param self this object
|
554
|
-
* @param bc_arg the border color
|
555
|
-
* @return self
|
556
|
-
* @throw ArgumentError
|
518
|
+
* @param bc_arg [Magick::Pixel, String] the border color
|
519
|
+
* @return [Magick::Pixel, String] the given color
|
557
520
|
*/
|
558
521
|
VALUE
|
559
522
|
Info_border_color_eq(VALUE self, VALUE bc_arg)
|
560
523
|
{
|
561
524
|
Info *info;
|
562
|
-
//char colorname[MaxTextExtent];
|
563
525
|
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
return
|
526
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
527
|
+
Color_to_PixelColor(&info->border_color, bc_arg);
|
528
|
+
|
529
|
+
return bc_arg;
|
568
530
|
}
|
569
531
|
|
570
532
|
|
571
533
|
|
572
534
|
/**
|
573
|
-
*
|
535
|
+
* Get a caption of image
|
574
536
|
*
|
575
|
-
*
|
576
|
-
* - @verbatim Info#caption @endverbatim
|
577
|
-
*
|
578
|
-
* @param self this object
|
579
|
-
* @return the caption
|
537
|
+
* @return [String] the caption
|
580
538
|
*/
|
581
539
|
VALUE
|
582
540
|
Info_caption(VALUE self)
|
@@ -587,14 +545,10 @@ Info_caption(VALUE self)
|
|
587
545
|
|
588
546
|
|
589
547
|
/**
|
590
|
-
*
|
548
|
+
* Assigns a caption to an image.
|
591
549
|
*
|
592
|
-
*
|
593
|
-
*
|
594
|
-
*
|
595
|
-
* @param self this object
|
596
|
-
* @param caption the caption
|
597
|
-
* @return self
|
550
|
+
* @param caption [String] the caption
|
551
|
+
* @return [String] the given value
|
598
552
|
*/
|
599
553
|
VALUE
|
600
554
|
Info_caption_eq(VALUE self, VALUE caption)
|
@@ -606,19 +560,13 @@ Info_caption_eq(VALUE self, VALUE caption)
|
|
606
560
|
/**
|
607
561
|
* Set the channels
|
608
562
|
*
|
609
|
-
*
|
610
|
-
*
|
611
|
-
* - @verbatim Info#channel(channel) @endverbatim
|
612
|
-
* - @verbatim Info#channel(channel, ...) @endverbatim
|
563
|
+
* @overload channel(channel = Magick::AllChannels)
|
564
|
+
* @param channel [Magick::ChannelType] the channel
|
613
565
|
*
|
614
|
-
*
|
615
|
-
*
|
616
|
-
* - Thanks to Douglas Sellers.
|
566
|
+
* @overload channel(*channels)
|
567
|
+
* @param channels [Magick::ChannelType] the multiple arguments of channel
|
617
568
|
*
|
618
|
-
* @
|
619
|
-
* @param argv array of input arguments
|
620
|
-
* @param self this object
|
621
|
-
* @return self
|
569
|
+
* @return [Magick::Image::Info] self
|
622
570
|
*/
|
623
571
|
VALUE
|
624
572
|
Info_channel(int argc, VALUE *argv, VALUE self)
|
@@ -634,7 +582,7 @@ Info_channel(int argc, VALUE *argv, VALUE self)
|
|
634
582
|
raise_ChannelType_error(argv[argc-1]);
|
635
583
|
}
|
636
584
|
|
637
|
-
|
585
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
638
586
|
|
639
587
|
info->channel = channels;
|
640
588
|
return self;
|
@@ -644,98 +592,93 @@ Info_channel(int argc, VALUE *argv, VALUE self)
|
|
644
592
|
/**
|
645
593
|
* Get the colorspace type.
|
646
594
|
*
|
647
|
-
*
|
648
|
-
* - @verbatim Info#colorspace @endverbatim
|
649
|
-
*
|
650
|
-
* @param self this object
|
651
|
-
* @return the colorspace type
|
595
|
+
* @return [Magick::ColorspaceType] the colorspace type
|
652
596
|
*/
|
653
597
|
VALUE
|
654
598
|
Info_colorspace(VALUE self)
|
655
599
|
{
|
656
600
|
Info *info;
|
657
601
|
|
658
|
-
|
659
|
-
return
|
602
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
603
|
+
return ColorspaceType_find(info->colorspace);
|
660
604
|
}
|
661
605
|
|
662
606
|
/**
|
663
607
|
* Set the colorspace type
|
664
608
|
*
|
665
|
-
*
|
666
|
-
*
|
667
|
-
*
|
668
|
-
* @param self this object
|
669
|
-
* @param colorspace the colorspace type
|
670
|
-
* @return self
|
671
|
-
* @throw ArgumentError
|
609
|
+
* @param colorspace [Magick::ColorspaceType] the colorspace type
|
610
|
+
* @return [Magick::ColorspaceType] the given colorspace
|
672
611
|
*/
|
673
612
|
VALUE
|
674
613
|
Info_colorspace_eq(VALUE self, VALUE colorspace)
|
675
614
|
{
|
676
615
|
Info *info;
|
677
616
|
|
678
|
-
|
617
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
679
618
|
VALUE_TO_ENUM(colorspace, info->colorspace, ColorspaceType);
|
680
|
-
return
|
619
|
+
return colorspace;
|
681
620
|
}
|
682
621
|
|
683
|
-
|
622
|
+
/**
|
623
|
+
* Get the comment.
|
624
|
+
*
|
625
|
+
* @return [String] the comment
|
626
|
+
*/
|
627
|
+
VALUE Info_comment(VALUE self)
|
628
|
+
{
|
629
|
+
return get_option(self, "Comment");
|
630
|
+
}
|
684
631
|
|
685
632
|
/**
|
686
|
-
*
|
633
|
+
* Set the comment
|
687
634
|
*
|
688
|
-
*
|
689
|
-
*
|
635
|
+
* @param string [String] the comment
|
636
|
+
* @return [String] the given comment
|
637
|
+
*/
|
638
|
+
VALUE Info_comment_eq(VALUE self, VALUE string)
|
639
|
+
{
|
640
|
+
return set_option(self, "Comment", string);
|
641
|
+
}
|
642
|
+
|
643
|
+
/**
|
644
|
+
* Get the compression type.
|
690
645
|
*
|
691
|
-
* @
|
692
|
-
* @return the compression type
|
646
|
+
* @return [Magick::CompressionType] the compression type
|
693
647
|
*/
|
694
648
|
VALUE
|
695
649
|
Info_compression(VALUE self)
|
696
650
|
{
|
697
651
|
Info *info;
|
698
652
|
|
699
|
-
|
700
|
-
return
|
653
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
654
|
+
return CompressionType_find(info->compression);
|
701
655
|
}
|
702
656
|
|
703
657
|
/**
|
704
658
|
* Set the compression type
|
705
659
|
*
|
706
|
-
*
|
707
|
-
*
|
708
|
-
*
|
709
|
-
* @param self this object
|
710
|
-
* @param type the compression type
|
711
|
-
* @return self
|
712
|
-
* @throw ArgumentError
|
660
|
+
* @param type [Magick::CompressionType] the compression type
|
661
|
+
* @return [Magick::CompressionType] the given type
|
713
662
|
*/
|
714
663
|
VALUE
|
715
664
|
Info_compression_eq(VALUE self, VALUE type)
|
716
665
|
{
|
717
666
|
Info *info;
|
718
667
|
|
719
|
-
|
668
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
720
669
|
VALUE_TO_ENUM(type, info->compression, CompressionType);
|
721
|
-
return
|
670
|
+
return type;
|
722
671
|
}
|
723
672
|
|
724
673
|
/**
|
725
|
-
*
|
674
|
+
* Define an option.
|
726
675
|
*
|
727
|
-
*
|
728
|
-
*
|
729
|
-
*
|
730
|
-
*
|
731
|
-
* Notes:
|
732
|
-
* - Default value is the empty string
|
733
|
-
* - This is the only method in Info that is not an attribute accessor.
|
676
|
+
* @overload Info#define(format, key, value = "")
|
677
|
+
* @param format [String] An image format name such as "ps" or "tiff".
|
678
|
+
* @param key [String] A string that identifies the option.
|
679
|
+
* @param value [String] A value of option
|
734
680
|
*
|
735
|
-
* @
|
736
|
-
* @param argv array of input arguments
|
737
|
-
* @param self this object
|
738
|
-
* @return self
|
681
|
+
* @return [Magick::Image::Info] self
|
739
682
|
*/
|
740
683
|
VALUE
|
741
684
|
Info_define(int argc, VALUE *argv, VALUE self)
|
@@ -748,14 +691,14 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
748
691
|
unsigned int okay;
|
749
692
|
VALUE fmt_arg;
|
750
693
|
|
751
|
-
|
694
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
752
695
|
|
753
696
|
switch (argc)
|
754
697
|
{
|
755
698
|
case 3:
|
756
699
|
/* Allow any argument that supports to_s */
|
757
700
|
fmt_arg = rb_String(argv[2]);
|
758
|
-
value = (const char *)
|
701
|
+
value = (const char *)StringValueCStr(fmt_arg);
|
759
702
|
case 2:
|
760
703
|
key = rm_str2cstr(argv[1], &key_l);
|
761
704
|
format = rm_str2cstr(argv[0], &format_l);
|
@@ -768,9 +711,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
768
711
|
{
|
769
712
|
rb_raise(rb_eArgError, "%.20s:%.20s not defined - format or key too long", format, key);
|
770
713
|
}
|
771
|
-
(
|
714
|
+
snprintf(ckey, sizeof(ckey), "%s:%s", format, key);
|
772
715
|
|
773
|
-
(
|
716
|
+
DeleteImageOption(info, ckey);
|
774
717
|
okay = SetImageOption(info, ckey, value);
|
775
718
|
if (!okay)
|
776
719
|
{
|
@@ -784,16 +727,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
|
|
784
727
|
}
|
785
728
|
|
786
729
|
/**
|
787
|
-
* Get the delay
|
730
|
+
* Get the delay value.
|
788
731
|
*
|
789
|
-
*
|
790
|
-
* - @verbatim Info#delay @endverbatim
|
791
|
-
*
|
792
|
-
* Notes:
|
793
|
-
* - Convert from string to numeric
|
794
|
-
*
|
795
|
-
* @param self this object
|
796
|
-
* @return the delay
|
732
|
+
* @return [Numeric, nil] the delay
|
797
733
|
*/
|
798
734
|
VALUE
|
799
735
|
Info_delay(VALUE self)
|
@@ -801,13 +737,14 @@ Info_delay(VALUE self)
|
|
801
737
|
Info *info;
|
802
738
|
const char *delay;
|
803
739
|
char *p;
|
804
|
-
long d;
|
805
740
|
|
806
|
-
|
741
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
807
742
|
|
808
743
|
delay = GetImageOption(info, "delay");
|
809
744
|
if (delay)
|
810
745
|
{
|
746
|
+
long d;
|
747
|
+
|
811
748
|
d = strtol(delay, &p, 10);
|
812
749
|
if (*p != '\0')
|
813
750
|
{
|
@@ -829,78 +766,62 @@ Info_delay(VALUE self)
|
|
829
766
|
static VALUE
|
830
767
|
arg_is_integer(VALUE arg)
|
831
768
|
{
|
832
|
-
|
833
|
-
d = d; // satisfy icc
|
834
|
-
return arg;
|
769
|
+
return INT2NUM(NUM2INT(arg));
|
835
770
|
}
|
836
771
|
|
837
772
|
/**
|
838
|
-
* Set the delay
|
773
|
+
* Set the delay value.
|
839
774
|
*
|
840
|
-
*
|
841
|
-
*
|
842
|
-
*
|
843
|
-
* Notes:
|
844
|
-
* - Convert from numeric value to string.
|
845
|
-
*
|
846
|
-
* @param self this object
|
847
|
-
* @param string the delay
|
848
|
-
* @return self
|
775
|
+
* @param string [String] the delay
|
776
|
+
* @return [String] the given value
|
849
777
|
*/
|
850
778
|
VALUE
|
851
779
|
Info_delay_eq(VALUE self, VALUE string)
|
852
780
|
{
|
853
781
|
Info *info;
|
854
|
-
int delay;
|
855
782
|
int not_num;
|
856
|
-
char dstr[20];
|
857
783
|
|
858
|
-
|
784
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
859
785
|
|
860
786
|
if (NIL_P(string))
|
861
787
|
{
|
862
|
-
(
|
788
|
+
DeleteImageOption(info, "delay");
|
863
789
|
}
|
864
790
|
else
|
865
791
|
{
|
792
|
+
char dstr[20];
|
793
|
+
int delay;
|
794
|
+
|
866
795
|
not_num = 0;
|
867
|
-
|
796
|
+
rb_protect(arg_is_integer, string, ¬_num);
|
868
797
|
if (not_num)
|
869
798
|
{
|
870
799
|
rb_raise(rb_eTypeError, "failed to convert %s into Integer", rb_class2name(CLASS_OF(string)));
|
871
800
|
}
|
872
801
|
delay = NUM2INT(string);
|
873
|
-
|
874
|
-
(
|
875
|
-
(void) SetImageOption(info, "delay", dstr);
|
802
|
+
snprintf(dstr, sizeof(dstr), "%d", delay);
|
803
|
+
SetImageOption(info, "delay", dstr);
|
876
804
|
}
|
877
|
-
return
|
805
|
+
return string;
|
878
806
|
}
|
879
807
|
|
880
808
|
/**
|
881
|
-
* Get the density
|
882
|
-
*
|
883
|
-
* Ruby usage:
|
884
|
-
* - @verbatim Info#density @endverbatim
|
809
|
+
* Get the density value
|
885
810
|
*
|
886
|
-
* @
|
887
|
-
* @return the density
|
811
|
+
* @return [String] the density
|
888
812
|
*/
|
889
|
-
|
813
|
+
VALUE
|
814
|
+
Info_density(VALUE self)
|
815
|
+
{
|
816
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, density, str, &rm_info_data_type);
|
817
|
+
}
|
890
818
|
|
891
819
|
/**
|
892
|
-
* Set the text rendering density
|
820
|
+
* Set the text rendering density geometry
|
893
821
|
*
|
894
|
-
*
|
895
|
-
*
|
896
|
-
*
|
897
|
-
* Notes:
|
898
|
-
* - density should be a string, e.g., "72x72"
|
899
|
-
*
|
900
|
-
* @param self this object
|
901
|
-
* @param density_arg the density
|
902
|
-
* @return self
|
903
|
-
* @throw ArgumentError
|
822
|
+
* @param density_arg [String] the density
|
823
|
+
* @return [String] the given value
|
824
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
904
825
|
*/
|
905
826
|
VALUE
|
906
827
|
Info_density_eq(VALUE self, VALUE density_arg)
|
@@ -909,7 +830,7 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
909
830
|
VALUE density;
|
910
831
|
char *dens;
|
911
832
|
|
912
|
-
|
833
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
913
834
|
|
914
835
|
if (NIL_P(density_arg))
|
915
836
|
{
|
@@ -918,8 +839,8 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
918
839
|
return self;
|
919
840
|
}
|
920
841
|
|
921
|
-
density =
|
922
|
-
dens =
|
842
|
+
density = rb_String(density_arg);
|
843
|
+
dens = StringValueCStr(density);
|
923
844
|
if (!IsGeometry(dens))
|
924
845
|
{
|
925
846
|
rb_raise(rb_eArgError, "invalid density geometry: %s", dens);
|
@@ -929,30 +850,25 @@ Info_density_eq(VALUE self, VALUE density_arg)
|
|
929
850
|
|
930
851
|
RB_GC_GUARD(density);
|
931
852
|
|
932
|
-
return
|
853
|
+
return density_arg;
|
933
854
|
}
|
934
855
|
|
935
856
|
/**
|
936
|
-
* Get the depth
|
857
|
+
* Get the depth value
|
937
858
|
*
|
938
|
-
*
|
939
|
-
* - @verbatim Info#depth @endverbatim
|
940
|
-
*
|
941
|
-
* @param self this object
|
942
|
-
* @return the depth
|
859
|
+
* @return [Numeric] the depth
|
943
860
|
*/
|
944
|
-
|
861
|
+
VALUE
|
862
|
+
Info_depth(VALUE self)
|
863
|
+
{
|
864
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, depth, int, &rm_info_data_type);
|
865
|
+
}
|
945
866
|
|
946
867
|
/**
|
947
|
-
* Set the depth (8, 16, 32).
|
948
|
-
*
|
949
|
-
* Ruby usage:
|
950
|
-
* - @verbatim Info#depth= @endverbatim
|
868
|
+
* Set the depth (8, 16, 32, 64).
|
951
869
|
*
|
952
|
-
* @param
|
953
|
-
* @
|
954
|
-
* @return self
|
955
|
-
* @throw ArgumentError
|
870
|
+
* @param depth [Numeric] the depth
|
871
|
+
* @return [Numeric] the given depth
|
956
872
|
*/
|
957
873
|
VALUE
|
958
874
|
Info_depth_eq(VALUE self, VALUE depth)
|
@@ -960,7 +876,7 @@ Info_depth_eq(VALUE self, VALUE depth)
|
|
960
876
|
Info *info;
|
961
877
|
unsigned long d;
|
962
878
|
|
963
|
-
|
879
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
964
880
|
d = NUM2ULONG(depth);
|
965
881
|
switch (d)
|
966
882
|
{
|
@@ -981,7 +897,7 @@ Info_depth_eq(VALUE self, VALUE depth)
|
|
981
897
|
}
|
982
898
|
|
983
899
|
info->depth = d;
|
984
|
-
return
|
900
|
+
return depth;
|
985
901
|
}
|
986
902
|
|
987
903
|
/** A dispose option */
|
@@ -1035,29 +951,24 @@ DisposeType rm_dispose_to_enum(const char *name)
|
|
1035
951
|
* Retrieve the dispose option string and convert it to a DisposeType
|
1036
952
|
* enumerator.
|
1037
953
|
*
|
1038
|
-
*
|
1039
|
-
* - @verbatim Info#dispose @endverbatim
|
1040
|
-
*
|
1041
|
-
* @param self this object
|
1042
|
-
* @return a DisposeType enumerator
|
954
|
+
* @return [Magick::DisposeType] a DisposeType enumerator
|
1043
955
|
*/
|
1044
956
|
VALUE
|
1045
957
|
Info_dispose(VALUE self)
|
1046
958
|
{
|
1047
959
|
Info *info;
|
1048
|
-
int x;
|
1049
960
|
ID dispose_id;
|
1050
961
|
const char *dispose;
|
1051
962
|
|
1052
|
-
|
963
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1053
964
|
|
1054
965
|
dispose_id = rb_intern("UndefinedDispose");
|
1055
966
|
|
1056
967
|
// Map the dispose option string to a DisposeType enumerator.
|
1057
|
-
dispose=GetImageOption(info, "dispose");
|
968
|
+
dispose = GetImageOption(info, "dispose");
|
1058
969
|
if (dispose)
|
1059
970
|
{
|
1060
|
-
for (x = 0; x < N_DISPOSE_OPTIONS; x++)
|
971
|
+
for (int x = 0; x < N_DISPOSE_OPTIONS; x++)
|
1061
972
|
{
|
1062
973
|
if (strcmp(dispose, Dispose_Option[x].string) == 0)
|
1063
974
|
{
|
@@ -1073,12 +984,8 @@ Info_dispose(VALUE self)
|
|
1073
984
|
/**
|
1074
985
|
* Convert a DisposeType enumerator into the equivalent dispose option string.
|
1075
986
|
*
|
1076
|
-
*
|
1077
|
-
*
|
1078
|
-
*
|
1079
|
-
* @param self this object
|
1080
|
-
* @param disp the DisposeType enumerator
|
1081
|
-
* @return self
|
987
|
+
* @param disp [Magic::DisposeType] the DisposeType enumerator
|
988
|
+
* @return [Magic::DisposeType] the given value
|
1082
989
|
*/
|
1083
990
|
VALUE
|
1084
991
|
Info_dispose_eq(VALUE self, VALUE disp)
|
@@ -1088,11 +995,11 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1088
995
|
const char *option;
|
1089
996
|
int x;
|
1090
997
|
|
1091
|
-
|
998
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1092
999
|
|
1093
1000
|
if (NIL_P(disp))
|
1094
1001
|
{
|
1095
|
-
(
|
1002
|
+
DeleteImageOption(info, "dispose");
|
1096
1003
|
return self;
|
1097
1004
|
}
|
1098
1005
|
|
@@ -1108,41 +1015,54 @@ Info_dispose_eq(VALUE self, VALUE disp)
|
|
1108
1015
|
}
|
1109
1016
|
}
|
1110
1017
|
|
1111
|
-
|
1112
|
-
return
|
1018
|
+
SetImageOption(info, "dispose", option);
|
1019
|
+
return disp;
|
1113
1020
|
}
|
1114
1021
|
|
1115
|
-
|
1116
|
-
|
1022
|
+
/**
|
1023
|
+
* Get dither value
|
1024
|
+
*
|
1025
|
+
* @return [Boolean] true if dither is enabled
|
1026
|
+
*/
|
1027
|
+
VALUE
|
1028
|
+
Info_dither(VALUE self)
|
1029
|
+
{
|
1030
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, dither, boolean, &rm_info_data_type);
|
1031
|
+
}
|
1117
1032
|
|
1118
1033
|
/**
|
1119
|
-
*
|
1034
|
+
* Set dither value
|
1120
1035
|
*
|
1121
|
-
*
|
1122
|
-
*
|
1036
|
+
* @param val [Boolean] true if dither will be enabled
|
1037
|
+
* @return [Boolean] true if dither is enabled
|
1038
|
+
*/
|
1039
|
+
VALUE
|
1040
|
+
Info_dither_eq(VALUE self, VALUE val)
|
1041
|
+
{
|
1042
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, dither, boolean, &rm_info_data_type);
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
|
1046
|
+
/**
|
1047
|
+
* Get the endian value.
|
1123
1048
|
*
|
1124
|
-
* @
|
1125
|
-
* @return the endian (Magick::MSBEndian or Magick::LSBEndian)
|
1049
|
+
* @return [Magick::EndianType] the endian
|
1126
1050
|
*/
|
1127
1051
|
VALUE
|
1128
1052
|
Info_endian(VALUE self)
|
1129
1053
|
{
|
1130
1054
|
Info *info;
|
1131
1055
|
|
1132
|
-
|
1133
|
-
return
|
1056
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1057
|
+
return EndianType_find(info->endian);
|
1134
1058
|
}
|
1135
1059
|
|
1136
1060
|
|
1137
1061
|
/**
|
1138
|
-
* Set the endian
|
1062
|
+
* Set the endian value.
|
1139
1063
|
*
|
1140
|
-
*
|
1141
|
-
*
|
1142
|
-
*
|
1143
|
-
* @param self this object
|
1144
|
-
* @param endian the endian (Magick::MSBEndian or Magick::LSBEndian)
|
1145
|
-
* @return self
|
1064
|
+
* @param endian [Magick::EndianType] the endian
|
1065
|
+
* @return [Magick::EndianType] the given endian
|
1146
1066
|
*/
|
1147
1067
|
VALUE
|
1148
1068
|
Info_endian_eq(VALUE self, VALUE endian)
|
@@ -1155,39 +1075,30 @@ Info_endian_eq(VALUE self, VALUE endian)
|
|
1155
1075
|
VALUE_TO_ENUM(endian, type, EndianType);
|
1156
1076
|
}
|
1157
1077
|
|
1158
|
-
|
1078
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1159
1079
|
info->endian = type;
|
1160
|
-
return
|
1080
|
+
return endian;
|
1161
1081
|
}
|
1162
1082
|
|
1163
1083
|
|
1164
1084
|
/**
|
1165
|
-
* Get the extract
|
1085
|
+
* Get the extract geometry, e.g. "200x200+100+100"
|
1166
1086
|
*
|
1167
|
-
*
|
1168
|
-
*
|
1169
|
-
*
|
1170
|
-
* Notes:
|
1171
|
-
* - Defined for ImageMagick 5.5.6 and later
|
1172
|
-
*
|
1173
|
-
* @param self this object
|
1174
|
-
* @return the extract string
|
1087
|
+
* @return [String] the extract string
|
1088
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1175
1089
|
*/
|
1176
|
-
|
1090
|
+
VALUE
|
1091
|
+
Info_extract(VALUE self)
|
1092
|
+
{
|
1093
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, extract, str, &rm_info_data_type);
|
1094
|
+
}
|
1177
1095
|
|
1178
1096
|
/**
|
1179
|
-
* Set the extract
|
1180
|
-
*
|
1181
|
-
* Ruby usage:
|
1182
|
-
* - @verbatim Info#extract= @endverbatim
|
1183
|
-
*
|
1184
|
-
* Notes:
|
1185
|
-
* - Defined for ImageMagick 5.5.6 and later
|
1097
|
+
* Set the extract geometry.
|
1186
1098
|
*
|
1187
|
-
* @param
|
1188
|
-
* @
|
1189
|
-
* @
|
1190
|
-
* @throw ArgumentError
|
1099
|
+
* @param extract_arg [String] the extract string
|
1100
|
+
* @return [String] the given value
|
1101
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1191
1102
|
*/
|
1192
1103
|
VALUE
|
1193
1104
|
Info_extract_eq(VALUE self, VALUE extract_arg)
|
@@ -1196,7 +1107,7 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1196
1107
|
char *extr;
|
1197
1108
|
VALUE extract;
|
1198
1109
|
|
1199
|
-
|
1110
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1200
1111
|
|
1201
1112
|
if (NIL_P(extract_arg))
|
1202
1113
|
{
|
@@ -1205,8 +1116,8 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1205
1116
|
return self;
|
1206
1117
|
}
|
1207
1118
|
|
1208
|
-
extract =
|
1209
|
-
extr =
|
1119
|
+
extract = rb_String(extract_arg);
|
1120
|
+
extr = StringValueCStr(extract);
|
1210
1121
|
if (!IsGeometry(extr))
|
1211
1122
|
{
|
1212
1123
|
rb_raise(rb_eArgError, "invalid extract geometry: %s", extr);
|
@@ -1216,77 +1127,62 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
|
|
1216
1127
|
|
1217
1128
|
RB_GC_GUARD(extract);
|
1218
1129
|
|
1219
|
-
return
|
1130
|
+
return extract_arg;
|
1220
1131
|
}
|
1221
1132
|
|
1222
1133
|
|
1223
1134
|
/**
|
1224
|
-
* Get the "filename".
|
1135
|
+
* Get the "filename" value.
|
1225
1136
|
*
|
1226
|
-
*
|
1227
|
-
*
|
1228
|
-
*
|
1229
|
-
* Notes:
|
1230
|
-
* - Only used for Image_capture
|
1231
|
-
*
|
1232
|
-
* @param self this object
|
1233
|
-
* @return the filename ("" if filename not set)
|
1234
|
-
* @see Image_capture
|
1137
|
+
* @return [String] the file name ("" if filename not set)
|
1138
|
+
* @note Only used for Image#capture
|
1139
|
+
* @see Image#capture
|
1235
1140
|
*/
|
1236
1141
|
VALUE
|
1237
1142
|
Info_filename(VALUE self)
|
1238
1143
|
{
|
1239
1144
|
Info *info;
|
1240
1145
|
|
1241
|
-
|
1146
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1242
1147
|
return rb_str_new2(info->filename);
|
1243
1148
|
}
|
1244
1149
|
|
1245
1150
|
/**
|
1246
|
-
* Set the "filename".
|
1151
|
+
* Set the "filename" value.
|
1247
1152
|
*
|
1248
|
-
*
|
1249
|
-
*
|
1250
|
-
*
|
1251
|
-
*
|
1252
|
-
* - Only used for Image_capture
|
1253
|
-
*
|
1254
|
-
* @param self this object
|
1255
|
-
* @param filename the filename
|
1256
|
-
* @return self
|
1257
|
-
* @see Image_capture
|
1153
|
+
* @param filename [String] the file name
|
1154
|
+
* @return [String] the given file name
|
1155
|
+
* @note Only used for Image#capture
|
1156
|
+
* @see Image#capture
|
1258
1157
|
*/
|
1259
1158
|
VALUE
|
1260
1159
|
Info_filename_eq(VALUE self, VALUE filename)
|
1261
1160
|
{
|
1262
1161
|
Info *info;
|
1263
|
-
char *fname;
|
1264
1162
|
|
1265
|
-
|
1163
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1266
1164
|
|
1267
1165
|
// Allow "nil" - remove current filename
|
1268
|
-
if (NIL_P(filename) ||
|
1166
|
+
if (NIL_P(filename) || StringValueCStr(filename) == NULL)
|
1269
1167
|
{
|
1270
1168
|
info->filename[0] = '\0';
|
1271
1169
|
}
|
1272
1170
|
else
|
1273
1171
|
{
|
1172
|
+
char *fname;
|
1173
|
+
|
1274
1174
|
// Otherwise copy in filename
|
1275
|
-
fname =
|
1276
|
-
|
1175
|
+
fname = StringValueCStr(filename);
|
1176
|
+
strlcpy(info->filename, fname, sizeof(info->filename));
|
1277
1177
|
}
|
1278
|
-
return
|
1178
|
+
return filename;
|
1279
1179
|
}
|
1280
1180
|
|
1281
1181
|
|
1282
1182
|
/**
|
1283
1183
|
* Return the fill color as a String.
|
1284
1184
|
*
|
1285
|
-
*
|
1286
|
-
* - @verbatim Info#fill @endverbatim
|
1287
|
-
*
|
1288
|
-
* @param self this object
|
1289
|
-
* @return the fill color
|
1185
|
+
* @return [String] the fill color
|
1290
1186
|
*/
|
1291
1187
|
VALUE
|
1292
1188
|
Info_fill(VALUE self)
|
@@ -1297,13 +1193,8 @@ Info_fill(VALUE self)
|
|
1297
1193
|
/**
|
1298
1194
|
* Set the fill color
|
1299
1195
|
*
|
1300
|
-
*
|
1301
|
-
*
|
1302
|
-
*
|
1303
|
-
* @param self this object
|
1304
|
-
* @param color the fill color (as a String)
|
1305
|
-
* @return self
|
1306
|
-
* @throw ArgumentError
|
1196
|
+
* @param color [String] the fill color
|
1197
|
+
* @return [String] the given value
|
1307
1198
|
*/
|
1308
1199
|
VALUE
|
1309
1200
|
Info_fill_eq(VALUE self, VALUE color)
|
@@ -1315,65 +1206,59 @@ Info_fill_eq(VALUE self, VALUE color)
|
|
1315
1206
|
/**
|
1316
1207
|
* Get the text font.
|
1317
1208
|
*
|
1318
|
-
*
|
1319
|
-
* - @verbatim Info#font @endverbatim
|
1320
|
-
*
|
1321
|
-
* @param self this object
|
1322
|
-
* @return the font
|
1209
|
+
* @return [String] the font
|
1323
1210
|
*/
|
1324
|
-
|
1211
|
+
VALUE
|
1212
|
+
Info_font(VALUE self)
|
1213
|
+
{
|
1214
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, font, str, &rm_info_data_type);
|
1215
|
+
}
|
1325
1216
|
|
1326
1217
|
/**
|
1327
1218
|
* Set the text font.
|
1328
1219
|
*
|
1329
|
-
*
|
1330
|
-
*
|
1331
|
-
*
|
1332
|
-
* @param self this object
|
1333
|
-
* @param font_arg the font (as a String)
|
1334
|
-
* @return self
|
1220
|
+
* @param font_arg [String] the font
|
1221
|
+
* @return [String] the given font
|
1335
1222
|
*/
|
1336
1223
|
VALUE
|
1337
1224
|
Info_font_eq(VALUE self, VALUE font_arg)
|
1338
1225
|
{
|
1339
1226
|
Info *info;
|
1340
|
-
char *font;
|
1341
1227
|
|
1342
|
-
|
1343
|
-
if (NIL_P(font_arg) ||
|
1228
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1229
|
+
if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
|
1344
1230
|
{
|
1345
1231
|
magick_free(info->font);
|
1346
1232
|
info->font = NULL;
|
1347
1233
|
}
|
1348
1234
|
else
|
1349
1235
|
{
|
1350
|
-
font
|
1236
|
+
char *font;
|
1237
|
+
|
1238
|
+
font = StringValueCStr(font_arg);
|
1351
1239
|
magick_clone_string(&info->font, font);
|
1352
1240
|
}
|
1353
|
-
return
|
1241
|
+
return font_arg;
|
1354
1242
|
}
|
1355
1243
|
|
1356
1244
|
/**
|
1357
1245
|
* Return the image encoding format.
|
1358
1246
|
*
|
1359
|
-
*
|
1360
|
-
* - @verbatim Info#format @endverbatim
|
1361
|
-
*
|
1362
|
-
* @param self this object
|
1363
|
-
* @return the encoding format
|
1247
|
+
* @return [String, nil] the encoding format
|
1364
1248
|
*/
|
1365
1249
|
VALUE Info_format(VALUE self)
|
1366
1250
|
{
|
1367
1251
|
Info *info;
|
1368
|
-
const MagickInfo *magick_info ;
|
1369
|
-
ExceptionInfo *exception;
|
1370
1252
|
|
1371
|
-
|
1253
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1372
1254
|
if (*info->magick)
|
1373
1255
|
{
|
1256
|
+
const MagickInfo *magick_info;
|
1257
|
+
ExceptionInfo *exception;
|
1258
|
+
|
1374
1259
|
exception = AcquireExceptionInfo();
|
1375
1260
|
magick_info = GetMagickInfo(info->magick, exception);
|
1376
|
-
|
1261
|
+
DestroyExceptionInfo(exception);
|
1377
1262
|
|
1378
1263
|
return magick_info ? rb_str_new2(magick_info->name) : Qnil;
|
1379
1264
|
}
|
@@ -1384,12 +1269,8 @@ VALUE Info_format(VALUE self)
|
|
1384
1269
|
/**
|
1385
1270
|
* Set the image encoding format.
|
1386
1271
|
*
|
1387
|
-
*
|
1388
|
-
*
|
1389
|
-
*
|
1390
|
-
* @param self this object
|
1391
|
-
* @param magick the encoding format
|
1392
|
-
* @return self
|
1272
|
+
* @param magick [String] the encoding format
|
1273
|
+
* @return [String] the given format
|
1393
1274
|
*/
|
1394
1275
|
VALUE
|
1395
1276
|
Info_format_eq(VALUE self, VALUE magick)
|
@@ -1399,55 +1280,52 @@ Info_format_eq(VALUE self, VALUE magick)
|
|
1399
1280
|
char *mgk;
|
1400
1281
|
ExceptionInfo *exception;
|
1401
1282
|
|
1402
|
-
|
1283
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1403
1284
|
|
1404
|
-
|
1285
|
+
mgk = StringValueCStr(magick);
|
1405
1286
|
|
1406
|
-
|
1287
|
+
exception = AcquireExceptionInfo();
|
1407
1288
|
m = GetMagickInfo(mgk, exception);
|
1408
|
-
CHECK_EXCEPTION()
|
1409
|
-
|
1289
|
+
CHECK_EXCEPTION();
|
1290
|
+
DestroyExceptionInfo(exception);
|
1410
1291
|
|
1411
1292
|
if (!m)
|
1412
1293
|
{
|
1413
1294
|
rb_raise(rb_eArgError, "unknown format: %s", mgk);
|
1414
1295
|
}
|
1415
1296
|
|
1416
|
-
|
1417
|
-
return
|
1297
|
+
strlcpy(info->magick, m->name, sizeof(info->magick));
|
1298
|
+
return magick;
|
1418
1299
|
}
|
1419
1300
|
|
1420
1301
|
/**
|
1421
1302
|
* Get the fuzz.
|
1422
1303
|
*
|
1423
|
-
*
|
1424
|
-
*
|
1425
|
-
*
|
1426
|
-
* @param self this object
|
1427
|
-
* @return the fuzz
|
1428
|
-
* @see Image_fuzz
|
1304
|
+
* @return [Float] the fuzz
|
1305
|
+
* @see Image#fuzz
|
1429
1306
|
*/
|
1430
|
-
|
1307
|
+
VALUE
|
1308
|
+
Info_fuzz(VALUE self)
|
1309
|
+
{
|
1310
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, fuzz, dbl, &rm_info_data_type);
|
1311
|
+
}
|
1431
1312
|
|
1432
1313
|
/**
|
1433
1314
|
* Set the fuzz.
|
1434
1315
|
*
|
1435
|
-
*
|
1436
|
-
*
|
1437
|
-
*
|
1438
|
-
*
|
1439
|
-
* @param self this object
|
1440
|
-
* @param fuzz the fuzz
|
1441
|
-
* @return self
|
1442
|
-
* @see Image_fuzz_eq
|
1316
|
+
* @param fuzz [Float, String] the fuzz with Float or
|
1317
|
+
* percent format "xx%" with String
|
1318
|
+
* @return [Float, String] the given value
|
1319
|
+
* @see Image#fuzz=
|
1443
1320
|
*/
|
1444
|
-
VALUE
|
1321
|
+
VALUE
|
1322
|
+
Info_fuzz_eq(VALUE self, VALUE fuzz)
|
1445
1323
|
{
|
1446
1324
|
Info *info;
|
1447
1325
|
|
1448
|
-
|
1326
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1449
1327
|
info->fuzz = rm_fuzz_to_dbl(fuzz);
|
1450
|
-
return
|
1328
|
+
return fuzz;
|
1451
1329
|
}
|
1452
1330
|
|
1453
1331
|
/** A gravity option */
|
@@ -1468,8 +1346,7 @@ static struct
|
|
1468
1346
|
{ "SouthEast", "SouthEastGravity", SouthEastGravity},
|
1469
1347
|
{ "South", "SouthGravity", SouthGravity},
|
1470
1348
|
{ "SouthWest", "SouthWestGravity", SouthWestGravity},
|
1471
|
-
{ "West", "WestGravity", WestGravity}
|
1472
|
-
{ "Static", "StaticGravity", StaticGravity}
|
1349
|
+
{ "West", "WestGravity", WestGravity}
|
1473
1350
|
};
|
1474
1351
|
|
1475
1352
|
/** Number of gravity options */
|
@@ -1505,28 +1382,23 @@ GravityType rm_gravity_to_enum(const char *name)
|
|
1505
1382
|
/**
|
1506
1383
|
* Return the value of the gravity option as a GravityType enumerator.
|
1507
1384
|
*
|
1508
|
-
*
|
1509
|
-
* - @verbatim Info#gravity @endverbatim
|
1510
|
-
*
|
1511
|
-
* @param self this object
|
1512
|
-
* @return the gravity enumerator
|
1385
|
+
* @return [Magick::GravityType] the gravity enumerator
|
1513
1386
|
*/
|
1514
1387
|
VALUE Info_gravity(VALUE self)
|
1515
1388
|
{
|
1516
1389
|
Info *info;
|
1517
1390
|
const char *gravity;
|
1518
|
-
int x;
|
1519
1391
|
ID gravity_id;
|
1520
1392
|
|
1521
|
-
|
1393
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1522
1394
|
|
1523
1395
|
gravity_id = rb_intern("UndefinedGravity");
|
1524
1396
|
|
1525
1397
|
// Map the gravity option string to a GravityType enumerator.
|
1526
|
-
gravity=GetImageOption(info, "gravity");
|
1398
|
+
gravity = GetImageOption(info, "gravity");
|
1527
1399
|
if (gravity)
|
1528
1400
|
{
|
1529
|
-
for (x = 0; x < N_GRAVITY_OPTIONS; x++)
|
1401
|
+
for (int x = 0; x < N_GRAVITY_OPTIONS; x++)
|
1530
1402
|
{
|
1531
1403
|
if (strcmp(gravity, Gravity_Option[x].string) == 0)
|
1532
1404
|
{
|
@@ -1543,12 +1415,8 @@ VALUE Info_gravity(VALUE self)
|
|
1543
1415
|
* Convert a GravityType enum to a gravity option name and store in the Info
|
1544
1416
|
* structure.
|
1545
1417
|
*
|
1546
|
-
*
|
1547
|
-
*
|
1548
|
-
*
|
1549
|
-
* @param self this object
|
1550
|
-
* @param grav the gravity enumerator
|
1551
|
-
* @return self
|
1418
|
+
* @param grav [Magick::GravityType] the gravity enumerator
|
1419
|
+
* @return [Magick::GravityType] the given gravity
|
1552
1420
|
*/
|
1553
1421
|
VALUE
|
1554
1422
|
Info_gravity_eq(VALUE self, VALUE grav)
|
@@ -1558,11 +1426,11 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1558
1426
|
const char *option;
|
1559
1427
|
int x;
|
1560
1428
|
|
1561
|
-
|
1429
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1562
1430
|
|
1563
1431
|
if (NIL_P(grav))
|
1564
1432
|
{
|
1565
|
-
(
|
1433
|
+
DeleteImageOption(info, "gravity");
|
1566
1434
|
return self;
|
1567
1435
|
}
|
1568
1436
|
|
@@ -1578,222 +1446,207 @@ Info_gravity_eq(VALUE self, VALUE grav)
|
|
1578
1446
|
}
|
1579
1447
|
}
|
1580
1448
|
|
1581
|
-
|
1582
|
-
return
|
1449
|
+
SetImageOption(info, "gravity", option);
|
1450
|
+
return grav;
|
1583
1451
|
}
|
1584
1452
|
|
1585
1453
|
|
1586
|
-
DEF_ATTR_ACCESSOR(Info, group, long)
|
1587
|
-
|
1588
1454
|
/**
|
1589
1455
|
* Get the classification type.
|
1590
1456
|
*
|
1591
|
-
*
|
1592
|
-
* - @verbatim Info#image_type @endverbatim
|
1593
|
-
*
|
1594
|
-
* @param self this object
|
1595
|
-
* @return the classification type
|
1457
|
+
* @return [Magick::ImageType] the classification type
|
1596
1458
|
*/
|
1597
1459
|
VALUE
|
1598
1460
|
Info_image_type(VALUE self)
|
1599
1461
|
{
|
1600
1462
|
Info *info;
|
1601
1463
|
|
1602
|
-
|
1603
|
-
return
|
1464
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1465
|
+
return ImageType_find(info->type);
|
1604
1466
|
}
|
1605
1467
|
|
1606
1468
|
/**
|
1607
1469
|
* Set the classification type.
|
1608
1470
|
*
|
1609
|
-
*
|
1610
|
-
*
|
1611
|
-
*
|
1612
|
-
* @param self this object
|
1613
|
-
* @param type the classification type
|
1614
|
-
* @return self
|
1615
|
-
* @throw ArgumentError
|
1471
|
+
* @param type [Magick::ImageType] the classification type
|
1472
|
+
* @return [Magick::ImageType] the given type
|
1616
1473
|
*/
|
1617
1474
|
VALUE
|
1618
1475
|
Info_image_type_eq(VALUE self, VALUE type)
|
1619
1476
|
{
|
1620
1477
|
Info *info;
|
1621
1478
|
|
1622
|
-
|
1479
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1623
1480
|
VALUE_TO_ENUM(type, info->type, ImageType);
|
1624
|
-
return
|
1481
|
+
return type;
|
1625
1482
|
}
|
1626
1483
|
|
1627
1484
|
/**
|
1628
1485
|
* Get the interlace type.
|
1629
1486
|
*
|
1630
|
-
*
|
1631
|
-
* - @verbatim Info#interlace @endverbatim
|
1632
|
-
*
|
1633
|
-
* @param self this object
|
1634
|
-
* @return the interlace type
|
1487
|
+
* @return [Magick::InterlaceType] the interlace type
|
1635
1488
|
*/
|
1636
1489
|
VALUE
|
1637
1490
|
Info_interlace(VALUE self)
|
1638
1491
|
{
|
1639
1492
|
Info *info;
|
1640
1493
|
|
1641
|
-
|
1642
|
-
return
|
1494
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1495
|
+
return InterlaceType_find(info->interlace);
|
1643
1496
|
}
|
1644
1497
|
|
1645
1498
|
/**
|
1646
1499
|
* Set the interlace type
|
1647
1500
|
*
|
1648
|
-
*
|
1649
|
-
*
|
1650
|
-
*
|
1651
|
-
* @param self this object
|
1652
|
-
* @param inter the interlace type
|
1653
|
-
* @return self
|
1654
|
-
* @throw ArgumentError
|
1501
|
+
* @param inter [Magick::InterlaceType] the interlace type
|
1502
|
+
* @return [Magick::InterlaceType] the given interlace
|
1655
1503
|
*/
|
1656
1504
|
VALUE
|
1657
1505
|
Info_interlace_eq(VALUE self, VALUE inter)
|
1658
1506
|
{
|
1659
1507
|
Info *info;
|
1660
1508
|
|
1661
|
-
|
1509
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1662
1510
|
VALUE_TO_ENUM(inter, info->interlace, InterlaceType);
|
1663
|
-
return
|
1511
|
+
return inter;
|
1664
1512
|
}
|
1665
1513
|
|
1666
|
-
|
1514
|
+
/**
|
1515
|
+
* Get the label.
|
1516
|
+
*
|
1517
|
+
* @return [String] the label
|
1518
|
+
*/
|
1519
|
+
VALUE Info_label(VALUE self)
|
1520
|
+
{
|
1521
|
+
return get_option(self, "Label");
|
1522
|
+
}
|
1667
1523
|
|
1668
1524
|
/**
|
1669
|
-
*
|
1525
|
+
* Set the label.
|
1670
1526
|
*
|
1671
|
-
*
|
1672
|
-
*
|
1527
|
+
* @param string [String] the label
|
1528
|
+
* @return [String] the given label
|
1529
|
+
*/
|
1530
|
+
VALUE Info_label_eq(VALUE self, VALUE string)
|
1531
|
+
{
|
1532
|
+
return set_option(self, "Label", string);
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
/**
|
1536
|
+
* Return the name of the matte color as a String.
|
1673
1537
|
*
|
1674
|
-
* @
|
1675
|
-
* @
|
1676
|
-
* @see Image_matte_color
|
1538
|
+
* @return [String] the name of the matte color
|
1539
|
+
* @see Image#matte_color
|
1677
1540
|
*/
|
1678
1541
|
VALUE
|
1679
1542
|
Info_matte_color(VALUE self)
|
1680
1543
|
{
|
1681
1544
|
Info *info;
|
1682
1545
|
|
1683
|
-
|
1684
|
-
return
|
1546
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1547
|
+
return rm_pixelcolor_to_color_name_info(info, &info->matte_color);
|
1685
1548
|
}
|
1686
1549
|
|
1687
1550
|
/**
|
1688
1551
|
* Set the matte color.
|
1689
1552
|
*
|
1690
|
-
*
|
1691
|
-
*
|
1692
|
-
*
|
1693
|
-
* @param self this object
|
1694
|
-
* @param matte_arg the name of the matte as a String
|
1695
|
-
* @return self
|
1696
|
-
* @throw ArgumentError
|
1553
|
+
* @param matte_arg [Magick::Pixel, String] the name of the matte as a String
|
1554
|
+
* @return [Magick::Pixel, String] the given value
|
1697
1555
|
*/
|
1698
1556
|
VALUE
|
1699
1557
|
Info_matte_color_eq(VALUE self, VALUE matte_arg)
|
1700
1558
|
{
|
1701
1559
|
Info *info;
|
1702
|
-
//char colorname[MaxTextExtent];
|
1703
1560
|
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
return
|
1561
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1562
|
+
Color_to_PixelColor(&info->matte_color, matte_arg);
|
1563
|
+
|
1564
|
+
return matte_arg;
|
1708
1565
|
}
|
1709
1566
|
|
1710
1567
|
/**
|
1711
|
-
*
|
1568
|
+
* Get the monochrome value.
|
1712
1569
|
*
|
1713
|
-
*
|
1714
|
-
* - @verbatim Info#monitor= @endverbatim
|
1715
|
-
*
|
1716
|
-
* @param self this object
|
1717
|
-
* @param monitor the monitor
|
1718
|
-
* @return self
|
1719
|
-
* @see Image_monitor_eq
|
1570
|
+
* @return [Boolean] true or false
|
1720
1571
|
*/
|
1721
1572
|
VALUE
|
1722
|
-
|
1573
|
+
Info_monochrome(VALUE self)
|
1723
1574
|
{
|
1724
|
-
Info
|
1725
|
-
|
1726
|
-
Data_Get_Struct(self, Info, info);
|
1727
|
-
|
1728
|
-
if (NIL_P(monitor))
|
1729
|
-
{
|
1730
|
-
info->progress_monitor = NULL;
|
1731
|
-
}
|
1732
|
-
else
|
1733
|
-
{
|
1734
|
-
(void) SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
|
1735
|
-
}
|
1736
|
-
|
1737
|
-
|
1738
|
-
return self;
|
1575
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, monochrome, boolean, &rm_info_data_type);
|
1739
1576
|
}
|
1740
1577
|
|
1578
|
+
/**
|
1579
|
+
* Set the monochrome value.
|
1580
|
+
*
|
1581
|
+
* @param val [Boolean] true or false
|
1582
|
+
* @return [Boolean] the given value
|
1583
|
+
*/
|
1584
|
+
VALUE
|
1585
|
+
Info_monochrome_eq(VALUE self, VALUE val)
|
1586
|
+
{
|
1587
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, monochrome, boolean, &rm_info_data_type);
|
1588
|
+
}
|
1741
1589
|
|
1590
|
+
/**
|
1591
|
+
* Get the scene number of an image or the first image in a sequence.
|
1592
|
+
*
|
1593
|
+
* @return [Numeric] the scene number
|
1594
|
+
*/
|
1595
|
+
VALUE
|
1596
|
+
Info_number_scenes(VALUE self)
|
1597
|
+
{
|
1598
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, number_scenes, ulong, &rm_info_data_type);
|
1599
|
+
}
|
1742
1600
|
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1601
|
+
/**
|
1602
|
+
* Set the scene number of an image or the first image in a sequence.
|
1603
|
+
*
|
1604
|
+
* @param val [Numeric] the scene number
|
1605
|
+
* @return [Numeric] the given value
|
1606
|
+
*/
|
1607
|
+
VALUE
|
1608
|
+
Info_number_scenes_eq(VALUE self, VALUE val)
|
1609
|
+
{
|
1610
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, number_scenes, ulong, &rm_info_data_type);
|
1611
|
+
}
|
1747
1612
|
|
1748
1613
|
/**
|
1749
1614
|
* Return the orientation attribute as an OrientationType enum value.
|
1750
1615
|
*
|
1751
|
-
*
|
1752
|
-
* - @verbatim Info#orientation @endverbatim
|
1753
|
-
*
|
1754
|
-
* @param self this object
|
1755
|
-
* @return the orientation
|
1616
|
+
* @return [Magick::OrientationType] the orientation
|
1756
1617
|
*/
|
1757
1618
|
VALUE
|
1758
1619
|
Info_orientation(VALUE self)
|
1759
1620
|
{
|
1760
1621
|
Info *info;
|
1761
1622
|
|
1762
|
-
|
1763
|
-
return
|
1623
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1624
|
+
return OrientationType_find(info->orientation);
|
1764
1625
|
}
|
1765
1626
|
|
1766
1627
|
|
1767
1628
|
/**
|
1768
1629
|
* Set the Orientation type.
|
1769
1630
|
*
|
1770
|
-
*
|
1771
|
-
*
|
1772
|
-
*
|
1773
|
-
* @param self this object
|
1774
|
-
* @param inter the orientation type as an OrientationType enum value
|
1775
|
-
* @return self
|
1776
|
-
* @throw ArgumentError
|
1631
|
+
* @param inter [Magick::OrientationType] the orientation type as an OrientationType enum value
|
1632
|
+
* @return [Magick::OrientationType] the given value
|
1777
1633
|
*/
|
1778
1634
|
VALUE
|
1779
1635
|
Info_orientation_eq(VALUE self, VALUE inter)
|
1780
1636
|
{
|
1781
1637
|
Info *info;
|
1782
1638
|
|
1783
|
-
|
1639
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1784
1640
|
VALUE_TO_ENUM(inter, info->orientation, OrientationType);
|
1785
|
-
return
|
1641
|
+
return inter;
|
1786
1642
|
}
|
1787
1643
|
|
1788
1644
|
|
1789
1645
|
/**
|
1790
1646
|
* Return origin geometry.
|
1791
1647
|
*
|
1792
|
-
*
|
1793
|
-
*
|
1794
|
-
*
|
1795
|
-
* @param self this object
|
1796
|
-
* @return the origin geometry
|
1648
|
+
* @return [String] the origin geometry
|
1649
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1797
1650
|
*/
|
1798
1651
|
VALUE
|
1799
1652
|
Info_origin(VALUE self)
|
@@ -1801,7 +1654,7 @@ Info_origin(VALUE self)
|
|
1801
1654
|
Info *info;
|
1802
1655
|
const char *origin;
|
1803
1656
|
|
1804
|
-
|
1657
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1805
1658
|
|
1806
1659
|
origin = GetImageOption(info, "origin");
|
1807
1660
|
return origin ? rb_str_new2(origin) : Qnil;
|
@@ -1812,12 +1665,12 @@ Info_origin(VALUE self)
|
|
1812
1665
|
* Set origin geometry. Argument may be a Geometry object as well as a geometry
|
1813
1666
|
* string.
|
1814
1667
|
*
|
1815
|
-
*
|
1816
|
-
*
|
1668
|
+
* The geometry format is
|
1669
|
+
* +-x+-y
|
1817
1670
|
*
|
1818
|
-
* @param
|
1819
|
-
* @
|
1820
|
-
* @
|
1671
|
+
* @param origin_arg [String] the origin geometry
|
1672
|
+
* @return [String] the given value
|
1673
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1821
1674
|
*/
|
1822
1675
|
VALUE
|
1823
1676
|
Info_origin_eq(VALUE self, VALUE origin_arg)
|
@@ -1826,45 +1679,43 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
|
|
1826
1679
|
VALUE origin_str;
|
1827
1680
|
char *origin;
|
1828
1681
|
|
1829
|
-
|
1682
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1830
1683
|
|
1831
1684
|
if (NIL_P(origin_arg))
|
1832
1685
|
{
|
1833
|
-
(
|
1686
|
+
DeleteImageOption(info, "origin");
|
1834
1687
|
return self;
|
1835
1688
|
}
|
1836
1689
|
|
1837
|
-
origin_str =
|
1838
|
-
origin = GetPageGeometry(
|
1690
|
+
origin_str = rb_String(origin_arg);
|
1691
|
+
origin = GetPageGeometry(StringValueCStr(origin_str));
|
1839
1692
|
|
1840
1693
|
if (IsGeometry(origin) == MagickFalse)
|
1841
1694
|
{
|
1842
|
-
|
1695
|
+
magick_free(origin);
|
1696
|
+
rb_raise(rb_eArgError, "invalid origin geometry");
|
1843
1697
|
}
|
1844
1698
|
|
1845
|
-
|
1699
|
+
SetImageOption(info, "origin", origin);
|
1700
|
+
magick_free(origin);
|
1846
1701
|
|
1847
1702
|
RB_GC_GUARD(origin_str);
|
1848
1703
|
|
1849
|
-
return
|
1704
|
+
return origin_arg;
|
1850
1705
|
}
|
1851
1706
|
|
1852
1707
|
|
1853
1708
|
/**
|
1854
1709
|
* Get the Postscript page geometry.
|
1855
1710
|
*
|
1856
|
-
*
|
1857
|
-
* - @verbatim Info_page @endverbatim
|
1858
|
-
*
|
1859
|
-
* @param self this object
|
1860
|
-
* @return the page geometry
|
1711
|
+
* @return [String] the page geometry
|
1861
1712
|
*/
|
1862
1713
|
VALUE
|
1863
1714
|
Info_page(VALUE self)
|
1864
1715
|
{
|
1865
1716
|
Info *info;
|
1866
1717
|
|
1867
|
-
|
1718
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1868
1719
|
return info->page ? rb_str_new2(info->page) : Qnil;
|
1869
1720
|
|
1870
1721
|
}
|
@@ -1873,12 +1724,9 @@ Info_page(VALUE self)
|
|
1873
1724
|
* Store the Postscript page geometry. Argument may be a Geometry object as well
|
1874
1725
|
* as a geometry string.
|
1875
1726
|
*
|
1876
|
-
*
|
1877
|
-
*
|
1878
|
-
*
|
1879
|
-
* @param self this object
|
1880
|
-
* @param page_arg the geometry
|
1881
|
-
* @return self
|
1727
|
+
* @param page_arg [String] the geometry
|
1728
|
+
* @return [String] the given value
|
1729
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
1882
1730
|
*/
|
1883
1731
|
VALUE
|
1884
1732
|
Info_page_eq(VALUE self, VALUE page_arg)
|
@@ -1887,46 +1735,85 @@ Info_page_eq(VALUE self, VALUE page_arg)
|
|
1887
1735
|
VALUE geom_str;
|
1888
1736
|
char *geometry;
|
1889
1737
|
|
1890
|
-
|
1738
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1891
1739
|
if (NIL_P(page_arg))
|
1892
1740
|
{
|
1893
1741
|
magick_free(info->page);
|
1894
1742
|
info->page = NULL;
|
1895
1743
|
return self;
|
1896
1744
|
}
|
1897
|
-
geom_str =
|
1898
|
-
geometry=GetPageGeometry(
|
1745
|
+
geom_str = rb_String(page_arg);
|
1746
|
+
geometry = GetPageGeometry(StringValueCStr(geom_str));
|
1899
1747
|
if (*geometry == '\0')
|
1900
1748
|
{
|
1901
1749
|
magick_free(info->page);
|
1902
1750
|
info->page = NULL;
|
1903
1751
|
return self;
|
1904
1752
|
}
|
1905
|
-
|
1753
|
+
info->page = geometry;
|
1906
1754
|
|
1907
1755
|
RB_GC_GUARD(geom_str);
|
1908
1756
|
|
1909
|
-
return
|
1757
|
+
return page_arg;
|
1910
1758
|
}
|
1911
1759
|
|
1912
|
-
|
1913
|
-
|
1760
|
+
/**
|
1761
|
+
* Get the point size.
|
1762
|
+
*
|
1763
|
+
* @return [Float] the point size
|
1764
|
+
*/
|
1765
|
+
VALUE
|
1766
|
+
Info_pointsize(VALUE self)
|
1767
|
+
{
|
1768
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, pointsize, dbl, &rm_info_data_type);
|
1769
|
+
}
|
1914
1770
|
|
1915
1771
|
/**
|
1916
|
-
*
|
1772
|
+
* Set the point size.
|
1917
1773
|
*
|
1918
|
-
*
|
1919
|
-
*
|
1774
|
+
* @param val [Float] the point size
|
1775
|
+
* @return [Float] the given value
|
1776
|
+
*/
|
1777
|
+
VALUE
|
1778
|
+
Info_pointsize_eq(VALUE self, VALUE val)
|
1779
|
+
{
|
1780
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, pointsize, dbl, &rm_info_data_type);
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
/**
|
1784
|
+
* Get the compression level for JPEG, etc.
|
1920
1785
|
*
|
1921
|
-
* @
|
1922
|
-
|
1786
|
+
* @return [Numeric] the compression level
|
1787
|
+
*/
|
1788
|
+
VALUE
|
1789
|
+
Info_quality(VALUE self)
|
1790
|
+
{
|
1791
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, quality, ulong, &rm_info_data_type);
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
/**
|
1795
|
+
* Get the compression level for JPEG, etc.
|
1796
|
+
*
|
1797
|
+
* @param val [Numeric] the compression level
|
1798
|
+
* @return [Numeric] the given value
|
1799
|
+
*/
|
1800
|
+
VALUE
|
1801
|
+
Info_quality_eq(VALUE self, VALUE val)
|
1802
|
+
{
|
1803
|
+
IMPLEMENT_TYPED_ATTR_WRITER(Info, quality, ulong, &rm_info_data_type);
|
1804
|
+
}
|
1805
|
+
|
1806
|
+
/**
|
1807
|
+
* Get sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
|
1808
|
+
*
|
1809
|
+
* @return [String, nil] the sampling factors
|
1923
1810
|
*/
|
1924
1811
|
VALUE
|
1925
1812
|
Info_sampling_factor(VALUE self)
|
1926
1813
|
{
|
1927
1814
|
Info *info;
|
1928
1815
|
|
1929
|
-
|
1816
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1930
1817
|
if (info->sampling_factor)
|
1931
1818
|
{
|
1932
1819
|
return rb_str_new2(info->sampling_factor);
|
@@ -1940,12 +1827,8 @@ Info_sampling_factor(VALUE self)
|
|
1940
1827
|
/**
|
1941
1828
|
* Set sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
|
1942
1829
|
*
|
1943
|
-
*
|
1944
|
-
*
|
1945
|
-
*
|
1946
|
-
* @param self this object
|
1947
|
-
* @param sampling_factor the sampling factors
|
1948
|
-
* @return self
|
1830
|
+
* @param sampling_factor [String] the sampling factors
|
1831
|
+
* @return [String] the given value
|
1949
1832
|
*/
|
1950
1833
|
VALUE
|
1951
1834
|
Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
@@ -1954,7 +1837,7 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
|
1954
1837
|
char *sampling_factor_p = NULL;
|
1955
1838
|
long sampling_factor_len = 0;
|
1956
1839
|
|
1957
|
-
|
1840
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1958
1841
|
|
1959
1842
|
if (!NIL_P(sampling_factor))
|
1960
1843
|
{
|
@@ -1971,25 +1854,21 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
|
|
1971
1854
|
magick_clone_string(&info->sampling_factor, sampling_factor_p);
|
1972
1855
|
}
|
1973
1856
|
|
1974
|
-
return
|
1857
|
+
return sampling_factor;
|
1975
1858
|
}
|
1976
1859
|
|
1977
1860
|
|
1978
1861
|
/**
|
1979
1862
|
* Get the scene number.
|
1980
1863
|
*
|
1981
|
-
*
|
1982
|
-
* - @verbatim Info#scene @endverbatim
|
1983
|
-
*
|
1984
|
-
* @param self this object
|
1985
|
-
* @return the scene number
|
1864
|
+
* @return [Numeric] the scene number
|
1986
1865
|
*/
|
1987
1866
|
VALUE
|
1988
1867
|
Info_scene(VALUE self)
|
1989
1868
|
{
|
1990
1869
|
Info *info;
|
1991
1870
|
|
1992
|
-
|
1871
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1993
1872
|
return ULONG2NUM(info->scene);
|
1994
1873
|
}
|
1995
1874
|
|
@@ -1997,12 +1876,8 @@ Info_scene(VALUE self)
|
|
1997
1876
|
/**
|
1998
1877
|
* Set the scene number.
|
1999
1878
|
*
|
2000
|
-
*
|
2001
|
-
*
|
2002
|
-
*
|
2003
|
-
* @param self this object
|
2004
|
-
* @param scene the scene number
|
2005
|
-
* @return self
|
1879
|
+
* @param scene [Numeric] the scene number
|
1880
|
+
* @return [Numeric] the given value
|
2006
1881
|
*/
|
2007
1882
|
VALUE
|
2008
1883
|
Info_scene_eq(VALUE self, VALUE scene)
|
@@ -2010,84 +1885,73 @@ Info_scene_eq(VALUE self, VALUE scene)
|
|
2010
1885
|
Info *info;
|
2011
1886
|
char buf[25];
|
2012
1887
|
|
2013
|
-
|
1888
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2014
1889
|
info->scene = NUM2ULONG(scene);
|
2015
1890
|
|
2016
|
-
|
2017
|
-
(
|
2018
|
-
#else
|
2019
|
-
(void) sprintf(buf, "%-l", info->scene);
|
2020
|
-
#endif
|
2021
|
-
(void) SetImageOption(info, "scene", buf);
|
1891
|
+
snprintf(buf, sizeof(buf), "%"RMIuSIZE"", info->scene);
|
1892
|
+
SetImageOption(info, "scene", buf);
|
2022
1893
|
|
2023
|
-
return
|
1894
|
+
return scene;
|
2024
1895
|
}
|
2025
1896
|
|
2026
1897
|
|
2027
1898
|
/**
|
2028
1899
|
* Get the server name.
|
2029
1900
|
*
|
2030
|
-
*
|
2031
|
-
* - @verbatim Info#server_name @endverbatim
|
2032
|
-
*
|
2033
|
-
* @param self this object
|
2034
|
-
* @return the server name
|
1901
|
+
* @return [String] the server name
|
2035
1902
|
*/
|
2036
|
-
|
1903
|
+
VALUE
|
1904
|
+
Info_server_name(VALUE self)
|
1905
|
+
{
|
1906
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, server_name, str, &rm_info_data_type);
|
1907
|
+
}
|
2037
1908
|
|
2038
1909
|
|
2039
1910
|
/**
|
2040
1911
|
* Set the server name.
|
2041
1912
|
*
|
2042
|
-
*
|
2043
|
-
*
|
2044
|
-
*
|
2045
|
-
* @param self this object
|
2046
|
-
* @param server_arg the server name as a String
|
2047
|
-
* @return self
|
1913
|
+
* @param server_arg [String] the server name
|
1914
|
+
* @return [String] the given value
|
2048
1915
|
*/
|
2049
1916
|
VALUE
|
2050
1917
|
Info_server_name_eq(VALUE self, VALUE server_arg)
|
2051
1918
|
{
|
2052
1919
|
Info *info;
|
2053
|
-
char *server;
|
2054
1920
|
|
2055
|
-
|
2056
|
-
if (NIL_P(server_arg) ||
|
1921
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
1922
|
+
if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
|
2057
1923
|
{
|
2058
1924
|
magick_free(info->server_name);
|
2059
1925
|
info->server_name = NULL;
|
2060
1926
|
}
|
2061
1927
|
else
|
2062
1928
|
{
|
2063
|
-
server
|
1929
|
+
char *server;
|
1930
|
+
|
1931
|
+
server = StringValueCStr(server_arg);
|
2064
1932
|
magick_clone_string(&info->server_name, server);
|
2065
1933
|
}
|
2066
|
-
return
|
1934
|
+
return server_arg;
|
2067
1935
|
}
|
2068
1936
|
|
2069
1937
|
/**
|
2070
1938
|
* Get ths size
|
2071
1939
|
*
|
2072
|
-
*
|
2073
|
-
*
|
2074
|
-
*
|
2075
|
-
* @param self this object
|
2076
|
-
* @return the size as a Geometry object
|
1940
|
+
* @return [String] the size as a Geometry object
|
1941
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2077
1942
|
*/
|
2078
|
-
|
1943
|
+
VALUE
|
1944
|
+
Info_size(VALUE self)
|
1945
|
+
{
|
1946
|
+
IMPLEMENT_TYPED_ATTR_READER(Info, size, str, &rm_info_data_type);
|
1947
|
+
}
|
2079
1948
|
|
2080
1949
|
/**
|
2081
|
-
* Set the size (either as a Geometry object or a Geometry string
|
2082
|
-
* WxH{+-}x{+-}y)
|
1950
|
+
* Set the size (either as a Geometry object or a Geometry string
|
2083
1951
|
*
|
2084
|
-
*
|
2085
|
-
*
|
2086
|
-
*
|
2087
|
-
* @param self this object
|
2088
|
-
* @param size_arg the size
|
2089
|
-
* @return self
|
2090
|
-
* @throw ArgumentError
|
1952
|
+
* @param size_arg [String] the size
|
1953
|
+
* @return [String] the given value
|
1954
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2091
1955
|
*/
|
2092
1956
|
VALUE
|
2093
1957
|
Info_size_eq(VALUE self, VALUE size_arg)
|
@@ -2096,7 +1960,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
2096
1960
|
VALUE size;
|
2097
1961
|
char *sz;
|
2098
1962
|
|
2099
|
-
|
1963
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2100
1964
|
|
2101
1965
|
if (NIL_P(size_arg))
|
2102
1966
|
{
|
@@ -2105,8 +1969,8 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
2105
1969
|
return self;
|
2106
1970
|
}
|
2107
1971
|
|
2108
|
-
size =
|
2109
|
-
sz =
|
1972
|
+
size = rb_String(size_arg);
|
1973
|
+
sz = StringValueCStr(size);
|
2110
1974
|
if (!IsGeometry(sz))
|
2111
1975
|
{
|
2112
1976
|
rb_raise(rb_eArgError, "invalid size geometry: %s", sz);
|
@@ -2116,18 +1980,14 @@ Info_size_eq(VALUE self, VALUE size_arg)
|
|
2116
1980
|
|
2117
1981
|
RB_GC_GUARD(size);
|
2118
1982
|
|
2119
|
-
return
|
1983
|
+
return size_arg;
|
2120
1984
|
}
|
2121
1985
|
|
2122
1986
|
|
2123
1987
|
/**
|
2124
1988
|
* Return the stroke color as a String.
|
2125
1989
|
*
|
2126
|
-
*
|
2127
|
-
* - @verbatim Info#stroke @endverbatim
|
2128
|
-
*
|
2129
|
-
* @param self this object
|
2130
|
-
* @return the stroke color
|
1990
|
+
* @return [String] the stroke color
|
2131
1991
|
*/
|
2132
1992
|
VALUE
|
2133
1993
|
Info_stroke(VALUE self)
|
@@ -2138,13 +1998,8 @@ Info_stroke(VALUE self)
|
|
2138
1998
|
/**
|
2139
1999
|
* Set the stroke color
|
2140
2000
|
*
|
2141
|
-
*
|
2142
|
-
*
|
2143
|
-
*
|
2144
|
-
* @param self this object
|
2145
|
-
* @param color the stroke color as a String
|
2146
|
-
* @return self
|
2147
|
-
* @throw ArgumentError
|
2001
|
+
* @param color [String] the stroke color
|
2002
|
+
* @return [String] the given value
|
2148
2003
|
*/
|
2149
2004
|
VALUE
|
2150
2005
|
Info_stroke_eq(VALUE self, VALUE color)
|
@@ -2154,16 +2009,9 @@ Info_stroke_eq(VALUE self, VALUE color)
|
|
2154
2009
|
|
2155
2010
|
|
2156
2011
|
/**
|
2157
|
-
*
|
2158
|
-
*
|
2159
|
-
* Ruby usage:
|
2160
|
-
* - @verbatim Info#stroke_width @endverbatim
|
2161
|
-
*
|
2162
|
-
* Notes:
|
2163
|
-
* - Supported in ImageMagick >= 6.3.2-6
|
2012
|
+
* Get stroke width.
|
2164
2013
|
*
|
2165
|
-
* @
|
2166
|
-
* @return the stroke width
|
2014
|
+
* @return [Float] the stroke width
|
2167
2015
|
*/
|
2168
2016
|
VALUE
|
2169
2017
|
Info_stroke_width(VALUE self)
|
@@ -2173,17 +2021,10 @@ Info_stroke_width(VALUE self)
|
|
2173
2021
|
|
2174
2022
|
|
2175
2023
|
/**
|
2176
|
-
*
|
2177
|
-
*
|
2178
|
-
* Ruby usage:
|
2179
|
-
* - @verbatim Info#stroke_width= @endverbatim
|
2180
|
-
*
|
2181
|
-
* Notes:
|
2182
|
-
* - Supported in ImageMagick >= 6.3.2-6
|
2024
|
+
* Set stroke width.
|
2183
2025
|
*
|
2184
|
-
* @param
|
2185
|
-
* @
|
2186
|
-
* @return self
|
2026
|
+
* @param stroke_width [Float] the stroke width
|
2027
|
+
* @return [Float] the given value
|
2187
2028
|
*/
|
2188
2029
|
VALUE
|
2189
2030
|
Info_stroke_width_eq(VALUE self, VALUE stroke_width)
|
@@ -2195,12 +2036,8 @@ Info_stroke_width_eq(VALUE self, VALUE stroke_width)
|
|
2195
2036
|
/**
|
2196
2037
|
* Set name of texture to tile onto the image background.
|
2197
2038
|
*
|
2198
|
-
*
|
2199
|
-
*
|
2200
|
-
*
|
2201
|
-
* @param self this object
|
2202
|
-
* @param texture the name of the texture image
|
2203
|
-
* @return self
|
2039
|
+
* @param texture [Magick::Image] the texture image
|
2040
|
+
* @return [Magick::Image] the given image
|
2204
2041
|
*/
|
2205
2042
|
VALUE
|
2206
2043
|
Info_texture_eq(VALUE self, VALUE texture)
|
@@ -2209,7 +2046,7 @@ Info_texture_eq(VALUE self, VALUE texture)
|
|
2209
2046
|
Image *image;
|
2210
2047
|
char name[MaxTextExtent];
|
2211
2048
|
|
2212
|
-
|
2049
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2213
2050
|
|
2214
2051
|
// Delete any existing texture file
|
2215
2052
|
if (info->texture)
|
@@ -2222,28 +2059,50 @@ Info_texture_eq(VALUE self, VALUE texture)
|
|
2222
2059
|
// If argument is nil we're done
|
2223
2060
|
if (texture == Qnil)
|
2224
2061
|
{
|
2225
|
-
return
|
2062
|
+
return texture;
|
2226
2063
|
}
|
2227
2064
|
|
2228
2065
|
// Create a temp copy of the texture and store its name in the texture field
|
2229
2066
|
image = rm_check_destroyed(texture);
|
2230
|
-
rm_write_temp_image(image, name);
|
2067
|
+
rm_write_temp_image(image, name, sizeof(name));
|
2231
2068
|
|
2232
2069
|
magick_clone_string(&info->texture, name);
|
2233
2070
|
|
2234
|
-
return
|
2071
|
+
return texture;
|
2235
2072
|
}
|
2236
2073
|
|
2237
2074
|
|
2238
2075
|
/**
|
2239
|
-
*
|
2076
|
+
* Return tile_offset geometry.
|
2240
2077
|
*
|
2241
|
-
*
|
2242
|
-
*
|
2078
|
+
* @return [String, nil] the tile offset
|
2079
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2080
|
+
*/
|
2081
|
+
VALUE
|
2082
|
+
Info_tile_offset(VALUE self)
|
2083
|
+
{
|
2084
|
+
Info *info;
|
2085
|
+
const char *tile_offset;
|
2086
|
+
|
2087
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2088
|
+
|
2089
|
+
tile_offset = GetImageOption(info, "tile-offset");
|
2090
|
+
|
2091
|
+
if (!tile_offset)
|
2092
|
+
{
|
2093
|
+
return Qnil;
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
return rb_str_new2(tile_offset);
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
|
2100
|
+
/**
|
2101
|
+
* Set tile offset geometry.
|
2243
2102
|
*
|
2244
|
-
* @param
|
2245
|
-
* @
|
2246
|
-
* @
|
2103
|
+
* @param offset [String] the offset geometry
|
2104
|
+
* @return [String] the given value
|
2105
|
+
* @see https://www.imagemagick.org/Magick++/Geometry.html
|
2247
2106
|
*/
|
2248
2107
|
VALUE
|
2249
2108
|
Info_tile_offset_eq(VALUE self, VALUE offset)
|
@@ -2252,106 +2111,64 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
|
|
2252
2111
|
VALUE offset_str;
|
2253
2112
|
char *tile_offset;
|
2254
2113
|
|
2255
|
-
offset_str =
|
2256
|
-
tile_offset =
|
2114
|
+
offset_str = rb_String(offset);
|
2115
|
+
tile_offset = StringValueCStr(offset_str);
|
2257
2116
|
if (!IsGeometry(tile_offset))
|
2258
2117
|
{
|
2259
2118
|
rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
|
2260
2119
|
}
|
2261
2120
|
|
2262
|
-
|
2121
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2263
2122
|
|
2264
|
-
|
2265
|
-
|
2123
|
+
DeleteImageOption(info, "tile-offset");
|
2124
|
+
SetImageOption(info, "tile-offset", tile_offset);
|
2266
2125
|
|
2267
2126
|
RB_GC_GUARD(offset_str);
|
2268
2127
|
|
2269
|
-
return
|
2128
|
+
return offset;
|
2270
2129
|
}
|
2271
2130
|
|
2272
2131
|
|
2273
2132
|
/**
|
2274
|
-
* Return the name of the transparent color
|
2275
|
-
*
|
2276
|
-
* Ruby usage:
|
2277
|
-
* - @verbatim Info#transparent_color @endverbatim
|
2133
|
+
* Return the name of the transparent color.
|
2278
2134
|
*
|
2279
|
-
* @
|
2280
|
-
* @
|
2281
|
-
* @see Image_transparent_color
|
2135
|
+
* @return [String] the name of the transparent color
|
2136
|
+
* @see Image#transparent_color
|
2282
2137
|
*/
|
2283
2138
|
VALUE
|
2284
2139
|
Info_transparent_color(VALUE self)
|
2285
2140
|
{
|
2286
2141
|
Info *info;
|
2287
2142
|
|
2288
|
-
|
2289
|
-
return
|
2143
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2144
|
+
return rm_pixelcolor_to_color_name_info(info, &info->transparent_color);
|
2290
2145
|
}
|
2291
2146
|
|
2292
2147
|
|
2293
2148
|
/**
|
2294
2149
|
* Set the transparent color.
|
2295
2150
|
*
|
2296
|
-
*
|
2297
|
-
*
|
2298
|
-
*
|
2299
|
-
* @param self this object
|
2300
|
-
* @param tc_arg the transparent color as a String
|
2301
|
-
* @return self
|
2302
|
-
* @throw ArgumentError
|
2151
|
+
* @param tc_arg [String] the transparent color
|
2152
|
+
* @return [Magick::Pixel, String] the given value
|
2303
2153
|
*/
|
2304
2154
|
VALUE
|
2305
2155
|
Info_transparent_color_eq(VALUE self, VALUE tc_arg)
|
2306
2156
|
{
|
2307
2157
|
Info *info;
|
2308
|
-
//char colorname[MaxTextExtent];
|
2309
|
-
|
2310
|
-
Data_Get_Struct(self, Info, info);
|
2311
|
-
Color_to_PixelPacket(&info->transparent_color, tc_arg);
|
2312
|
-
//SetImageOption(info, "transparent", pixel_packet_to_hexname(&info->transparent_color, colorname));
|
2313
|
-
return self;
|
2314
|
-
}
|
2315
|
-
|
2316
|
-
|
2317
|
-
/**
|
2318
|
-
* Return tile_offset attribute values.
|
2319
|
-
*
|
2320
|
-
* Ruby usage:
|
2321
|
-
* - @verbatim Image::Info#tile_offset @endverbatim
|
2322
|
-
*
|
2323
|
-
* @param self this object
|
2324
|
-
* @return the tile offset
|
2325
|
-
*/
|
2326
|
-
VALUE
|
2327
|
-
Info_tile_offset(VALUE self)
|
2328
|
-
{
|
2329
|
-
Info *info;
|
2330
|
-
const char *tile_offset;
|
2331
2158
|
|
2332
|
-
|
2159
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2160
|
+
Color_to_PixelColor(&info->transparent_color, tc_arg);
|
2333
2161
|
|
2334
|
-
|
2335
|
-
|
2336
|
-
if (!tile_offset)
|
2337
|
-
{
|
2338
|
-
return Qnil;
|
2339
|
-
}
|
2340
|
-
|
2341
|
-
return rb_str_new2(tile_offset);
|
2162
|
+
return tc_arg;
|
2342
2163
|
}
|
2343
2164
|
|
2344
2165
|
|
2345
2166
|
/**
|
2346
2167
|
* Undefine image option.
|
2347
2168
|
*
|
2348
|
-
*
|
2349
|
-
*
|
2350
|
-
*
|
2351
|
-
* @param self this object
|
2352
|
-
* @param format the format
|
2353
|
-
* @param key the key
|
2354
|
-
* @return self
|
2169
|
+
* @param format [String] the format
|
2170
|
+
* @param key [String] the key
|
2171
|
+
* @return [Magick::Info] self
|
2355
2172
|
*/
|
2356
2173
|
VALUE
|
2357
2174
|
Info_undefine(VALUE self, VALUE format, VALUE key)
|
@@ -2369,25 +2186,19 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
|
|
2369
2186
|
rb_raise(rb_eArgError, "can't undefine %.60s:%.1024s - too long", format_p, key_p);
|
2370
2187
|
}
|
2371
2188
|
|
2372
|
-
|
2189
|
+
snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
|
2373
2190
|
|
2374
|
-
|
2375
|
-
|
2376
|
-
/* char * or MagickBooleanType. Ignore the return value. */
|
2377
|
-
(void) RemoveImageOption(info, fkey);
|
2191
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2192
|
+
DeleteImageOption(info, fkey);
|
2378
2193
|
|
2379
2194
|
return self;
|
2380
2195
|
}
|
2381
2196
|
|
2382
2197
|
|
2383
2198
|
/**
|
2384
|
-
* Return the undercolor color
|
2385
|
-
*
|
2386
|
-
* Ruby usage:
|
2387
|
-
* - @verbatim Info#undercolor @endverbatim
|
2199
|
+
* Return the undercolor color.
|
2388
2200
|
*
|
2389
|
-
* @
|
2390
|
-
* @return the undercolor
|
2201
|
+
* @return [String] the undercolor
|
2391
2202
|
*/
|
2392
2203
|
VALUE
|
2393
2204
|
Info_undercolor(VALUE self)
|
@@ -2398,13 +2209,8 @@ Info_undercolor(VALUE self)
|
|
2398
2209
|
/**
|
2399
2210
|
* Set the undercolor color.
|
2400
2211
|
*
|
2401
|
-
*
|
2402
|
-
*
|
2403
|
-
*
|
2404
|
-
* @param self this object
|
2405
|
-
* @param color the undercolor color as a String
|
2406
|
-
* @return self
|
2407
|
-
* @throw ArgumentError
|
2212
|
+
* @param color [String] the undercolor color
|
2213
|
+
* @return [String] the given value
|
2408
2214
|
*/
|
2409
2215
|
VALUE
|
2410
2216
|
Info_undercolor_eq(VALUE self, VALUE color)
|
@@ -2415,87 +2221,96 @@ Info_undercolor_eq(VALUE self, VALUE color)
|
|
2415
2221
|
/**
|
2416
2222
|
* Get the resolution type.
|
2417
2223
|
*
|
2418
|
-
*
|
2419
|
-
* - @verbatim Info#units @endverbatim
|
2420
|
-
*
|
2421
|
-
* @param self this object
|
2422
|
-
* @return the resolution type
|
2224
|
+
* @return [Magick::ResolutionType] the resolution type
|
2423
2225
|
*/
|
2424
2226
|
VALUE
|
2425
2227
|
Info_units(VALUE self)
|
2426
2228
|
{
|
2427
2229
|
Info *info;
|
2428
2230
|
|
2429
|
-
|
2430
|
-
return
|
2231
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2232
|
+
return ResolutionType_find(info->units);
|
2431
2233
|
}
|
2432
2234
|
|
2433
2235
|
/**
|
2434
2236
|
* Set the resolution type
|
2435
2237
|
*
|
2436
|
-
*
|
2437
|
-
*
|
2438
|
-
*
|
2439
|
-
* @param self this object
|
2440
|
-
* @param units the resolution type
|
2441
|
-
* @return self
|
2442
|
-
* @throw ArgumentError
|
2238
|
+
* @param units [Magick::ResolutionType] the resolution type
|
2239
|
+
* @return [Magick::ResolutionType] the given value
|
2443
2240
|
*/
|
2444
2241
|
VALUE
|
2445
2242
|
Info_units_eq(VALUE self, VALUE units)
|
2446
2243
|
{
|
2447
2244
|
Info *info;
|
2448
2245
|
|
2449
|
-
|
2246
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2450
2247
|
VALUE_TO_ENUM(units, info->units, ResolutionType);
|
2451
|
-
return
|
2248
|
+
return units;
|
2452
2249
|
}
|
2453
2250
|
|
2454
2251
|
/**
|
2455
2252
|
* Get FlashPix viewing parameters.
|
2456
2253
|
*
|
2457
|
-
*
|
2458
|
-
* - @verbatim Info#view @endverbatim
|
2459
|
-
*
|
2460
|
-
* @param self this object.
|
2461
|
-
* @return the viewing parameters
|
2254
|
+
* @return [String] the viewing parameters
|
2462
2255
|
*/
|
2463
|
-
|
2256
|
+
VALUE
|
2257
|
+
Info_view(VALUE self)
|
2258
|
+
{
|
2259
|
+
Info *info;
|
2260
|
+
|
2261
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2262
|
+
#if defined(IMAGEMAGICK_7)
|
2263
|
+
return C_str_to_R_str(GetImageOption(info, "fpx:view"));
|
2264
|
+
#else
|
2265
|
+
return C_str_to_R_str(info->view);
|
2266
|
+
#endif
|
2267
|
+
}
|
2464
2268
|
|
2465
2269
|
/**
|
2466
2270
|
* Set FlashPix viewing parameters.
|
2467
2271
|
*
|
2468
|
-
*
|
2469
|
-
*
|
2470
|
-
*
|
2471
|
-
* @param self this object
|
2472
|
-
* @param view_arg the viewing parameters
|
2473
|
-
* @return self
|
2272
|
+
* @param view_arg [String] the viewing parameters
|
2273
|
+
* @return [String] the given value
|
2474
2274
|
*/
|
2475
2275
|
VALUE
|
2476
2276
|
Info_view_eq(VALUE self, VALUE view_arg)
|
2477
2277
|
{
|
2478
2278
|
Info *info;
|
2479
|
-
char *view;
|
2279
|
+
char *view = NULL;
|
2480
2280
|
|
2481
|
-
|
2281
|
+
TypedData_Get_Struct(self, Info, &rm_info_data_type, info);
|
2482
2282
|
|
2483
|
-
if (NIL_P(view_arg)
|
2283
|
+
if (!NIL_P(view_arg))
|
2284
|
+
{
|
2285
|
+
view = StringValueCStr(view_arg);
|
2286
|
+
}
|
2287
|
+
|
2288
|
+
#if defined(IMAGEMAGICK_7)
|
2289
|
+
if (view)
|
2290
|
+
{
|
2291
|
+
SetImageOption(info, "fpx:view", view);
|
2292
|
+
}
|
2293
|
+
else
|
2294
|
+
{
|
2295
|
+
RemoveImageOption(info, "fpx:view");
|
2296
|
+
}
|
2297
|
+
#else
|
2298
|
+
if (info->view)
|
2484
2299
|
{
|
2485
2300
|
magick_free(info->view);
|
2486
2301
|
info->view = NULL;
|
2487
2302
|
}
|
2488
|
-
|
2303
|
+
if (view)
|
2489
2304
|
{
|
2490
|
-
view = StringValuePtr(view_arg);
|
2491
2305
|
magick_clone_string(&info->view, view);
|
2492
2306
|
}
|
2493
|
-
|
2307
|
+
#endif
|
2308
|
+
return view_arg;
|
2494
2309
|
}
|
2495
2310
|
|
2496
2311
|
|
2497
2312
|
/**
|
2498
|
-
* If there is a texture image, delete it before destroying the
|
2313
|
+
* If there is a texture image, delete it before destroying the Image::Info
|
2499
2314
|
* structure.
|
2500
2315
|
*
|
2501
2316
|
* No Ruby usage (internal function)
|
@@ -2503,7 +2318,7 @@ Info_view_eq(VALUE self, VALUE view_arg)
|
|
2503
2318
|
* @param infoptr pointer to the Info object
|
2504
2319
|
*/
|
2505
2320
|
static void
|
2506
|
-
|
2321
|
+
Info_free(void *infoptr)
|
2507
2322
|
{
|
2508
2323
|
Info *info = (Info *)infoptr;
|
2509
2324
|
|
@@ -2514,12 +2329,24 @@ destroy_Info(void *infoptr)
|
|
2514
2329
|
info->texture = NULL;
|
2515
2330
|
}
|
2516
2331
|
|
2517
|
-
|
2332
|
+
DestroyImageInfo(info);
|
2518
2333
|
}
|
2519
2334
|
|
2335
|
+
/**
|
2336
|
+
* Get Info object size.
|
2337
|
+
*
|
2338
|
+
* No Ruby usage (internal function)
|
2339
|
+
*
|
2340
|
+
* @param infoptr pointer to the Info object
|
2341
|
+
*/
|
2342
|
+
static size_t
|
2343
|
+
Info_memsize(const void *infoptr)
|
2344
|
+
{
|
2345
|
+
return sizeof(Info);
|
2346
|
+
}
|
2520
2347
|
|
2521
2348
|
/**
|
2522
|
-
* Create an
|
2349
|
+
* Create an Image::Info object.
|
2523
2350
|
*
|
2524
2351
|
* No Ruby usage (internal function)
|
2525
2352
|
*
|
@@ -2537,7 +2364,7 @@ Info_alloc(VALUE class)
|
|
2537
2364
|
{
|
2538
2365
|
rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
|
2539
2366
|
}
|
2540
|
-
info_obj =
|
2367
|
+
info_obj = TypedData_Wrap_Struct(class, &rm_info_data_type, info);
|
2541
2368
|
|
2542
2369
|
RB_GC_GUARD(info_obj);
|
2543
2370
|
|
@@ -2571,10 +2398,11 @@ rm_info_new(void)
|
|
2571
2398
|
/**
|
2572
2399
|
* If an initializer block is present, run it.
|
2573
2400
|
*
|
2574
|
-
*
|
2575
|
-
*
|
2401
|
+
* @overload initialize
|
2402
|
+
*
|
2403
|
+
* @overload initialize
|
2404
|
+
* @yield [Magick::Image::Info]
|
2576
2405
|
*
|
2577
|
-
* @param self this object
|
2578
2406
|
* @return self
|
2579
2407
|
*/
|
2580
2408
|
VALUE
|
@@ -2582,8 +2410,7 @@ Info_initialize(VALUE self)
|
|
2582
2410
|
{
|
2583
2411
|
if (rb_block_given_p())
|
2584
2412
|
{
|
2585
|
-
|
2586
|
-
(void) rb_obj_instance_eval(0, NULL, self);
|
2413
|
+
rb_yield(self);
|
2587
2414
|
}
|
2588
2415
|
return self;
|
2589
2416
|
}
|