rmagick 1.14.1 → 1.15.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 (66) hide show
  1. data/ChangeLog +22 -0
  2. data/README.html +11 -63
  3. data/README.txt +8 -56
  4. data/configure +214 -787
  5. data/configure.ac +22 -24
  6. data/doc/comtasks.html +2 -2
  7. data/doc/constants.html +5 -6
  8. data/doc/draw.html +33 -14
  9. data/doc/ex/clip_path.rb +3 -0
  10. data/doc/ex/path.rb +1 -1
  11. data/doc/ex/polaroid.rb +23 -0
  12. data/doc/ex/tspan01.rb +2 -2
  13. data/doc/ex/tspan02.rb +2 -2
  14. data/doc/ex/tspan03.rb +3 -3
  15. data/doc/ex/wet_floor.rb +54 -0
  16. data/doc/ilist.html +83 -4
  17. data/doc/image1.html +4 -5
  18. data/doc/image2.html +395 -266
  19. data/doc/image3.html +104 -8
  20. data/doc/imageattrs.html +2 -2
  21. data/doc/imusage.html +2 -2
  22. data/doc/index.html +22 -18
  23. data/doc/info.html +28 -6
  24. data/doc/magick.html +125 -4
  25. data/doc/optequiv.html +196 -21
  26. data/doc/rvg.html +2 -2
  27. data/doc/rvgclip.html +2 -2
  28. data/doc/rvggroup.html +2 -2
  29. data/doc/rvgimage.html +2 -2
  30. data/doc/rvgpattern.html +2 -2
  31. data/doc/rvgshape.html +2 -2
  32. data/doc/rvgstyle.html +2 -2
  33. data/doc/rvgtext.html +2 -2
  34. data/doc/rvgtspan.html +2 -2
  35. data/doc/rvgtut.html +3 -3
  36. data/doc/rvguse.html +2 -2
  37. data/doc/rvgxform.html +2 -2
  38. data/doc/struct.html +2 -2
  39. data/doc/usage.html +26 -5
  40. data/ext/RMagick/MANIFEST +3 -1
  41. data/ext/RMagick/rmagick.h +46 -12
  42. data/ext/RMagick/rmagick_config.h.in +12 -2
  43. data/ext/RMagick/rmdraw.c +202 -62
  44. data/ext/RMagick/rmfill.c +36 -36
  45. data/ext/RMagick/rmilist.c +75 -31
  46. data/ext/RMagick/rmimage.c +640 -323
  47. data/ext/RMagick/rminfo.c +76 -15
  48. data/ext/RMagick/rmmain.c +107 -30
  49. data/ext/RMagick/rmutil.c +97 -68
  50. data/lib/RMagick.rb +11 -11
  51. data/lib/rvg/clippath.rb +38 -36
  52. data/lib/rvg/container.rb +120 -118
  53. data/lib/rvg/deep_equal.rb +44 -42
  54. data/lib/rvg/describable.rb +49 -47
  55. data/lib/rvg/embellishable.rb +399 -397
  56. data/lib/rvg/misc.rb +613 -603
  57. data/lib/rvg/paint.rb +38 -36
  58. data/lib/rvg/pathdata.rb +124 -122
  59. data/lib/rvg/rvg.rb +202 -198
  60. data/lib/rvg/stretchable.rb +132 -130
  61. data/lib/rvg/stylable.rb +101 -99
  62. data/lib/rvg/text.rb +173 -171
  63. data/lib/rvg/transformable.rb +120 -118
  64. data/lib/rvg/units.rb +60 -58
  65. data/rmagick.gemspec +1 -1
  66. metadata +5 -3
@@ -1,6 +1,6 @@
1
- # $Id: RMagick.rb,v 1.48 2006/08/27 23:06:00 rmagick Exp $
1
+ # $Id: RMagick.rb,v 1.51 2007/01/20 23:13:50 rmagick Exp $
2
2
  #==============================================================================
3
- # Copyright (C) 2006 by Timothy P. Hunter
3
+ # Copyright (C) 2007 by Timothy P. Hunter
4
4
  # Name: RMagick.rb
5
5
  # Author: Tim Hunter
6
6
  # Purpose: Extend Ruby to interface with ImageMagick.
@@ -108,25 +108,25 @@ class Draw
108
108
  LeftAlign.to_i => 'left',
109
109
  RightAlign.to_i => 'right',
110
110
  CenterAlign.to_i => 'center'
111
- }
111
+ }.freeze
112
112
  ANCHOR_TYPE_NAMES = {
113
113
  StartAnchor.to_i => 'start',
114
114
  MiddleAnchor.to_i => 'middle',
115
115
  EndAnchor.to_i => 'end'
116
- }
116
+ }.freeze
117
117
  DECORATION_TYPE_NAMES = {
118
118
  NoDecoration.to_i => 'none',
119
119
  UnderlineDecoration.to_i => 'underline',
120
120
  OverlineDecoration.to_i => 'overline',
121
121
  LineThroughDecoration.to_i => 'line-through'
122
- }
122
+ }.freeze
123
123
  FONT_WEIGHT_NAMES = {
124
124
  AnyWeight.to_i => 'all',
125
125
  NormalWeight.to_i => 'normal',
126
126
  BoldWeight.to_i => 'bold',
127
127
  BolderWeight.to_i => 'bolder',
128
128
  LighterWeight.to_i => 'lighter',
129
- }
129
+ }.freeze
130
130
  GRAVITY_NAMES = {
131
131
  NorthWestGravity.to_i => 'northwest',
132
132
  NorthGravity.to_i => 'north',
@@ -137,14 +137,14 @@ class Draw
137
137
  SouthWestGravity.to_i => 'southwest',
138
138
  SouthGravity.to_i => 'south',
139
139
  SouthEastGravity.to_i => 'southeast'
140
- }
140
+ }.freeze
141
141
  PAINT_METHOD_NAMES = {
142
142
  PointMethod.to_i => 'point',
143
143
  ReplaceMethod.to_i => 'replace',
144
144
  FloodfillMethod.to_i => 'floodfill',
145
145
  FillToBorderMethod.to_i => 'filltoborder',
146
146
  ResetMethod.to_i => 'reset'
147
- }
147
+ }.freeze
148
148
  STRETCH_TYPE_NAMES = {
149
149
  NormalStretch.to_i => 'normal',
150
150
  UltraCondensedStretch.to_i => 'ultra-condensed',
@@ -156,13 +156,13 @@ class Draw
156
156
  ExtraExpandedStretch.to_i => 'extra-expanded',
157
157
  UltraExpandedStretch.to_i => 'ultra-expanded',
158
158
  AnyStretch.to_i => 'all'
159
- }
159
+ }.freeze
160
160
  STYLE_TYPE_NAMES = {
161
161
  NormalStyle.to_i => 'normal',
162
162
  ItalicStyle.to_i => 'italic',
163
163
  ObliqueStyle.to_i => 'oblique',
164
164
  AnyStyle.to_i => 'all'
165
- }
165
+ }.freeze
166
166
 
167
167
  private
168
168
  def enquote(str)
@@ -340,7 +340,7 @@ class Draw
340
340
 
341
341
  # Set matte (make transparent) in image according to the specified
342
342
  # colorization rule
343
- def matte(x, y, rule)
343
+ def matte(x, y, method)
344
344
  if ( not PAINT_METHOD_NAMES.has_key?(method.to_i) )
345
345
  Kernel.raise ArgumentError, "Unknown paint method"
346
346
  end
@@ -1,46 +1,48 @@
1
1
  #--
2
- # $Id: clippath.rb,v 1.2 2005/12/31 14:41:04 rmagick Exp $
3
- # Copyright (C) 2006 Timothy P. Hunter
2
+ # $Id: clippath.rb,v 1.3 2007/01/20 17:39:48 rmagick Exp $
3
+ # Copyright (C) 2007 Timothy P. Hunter
4
4
  #++
5
- class Magick::RVG
5
+ module Magick
6
+ class RVG
6
7
 
7
- class ClipPath
8
- include ShapeConstructors
9
- include UseConstructors
10
- include TextConstructors
11
- include Describable
12
- include Stylable
13
- include Duplicatable
8
+ class ClipPath
9
+ include ShapeConstructors
10
+ include UseConstructors
11
+ include TextConstructors
12
+ include Describable
13
+ include Stylable
14
+ include Duplicatable
14
15
 
15
- # Create a clipping path. Within the block create an outline
16
- # from one or more paths, basic shapes, text objects, or +use+.
17
- # Everything drawn within the outline will be displayed.
18
- # Anything drawn outside the outline will not.
19
- #
20
- # If the clipping path contains a +use+, it
21
- # must directly reference path, basic shape, or text objects.
22
- #
23
- # Attach the clipping path to an object with the :clip_path style.
24
- def initialize(clip_path_units='userSpaceOnUse')
25
- super()
26
- if ! ['userSpaceOnUse', 'objectBoundingBox'].include?(clip_path_units)
27
- raise ArgumentError, "undefined value for clip path units: #{clip_path_units}"
16
+ # Create a clipping path. Within the block create an outline
17
+ # from one or more paths, basic shapes, text objects, or +use+.
18
+ # Everything drawn within the outline will be displayed.
19
+ # Anything drawn outside the outline will not.
20
+ #
21
+ # If the clipping path contains a +use+, it
22
+ # must directly reference path, basic shape, or text objects.
23
+ #
24
+ # Attach the clipping path to an object with the :clip_path style.
25
+ def initialize(clip_path_units='userSpaceOnUse')
26
+ super()
27
+ if ! ['userSpaceOnUse', 'objectBoundingBox'].include?(clip_path_units)
28
+ raise ArgumentError, "undefined value for clip path units: #{clip_path_units}"
29
+ end
30
+ @clip_path_units = clip_path_units
31
+ @content = Content.new
32
+ yield(self) if block_given?
28
33
  end
29
- @clip_path_units = clip_path_units
30
- @content = Content.new
31
- yield(self) if block_given?
32
- end
33
34
 
34
- def add_primitives(gc, style) #:nodoc:
35
- name = __id__.to_s
36
- gc.define_clip_path(name) do
37
- gc.clip_units(@clip_path_units)
38
- @content.each { |element| element.add_primitives(gc) }
35
+ def add_primitives(gc, style) #:nodoc:
36
+ name = __id__.to_s
37
+ gc.define_clip_path(name) do
38
+ gc.clip_units(@clip_path_units)
39
+ @content.each { |element| element.add_primitives(gc) }
40
+ end
41
+ gc.clip_path(name)
39
42
  end
40
- gc.clip_path(name)
41
- end
42
43
 
43
- end # class ClipPath
44
+ end # class ClipPath
44
45
 
45
- end # class Magick::RVG
46
+ end # class RVG
47
+ end # module Magick
46
48
 
@@ -1,129 +1,131 @@
1
1
  #--
2
- # $Id: container.rb,v 1.2 2005/12/31 14:41:04 rmagick Exp $
3
- # Copyright (C) 2006 Timothy P. Hunter
2
+ # $Id: container.rb,v 1.3 2007/01/20 17:39:49 rmagick Exp $
3
+ # Copyright (C) 2007 Timothy P. Hunter
4
4
  #++
5
5
 
6
- class Magick::RVG
7
-
8
- # Content is simply an Array with a deep_copy method.
9
- # When unit-testing, it also has a deep_equal method.
10
- class Content < Array #:nodoc:
11
-
12
- def deep_copy(h = {})
13
- me = self.__id__
14
- copy = h[me]
15
- unless copy
16
- copy = self.class.new
17
- each do |c|
18
- copy << case
19
- when c.nil?
20
- nil
21
- when c.respond_to?(:deep_copy)
22
- c.deep_copy(h)
23
- when c.respond_to?(:dup)
24
- c.dup rescue c
25
- else
26
- c
27
- end
6
+ module Magick
7
+ class RVG
8
+
9
+ # Content is simply an Array with a deep_copy method.
10
+ # When unit-testing, it also has a deep_equal method.
11
+ class Content < Array #:nodoc:
12
+
13
+ def deep_copy(h = {})
14
+ me = self.__id__
15
+ copy = h[me]
16
+ unless copy
17
+ copy = self.class.new
18
+ each do |c|
19
+ copy << case
20
+ when c.nil?
21
+ nil
22
+ when c.respond_to?(:deep_copy)
23
+ c.deep_copy(h)
24
+ when c.respond_to?(:dup)
25
+ c.dup rescue c
26
+ else
27
+ c
28
+ end
29
+ end
30
+ copy.freeze if frozen?
31
+ h[me] = copy
28
32
  end
29
- copy.freeze if frozen?
30
- h[me] = copy
33
+ return copy
31
34
  end
32
- return copy
33
- end
34
-
35
- end # class Content
36
-
37
- # Define a collection of shapes, text, etc. that can be reused.
38
- # Group objects are _containers_. That is, styles and transforms defined
39
- # on the group are used by contained objects such as shapes, text, and
40
- # nested groups unless overridden by a nested container or the object itself.
41
- # Groups can be reused with the RVG::UseConstructors#use method.
42
- # Create groups within
43
- # containers with the RVG::StructureConstructors#g method.
44
- #
45
- # Example:
46
- # # All elements in the group will be translated by 50 in the
47
- # # x-direction and 10 in the y-direction.
48
- # rvg.g.translate(50, 10).styles(:stroke=>'red',:fill=>'none') do |grp|
49
- # # The line will be red.
50
- # grp.line(10,10, 20,20)
51
- # # The circle will be blue.
52
- # grp.circle(10, 20, 20).styles(:stroke=>'blue')
53
- # end
54
- class Group
55
- include Stylable
56
- include Transformable
57
- include Embellishable
58
- include Describable
59
- include Duplicatable
60
-
61
- def initialize
62
- super
63
- @content = Content.new
64
- yield(self) if block_given?
65
- end
66
-
67
- def add_primitives(gc) #:nodoc:
68
- gc.push
69
- add_transform_primitives(gc)
70
- add_style_primitives(gc)
71
- @content.each { |element| element.add_primitives(gc) }
72
- gc.pop
73
- end
74
-
75
- # Translate container according to #use arguments
76
- def ref(x, y, width, height) #:nodoc:
77
- translate(x, y) if (x != 0 || y != 0)
78
- end
79
-
80
- # Append an arbitrary object to the group's content. Called
81
- # by #use to insert a non-container object into a group.
82
- def <<(obj) #:nodoc:
83
- @content << obj
84
- end
85
-
86
- end # class Group
87
-
88
-
89
- # A Use object allows the re-use of RVG and RVG::Group
90
- # objects within a container. Create a Use object with the
91
- # RVG::UseConstructors#use method.
92
- class Use
93
- include Stylable
94
- include Transformable
95
- include Duplicatable
96
-
97
- # In a container, Use objects are created indirectly via the
35
+
36
+ end # class Content
37
+
38
+ # Define a collection of shapes, text, etc. that can be reused.
39
+ # Group objects are _containers_. That is, styles and transforms defined
40
+ # on the group are used by contained objects such as shapes, text, and
41
+ # nested groups unless overridden by a nested container or the object itself.
42
+ # Groups can be reused with the RVG::UseConstructors#use method.
43
+ # Create groups within
44
+ # containers with the RVG::StructureConstructors#g method.
45
+ #
46
+ # Example:
47
+ # # All elements in the group will be translated by 50 in the
48
+ # # x-direction and 10 in the y-direction.
49
+ # rvg.g.translate(50, 10).styles(:stroke=>'red',:fill=>'none') do |grp|
50
+ # # The line will be red.
51
+ # grp.line(10,10, 20,20)
52
+ # # The circle will be blue.
53
+ # grp.circle(10, 20, 20).styles(:stroke=>'blue')
54
+ # end
55
+ class Group
56
+ include Stylable
57
+ include Transformable
58
+ include Embellishable
59
+ include Describable
60
+ include Duplicatable
61
+
62
+ def initialize
63
+ super
64
+ @content = Content.new
65
+ yield(self) if block_given?
66
+ end
67
+
68
+ def add_primitives(gc) #:nodoc:
69
+ gc.push
70
+ add_transform_primitives(gc)
71
+ add_style_primitives(gc)
72
+ @content.each { |element| element.add_primitives(gc) }
73
+ gc.pop
74
+ end
75
+
76
+ # Translate container according to #use arguments
77
+ def ref(x, y, width, height) #:nodoc:
78
+ translate(x, y) if (x != 0 || y != 0)
79
+ end
80
+
81
+ # Append an arbitrary object to the group's content. Called
82
+ # by #use to insert a non-container object into a group.
83
+ def <<(obj) #:nodoc:
84
+ @content << obj
85
+ end
86
+
87
+ end # class Group
88
+
89
+
90
+ # A Use object allows the re-use of RVG and RVG::Group
91
+ # objects within a container. Create a Use object with the
98
92
  # RVG::UseConstructors#use method.
99
- # The +x+ and +y+ arguments
100
- # can be used to specify an additional translation for
101
- # the group. The +width+ and +height+ arguments specify
102
- # a width and height for referenced RVG objects.
103
- def initialize(element, x=0, y=0, width=nil, height=nil)
104
- super()
105
-
106
- # If the element is not a group, defs, symbol, or rvg,
107
- # wrap a group around it so it can get a transform and
108
- # possibly a new viewport.
109
- if ! element.respond_to?(:ref)
110
- @element = Group.new
111
- @element << element.deep_copy
112
- else
113
- @element = element.deep_copy
93
+ class Use
94
+ include Stylable
95
+ include Transformable
96
+ include Duplicatable
97
+
98
+ # In a container, Use objects are created indirectly via the
99
+ # RVG::UseConstructors#use method.
100
+ # The +x+ and +y+ arguments
101
+ # can be used to specify an additional translation for
102
+ # the group. The +width+ and +height+ arguments specify
103
+ # a width and height for referenced RVG objects.
104
+ def initialize(element, x=0, y=0, width=nil, height=nil)
105
+ super()
106
+
107
+ # If the element is not a group, defs, symbol, or rvg,
108
+ # wrap a group around it so it can get a transform and
109
+ # possibly a new viewport.
110
+ if ! element.respond_to?(:ref)
111
+ @element = Group.new
112
+ @element << element.deep_copy
113
+ else
114
+ @element = element.deep_copy
115
+ end
116
+ @element.ref(x, y, width, height)
114
117
  end
115
- @element.ref(x, y, width, height)
116
- end
117
118
 
118
- def add_primitives(gc) #:nodoc:
119
- gc.push
120
- add_transform_primitives(gc)
121
- add_style_primitives(gc)
122
- @element.add_primitives(gc)
123
- gc.pop
124
- end
119
+ def add_primitives(gc) #:nodoc:
120
+ gc.push
121
+ add_transform_primitives(gc)
122
+ add_style_primitives(gc)
123
+ @element.add_primitives(gc)
124
+ gc.pop
125
+ end
125
126
 
126
- end # class Use
127
+ end # class Use
127
128
 
128
- end # class Magick::RVG
129
+ end # class RVG
130
+ end # module Magick
129
131
 
@@ -1,54 +1,56 @@
1
- class Magick::RVG
1
+ module Magick
2
+ class RVG
2
3
 
3
- [PathData, Styles, Transforms].each do |c|
4
- c.class_eval do
5
- def deep_equal(other)
6
- if self != other
7
- puts "#{c.inspect} not equal.\nself:#{self} != other:#{other}"
8
- return false
4
+ [PathData, Styles, Transforms].each do |c|
5
+ c.class_eval do
6
+ def deep_equal(other)
7
+ if self != other
8
+ puts "#{c.inspect} not equal.\nself:#{self} != other:#{other}"
9
+ return false
10
+ end
11
+ return true
9
12
  end
10
- return true
11
13
  end
12
14
  end
13
- end
14
15
 
15
- [Shape, TextBase, Image, Group, Content, Use, ClipPath, Pattern, self].each do |c|
16
- c.class_eval do
17
- def deep_equal(other)
18
- ivs = self.instance_variables
16
+ [Shape, TextBase, Image, Group, Content, Use, ClipPath, Pattern, self].each do |c|
17
+ c.class_eval do
18
+ def deep_equal(other)
19
+ ivs = self.instance_variables
19
20
 
20
- ivs.each do |iv|
21
- itv = self.instance_variable_get(iv)
22
- otv = other.instance_variable_get(iv)
23
- if itv.respond_to?(:deep_equal)
24
- if itv.equal?(otv)
25
- puts "#{iv} has deep_equal but self.#{iv} and other.#{iv} are the same object."
26
- return false
27
- end
28
- if !itv.deep_equal(otv)
29
- puts "Not equal.\nself.#{iv}=#{itv.inspect}\nother.#{iv}=#{otv.inspect}"
30
- return false
31
- end
32
- else
33
- case itv
34
- when Float, Symbol, TrueClass, FalseClass, Fixnum, NilClass
35
- return false if itv != otv
36
- else
37
- if itv.equal?(otv)
38
- puts "#{iv} is dup-able but self.#{iv} and other.#{iv} are the same object."
39
- return false
40
- end
41
- if itv != otv
42
- puts "Not equal.\nself.#{iv}=#{itv.inspect}\nother.#{iv}=#{otv.inspect}"
43
- return false
44
- end
21
+ ivs.each do |iv|
22
+ itv = self.instance_variable_get(iv)
23
+ otv = other.instance_variable_get(iv)
24
+ if itv.respond_to?(:deep_equal)
25
+ if itv.equal?(otv)
26
+ puts "#{iv} has deep_equal but self.#{iv} and other.#{iv} are the same object."
27
+ return false
28
+ end
29
+ if !itv.deep_equal(otv)
30
+ puts "Not equal.\nself.#{iv}=#{itv.inspect}\nother.#{iv}=#{otv.inspect}"
31
+ return false
32
+ end
33
+ else
34
+ case itv
35
+ when Float, Symbol, TrueClass, FalseClass, Fixnum, NilClass
36
+ return false if itv != otv
37
+ else
38
+ if itv.equal?(otv)
39
+ puts "#{iv} is dup-able but self.#{iv} and other.#{iv} are the same object."
40
+ return false
41
+ end
42
+ if itv != otv
43
+ puts "Not equal.\nself.#{iv}=#{itv.inspect}\nother.#{iv}=#{otv.inspect}"
44
+ return false
45
+ end
46
+ end
45
47
  end
46
48
  end
47
- end
48
49
 
49
- return true
50
+ return true
51
+ end
50
52
  end
51
53
  end
52
- end
53
54
 
54
- end # class Magick::RVG
55
+ end # class RVG
56
+ end # module Magick