rmagick 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (52) hide show
  1. data/ChangeLog +29 -0
  2. data/README.html +7 -7
  3. data/doc/comtasks.html +2 -2
  4. data/doc/constants.html +22 -5
  5. data/doc/draw.html +2 -2
  6. data/doc/ex/affinity.rb +12 -0
  7. data/doc/ex/affinity_images.rb +21 -0
  8. data/doc/ex/composite_tiled.rb +23 -0
  9. data/doc/ex/images/Apple.miff +0 -0
  10. data/doc/ex/images/Leaf.miff +0 -0
  11. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  12. data/doc/ex/images/Yellow_Rose.miff +0 -0
  13. data/doc/ex/level_colors.rb +11 -0
  14. data/doc/ilist.html +72 -30
  15. data/doc/image1.html +305 -34
  16. data/doc/image2.html +144 -18
  17. data/doc/image3.html +111 -8
  18. data/doc/imageattrs.html +10 -2
  19. data/doc/imusage.html +5 -5
  20. data/doc/index.html +3 -3
  21. data/doc/info.html +2 -2
  22. data/doc/magick.html +2 -2
  23. data/doc/optequiv.html +54 -9
  24. data/doc/rvg.html +2 -2
  25. data/doc/rvgclip.html +2 -2
  26. data/doc/rvggroup.html +2 -2
  27. data/doc/rvgimage.html +2 -2
  28. data/doc/rvgpattern.html +2 -2
  29. data/doc/rvgshape.html +2 -2
  30. data/doc/rvgstyle.html +2 -2
  31. data/doc/rvgtext.html +2 -2
  32. data/doc/rvgtspan.html +2 -2
  33. data/doc/rvgtut.html +2 -2
  34. data/doc/rvguse.html +2 -2
  35. data/doc/rvgxform.html +2 -2
  36. data/doc/struct.html +2 -2
  37. data/doc/usage.html +27 -8
  38. data/ext/RMagick/MANIFEST +9 -3
  39. data/ext/RMagick/extconf.rb +19 -3
  40. data/ext/RMagick/rmagick.h +23 -7
  41. data/ext/RMagick/rmdraw.c +74 -22
  42. data/ext/RMagick/rmfill.c +2 -2
  43. data/ext/RMagick/rmilist.c +79 -29
  44. data/ext/RMagick/rmimage.c +904 -393
  45. data/ext/RMagick/rminfo.c +9 -9
  46. data/ext/RMagick/rmmain.c +64 -9
  47. data/ext/RMagick/rmutil.c +158 -44
  48. data/lib/RMagick.rb +32 -1
  49. data/rmagick.gemspec +1 -1
  50. metadata +10 -4
  51. data/doc/ex/map.rb +0 -28
  52. data/doc/ex/map_f.rb +0 -15
@@ -6,7 +6,7 @@
6
6
  <meta name="generator" content=
7
7
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
8
8
 
9
- <title>RMagick 2.5.2: class Image (class methods and instance
9
+ <title>RMagick 2.6.0: class Image (class methods and instance
10
10
  methods a-d)</title>
11
11
  <meta http-equiv="Content-Type" content=
12
12
  "text/html; charset=us-ascii" />
@@ -48,7 +48,7 @@ float: left;
48
48
  </head>
49
49
 
50
50
  <body>
51
- <h6 id="header">RMagick 2.5.2 User's Guide and Reference</h6>
51
+ <h6 id="header">RMagick 2.6.0 User's Guide and Reference</h6>
52
52
 
53
53
  <div class="nav">
54
54
  &laquo;&nbsp;<a href="imageattrs.html">Prev</a> | <a href=
@@ -132,6 +132,8 @@ float: left;
132
132
 
133
133
  <li><a href="#affine_transform">affine_transform</a></li>
134
134
 
135
+ <li><a href="#affinity">affinity</a></li>
136
+
135
137
  <li><a href="#alpha">alpha</a></li>
136
138
 
137
139
  <li><a href="#alpha_q">alpha?</a></li>
@@ -204,12 +206,17 @@ float: left;
204
206
  <li><a href="#composite">composite</a></li>
205
207
 
206
208
  <li><a href="#composite_bang">composite!</a></li>
209
+
210
+ <li><a href="#composite_affine">composite_affine</a></li>
211
+
212
+ <li><a href="#composite_tiled">composite_tiled</a></li>
207
213
  </ul>
208
214
  </div>
209
215
 
210
216
  <div class="toccol">
211
217
  <ul>
212
- <li><a href="#composite_affine">composite_affine</a></li>
218
+ <li><a href=
219
+ "#composite_tiled_bang">composite_tiled!</a></li>
213
220
 
214
221
  <li><a href=
215
222
  "#compress_colormap_bang">compress_colormap!</a></li>
@@ -240,6 +247,8 @@ float: left;
240
247
 
241
248
  <li><a href="#delete_profile">delete_profile</a></li>
242
249
 
250
+ <li><a href="#deskew">deskew</a></li>
251
+
243
252
  <li><a href="#despeckle">despeckle</a></li>
244
253
 
245
254
  <li><a href="#destroy_bang">destroy!</a></li>
@@ -1447,6 +1456,62 @@ img = Image.read_inline(content)
1447
1456
  <p>AffineTransformImage</p>
1448
1457
  </div>
1449
1458
 
1459
+ <div class="sig">
1460
+ <h3 id="affinity">affinity</h3>
1461
+
1462
+ <p><span class="arg">img</span>.affinity(<span class=
1463
+ "arg">affinity_image</span>, <span class=
1464
+ "arg">dither</span>=RiemersmaDitherMethod) -&gt; <em>self</em></p>
1465
+ </div>
1466
+
1467
+ <div class="desc">
1468
+ <h4>Description</h4>
1469
+
1470
+ <p>Reduce the number of colors in <span class="arg">img</span>
1471
+ to the colors used by <span class="arg">affinity_image</span>.
1472
+ If a dither method is specified <span class="imquote">then the
1473
+ given colors are dithered over the image as necessary,
1474
+ otherwise the closest color (in RGB colorspace) is selected to
1475
+ replace that pixel in the image.</span></p>
1476
+
1477
+ <h4>Arguments</h4>
1478
+
1479
+ <dl>
1480
+ <dt>affinity_image</dt>
1481
+
1482
+ <dd>The reference image</dd>
1483
+
1484
+ <dt>dither</dt>
1485
+
1486
+ <dd>A <a href="constants.html#DitherMethod">DitherMethod</a>
1487
+ value. RiemersmaDitherMethod is the default. To disable
1488
+ dithering specify NoDitherMethod.</dd>
1489
+ </dl>
1490
+
1491
+ <h4>Returns</h4>
1492
+
1493
+ <p>self</p>
1494
+
1495
+ <h4>Example</h4>
1496
+
1497
+ <p class="rollover"><a href=
1498
+ "javascript:popup('affinity.rb.html')"><img onmouseover=
1499
+ "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
1500
+ "this.src='ex/affinity.jpg'" src="ex/affinity.jpg" alt=
1501
+ "affinity example" title=
1502
+ "Click to see the example script" /></a> <img src=
1503
+ "ex/images/spin.gif" alt="" class="spin" style="left: 202px;"
1504
+ title="Mouse over the example to see the original image" /></p>
1505
+
1506
+ <h4>See also</h4>
1507
+
1508
+ <p><a href="ilist.html#affinity">ImageList#affinity</a></p>
1509
+
1510
+ <h4>Magick API</h4>
1511
+
1512
+ <p>AffinityImage (available in ImageMagick 6.4.3-6)</p>
1513
+ </div>
1514
+
1450
1515
  <div class="sig">
1451
1516
  <h3 id="alpha">alpha</h3>
1452
1517
 
@@ -1915,7 +1980,7 @@ img = Image.read_inline(content)
1915
1980
 
1916
1981
  <dd>Border color. Use a <a href=
1917
1982
  "imusage.html#color_names">named color</a> or a <a href=
1918
- "struct.html#Pixel">Pixel</a> object.</dd>
1983
+ "struct.html#Pixel">pixel</a> object.</dd>
1919
1984
  </dl>
1920
1985
 
1921
1986
  <h4>Returns</h4>
@@ -2557,7 +2622,7 @@ mona.change_geometry!('320x240') { |cols, rows, img|
2557
2622
  <h4>Returns</h4>
2558
2623
 
2559
2624
  <p>A hash. Each key in the hash is a <a href=
2560
- "struct.html#Pixel">Pixel</a> representing a color that appears
2625
+ "struct.html#Pixel">pixel</a> representing a color that appears
2561
2626
  in the image. The value associated with the key is the number
2562
2627
  of times that color appears in the image. <em>Caution:</em> if
2563
2628
  the image contains many colors the hash will be very large. You
@@ -2609,8 +2674,8 @@ mona.change_geometry!('320x240') { |cols, rows, img|
2609
2674
 
2610
2675
  <dt>fill</dt>
2611
2676
 
2612
- <dd>A color name or a <a href="struct.html#Pixel">Pixel</a>
2613
- structure</dd>
2677
+ <dd>A color name or a <a href=
2678
+ "struct.html#Pixel">Pixel</a></dd>
2614
2679
  </dl>
2615
2680
 
2616
2681
  <h4>Returns</h4>
@@ -2676,7 +2741,7 @@ mona.change_geometry!('320x240') { |cols, rows, img|
2676
2741
 
2677
2742
  <dd>Optional. If specified, may be either a <a href=
2678
2743
  "imusage.html#color_names">color name</a> or a <a href=
2679
- "struct.html#Pixel">Pixel</a>.</dd>
2744
+ "struct.html#Pixel">pixel</a>.</dd>
2680
2745
  </dl>
2681
2746
 
2682
2747
  <h4>Returns</h4>
@@ -2768,8 +2833,9 @@ f.color_reset!(red)
2768
2833
 
2769
2834
  <p><span class="arg">img</span>.compare_channel(<span class=
2770
2835
  "arg">img</span>, <span class="arg">metric</span> [,
2771
- <span class="arg">channel...</span>]) -&gt; [<em>image</em>,
2772
- <em>float</em>]</p>
2836
+ <span class="arg">channel...</span>]) [ <span class=
2837
+ "arg">{&nbsp;optional arguments&nbsp;}</span> ] -&gt;
2838
+ [<em>image</em>, <em>float</em>]</p>
2773
2839
  </div>
2774
2840
 
2775
2841
  <div class="desc">
@@ -2797,6 +2863,29 @@ f.color_reset!(red)
2797
2863
  specified channels contribute to the comparison and the
2798
2864
  distortion value. If no channels are specified, compares all
2799
2865
  channels.</dd>
2866
+
2867
+ <dt>optional arguments</dt>
2868
+
2869
+ <dd>
2870
+ If present, <code>compare_channel</code> yields to a block
2871
+ in which you can set optional arguments by setting
2872
+ attributes on <em>self</em>. In both cases <span class=
2873
+ "arg">color</span> may be either a <a href=
2874
+ "imusage.html#color_names">color name</a> or a <a href=
2875
+ "struct.html#Pixel">pixel</a>.
2876
+
2877
+ <dl>
2878
+ <dt>self.highlight_color = color</dt>
2879
+
2880
+ <dd>Emphasize pixel differences with this color. The
2881
+ default is partially transparent red.</dd>
2882
+
2883
+ <dt>self.lowlight_color = color</dt>
2884
+
2885
+ <dd>Demphasize pixel differences with this color. The
2886
+ default is partially transparent white.</dd>
2887
+ </dl>
2888
+ </dd>
2800
2889
  </dl>
2801
2890
 
2802
2891
  <h4>Returns</h4>
@@ -3064,6 +3153,88 @@ f.color_reset!(red)
3064
3153
  <p>DrawAffineImage</p>
3065
3154
  </div>
3066
3155
 
3156
+ <div class="sig">
3157
+ <h3 id="composite_tiled">composite_tiled</h3>
3158
+
3159
+ <p><span class="arg">img</span>.composite_tiled(<span class=
3160
+ "arg">src</span>, <span class="arg">composite_op</span> =
3161
+ Magick::OverCompositeOp) -&gt; <em>image</em></p>
3162
+ </div>
3163
+
3164
+ <div class="desc">
3165
+ <h4>Description</h4>
3166
+
3167
+ <p>Composites multiple copies of the source image across and
3168
+ down the image, producing the same results as ImageMagick's
3169
+ composite command with the -tile option.</p>
3170
+
3171
+ <h4>Arguments</h4>
3172
+
3173
+ <dl>
3174
+ <dt>src</dt>
3175
+
3176
+ <dd>The source image</dd>
3177
+
3178
+ <dt>composite_op</dt>
3179
+
3180
+ <dd>A <a href=
3181
+ "constants.html#CompositeOperator">CompositeOperator</a>
3182
+ value</dd>
3183
+ </dl>
3184
+
3185
+ <h4>Returns</h4>
3186
+
3187
+ <p>A new image</p>
3188
+
3189
+ <h4>See also</h4>
3190
+
3191
+ <p><a href="#composite">composite</a>, <a href=
3192
+ "#composite_tiled_bang">composite_tiled!</a></p>
3193
+
3194
+ <h4>Magick API</h4>
3195
+
3196
+ <p>CompositeImage</p>
3197
+ </div>
3198
+
3199
+ <div class="sig">
3200
+ <h3 id="composite_tiled_bang">composite_tiled!</h3>
3201
+
3202
+ <p><span class="arg">img</span>.composite_tiled!(<span class=
3203
+ "arg">src</span>, <span class="arg">composite_op</span> =
3204
+ Magick::OverCompositeOp) -&gt; <em>self</em></p>
3205
+ </div>
3206
+
3207
+ <div class="desc">
3208
+ <h4>Description</h4>
3209
+
3210
+ <p>In-place form of <a href=
3211
+ "#composite_tiled">composite_tiled</a>.</p>
3212
+
3213
+ <h4>Example</h4>
3214
+
3215
+ <p class="rollover"><a href=
3216
+ "javascript:popup('composite_tiled.rb.html')"><img onmouseover=
3217
+ "this.src='ex/images/Flower_Hat.jpg'" onmouseout=
3218
+ "this.src='ex/composite_tiled.jpg'" src=
3219
+ "ex/composite_tiled.jpg" alt="composite_tiled example" title=
3220
+ "Click the image to see the example script" /></a> <img src=
3221
+ "ex/images/spin.gif" alt="" class="spin" title=
3222
+ "Mouse over the example to see the original image" /></p>
3223
+
3224
+ <h4>Returns</h4>
3225
+
3226
+ <p>self</p>
3227
+
3228
+ <h4>See also</h4>
3229
+
3230
+ <p><a href="#composite_bang">composite!</a>, <a href=
3231
+ "#composite_tiled">composite_tiled</a></p>
3232
+
3233
+ <h4>Magick API</h4>
3234
+
3235
+ <p>CompositeImage</p>
3236
+ </div>
3237
+
3067
3238
  <div class="sig">
3068
3239
  <h3 id="compress_colormap">compress_colormap</h3>
3069
3240
 
@@ -3692,6 +3863,48 @@ deciphered_img = img.decipher("magic word")
3692
3863
  <p>ProfileImage</p>
3693
3864
  </div>
3694
3865
 
3866
+ <div class="sig">
3867
+ <h3 id="deskew">deskew</h3>
3868
+
3869
+ <p><span class="arg">img</span>.deskew(<span class=
3870
+ "arg">threshold</span>=0.40, <span class=
3871
+ "arg">auto_crop_width</span>=nil) -&gt; <em>image</em></p>
3872
+ </div>
3873
+
3874
+ <div class="desc">
3875
+ <h4>Description</h4>
3876
+
3877
+ <p class="imquote">Straightens an image. A <span class=
3878
+ "arg">threshold</span> of 40% works for most images.</p>
3879
+
3880
+ <h4>Arguments</h4>
3881
+
3882
+ <dl>
3883
+ <dt>threshold</dt>
3884
+
3885
+ <dd>A percentage of QuantumRange. Either a Float between 0
3886
+ and 1.0, inclusive, or a string in the form "NN%" where NN is
3887
+ between 0 and 100.</dd>
3888
+
3889
+ <dt>auto_crop_width</dt>
3890
+
3891
+ <dd>Specify a value for this argument to cause the deskewed
3892
+ image to be auto-cropped. The argument is the pixel width of
3893
+ the image background (e.g. 40).</dd>
3894
+ </dl>
3895
+
3896
+ <h4>Returns</h4>
3897
+
3898
+ <p>A new image</p>
3899
+
3900
+ <h4>Example</h4>
3901
+ <pre>
3902
+ img2 = img.deskew
3903
+ </pre>
3904
+
3905
+ <h4>Magick API</h4>DeskewImage (available in 6.4.2)
3906
+ </div>
3907
+
3695
3908
  <div class="sig">
3696
3909
  <h3 id="despeckle">despeckle</h3>
3697
3910
 
@@ -4093,53 +4306,111 @@ pixels = f.dispatch(0, 0, f.columns, f.rows, "RGB")
4093
4306
 
4094
4307
  <p><span class="arg">img</span>.distort(<span class=
4095
4308
  "arg">type</span>, <span class="arg">points</span>,
4096
- <span class="arg">bestfit</span>=<code>false</code>) -&gt;
4097
- <em>image</em></p>
4309
+ <span class="arg">bestfit</span>=<code>false</code>) [
4310
+ <span class="arg">{&nbsp;optional arguments&nbsp;}</span> ]
4311
+ -&gt; <em>image</em></p>
4098
4312
  </div>
4099
4313
 
4100
4314
  <div class="desc">
4101
4315
  <h4>Description</h4>
4102
4316
 
4103
4317
  <p>Distort an image using the specified distortion type and its
4104
- required arguments. This method is the equivalent of
4105
- ImageMagick's -distort option.</p>
4318
+ required arguments. This method is equivalent to ImageMagick's
4319
+ -distort option.</p>
4106
4320
 
4107
4321
  <h4>Arguments</h4>
4108
4322
 
4109
- <p>Specify one of the following values for the distortion
4110
- <span class="arg">type</span>:</p>
4323
+ <dl>
4324
+ <dt>type</dt>
4325
+
4326
+ <dd>
4327
+ One of the following values:
4328
+
4329
+ <ul>
4330
+ <li>AffineDistortion</li>
4331
+
4332
+ <li>AffineProjectionDistortion</li>
4333
+
4334
+ <li>ArcDistortion</li>
4335
+
4336
+ <li>BarrelDistortion</li>
4111
4337
 
4112
- <ul>
4113
- <li>AffineDistortion</li>
4338
+ <li>BilinearDistortion</li>
4114
4339
 
4115
- <li>AffineProjectionDistortion</li>
4340
+ <li>PerspectiveDistortion</li>
4116
4341
 
4117
- <li>ArcDistortion</li>
4342
+ <li>PerspectiveProjectionDistortion</li>
4118
4343
 
4119
- <li>BilinearDistortion</li>
4344
+ <li>PolynomialDistortion</li>
4120
4345
 
4121
- <li>PerspectiveDistortion</li>
4346
+ <li>ScaleRotateTranslateDistortion</li>
4122
4347
 
4123
- <li>PerspectiveProjectionDistortion</li>
4348
+ <li>ShepardsDistortion</li>
4349
+ </ul>
4350
+ </dd>
4351
+
4352
+ <dt>points</dt>
4353
+
4354
+ <dd>An array of numbers. The size of the array depends on the
4355
+ distortion type.</dd>
4356
+
4357
+ <dt>bestfit</dt>
4358
+
4359
+ <dd class="imquote">If <span class="arg">bestfit</span> is
4360
+ enabled, and the distortion allows it, the destination image
4361
+ is adjusted to ensure the whole source image will just fit
4362
+ within the final destination image, which will be sized and
4363
+ offset accordingly. Also in many cases the virtual offset of
4364
+ the source image will be taken into account in the
4365
+ mapping.</dd>
4124
4366
 
4125
- <li>ScaleRotateTranslateDistortion</li>
4126
- </ul>
4367
+ <dt>optional arguments</dt>
4368
+
4369
+ <dd>
4370
+ If present, <code>distort</code> yields to a block in which
4371
+ you can set optional arguments by calling methods on
4372
+ <em>self</em>.
4373
+
4374
+ <dl>
4375
+ <dt>self.define("distort:viewport", "WxH+X+Y")</dt>
4127
4376
 
4128
- <p>The <span class="arg">points</span> argument is an array of
4129
- numbers. The size of the array depends on the distortion
4130
- type.</p>
4377
+ <dd>Specify the size and offset of the generated viewport
4378
+ image of the distorted image space. W and H are the width
4379
+ and height, and X and Y are the offset.</dd>
4131
4380
 
4132
- <p class="imquote">If <span class="arg">bestfit</span> is
4133
- enabled, and the distortion allows it, the destination image is
4134
- adjusted to ensure the whole source image will just fit within
4135
- the final destination image, which will be sized and offset
4136
- accordingly. Also in many cases the virtual offset of the
4137
- source image will be taken into account in the mapping.</p>
4381
+ <dt>self.define("distort:scale", N)</dt>
4382
+
4383
+ <dd>N is an integer factor. <span class="imquote">Scale
4384
+ the output image (viewport or otherwise) by that factor
4385
+ without changing the viewed contents of the distorted
4386
+ image. This can be used either for 'super-sampling' the
4387
+ image for a higher quality result, or for panning and
4388
+ zooming around the image (with appropriate viewport
4389
+ changes, or post-distort cropping and
4390
+ resizing).</span></dd>
4391
+
4392
+ <dt>self.verbose(true)</dt>
4393
+
4394
+ <dd class="imquote">Attempt to output the internal
4395
+ coefficients, and the -fx equivalent to the distortion,
4396
+ for expert study, and debugging purposes. This many not
4397
+ be available for all distorts.</dd>
4398
+ </dl>
4399
+ </dd>
4400
+ </dl>
4138
4401
 
4139
4402
  <h4>Returns</h4>
4140
4403
 
4141
4404
  <p>A new image</p>
4142
4405
 
4406
+ <h4>Example</h4>
4407
+ <pre>
4408
+ result = img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do
4409
+ self.define "distort:viewport", "44x44+15+0"
4410
+ self.define "distort:scale", 2
4411
+ end
4412
+ </pre>
4413
+
4143
4414
  <h4>Note</h4>
4144
4415
 
4145
4416
  <p>See <a href=