rmagick 1.9.3 → 1.10.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.
- data/ChangeLog +18 -0
- data/README.html +12 -12
- data/README.txt +10 -10
- data/configure +728 -367
- data/configure.ac +134 -69
- data/doc/comtasks.html +11 -3
- data/doc/constants.html +162 -40
- data/doc/draw.html +2 -2
- data/doc/ex/crop_resized.rb +10 -0
- data/doc/ex/get_type_metrics.rb +26 -22
- data/doc/ex/vignette.rb +19 -0
- data/doc/ilist.html +0 -5
- data/doc/image1.html +219 -49
- data/doc/image2.html +115 -47
- data/doc/image3.html +105 -23
- data/doc/imageattrs.html +4 -23
- data/doc/imusage.html +1 -1
- data/doc/index.html +8 -9
- data/doc/info.html +23 -3
- data/doc/magick.html +1 -1
- data/doc/rvg.html +1 -1
- data/doc/rvgclip.html +1 -1
- data/doc/rvggroup.html +1 -1
- data/doc/rvgimage.html +1 -1
- data/doc/rvgpattern.html +1 -1
- data/doc/rvgshape.html +1 -1
- data/doc/rvgstyle.html +1 -1
- data/doc/rvgtext.html +3 -3
- data/doc/rvgtspan.html +1 -1
- data/doc/rvgtut.html +119 -101
- data/doc/rvguse.html +1 -1
- data/doc/rvgxform.html +1 -1
- data/doc/struct.html +17 -11
- data/doc/usage.html +22 -4
- data/examples/histogram.rb +48 -12
- data/examples/spinner.rb +49 -0
- data/ext/RMagick/MANIFEST +4 -1
- data/ext/RMagick/rmagick.h +62 -33
- data/ext/RMagick/rmagick_config.h.in +28 -31
- data/ext/RMagick/rmdraw.c +14 -6
- data/ext/RMagick/rmfill.c +2 -2
- data/ext/RMagick/rmilist.c +8 -36
- data/ext/RMagick/rmimage.c +370 -97
- data/ext/RMagick/rminfo.c +6 -6
- data/ext/RMagick/rmmain.c +114 -25
- data/ext/RMagick/rmutil.c +98 -35
- data/lib/RMagick.rb +17 -2
- data/lib/rvg/clippath.rb +2 -2
- data/lib/rvg/container.rb +2 -2
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +2 -2
- data/lib/rvg/misc.rb +3 -3
- data/lib/rvg/paint.rb +2 -2
- data/lib/rvg/pathdata.rb +2 -2
- data/lib/rvg/rvg.rb +2 -2
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/text.rb +2 -2
- data/lib/rvg/transformable.rb +2 -2
- data/lib/rvg/units.rb +2 -2
- data/rmagick.gemspec +1 -1
- metadata +362 -353
data/doc/rvguse.html
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
13
13
|
<meta name="Copyright" content=
|
14
|
-
"Copyright (C)
|
14
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
15
15
|
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
16
|
<script type="text/javascript" src="scripts/doc.js">
|
17
17
|
</script>
|
data/doc/rvgxform.html
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
13
13
|
<meta name="Copyright" content=
|
14
|
-
"Copyright (C)
|
14
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
15
15
|
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
16
|
<link rel="stylesheet" type="text/css" href="css/ref.css" />
|
17
17
|
<script type="text/javascript" src="scripts/doc.js">
|
data/doc/struct.html
CHANGED
@@ -4,26 +4,26 @@
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
5
|
<head>
|
6
6
|
<meta name="generator" content=
|
7
|
-
"HTML Tidy for Linux/x86 (vers 1st
|
7
|
+
"HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
|
8
8
|
|
9
9
|
<title>RMagick: Miscellaneous classes</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
13
13
|
<meta name="Copyright" content=
|
14
|
-
"Copyright (C)
|
14
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
15
15
|
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
|
-
<link rel="stylesheet" type="text/css" href="css/ref.css"/>
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
<link rel="stylesheet" type="text/css" href="css/ref.css" />
|
17
|
+
<script type="text/javascript" src="scripts/doc.js">
|
18
|
+
</script>
|
19
|
+
<style type="text/css">
|
20
20
|
/*<![CDATA[*/
|
21
21
|
|
22
22
|
/* Styles local to this page. */
|
23
23
|
|
24
24
|
|
25
25
|
/*]]>*/
|
26
|
-
|
26
|
+
</style>
|
27
27
|
</head>
|
28
28
|
|
29
29
|
<body>
|
@@ -633,6 +633,12 @@ g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
|
|
633
633
|
<dd>The opacity level. Higher intensities are more
|
634
634
|
transparent. If the colorspace is CMYKColorspace, this
|
635
635
|
attribute is interpreted as the black intensity.</dd>
|
636
|
+
|
637
|
+
<dt>cyan, magenta, yellow, black</dt>
|
638
|
+
|
639
|
+
<dd>These attributes are aliases for <code>red</code>,
|
640
|
+
<code>green</code>, <code>blue</code>, and
|
641
|
+
<code>opacity</code>, respectively.</dd>
|
636
642
|
</dl>
|
637
643
|
</div>
|
638
644
|
|
@@ -662,8 +668,8 @@ g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
|
|
662
668
|
<div class="desc">
|
663
669
|
<h5>Description</h5>
|
664
670
|
|
665
|
-
<p>Constructs a pixel object from the specified array
|
666
|
-
|
671
|
+
<p>Constructs a pixel object from the specified array of 3
|
672
|
+
values: hue, saturation, and luminosity.</p>
|
667
673
|
</div>
|
668
674
|
|
669
675
|
<div class="sig">
|
@@ -1229,8 +1235,8 @@ g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
|
|
1229
1235
|
|
1230
1236
|
<p><a href=
|
1231
1237
|
"javascript:popup('texturefill.rb.html')"><img src="ex/texturefill.gif"
|
1232
|
-
|
1233
|
-
|
1238
|
+
alt="TextureFill example" title=
|
1239
|
+
"Click to see the example script" /></a></p>
|
1234
1240
|
</div>
|
1235
1241
|
</div>
|
1236
1242
|
|
data/doc/usage.html
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
5
|
<head>
|
6
6
|
<meta name="generator" content=
|
7
|
-
"HTML Tidy for Linux/x86 (vers 1st
|
7
|
+
"HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
|
8
8
|
|
9
9
|
<title>RMagick: How to use RMagick</title>
|
10
10
|
<meta http-equiv="Content-Type" content=
|
11
11
|
"text/html; charset=us-ascii" />
|
12
12
|
<meta name="GENERATOR" content="Quanta Plus" />
|
13
13
|
<meta name="Copyright" content=
|
14
|
-
"Copyright (C)
|
14
|
+
"Copyright (C) 2006 by Timothy P. Hunter" />
|
15
15
|
<link rel="stylesheet" type="text/css" href="css/doc.css" />
|
16
16
|
<script type="text/javascript" src="scripts/doc.js">
|
17
17
|
</script>
|
@@ -471,6 +471,11 @@ exit
|
|
471
471
|
|
472
472
|
<dd>Extract pixel data from the image into an array</dd>
|
473
473
|
|
474
|
+
<dt><a href=
|
475
|
+
"image2.html#export_pixels_to_str">export_pixels_to_str</a></dt>
|
476
|
+
|
477
|
+
<dd>Extract pixel data from the image into a string</dd>
|
478
|
+
|
474
479
|
<dt><a href=
|
475
480
|
"image2.html#get_exif_by_entry">get_exif_by_entry</a>,
|
476
481
|
<a href=
|
@@ -601,6 +606,10 @@ exit
|
|
601
606
|
|
602
607
|
<dd>Compute a new constrained size for the image</dd>
|
603
608
|
|
609
|
+
<dt><a href="image1.html#crop_resized">crop_resized</a></dt>
|
610
|
+
|
611
|
+
<dd>Resize and crop while retaining the aspect ratio</dd>
|
612
|
+
|
604
613
|
<dt><a href="image2.html#magnify">magnify</a></dt>
|
605
614
|
|
606
615
|
<dd>Double the size of the image</dd>
|
@@ -771,6 +780,10 @@ exit
|
|
771
780
|
|
772
781
|
<dd>Extract a region from the image</dd>
|
773
782
|
|
783
|
+
<dt><a href="image1.html#crop_resized">crop_resized</a></dt>
|
784
|
+
|
785
|
+
<dd>Resize and crop while retaining the aspect ratio</dd>
|
786
|
+
|
774
787
|
<dt class="ilist"><a href=
|
775
788
|
"ilist.html#deconstruct">deconstruct</a></dt>
|
776
789
|
|
@@ -895,7 +908,8 @@ exit
|
|
895
908
|
<dd>Threshold an image whose global intensity histogram
|
896
909
|
doesn't contain distinctive peaks</dd>
|
897
910
|
|
898
|
-
<dt><a href="image1.html#add_noise">add_noise</a
|
911
|
+
<dt><a href="image1.html#add_noise">add_noise</a>, <a href=
|
912
|
+
"image1.html#add_noise_channel">add_noise_channel</a></dt>
|
899
913
|
|
900
914
|
<dd>Add random noise</dd>
|
901
915
|
|
@@ -1016,6 +1030,10 @@ exit
|
|
1016
1030
|
|
1017
1031
|
<dd>Swirl the pixels about the center of the image</dd>
|
1018
1032
|
|
1033
|
+
<dt><a href="image3.html#vignette">vignette</a></dt>
|
1034
|
+
|
1035
|
+
<dd>Soften the edges of the image to create a vignette</dd>
|
1036
|
+
|
1019
1037
|
<dt><a href="image3.html#wave">wave</a></dt>
|
1020
1038
|
|
1021
1039
|
<dd>Add a ripple effect to the image</dd>
|
@@ -1339,7 +1357,7 @@ exit
|
|
1339
1357
|
use radians instead of degrees.</p>
|
1340
1358
|
</div>
|
1341
1359
|
|
1342
|
-
<p class="spacer"
|
1360
|
+
<p class="spacer"> </p>
|
1343
1361
|
|
1344
1362
|
<div class="nav">
|
1345
1363
|
« <a href="index.html">Prev</a> | <a href=
|
data/examples/histogram.rb
CHANGED
@@ -4,12 +4,34 @@
|
|
4
4
|
|
5
5
|
require 'RMagick'
|
6
6
|
|
7
|
+
class PixelColumn < Array
|
8
|
+
def initialize(size)
|
9
|
+
super
|
10
|
+
fill {Magick::Pixel.new}
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset(bg)
|
14
|
+
each {|pixel| pixel.reset(bg)}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
7
18
|
module Magick
|
19
|
+
|
20
|
+
class Pixel
|
21
|
+
def reset(bg)
|
22
|
+
self.red = bg.red
|
23
|
+
self.green = bg.green
|
24
|
+
self.blue = bg.blue
|
25
|
+
self.opacity = bg.opacity
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
8
29
|
class Image
|
9
30
|
|
10
31
|
private
|
11
32
|
HISTOGRAM_COLS = 256
|
12
33
|
HISTOGRAM_ROWS = 200
|
34
|
+
MAX_QUANTUM = 255
|
13
35
|
AIR_FACTOR = 1.025
|
14
36
|
|
15
37
|
# The alpha frequencies are shown as white dots.
|
@@ -49,36 +71,49 @@ module Magick
|
|
49
71
|
int_histogram['Label'] = 'Intensity'
|
50
72
|
int_histogram.matte = true
|
51
73
|
|
74
|
+
rgb_column = PixelColumn.new(HISTOGRAM_ROWS)
|
75
|
+
red_column = PixelColumn.new(HISTOGRAM_ROWS)
|
76
|
+
green_column = PixelColumn.new(HISTOGRAM_ROWS)
|
77
|
+
blue_column = PixelColumn.new(HISTOGRAM_ROWS)
|
78
|
+
int_column = PixelColumn.new(HISTOGRAM_ROWS)
|
79
|
+
|
52
80
|
HISTOGRAM_COLS.times do |x|
|
53
|
-
rgb_column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
54
|
-
red_column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
55
|
-
green_column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
56
|
-
blue_column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
57
|
-
int_column = Array.new(HISTOGRAM_ROWS).fill {Pixel.new}
|
58
81
|
HISTOGRAM_ROWS.times do |y|
|
59
82
|
|
60
83
|
yf = Float(y)
|
61
84
|
if yf >= HISTOGRAM_ROWS - (red[x] * scale)
|
62
85
|
red_column[y].red = MaxRGB
|
86
|
+
red_column[y].green = 0
|
87
|
+
red_column[y].blue = 0
|
63
88
|
rgb_column[y].red = MaxRGB
|
64
89
|
end
|
65
90
|
if yf >= HISTOGRAM_ROWS - (green[x] * scale)
|
66
91
|
green_column[y].green = MaxRGB
|
92
|
+
green_column[y].red = 0
|
93
|
+
green_column[y].blue = 0
|
67
94
|
rgb_column[y].green = MaxRGB
|
68
95
|
end
|
69
96
|
if yf >= HISTOGRAM_ROWS - (blue[x] * scale)
|
70
97
|
blue_column[y].blue = MaxRGB
|
98
|
+
blue_column[y].red = 0
|
99
|
+
blue_column[y].green = 0
|
71
100
|
rgb_column[y].blue = MaxRGB
|
72
101
|
end
|
73
102
|
if yf >= HISTOGRAM_ROWS - (int[x] * scale)
|
74
103
|
int_column[y].opacity = TransparentOpacity
|
75
104
|
end
|
76
105
|
end
|
106
|
+
|
77
107
|
rgb_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, rgb_column)
|
78
108
|
red_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, red_column)
|
79
109
|
green_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, green_column)
|
80
110
|
blue_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, blue_column)
|
81
111
|
int_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, int_column)
|
112
|
+
rgb_column.reset(bg)
|
113
|
+
red_column.reset(bg)
|
114
|
+
green_column.reset(bg)
|
115
|
+
blue_column.reset(bg)
|
116
|
+
int_column.reset(bg)
|
82
117
|
end
|
83
118
|
|
84
119
|
return red_histogram, green_histogram, blue_histogram, rgb_histogram, int_histogram
|
@@ -159,9 +194,9 @@ Colors: #{number_colors}
|
|
159
194
|
return int_histogram
|
160
195
|
end
|
161
196
|
|
162
|
-
# Returns a value between 0 and
|
197
|
+
# Returns a value between 0 and MAX_QUANTUM. Same as the PixelIntensity macro.
|
163
198
|
def pixel_intensity(pixel)
|
164
|
-
(306*pixel.red + 601*pixel.green + 117*pixel.blue)/1024
|
199
|
+
(306*(pixel.red & MAX_QUANTUM) + 601*(pixel.green & MAX_QUANTUM) + 117*(pixel.blue & MAX_QUANTUM))/1024
|
165
200
|
end
|
166
201
|
|
167
202
|
public
|
@@ -177,13 +212,13 @@ Colors: #{number_colors}
|
|
177
212
|
rows.times do |row|
|
178
213
|
pixels = get_pixels(0, row, columns, 1)
|
179
214
|
pixels.each do |pixel|
|
180
|
-
red[pixel.red] += 1
|
181
|
-
green[pixel.green] += 1
|
182
|
-
blue[pixel.blue] += 1
|
215
|
+
red[pixel.red & MAX_QUANTUM] += 1
|
216
|
+
green[pixel.green & MAX_QUANTUM] += 1
|
217
|
+
blue[pixel.blue & MAX_QUANTUM] += 1
|
183
218
|
|
184
219
|
# Only count opacity channel if some pixels are not opaque.
|
185
220
|
if !opaque?
|
186
|
-
alpha[pixel.opacity] += 1
|
221
|
+
alpha[pixel.opacity & MAX_QUANTUM] += 1
|
187
222
|
end
|
188
223
|
v = pixel_intensity(pixel)
|
189
224
|
int[v] += 1
|
@@ -193,6 +228,7 @@ Colors: #{number_colors}
|
|
193
228
|
# Scale to chart size. When computing the scale, add some "air" between
|
194
229
|
# the max frequency and the top of the histogram. This makes a prettier chart.
|
195
230
|
# The RGBA and intensity histograms are all drawn to the same scale.
|
231
|
+
|
196
232
|
max = [red.max, green.max, blue.max, alpha.max, int.max].max
|
197
233
|
scale = HISTOGRAM_ROWS / (max*AIR_FACTOR)
|
198
234
|
|
@@ -277,7 +313,7 @@ timer = Thread.new do
|
|
277
313
|
end
|
278
314
|
|
279
315
|
# Generate the histograms
|
280
|
-
histogram = image.histogram
|
316
|
+
histogram = image.histogram(Magick::Pixel.from_color('white'), Magick::Pixel.from_color('black'))
|
281
317
|
|
282
318
|
# Write output file
|
283
319
|
histogram.compression = Magick::ZipCompression
|
data/examples/spinner.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Make a 32x32 animated GIF that resembles the OS X animation.
|
2
|
+
# This produces a very small (~2.6Kb) GIF file.
|
3
|
+
|
4
|
+
require 'RMagick'
|
5
|
+
|
6
|
+
puts <<END_INFO
|
7
|
+
This example creates an animated GIF that resembles the OS X "waiting" icon.
|
8
|
+
You can view the GIF with the command
|
9
|
+
|
10
|
+
animate spinner.gif
|
11
|
+
END_INFO
|
12
|
+
|
13
|
+
|
14
|
+
NFRAMES = 12 # number of frames in the animation
|
15
|
+
DIM = 32 # width & height of image in pixels
|
16
|
+
DELAY = 100.0 / (NFRAMES/2) # 2 rotations per second
|
17
|
+
|
18
|
+
# 'frame' is a single frame in the animation.
|
19
|
+
frame = Magick::Image.new(DIM, DIM) {self.background_color = 'transparent'}
|
20
|
+
|
21
|
+
# 'spinner' will contain the frames that make up the animated GIF
|
22
|
+
spinner = Magick::ImageList.new
|
23
|
+
|
24
|
+
# 'level' is the change from darkest gray to white
|
25
|
+
level = Magick::MaxRGB / 2 / NFRAMES
|
26
|
+
|
27
|
+
NFRAMES.times do |x|
|
28
|
+
gc = Magick::Draw.new
|
29
|
+
gc.translate(DIM/2, DIM/2)
|
30
|
+
gc.stroke('none')
|
31
|
+
intensity = 0.58 * Magick::MaxRGB
|
32
|
+
fill_color = Magick::Pixel.new(intensity, intensity, intensity).to_color
|
33
|
+
gc.fill(fill_color)
|
34
|
+
angle = x * (360/NFRAMES)
|
35
|
+
NFRAMES.times do
|
36
|
+
gc.rotate(angle)
|
37
|
+
fill_color = Magick::Pixel.new(intensity, intensity, intensity).to_color
|
38
|
+
gc.fill(fill_color)
|
39
|
+
gc.roundrectangle(7, -1, 15, 0, 1, 1)
|
40
|
+
angle = -(360/NFRAMES)
|
41
|
+
intensity += level
|
42
|
+
end
|
43
|
+
spinner << frame.copy
|
44
|
+
gc.draw(spinner)
|
45
|
+
end
|
46
|
+
|
47
|
+
spinner.delay = DELAY
|
48
|
+
spinner.compression = Magick::LZWCompression
|
49
|
+
spinner.write('spinner.gif')
|
data/ext/RMagick/MANIFEST
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
MANIFEST for RMagick-1.
|
1
|
+
MANIFEST for RMagick-1.10.0 - 18:09:31 01/21/06
|
2
2
|
|
3
3
|
configure
|
4
4
|
README.html
|
@@ -19,6 +19,7 @@ lib/rvg/container.rb
|
|
19
19
|
lib/rvg/clippath.rb
|
20
20
|
examples/vignette.rb
|
21
21
|
examples/thumbnail.rb
|
22
|
+
examples/spinner.rb
|
22
23
|
examples/rotating_text.rb
|
23
24
|
examples/pattern_fill.rb
|
24
25
|
examples/import_export.rb
|
@@ -79,6 +80,7 @@ doc/comtasks.html
|
|
79
80
|
doc/ex/writing_mode02.rb
|
80
81
|
doc/ex/writing_mode01.rb
|
81
82
|
doc/ex/wave.rb
|
83
|
+
doc/ex/vignette.rb
|
82
84
|
doc/ex/viewex.rb
|
83
85
|
doc/ex/unsharp_mask.rb
|
84
86
|
doc/ex/tspan03.rb
|
@@ -204,6 +206,7 @@ doc/ex/cycle_colormap.rb
|
|
204
206
|
doc/ex/cubic02.rb
|
205
207
|
doc/ex/cubic01.rb
|
206
208
|
doc/ex/crop_with_gravity.rb
|
209
|
+
doc/ex/crop_resized.rb
|
207
210
|
doc/ex/crop.rb
|
208
211
|
doc/ex/contrast.rb
|
209
212
|
doc/ex/composite.rb
|
data/ext/RMagick/rmagick.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
/* $Id: rmagick.h,v 1.
|
1
|
+
/* $Id: rmagick.h,v 1.104 2006/01/11 23:53:06 rmagick Exp $ */
|
2
2
|
/*=============================================================================
|
3
|
-
| Copyright (C)
|
3
|
+
| Copyright (C) 2006 by Timothy P. Hunter
|
4
4
|
| Name: rmagick.h
|
5
5
|
| Purpose: RMagick declarations and definitions
|
6
6
|
| Author: Tim Hunter
|
@@ -51,10 +51,15 @@
|
|
51
51
|
#define RUBY16(d) d
|
52
52
|
#endif
|
53
53
|
|
54
|
+
// Backport these definitions to Ruby 1.6.7
|
54
55
|
#if !defined(ULONG2NUM)
|
55
56
|
#define ULONG2NUM(v) UINT2NUM(v)
|
56
57
|
#endif
|
57
58
|
|
59
|
+
#if !defined(LONG2NUM)
|
60
|
+
#define LONG2NUM(v) INT2NUM(v)
|
61
|
+
#endif
|
62
|
+
|
58
63
|
|
59
64
|
// Define a version of StringValuePtr that works in both 1.6 and 1.8.
|
60
65
|
#if !defined(StringValuePtr)
|
@@ -172,28 +177,30 @@ typedef enum _QuantumExpressionOperator
|
|
172
177
|
ImageMagick used simply size_t and off_t in 5.5.1, then defined the
|
173
178
|
Extended(Un)SignedIntegralType from 5.5.2 thru 5.5.7. The 5.5.8 release
|
174
179
|
deprecates these types and uses Magick(Un)SignedType instead.
|
175
|
-
|
180
|
+
Prior to 1.1, GraphicsMagick defined the Extended(Un)SignedIntegralType(s).
|
181
|
+
GraphicsMagick 1.1. introduced the magick_(u)int64_t types.
|
176
182
|
|
177
|
-
Here, if we don't already have magick_(u)int64_t, define them
|
183
|
+
Here, if we don't already have magick_(u)int64_t, define them in terms
|
184
|
+
of whatever other types are defined.
|
178
185
|
*/
|
179
186
|
#if !defined(HAVE_MAGICK_INT64_T)
|
180
|
-
#if defined(HAVE_MAGICKOFFSETTYPE)
|
181
|
-
typedef MagickOffsetType magick_int64_t;
|
182
|
-
#elif defined(HAVE_EXTENDEDSIGNEDINTEGRALTYPE)
|
183
|
-
typedef ExtendedSignedIntegralType magick_int64_t;
|
184
|
-
#else
|
185
|
-
typedef off_t magick_int64_t;
|
186
|
-
#endif
|
187
|
+
#if defined(HAVE_MAGICKOFFSETTYPE)
|
188
|
+
typedef MagickOffsetType magick_int64_t;
|
189
|
+
#elif defined(HAVE_EXTENDEDSIGNEDINTEGRALTYPE)
|
190
|
+
typedef ExtendedSignedIntegralType magick_int64_t;
|
191
|
+
#else
|
192
|
+
typedef off_t magick_int64_t;
|
193
|
+
#endif
|
187
194
|
#endif
|
188
195
|
|
189
196
|
#if !defined(HAVE_MAGICK_UINT64_T)
|
190
|
-
#if defined(HAVE_MAGICKSIZETYPE)
|
191
|
-
typedef MagickSizeType magick_uint64_t;
|
192
|
-
#elif defined(HAVE_EXTENDEDUNSIGNEDINTEGRALTYPE)
|
193
|
-
typedef ExtendedUnsignedIntegralType magick_uint64_t;
|
194
|
-
#else
|
195
|
-
typedef size_t magick_uint64_t;
|
196
|
-
#endif
|
197
|
+
#if defined(HAVE_MAGICKSIZETYPE)
|
198
|
+
typedef MagickSizeType magick_uint64_t;
|
199
|
+
#elif defined(HAVE_EXTENDEDUNSIGNEDINTEGRALTYPE)
|
200
|
+
typedef ExtendedUnsignedIntegralType magick_uint64_t;
|
201
|
+
#else
|
202
|
+
typedef size_t magick_uint64_t;
|
203
|
+
#endif
|
197
204
|
#endif
|
198
205
|
|
199
206
|
#if !defined(HAVE_MAGICKBOOLEANTYPE)
|
@@ -309,19 +316,6 @@ EXTERN ID ID_x; // "x"
|
|
309
316
|
EXTERN ID ID_y; // "y"
|
310
317
|
|
311
318
|
|
312
|
-
#if defined(HAVE_GETNEXTIMAGEINLIST)
|
313
|
-
#define GET_NEXT_IMAGE(a) GetNextImageInList(a)
|
314
|
-
#else
|
315
|
-
#define GET_NEXT_IMAGE(a) (a)->next
|
316
|
-
#endif
|
317
|
-
|
318
|
-
#if defined(HAVE_GETLOCALEEXCEPTIONMESSAGE)
|
319
|
-
#define GET_MSG(s,t) GetLocaleExceptionMessage((s), (t))
|
320
|
-
#else
|
321
|
-
#define GET_MSG(s,t) t
|
322
|
-
#endif
|
323
|
-
|
324
|
-
|
325
319
|
#define min(a,b) ((a)<(b)?(a):(b))
|
326
320
|
#define max(a,b) ((a)>(b)?(a):(b))
|
327
321
|
|
@@ -454,6 +448,33 @@ Pixel_##_channel_##_eq(VALUE self, VALUE v) \
|
|
454
448
|
}
|
455
449
|
|
456
450
|
|
451
|
+
/*
|
452
|
+
* Declare Pixel CMYK channel attribute accessors
|
453
|
+
*/
|
454
|
+
#define DEF_PIXEL_CMYK_CHANNEL_ACCESSOR(_cmyk_channel_, _rgb_channel_) \
|
455
|
+
extern VALUE \
|
456
|
+
Pixel_##_cmyk_channel_##_eq(VALUE self, VALUE v) \
|
457
|
+
{ \
|
458
|
+
Pixel *pixel; \
|
459
|
+
\
|
460
|
+
rm_check_frozen(self); \
|
461
|
+
Data_Get_Struct(self, Pixel, pixel); \
|
462
|
+
pixel->_rgb_channel_ = (Quantum) NUM2UINT(v); \
|
463
|
+
rb_funcall(self, ID_changed, 0); \
|
464
|
+
rb_funcall(self, ID_notify_observers, 1, self); \
|
465
|
+
return INT2NUM(pixel->_rgb_channel_); \
|
466
|
+
} \
|
467
|
+
\
|
468
|
+
extern VALUE \
|
469
|
+
Pixel_##_cmyk_channel_(VALUE self) \
|
470
|
+
{ \
|
471
|
+
Pixel *pixel; \
|
472
|
+
\
|
473
|
+
Data_Get_Struct(self, Pixel, pixel); \
|
474
|
+
return INT2NUM(pixel->_rgb_channel_); \
|
475
|
+
}
|
476
|
+
|
477
|
+
|
457
478
|
/*
|
458
479
|
* Enum constants - define a subclass of Enum for the specified enumeration.
|
459
480
|
* Define an instance of the subclass for each member in the enumeration.
|
@@ -714,6 +735,7 @@ extern VALUE Image_initialize(VALUE, VALUE, VALUE, VALUE, VALUE);
|
|
714
735
|
|
715
736
|
extern VALUE Image_adaptive_threshold(int, VALUE *, VALUE);
|
716
737
|
extern VALUE Image_add_noise(VALUE, VALUE);
|
738
|
+
extern VALUE Image_add_noise_channel(int, VALUE *, VALUE);
|
717
739
|
extern VALUE Image_affine_transform(VALUE, VALUE);
|
718
740
|
extern VALUE Image_aref(VALUE, VALUE);
|
719
741
|
extern VALUE Image_aset(VALUE, VALUE, VALUE);
|
@@ -765,7 +787,8 @@ extern VALUE Image_emboss(int, VALUE *, VALUE);
|
|
765
787
|
extern VALUE Image_enhance(VALUE);
|
766
788
|
extern VALUE Image_equalize(VALUE);
|
767
789
|
extern VALUE Image_erase_bang(VALUE);
|
768
|
-
extern VALUE Image_export_pixels(
|
790
|
+
extern VALUE Image_export_pixels(int, VALUE *, VALUE);
|
791
|
+
extern VALUE Image_export_pixels_to_str(int, VALUE *, VALUE);
|
769
792
|
extern VALUE Image_flip(VALUE);
|
770
793
|
extern VALUE Image_flip_bang(VALUE);
|
771
794
|
extern VALUE Image_flop(VALUE);
|
@@ -803,7 +826,7 @@ extern VALUE Image_normalize_channel(int, VALUE *, VALUE);
|
|
803
826
|
extern VALUE Image_oil_paint(int, VALUE *, VALUE);
|
804
827
|
extern VALUE Image_opaque(VALUE, VALUE, VALUE);
|
805
828
|
extern VALUE Image_opaque_q(VALUE);
|
806
|
-
extern VALUE Image_ordered_dither(VALUE);
|
829
|
+
extern VALUE Image_ordered_dither(int, VALUE *, VALUE);
|
807
830
|
extern VALUE Image_palette_q(VALUE);
|
808
831
|
extern VALUE Image_ping(VALUE, VALUE);
|
809
832
|
extern VALUE Image_pixel_color(int, VALUE *, VALUE);
|
@@ -864,6 +887,7 @@ extern VALUE Image_trim(VALUE);
|
|
864
887
|
extern VALUE Image_trim_bang(VALUE);
|
865
888
|
extern VALUE Image_unsharp_mask(int, VALUE *, VALUE);
|
866
889
|
extern VALUE Image_unsharp_mask_channel(int, VALUE *, VALUE);
|
890
|
+
extern VALUE Image_vignette(int, VALUE *, VALUE);
|
867
891
|
extern VALUE Image_wave(int, VALUE *, VALUE);
|
868
892
|
extern VALUE Image_white_threshold(int, VALUE *, VALUE);
|
869
893
|
extern VALUE Image_write(VALUE, VALUE);
|
@@ -919,6 +943,10 @@ ATTR_ACCESSOR(Pixel, red)
|
|
919
943
|
ATTR_ACCESSOR(Pixel, green)
|
920
944
|
ATTR_ACCESSOR(Pixel, blue)
|
921
945
|
ATTR_ACCESSOR(Pixel, opacity)
|
946
|
+
ATTR_ACCESSOR(Pixel, cyan)
|
947
|
+
ATTR_ACCESSOR(Pixel, magenta)
|
948
|
+
ATTR_ACCESSOR(Pixel, yellow)
|
949
|
+
ATTR_ACCESSOR(Pixel, black)
|
922
950
|
extern VALUE Pixel_case_eq(VALUE, VALUE);
|
923
951
|
extern VALUE Pixel_clone(VALUE);
|
924
952
|
extern VALUE Pixel_dup(VALUE);
|
@@ -990,6 +1018,7 @@ extern VALUE rm_no_freeze(VALUE);
|
|
990
1018
|
extern char *rm_string_value_ptr(volatile VALUE *);
|
991
1019
|
#endif
|
992
1020
|
extern char *rm_string_value_ptr_len(volatile VALUE *, long *);
|
1021
|
+
extern int rm_strcasecmp(const char *, const char *);
|
993
1022
|
extern void rm_check_ary_len(VALUE, int);
|
994
1023
|
extern void rm_check_frozen(VALUE);
|
995
1024
|
extern double rm_fuzz_to_dbl(VALUE);
|