rmagick 1.15.17 → 2.0.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 (108) hide show
  1. data/ChangeLog +78 -25
  2. data/README.html +117 -188
  3. data/README.txt +116 -181
  4. data/build_tarball.rake +205 -0
  5. data/doc/comtasks.html +2 -2
  6. data/doc/constants.html +118 -44
  7. data/doc/draw.html +57 -99
  8. data/doc/ex/adaptive_threshold.rb +1 -10
  9. data/doc/ex/add_noise.rb +4 -5
  10. data/doc/ex/axes.rb +1 -1
  11. data/doc/ex/bilevel_channel.rb +2 -13
  12. data/doc/ex/bounding_box.rb +3 -4
  13. data/doc/ex/channel.rb +6 -7
  14. data/doc/ex/clip_path.rb +11 -5
  15. data/doc/ex/color_histogram.rb +8 -20
  16. data/doc/ex/composite_layers.rb +53 -0
  17. data/doc/ex/fill_pattern.rb +26 -0
  18. data/doc/ex/get_multiline_type_metrics.rb +26 -37
  19. data/doc/ex/get_type_metrics.rb +25 -25
  20. data/doc/ex/images/notimplemented.gif +0 -0
  21. data/doc/ex/level.rb +1 -1
  22. data/doc/ex/matte_floodfill.rb +5 -6
  23. data/doc/ex/matte_replace.rb +5 -6
  24. data/doc/ex/negate_channel.rb +0 -10
  25. data/doc/ex/opacity.rb +3 -5
  26. data/doc/ex/polaroid.rb +4 -1
  27. data/doc/ex/posterize.rb +1 -12
  28. data/doc/ex/preview.rb +1 -8
  29. data/doc/ex/radial_blur.rb +1 -11
  30. data/doc/ex/raise.rb +1 -4
  31. data/doc/ex/random_threshold_channel.rb +4 -9
  32. data/doc/ex/sepiatone.rb +2 -9
  33. data/doc/ex/shadow.rb +12 -18
  34. data/doc/ex/sketch.rb +2 -9
  35. data/doc/ex/smile.rb +7 -7
  36. data/doc/ex/splice.rb +3 -10
  37. data/doc/ex/stegano.rb +5 -0
  38. data/doc/ex/threshold.rb +2 -2
  39. data/doc/ex/transpose.rb +1 -8
  40. data/doc/ex/transverse.rb +1 -8
  41. data/doc/ex/trim.rb +1 -2
  42. data/doc/ex/viewex.rb +4 -5
  43. data/doc/ex/vignette.rb +1 -8
  44. data/doc/ex/watermark.rb +1 -0
  45. data/doc/ex/wet_floor.rb +8 -14
  46. data/doc/ilist.html +301 -110
  47. data/doc/image1.html +362 -258
  48. data/doc/image2.html +429 -286
  49. data/doc/image3.html +418 -192
  50. data/doc/imageattrs.html +100 -39
  51. data/doc/imusage.html +26 -21
  52. data/doc/index.html +52 -93
  53. data/doc/info.html +160 -64
  54. data/doc/magick.html +37 -71
  55. data/doc/optequiv.html +155 -61
  56. data/doc/rvg.html +3 -3
  57. data/doc/rvgclip.html +2 -2
  58. data/doc/rvggroup.html +2 -2
  59. data/doc/rvgimage.html +3 -3
  60. data/doc/rvgpattern.html +3 -3
  61. data/doc/rvgshape.html +2 -2
  62. data/doc/rvgstyle.html +2 -2
  63. data/doc/rvgtext.html +2 -2
  64. data/doc/rvgtspan.html +4 -4
  65. data/doc/rvgtut.html +4 -4
  66. data/doc/rvguse.html +3 -3
  67. data/doc/rvgxform.html +2 -2
  68. data/doc/struct.html +26 -29
  69. data/doc/usage.html +99 -48
  70. data/examples/crop_with_gravity.rb +46 -0
  71. data/examples/demo.rb +2 -2
  72. data/examples/histogram.rb +11 -11
  73. data/examples/identify.rb +45 -45
  74. data/examples/spinner.rb +3 -2
  75. data/ext/RMagick/MANIFEST +7 -8
  76. data/ext/RMagick/extconf.rb +242 -0
  77. data/ext/RMagick/rmagick.h +136 -222
  78. data/ext/RMagick/rmdraw.c +226 -229
  79. data/ext/RMagick/rmfill.c +69 -118
  80. data/ext/RMagick/rmilist.c +234 -94
  81. data/ext/RMagick/rmimage.c +1719 -2564
  82. data/ext/RMagick/rminfo.c +433 -619
  83. data/ext/RMagick/rmmain.c +249 -487
  84. data/ext/RMagick/rmutil.c +344 -563
  85. data/lib/RMagick.rb +414 -358
  86. data/lib/rvg/clippath.rb +2 -2
  87. data/lib/rvg/container.rb +2 -2
  88. data/lib/rvg/describable.rb +2 -2
  89. data/lib/rvg/embellishable.rb +2 -2
  90. data/lib/rvg/misc.rb +3 -3
  91. data/lib/rvg/paint.rb +2 -7
  92. data/lib/rvg/pathdata.rb +2 -2
  93. data/lib/rvg/rvg.rb +2 -2
  94. data/lib/rvg/stretchable.rb +2 -14
  95. data/lib/rvg/stylable.rb +2 -2
  96. data/lib/rvg/text.rb +2 -2
  97. data/lib/rvg/transformable.rb +2 -2
  98. data/lib/rvg/units.rb +2 -2
  99. data/{metaconfig.in → metaconfig} +0 -1
  100. data/post-setup.rb +1 -1
  101. data/rmagick.gemspec +6 -9
  102. metadata +41 -49
  103. data/Makefile.in +0 -42
  104. data/configure +0 -12358
  105. data/configure.ac +0 -791
  106. data/ext/RMagick/extconf.rb.in +0 -25
  107. data/ext/RMagick/rmagick_config.h.in +0 -285
  108. data/gem_extconf.rb +0 -42
@@ -6,6 +6,6 @@ require 'RMagick'
6
6
  before = Magick::Image.read('images/Flower_Hat.jpg').first
7
7
 
8
8
  # Brighten up the mid-tones a bit.
9
- after = before.level(0, Magick::MaxRGB, 1.50)
9
+ after = before.level(0, Magick::QuantumRange, 1.50)
10
10
  after.write('level.jpg')
11
11
  exit
@@ -1,15 +1,14 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
 
3
3
  require 'RMagick'
4
- include Magick
5
4
 
6
- img = Image.new(200,200)
7
- img.compression = LZWCompression
5
+ img = Magick::Image.new(200,200)
6
+ img.compression = Magick::LZWCompression
8
7
 
9
- bg = Image.read('plasma:fractal') { self.size = '200x200' }
8
+ bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
10
9
  bg[0].matte = false
11
10
 
12
- gc = Draw.new
11
+ gc = Magick::Draw.new
13
12
  gc.stroke_width(2)
14
13
  gc.stroke('black')
15
14
  gc.fill('white')
@@ -27,7 +26,7 @@ img = img.matte_floodfill(100, 100)
27
26
 
28
27
  # Composite the image over a nice bright background
29
28
  # so that the transparent pixels will be obvious.
30
- img = bg[0].composite(img, CenterGravity, OverCompositeOp)
29
+ img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)
31
30
 
32
31
  img.write('matte_floodfill_after.gif')
33
32
  exit
@@ -1,15 +1,14 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
 
3
3
  require 'RMagick'
4
- include Magick
5
4
 
6
- img = Image.new(200,200)
7
- img.compression = LZWCompression
5
+ img = Magick::Image.new(200,200)
6
+ img.compression = Magick::LZWCompression
8
7
 
9
- bg = Image.read('plasma:fractal') { self.size = '200x200' }
8
+ bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
10
9
  bg[0].matte = false
11
10
 
12
- gc = Draw.new
11
+ gc = Magick::Draw.new
13
12
  gc.stroke_width(2)
14
13
  gc.stroke('black')
15
14
  gc.fill('white')
@@ -34,7 +33,7 @@ img = img.matte_replace(100, 45)
34
33
 
35
34
  # Composite the image over a nice bright background
36
35
  # so that the transparent pixels will be obvious.
37
- img = bg[0].composite(img, CenterGravity, OverCompositeOp)
36
+ img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)
38
37
 
39
38
  img.write('matte_replace_after.gif')
40
39
  exit
@@ -4,16 +4,6 @@ require 'RMagick'
4
4
  # Demonstrate the Image#negate_channel method
5
5
 
6
6
  img = Magick::Image.read('images/Flower_Hat.jpg').first
7
-
8
- begin
9
-
10
7
  result = img.negate_channel(false, Magick::GreenChannel)
11
-
12
- # Substitute the standard "Not Implemented" image
13
- rescue NotImplementedError
14
- result = Magick::Image.read("images/notimplemented.gif").first
15
- result.resize!(img.columns, img.rows)
16
- end
17
-
18
8
  result.write('negate_channel.jpg')
19
9
  exit
@@ -1,10 +1,8 @@
1
1
  #! /usr/local/bin/ruby -w
2
-
3
2
  require 'RMagick'
4
- include Magick
5
3
 
6
- canvas = Image.new(260, 125)
7
- gc = Draw.new
4
+ canvas = Magick::Image.new(260, 125)
5
+ gc = Magick::Draw.new
8
6
  gc.fill('black')
9
7
  gc.rectangle(10,20, 250,90)
10
8
 
@@ -26,7 +24,7 @@ gc.roundrectangle(200,20, 240,90, 5,5)
26
24
 
27
25
  gc.stroke('transparent')
28
26
  gc.fill('black')
29
- gc.gravity(SouthGravity)
27
+ gc.gravity(Magick::SouthGravity)
30
28
  gc.text(-90,20, '"25%%"')
31
29
  gc.text(-30,20, '"50%%"')
32
30
  gc.text( 30,20, '"75%%"')
@@ -8,7 +8,10 @@ img = Magick::Image.read('images/Flower_Hat.jpg').first
8
8
  img[:Caption] = "\nLosha\n" + Date.today.to_s
9
9
 
10
10
  begin
11
- picture = img.polaroid { self.gravity = Magick::CenterGravity }
11
+ picture = img.polaroid do
12
+ self.gravity = Magick::CenterGravity
13
+ self.border_color = "#f0f0f8"
14
+ end
12
15
 
13
16
  # Composite it on a white background so the result is opaque.
14
17
  background = Magick::Image.new(picture.columns, picture.rows)
@@ -1,19 +1,8 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
 
3
3
  require 'RMagick'
4
- include Magick
5
-
6
- img = Image.read('images/Flower_Hat.jpg').first
7
-
8
- begin
9
4
 
5
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
10
6
  result = img.posterize
11
-
12
- # Substitute the standard "Not Implemented" image
13
- rescue NotImplementedError
14
- result = Magick::Image.read("images/notimplemented.gif").first
15
- result.resize!(img.columns, img.rows)
16
- end
17
-
18
7
  result.write('posterize.jpg')
19
8
  exit
@@ -3,14 +3,7 @@
3
3
  require 'RMagick'
4
4
 
5
5
  img = Magick::Image.read("images/Flower_Hat.jpg").first
6
-
7
- begin
8
- preview = img.preview(Magick::SolarizePreview)
9
- rescue NotImplementedError
10
- img = Magick::Image.read('images/notimplemented.gif').first
11
- img.write('preview.jpg')
12
- exit
13
- end
6
+ preview = img.preview(Magick::SolarizePreview)
14
7
  preview.minify.write('preview.jpg')
15
8
  exit
16
9
 
@@ -4,16 +4,6 @@ require 'RMagick'
4
4
  # Demonstrate the Image#radial_blur method
5
5
 
6
6
  img = Magick::Image.read('images/Flower_Hat.jpg').first
7
-
8
- # Make a blurry copy.
9
- begin
10
- result = img.radial_blur(10.0)
11
-
12
- # Substitute the standard "Not Implemented" image
13
- rescue NotImplementedError
14
- result = Magick::Image.read("images/notimplemented.gif").first
15
- result.resize!(img.columns, img.rows)
16
- end
17
-
7
+ result = img.radial_blur(10.0)
18
8
  result.write('radial_blur.jpg')
19
9
  exit
@@ -1,11 +1,8 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
  require 'RMagick'
3
- include Magick
4
3
 
5
4
  # Demonstrate the Image#raise method.
6
- img = Image.read('images/Flower_Hat.jpg').first
7
-
5
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
8
6
  img = img.raise
9
-
10
7
  img.write('raise.jpg')
11
8
  exit
@@ -1,18 +1,13 @@
1
- #!/home/software/ruby-1.6.8/bin/ruby -w
1
+ #!/usr/local/bin/ruby -w
2
2
 
3
3
  # Demonstrate the random_channel_threshold method
4
4
 
5
5
  require 'RMagick'
6
- include Magick
7
6
 
8
- img = Image.read('images/Flower_Hat.jpg').first
7
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
9
8
 
10
- begin
11
- geom = Geometry.new(MaxRGB/2)
12
- img2 = img.random_threshold_channel(geom, RedChannel)
13
- rescue NotImplementedError
14
- img2 = Image.read('images/notimplemented.gif').first
15
- end
9
+ geom = Magick::Geometry.new(Magick::QuantumRange/2)
10
+ img2 = img.random_threshold_channel(geom, Magick::RedChannel)
16
11
 
17
12
  img2.write('random_threshold_channel.jpg')
18
13
  exit
@@ -1,15 +1,8 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
 
3
3
  require 'RMagick'
4
- include Magick
5
-
6
- img = Image.read('images/Flower_Hat.jpg').first
7
-
8
- begin
9
- sepiatone = img.sepiatone(MaxRGB * 0.8)
10
- rescue NotImplementedError
11
- sepiatone = Image.read('images/notimplemented.gif').first
12
- end
13
4
 
5
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
6
+ sepiatone = img.sepiatone(Magick::QuantumRange * 0.8)
14
7
  sepiatone.write('sepiatone.jpg')
15
8
 
@@ -1,9 +1,8 @@
1
1
  require 'RMagick'
2
- include Magick
3
2
 
4
3
  # Draw a big red Bezier curve on a transparent background.
5
- img = Image.new(340, 120) {self.background_color = 'none'}
6
- gc = Draw.new
4
+ img = Magick::Image.new(340, 120) {self.background_color = 'none'}
5
+ gc = Magick::Draw.new
7
6
  gc.fill('none')
8
7
  gc.stroke('red')
9
8
  gc.stroke_linecap('round')
@@ -14,24 +13,19 @@ gc.draw(img)
14
13
  # Composite it onto a white background, draw a border around the result,
15
14
  # write it to the "before" file.
16
15
  before = img.copy
17
- bg = Image.new(before.columns, before.rows) {self.background_color='white'}
18
- before = bg.composite(before, CenterGravity, OverCompositeOp)
16
+ bg = Magick::Image.new(before.columns, before.rows) {self.background_color='white'}
17
+ before = bg.composite(before, Magick::CenterGravity, Magick::OverCompositeOp)
19
18
  before.border!(1,1,'gray80')
20
19
  before.write('shadow_before.gif')
21
20
 
22
- begin
23
- # Create the shadow.
24
- shadow = img.shadow()
25
- # Composite the original image over the shadow, composite the result
26
- # onto a white background, add a border, write it to the "after" file.
27
- shadow = shadow.composite(img, NorthWestGravity, OverCompositeOp)
28
- bg = Image.new(shadow.columns, shadow.rows) {self.background_color='white'}
29
- after = bg.composite(shadow, CenterGravity, OverCompositeOp)
30
- after.border!(1,1,'gray80')
31
- rescue NotImplementedError
32
- after = Image.read('images/notimplemented.gif').first
33
- after.resize!(before.columns, before.rows)
34
- end
21
+ # Create the shadow.
22
+ shadow = img.shadow()
23
+ # Composite the original image over the shadow, composite the result
24
+ # onto a white background, add a border, write it to the "after" file.
25
+ shadow = shadow.composite(img, Magick::NorthWestGravity, Magick::OverCompositeOp)
26
+ bg = Magick::Image.new(shadow.columns, shadow.rows) {self.background_color='white'}
27
+ after = bg.composite(shadow, Magick::CenterGravity, Magick::OverCompositeOp)
28
+ after.border!(1,1,'gray80')
35
29
 
36
30
  after.write('shadow_after.gif')
37
31
 
@@ -11,15 +11,8 @@ sketch = img.quantize(256, Magick::GRAYColorspace)
11
11
  sketch = sketch.equalize
12
12
 
13
13
  # Sketch, then dissolve 25% of the original back in
14
- begin
15
- sketch = sketch.sketch(0, 10, 135)
16
- img = img.dissolve(sketch, 0.75, 0.25)
17
-
18
- rescue NotImplementedError
19
- not_impl = Magick::Image.read('images/notimplemented.gif').first
20
- not_impl.resize!(img.columns, img.rows)
21
- img = not_impl
22
- end
14
+ sketch = sketch.sketch(0, 10, 135)
15
+ img = img.dissolve(sketch, 0.75, 0.25)
23
16
 
24
17
  img.write('sketch.jpg')
25
18
 
@@ -101,20 +101,20 @@ SmileBits = [
101
101
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102
102
  0, 0, 0, 0 ]
103
103
 
104
- img = Image.new(SmileWidth, SmileHeight)
105
-
104
+ img = Image.new(SmileWidth, SmileHeight)
105
+
106
106
  q = Array.new # Create an array of pixels one
107
107
  SmileWidth.times do # row long
108
108
  q << Magick::Pixel.new(0,0,0,0)
109
109
  end
110
110
 
111
- n = 0
111
+ n = 0
112
112
  SmileHeight.times do |y| # Store pixels a row at a time
113
113
  SmileWidth.times do |x| # Build a row of pixels
114
- q[x].red = MaxRGB * SmileBits[n]
115
- q[x].green = MaxRGB * SmileBits[n]
116
- q[x].blue = MaxRGB * SmileBits[n]
117
- n += 1
114
+ q[x].red = QuantumRange * SmileBits[n]
115
+ q[x].green = QuantumRange * SmileBits[n]
116
+ q[x].blue = QuantumRange * SmileBits[n]
117
+ n += 1
118
118
  end
119
119
  # Store the row of pixels
120
120
  img.store_pixels(0, y, SmileWidth, 1, q)
@@ -1,16 +1,9 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
  require 'RMagick'
3
- include Magick
4
3
 
5
4
  # Demonstrate the splice method.
6
5
 
7
- img = Image.read('images/Flower_Hat.jpg').first
8
-
9
- begin
10
- spliced_img = img.splice(img.columns/2, img.rows/2, 20, 20, 'gray80')
11
- spliced_img.write('splice.jpg')
12
- rescue NotImplementedError
13
- not_implemented = Magick::Image.read("images/notimplemented.gif").first
14
- not_implemented.write('splice.jpg')
15
- end
6
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
7
+ spliced_img = img.splice(img.columns/2, img.rows/2, 20, 20, 'gray80')
8
+ spliced_img.write('splice.jpg')
16
9
 
@@ -29,6 +29,8 @@ begin
29
29
  # Read the image and retrieve the watermark. The size
30
30
  # attribute describes the size and offset of the watermark.
31
31
 
32
+ # This can take some time. Keep track of how far along we are.
33
+
32
34
  monitor = Proc.new do |text, quantum, span|
33
35
  printf("Extracting watermark...%3.0f%% complete\n", ((1.0-(quantum/span.to_f))*100.0))
34
36
  true
@@ -36,8 +38,11 @@ begin
36
38
 
37
39
  stegano = Magick::Image.read('stegano:img.miff') do
38
40
  self.size = Magick::Geometry.new(wmcols, wmrows, 91)
41
+ self.monitor = monitor
39
42
  end
40
43
 
44
+ stegano[0].monitor = nil
45
+
41
46
  # We don't need this any more.
42
47
  File.delete('img.miff')
43
48
 
@@ -5,8 +5,8 @@ require 'RMagick'
5
5
 
6
6
  img = Magick::Image.read('images/Flower_Hat.jpg').first
7
7
 
8
- # Use a threshold of 55% of MaxRGB.
9
- img = img.threshold(Magick::MaxRGB*0.55)
8
+ # Use a threshold of 55% of QuantumRange.
9
+ img = img.threshold(Magick::QuantumRange*0.55)
10
10
 
11
11
  #img.display
12
12
  img.write('threshold.jpg')
@@ -4,13 +4,6 @@ require 'RMagick'
4
4
  # Demonstrate the Image#transpose method
5
5
 
6
6
  img = Magick::Image.read('images/Flower_Hat.jpg').first
7
-
8
- begin
9
- img = img.transpose
10
- rescue NotImplementedError
11
- not_implemented = Magick::Image.read("images/notimplemented.gif").first
12
- not_implemented.resize!(img.columns, img.rows)
13
- img = not_implemented
14
- end
7
+ img = img.transpose
15
8
  img.write('transpose.jpg')
16
9
  exit
@@ -4,13 +4,6 @@ require 'RMagick'
4
4
  # Demonstrate the Image#transverse method
5
5
 
6
6
  img = Magick::Image.read('images/Flower_Hat.jpg').first
7
-
8
- begin
9
- img = img.transverse
10
- rescue NotImplementedError
11
- not_implemented = Magick::Image.read("images/notimplemented.gif").first
12
- not_implemented.resize!(img.columns, img.rows)
13
- img = not_implemented
14
- end
7
+ img = img.transverse
15
8
  img.write('transverse.jpg')
16
9
  exit
@@ -1,10 +1,9 @@
1
1
  require 'RMagick'
2
- include Magick
3
2
 
4
3
  # Demonstrate the trim method
5
4
 
6
5
  # Read the Flower_Hat image and reduce it to 80% of its original size.
7
- img = Image.read('images/Flower_Hat.jpg').first
6
+ img = Magick::Image.read('images/Flower_Hat.jpg').first
8
7
  cols = img.columns
9
8
  rows = img.rows
10
9
  img.resize!(0.80)
@@ -1,16 +1,15 @@
1
1
  #! /usr/local/bin/ruby -w
2
2
 
3
3
  require 'RMagick'
4
- include Magick
5
4
 
6
- img = Image.new(40, 40) {self.background_color = 'lightcyan2'}
5
+ img = Magick::Image.new(40, 40) {self.background_color = 'lightcyan2'}
7
6
 
8
7
  # The view is 400 pixels square, starting
9
8
  # column 10, row 5 from the top of the image.
10
9
  img.view( 10, 5, 20, 20) do |view|
11
10
 
12
11
  # Set all the pixels in the view to green.
13
- view[][] = Pixel.new(0, MaxRGB)
12
+ view[][] = Magick::Pixel.new(0, Magick::QuantumRange)
14
13
 
15
14
  # Change the top and bottom rows to red.
16
15
  view[0][] = 'red'
@@ -24,11 +23,11 @@ img.view( 10, 5, 20, 20) do |view|
24
23
 
25
24
  # Change the green channel of all the
26
25
  # pixels on row 8.
27
- view[8][].green = MaxRGB/2
26
+ view[8][].green = Magick::QuantumRange/2
28
27
 
29
28
  # Change the blue channel of 8 pixels
30
29
  # on column 10.
31
- view[4,8][10].blue = MaxRGB
30
+ view[4,8][10].blue = Magick::QuantumRange
32
31
  end
33
32
 
34
33
  img.scale(5).write("viewex.gif")