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