rmagick 5.4.4 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/ImageMagick6/devcontainer.json +1 -1
  3. data/.devcontainer/devcontainer.json +1 -1
  4. data/.github/workflows/ci.yml +41 -31
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +36 -9
  7. data/.rubocop_todo.yml +369 -187
  8. data/CHANGELOG.md +77 -0
  9. data/Gemfile +14 -0
  10. data/README.md +3 -3
  11. data/Rakefile +12 -1
  12. data/before_install_linux.sh +1 -11
  13. data/before_install_osx.sh +5 -7
  14. data/ext/RMagick/extconf.rb +58 -68
  15. data/ext/RMagick/rmagick.h +7 -12
  16. data/ext/RMagick/rmdraw.cpp +10 -20
  17. data/ext/RMagick/rmfill.cpp +4 -4
  18. data/ext/RMagick/rmilist.cpp +10 -2
  19. data/ext/RMagick/rmimage.cpp +342 -344
  20. data/ext/RMagick/rminfo.cpp +22 -21
  21. data/ext/RMagick/rmkinfo.cpp +5 -18
  22. data/ext/RMagick/rmmain.cpp +42 -91
  23. data/ext/RMagick/rmmontage.cpp +5 -5
  24. data/ext/RMagick/rmpixel.cpp +3 -3
  25. data/ext/RMagick/rmutil.cpp +58 -89
  26. data/lib/rmagick/version.rb +3 -3
  27. data/lib/rmagick.rb +1 -1
  28. data/lib/rmagick_internal.rb +111 -103
  29. data/lib/rvg/container.rb +3 -3
  30. data/lib/rvg/embellishable.rb +7 -3
  31. data/lib/rvg/misc.rb +15 -15
  32. data/lib/rvg/rvg.rb +6 -6
  33. data/lib/rvg/stretchable.rb +2 -2
  34. data/lib/rvg/stylable.rb +2 -2
  35. data/lib/rvg/transformable.rb +1 -1
  36. data/lib/rvg/units.rb +1 -0
  37. data/rmagick.gemspec +2 -15
  38. data/sig/rmagick/_draw_common_methods.rbs +64 -0
  39. data/sig/rmagick/_image_common_methods.rbs +387 -0
  40. data/sig/rmagick/draw.rbs +38 -0
  41. data/sig/rmagick/draw_attribute.rbs +28 -0
  42. data/sig/rmagick/enum.rbs +820 -0
  43. data/sig/rmagick/error.rbs +11 -0
  44. data/sig/rmagick/fill.rbs +21 -0
  45. data/sig/rmagick/geometry.rbs +14 -0
  46. data/sig/rmagick/image.rbs +196 -0
  47. data/sig/rmagick/image_list.rbs +183 -0
  48. data/sig/rmagick/iptc.rbs +101 -0
  49. data/sig/rmagick/kernel_info.rbs +12 -0
  50. data/sig/rmagick/optional_method_arguments.rbs +10 -0
  51. data/sig/rmagick/pixel.rbs +46 -0
  52. data/sig/rmagick/struct.rbs +90 -0
  53. data/sig/rmagick.rbs +43 -0
  54. data/sig/rvg/clippath.rbs +34 -0
  55. data/sig/rvg/container.rbs +78 -0
  56. data/sig/rvg/deep_equal.rbs +48 -0
  57. data/sig/rvg/describable.rbs +30 -0
  58. data/sig/rvg/embellishable.rbs +226 -0
  59. data/sig/rvg/misc.rbs +145 -0
  60. data/sig/rvg/paint.rbs +55 -0
  61. data/sig/rvg/pathdata.rbs +77 -0
  62. data/sig/rvg/rvg.rbs +125 -0
  63. data/sig/rvg/stretchable.rbs +56 -0
  64. data/sig/rvg/stylable.rbs +66 -0
  65. data/sig/rvg/text.rbs +118 -0
  66. data/sig/rvg/transformable.rbs +59 -0
  67. data/sig/rvg/units.rbs +33 -0
  68. metadata +38 -134
data/sig/rmagick.rbs ADDED
@@ -0,0 +1,43 @@
1
+ module Magick
2
+ # A real number, ie not a `Complex`.
3
+ type magick_real = Integer | Float | Rational | _ToF
4
+ # A percentage, a real number or a string in the form "NN%"
5
+ type magick_percentage = magick_real | String
6
+
7
+ type magick_image = Image | ImageList
8
+
9
+ type magick_color = Pixel | string
10
+
11
+ type magick_fill = GradientFill | HatchFill | SolidFill | TextureFill | _Fill
12
+
13
+ interface _Fill
14
+ def fill: (magick_image image_obj) -> void
15
+ end
16
+
17
+ VERSION: String
18
+ MIN_RUBY_VERSION: String
19
+ MIN_IM_VERSION: String
20
+
21
+ QuantumRange: Integer
22
+ MAGICKCORE_QUANTUM_DEPTH: Integer
23
+ OpaqueAlpha: Integer
24
+ TransparentAlpha: Integer
25
+
26
+ IMAGEMAGICK_VERSION: String
27
+ Magick_version: String
28
+ Long_version: String
29
+ Magick_features: String
30
+
31
+ def self.formats: () -> Hash[String, String]
32
+ | () { (String, String) -> void } -> self
33
+ def self.colors: () { (Color) -> void } -> self
34
+ | () -> Array[Color]
35
+ def self.fonts: () { (Font) -> void } -> self
36
+ | () -> Array[Font]
37
+ def self.init_formats: () -> Hash[String, String]
38
+ def self.limit_resource: (interned resource) -> Integer
39
+ | (interned resource, int limit) -> Integer
40
+ def self.set_cache_threshold: (int threshold) -> self
41
+ def self.set_log_event_mask: (*string args) -> self
42
+ def self.set_log_format: (string format) -> self
43
+ end
@@ -0,0 +1,34 @@
1
+ # -
2
+ # $Id: clippath.rb,v 1.5 2009/02/28 23:52:13 rmagick Exp $
3
+ # Copyright (C) 2009 Timothy P. Hunter
4
+ # +
5
+ module Magick
6
+ class RVG
7
+ class ClipPath
8
+ @clip_path_units: string
9
+ @content: Content
10
+
11
+ include ShapeConstructors
12
+ include UseConstructors
13
+ include TextConstructors
14
+ include Describable
15
+ include Stylable
16
+ include Duplicatable
17
+
18
+ # Create a clipping path. Within the block create an outline
19
+ # from one or more paths, basic shapes, text objects, or +use+.
20
+ # Everything drawn within the outline will be displayed.
21
+ # Anything drawn outside the outline will not.
22
+ #
23
+ # If the clipping path contains a +use+, it
24
+ # must directly reference path, basic shape, or text objects.
25
+ #
26
+ # Attach the clipping path to an object with the :clip_path style.
27
+ def initialize: (?string clip_path_units) -> void
28
+ | (?string clip_path_units) { (ClipPath) -> void } -> void
29
+
30
+ # @private
31
+ def add_primitives: (Utility::GraphicContext gc, untyped _style) -> void
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,78 @@
1
+ # -
2
+ # $Id: container.rb,v 1.5 2009/02/28 23:52:13 rmagick Exp $
3
+ # Copyright (C) 2009 Timothy P. Hunter
4
+ # +
5
+ module Magick
6
+ class RVG
7
+ # Content is simply an Array with a deep_copy method.
8
+ # When unit-testing, it also has a deep_equal method.
9
+ # @private
10
+ class Content < Array[untyped]
11
+ include _Duplicatable
12
+ end
13
+
14
+ # Define a collection of shapes, text, etc. that can be reused.
15
+ # Group objects are _containers_. That is, styles and transforms defined
16
+ # on the group are used by contained objects such as shapes, text, and
17
+ # nested groups unless overridden by a nested container or the object itself.
18
+ # Groups can be reused with the RVG::UseConstructors#use method.
19
+ # Create groups within
20
+ # containers with the RVG::StructureConstructors#g method.
21
+ #
22
+ # Example:
23
+ # # All elements in the group will be translated by 50 in the
24
+ # # x-direction and 10 in the y-direction.
25
+ # rvg.g.translate(50, 10).styles(:stroke=>'red',:fill=>'none') do |grp|
26
+ # # The line will be red.
27
+ # grp.line(10,10, 20,20)
28
+ # # The circle will be blue.
29
+ # grp.circle(10, 20, 20).styles(:stroke=>'blue')
30
+ # end
31
+ class Group
32
+ @content: Content
33
+
34
+ include Stylable
35
+ include Transformable
36
+ include Embellishable
37
+ include Describable
38
+ include Duplicatable
39
+
40
+ def initialize: () -> void
41
+ | () { (Group) -> void } -> void
42
+
43
+ # @private
44
+ def add_primitives: (Utility::GraphicContext gc) -> void
45
+
46
+ # Translate container according to #use arguments
47
+ # @private
48
+ def ref: (magick_real x, magick_real y, untyped _width, untyped _height) -> void
49
+
50
+ # Append an arbitrary object to the group's content. Called
51
+ # by #use to insert a non-container object into a group.
52
+ # @private
53
+ def <<: (_Duplicatable obj) -> void
54
+ end
55
+
56
+ # A Use object allows the re-use of RVG and RVG::Group
57
+ # objects within a container. Create a Use object with the
58
+ # RVG::UseConstructors#use method.
59
+ class Use
60
+ @element: Group
61
+
62
+ include Stylable
63
+ include Transformable
64
+ include Duplicatable
65
+
66
+ # In a container, Use objects are created indirectly via the
67
+ # RVG::UseConstructors#use method.
68
+ # The +x+ and +y+ arguments
69
+ # can be used to specify an additional translation for
70
+ # the group. The +width+ and +height+ arguments specify
71
+ # a width and height for referenced RVG objects.
72
+ def initialize: (_Duplicatable element, ?magick_real x, ?magick_real y, ?magick_real? width, ?magick_real? height) -> void
73
+
74
+ # @private
75
+ def add_primitives: (Utility::GraphicContext gc) -> void
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,48 @@
1
+ module Magick
2
+ class RVG
3
+ interface _DeepEqual
4
+ def deep_equal: (untyped other) -> bool
5
+ end
6
+ class PathData
7
+ include _DeepEqual
8
+ end
9
+
10
+ class Styles
11
+ include _DeepEqual
12
+ end
13
+
14
+ class Transforms
15
+ include _DeepEqual
16
+ end
17
+
18
+ class Shape
19
+ include _DeepEqual
20
+ end
21
+
22
+ class TextBase
23
+ include _DeepEqual
24
+ end
25
+
26
+ class Image
27
+ include _DeepEqual
28
+ end
29
+
30
+ class Group
31
+ include _DeepEqual
32
+ end
33
+
34
+ class Content
35
+ include _DeepEqual
36
+ end
37
+
38
+ class Use
39
+ include _DeepEqual
40
+ end
41
+
42
+ class ClipPath
43
+ include _DeepEqual
44
+ end
45
+
46
+ include _DeepEqual
47
+ end
48
+ end
@@ -0,0 +1,30 @@
1
+ module Magick
2
+ class RVG
3
+ # -
4
+ # Corresponds to SVG's Description.class
5
+ # +
6
+ # This module defines a number of metadata attributes.
7
+ module Describable
8
+ # Sets the object description
9
+ attr_writer desc: interned
10
+
11
+ # Sets the object title
12
+ attr_writer title: interned
13
+
14
+ # Sets the object metadata
15
+ attr_writer metadata: interned
16
+
17
+ # Returns the title of this object. The RVG object title is stored as
18
+ # the 'title' property on the image
19
+ def title: () -> String
20
+
21
+ # Returns the description of this object. The RVG object description is
22
+ # stored as the 'desc' property on the image
23
+ def desc: () -> String
24
+
25
+ # Returns additional metadata of this object. The RVG object metadata
26
+ # are stored as the 'metadata' property on the image
27
+ def metadata: () -> String
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,226 @@
1
+ module Magick
2
+ class RVG
3
+ # Parent class of Circle, Ellipse, Text, etc.
4
+ # @private
5
+ class Shape
6
+ include Stylable
7
+ include Transformable
8
+ include Duplicatable
9
+
10
+ # Each shape can have its own set of transforms and styles.
11
+ def add_primitives: (Utility::GraphicContext gc) -> void
12
+ end
13
+
14
+ class Circle < Shape
15
+ @primitive: Symbol
16
+ @args: Array[Float]
17
+
18
+ # Define a circle with radius +r+ and centered at [<tt>cx</tt>, <tt>cy</tt>].
19
+ # Use the RVG::ShapeConstructors#circle method to create Circle objects in a container.
20
+ def initialize: (magick_real r, ?magick_real cx, ?magick_real cy) -> void
21
+ end
22
+
23
+ class Ellipse < Shape
24
+ @primitive: Symbol
25
+ @args: Array[Integer | Float]
26
+
27
+ # Define an ellipse with a center at [<tt>cx</tt>, <tt>cy</tt>], a horizontal radius +rx+
28
+ # and a vertical radius +ry+.
29
+ # Use the RVG::ShapeConstructors#ellipse method to create Ellipse objects in a container.
30
+ def initialize: (magick_real rx, magick_real ry, ?magick_real cx, ?magick_real cy) -> void
31
+ end
32
+
33
+ class Line < Shape
34
+ @primitive: Symbol
35
+ @args: Array[Integer | Float]
36
+
37
+ # Define a line from [<tt>x1</tt>, <tt>y1</tt>] to [<tt>x2</tt>, <tt>y2</tt>].
38
+ # Use the RVG::ShapeConstructors#line method to create Line objects in a container.
39
+ def initialize: (?magick_real x1, ?magick_real y1, ?magick_real x2, ?magick_real y2) -> void
40
+ end
41
+
42
+ class Path < Shape
43
+ @primitive: Symbol
44
+ @args: Array[String]
45
+
46
+ # Define an SVG path. The argument can be either a path string
47
+ # or a PathData object.
48
+ # Use the RVG::ShapeConstructors#path method to create Path objects in a container.
49
+ def initialize: (interned path) -> void
50
+ end
51
+
52
+ class Rect < Shape
53
+ @primitive: Symbol
54
+ @args: Array[Float]
55
+
56
+ # Define a width x height rectangle. The upper-left corner is at [<tt>x</tt>, <tt>y</tt>].
57
+ # If either <tt>width</tt> or <tt>height</tt> is 0, the rectangle is not rendered.
58
+ # Use the RVG::ShapeConstructors#rect method to create Rect objects in a container.
59
+ def initialize: (magick_real width, magick_real height, ?magick_real x, ?magick_real y) -> void
60
+
61
+ # Specify optional rounded corners for a rectangle. The arguments
62
+ # are the x- and y-axis radii. If y is omitted it defaults to x.
63
+ def round: (magick_real rx, ?magick_real? ry) -> self
64
+ end
65
+
66
+ class PolyShape < Shape
67
+ def polypoints: (Array[magick_real] points) -> Array[Float?]
68
+ end
69
+
70
+ class Polygon < PolyShape
71
+ @primitive: Symbol
72
+ @args: Array[Float]
73
+
74
+ # Draws a polygon. The arguments are [<tt>x</tt>, <tt>y</tt>] pairs that
75
+ # define the points that make up the polygon. At least two
76
+ # points must be specified. If the last point is not the
77
+ # same as the first, adds an additional point to close
78
+ # the polygon.
79
+ # Use the RVG::ShapeConstructors#polygon method to create Polygon objects in a container.
80
+ def initialize: (*magick_real points) -> void
81
+ end
82
+
83
+ class Polyline < PolyShape
84
+ @primitive: Symbol
85
+ @args: Array[Float]
86
+
87
+ # Draws a polyline. The arguments are [<tt>x</tt>, <tt>y</tt>] pairs that
88
+ # define the points that make up the polyline. At least two
89
+ # points must be specified.
90
+ # Use the RVG::ShapeConstructors#polyline method to create Polyline objects in a container.
91
+ def initialize: (*magick_real points) -> void
92
+ end
93
+
94
+ class Image
95
+ @align: String
96
+ @vbx_width: Integer
97
+ @vbx_height: Integer
98
+ @meet_or_slice: String
99
+ @image: Magick::Image
100
+ @x: Float
101
+ @y: Float
102
+ @width: Float
103
+ @height: Float
104
+
105
+ include Stylable
106
+ include Transformable
107
+ include Describable
108
+ include PreserveAspectRatio
109
+ include Duplicatable
110
+
111
+ private
112
+
113
+ def align_to_viewport: (real scale) -> [Numeric?, Numeric?]
114
+ def add_composite_primitive: (Utility::GraphicContext gc) -> void
115
+ def init_viewbox: () -> void
116
+
117
+ public
118
+
119
+ # Composite a raster image in the viewport defined by [x,y] and
120
+ # +width+ and +height+.
121
+ # Use the RVG::ImageConstructors#image method to create Text objects in a container.
122
+ def initialize: (Magick::Image image, ?magick_real? width, ?magick_real? height, ?magick_real x, ?magick_real y) -> void
123
+
124
+ # @private
125
+ def add_primitives: (Utility::GraphicContext gc) -> void
126
+ end
127
+
128
+ # Methods that construct basic shapes within a container
129
+ module ShapeConstructors
130
+ # Draws a circle whose center is [<tt>cx</tt>, <tt>cy</tt>] and radius is +r+.
131
+ def circle: (magick_real r, ?magick_real cx, ?magick_real cy) -> Circle
132
+
133
+ # Draws an ellipse whose center is [<tt>cx</tt>, <tt>cy</tt>] and having
134
+ # a horizontal radius +rx+ and vertical radius +ry+.
135
+ def ellipse: (magick_real rx, magick_real ry, ?magick_real cx, ?magick_real cy) -> Ellipse
136
+
137
+ # Draws a line from [<tt>x1</tt>, <tt>y1</tt>] to [<tt>x2</tt>, <tt>y2</tt>].
138
+ def line: (?magick_real x1, ?magick_real y1, ?magick_real x2, ?magick_real y2) -> Line
139
+
140
+ # Draws a path defined by an SVG path string or a PathData
141
+ # object.
142
+ def path: (interned path) -> Path
143
+
144
+ # Draws a rectangle whose upper-left corner is [<tt>x</tt>, <tt>y</tt>] and
145
+ # with the specified +width+ and +height+. Unless otherwise
146
+ # specified the rectangle has square corners. Returns a
147
+ # Rectangle object.
148
+ #
149
+ # Draw a rectangle with rounded corners by calling the #round
150
+ # method on the Rectangle object. <tt>rx</tt> and <tt>ry</tt> are
151
+ # the corner radii in the x- and y-directions. For example:
152
+ # canvas.rect(width, height, x, y).round(8, 6)
153
+ # If <tt>ry</tt> is omitted it defaults to <tt>rx</tt>.
154
+ def rect: (magick_real width, magick_real height, ?magick_real x, ?magick_real y) -> Rect
155
+
156
+ # Draws a polygon. The arguments are [<tt>x</tt>, <tt>y</tt>] pairs that
157
+ # define the points that make up the polygon. At least two
158
+ # points must be specified. If the last point is not the
159
+ # same as the first, adds an additional point to close
160
+ # the polygon.
161
+ def polygon: (*magick_real points) -> Polygon
162
+
163
+ # Draws a polyline. The arguments are [<tt>x</tt>, <tt>y</tt>] pairs that
164
+ # define the points that make up the polyline. At least two
165
+ # points must be specified.
166
+ def polyline: (*magick_real points) -> Polyline
167
+ end
168
+
169
+ # Methods that reference ("use") other drawable objects within a container
170
+ module UseConstructors
171
+ # Reference an object to be inserted into the container's
172
+ # content. [<tt>x</tt>,<tt>y</tt>] is the offset from the upper-left
173
+ # corner. If the argument is an RVG or Image object and +width+ and +height+
174
+ # are specified, these values will override the +width+ and +height+
175
+ # attributes on the argument.
176
+ def use: (_Duplicatable obj, ?magick_real x, ?magick_real y, ?magick_real? width, ?magick_real? height) -> Use
177
+ end
178
+
179
+ # Methods that construct container objects within a container
180
+ module StructureConstructors
181
+ # Establishes a new viewport. [<tt>x</tt>, <tt>y</tt>] is the coordinate of the
182
+ # upper-left corner within the containing viewport. This is a
183
+ # _container_ method. Styles and
184
+ # transforms specified on this object will be used by objects
185
+ # contained within, unless overridden by an inner container or
186
+ # the contained object itself.
187
+ def rvg: (magick_real cols, magick_real rows, ?magick_real x, ?magick_real y) -> RVG
188
+ | (magick_real cols, magick_real rows, ?magick_real x, ?magick_real y) { (RVG) -> void } -> RVG
189
+
190
+ # Defines a group.
191
+ #
192
+ # This method constructs a new
193
+ # Group _container_ object. The styles and
194
+ # transforms specified on this object will be used by objects
195
+ # contained within, unless overridden by an inner container or
196
+ # the contained object itself.
197
+ # Define grouped elements by calling RVG::Embellishable
198
+ # methods within the associated block.
199
+ def g: () -> Group
200
+ | { (Group) -> void } -> Group
201
+ end
202
+
203
+ # Methods that construct raster image objects within a container
204
+ module ImageConstructors
205
+ # Composite a raster image at [<tt>x</tt>,<tt>y</tt>]
206
+ # in a viewport of the specified <tt>width</tt> and <tt>height</tt>.
207
+ # If not specified, the width and height are the width and height
208
+ # of the image. Use the RVG::PreserveAspectRatio#preserve_aspect_ratio method to
209
+ # control the placement and scaling of the image within the
210
+ # viewport. By default, the image is scaled to fit inside the
211
+ # viewport and centered within the viewport.
212
+ def image: (Magick::Image image, ?magick_real? width, ?magick_real? height, ?magick_real x, ?magick_real y) -> Image
213
+ end
214
+
215
+ # Methods that create shapes, text, and other drawable objects
216
+ # within container objects such as ::Magick::RVG and
217
+ # ::Magick::RVG::Group
218
+ module Embellishable
219
+ include StructureConstructors
220
+ include ShapeConstructors
221
+ include TextConstructors
222
+ include UseConstructors
223
+ include ImageConstructors
224
+ end
225
+ end
226
+ end
data/sig/rvg/misc.rbs ADDED
@@ -0,0 +1,145 @@
1
+ # $Id: misc.rb,v 1.17 2010/03/21 01:43:01 baror Exp $
2
+ # Copyright (C) 2009 Timothy P. Hunter
3
+ module Magick
4
+ class RVG
5
+ # This is a standard deep_copy method that is used in most classes.
6
+ # Thanks to Robert Klemme.
7
+ module Duplicatable
8
+ include _Duplicatable
9
+ end
10
+
11
+ # Convert an array of method arguments to Float objects. If any
12
+ # cannot be converted, raise ArgumentError and issue a message.
13
+ def self.fmsg: (*untyped args) -> String
14
+
15
+ def self.convert_to_float: (*(magick_real | Symbol) args) -> Array[Float?]
16
+ def self.convert_one_to_float: (magick_real arg) -> Float
17
+ end
18
+ end
19
+
20
+ module Magick
21
+ class RVG
22
+ class Utility
23
+ class TextStrategy
24
+ @ctx: GraphicContext
25
+
26
+ def initialize: (GraphicContext context) -> void
27
+ def enquote: (String text) -> String
28
+ def glyph_metrics: (Integer | Float glyph_orientation, string glyph) -> [Integer | Float, Integer | Float]
29
+ def text_rel_coords: (string text) -> [Array[Integer | Float], Array[Integer | Float]]
30
+ def shift_baseline: (Integer | Float glyph_orientation, string glyph) -> (Integer | Float)
31
+ def render_glyph: (Integer | Float glyph_orientation, magick_real x, magick_real y, String glyph) -> void
32
+ end
33
+
34
+ class LRTextStrategy < TextStrategy
35
+ @word_space: Integer | Float
36
+
37
+ def get_word_spacing: () -> [Integer | Float, 0]
38
+ def get_letter_spacing: (string glyph) -> [Integer | Float, Integer | Float]
39
+ def render: (Integer | Float x, Integer | Float y, string text) -> [Integer | Float, 0]
40
+ end
41
+
42
+ class RLTextStrategy < TextStrategy
43
+ def render: (untyped _x, untyped _y, untyped _text) -> untyped
44
+ end
45
+
46
+ class TBTextStrategy < TextStrategy
47
+ @word_space: Integer | Float
48
+
49
+ def get_word_spacing: () -> [0, Integer | Float]
50
+ def get_letter_spacing: (string glyph) -> [Integer | Float, Integer | Float]
51
+ def render: (Integer | Float x, Integer | Float y, string text) -> [0, Integer | Float]
52
+ end
53
+
54
+ # Handle "easy" text
55
+ class DefaultTextStrategy < TextStrategy
56
+ def render: (Integer | Float x, Integer | Float y, String text) -> [(Integer | Float)?, 0]
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ module Magick
63
+ class RVG
64
+ class Utility
65
+ class TextAttributes
66
+ def initialize: () -> void
67
+ def push: () -> void
68
+ def pop: () -> void
69
+ def set_affine: (real sx, real rx, real ry, real sy, real tx, real ty) -> void
70
+ def affine: () -> Magick::AffineMatrix
71
+ def baseline_shift: () -> Symbol
72
+ def baseline_shift=: (interned | real value) -> Symbol
73
+ def text_anchor: () -> Symbol
74
+ def text_anchor=: (Symbol anchor) -> Symbol
75
+ def glyph_orientation_vertical: () -> (Integer | Float)
76
+ def glyph_orientation_vertical=: (Integer | Float angle) -> (Integer | Float)
77
+ def glyph_orientation_horizontal: () -> (Integer | Float)
78
+ def glyph_orientation_horizontal=: (Integer | Float angle) -> (Integer | Float)
79
+ def letter_spacing: () -> (Integer | Float)
80
+ def letter_spacing=: (Integer | Float value) -> (Integer | Float)
81
+ def non_default?: () -> bool
82
+ def word_spacing: () -> (Integer | Float)
83
+ def word_spacing=: (Integer | Float value) -> (Integer | Float)
84
+ def writing_mode: () -> String
85
+ def writing_mode=: (String mode) -> String
86
+ end
87
+
88
+ class GraphicContext
89
+ @rx: Integer | Float
90
+ @sx: Integer | Float
91
+ @tx: Integer | Float
92
+ @gc: Magick::Draw
93
+ @shadow: Array[Magick::Draw]
94
+ @text_attrs: TextAttributes
95
+ @ry: Integer | Float
96
+ @sy: Integer | Float
97
+ @ty: Integer | Float
98
+
99
+ # The methods of Magick::Draw class can be called via method_missing
100
+ include Magick::_DrawCommonMethods
101
+
102
+ attr_reader gc: Magick::Draw
103
+ attr_reader text_attrs: TextAttributes
104
+
105
+ private
106
+
107
+ def init_matrix: () -> void
108
+ def concat_matrix: () -> void
109
+
110
+ public
111
+
112
+ def self.degrees_to_radians: (real deg) -> Float
113
+
114
+ def initialize: () -> void
115
+ def affine: (magick_real sx, magick_real rx, magick_real ry, magick_real sy, magick_real tx, magick_real ty) -> nil
116
+ | ...
117
+ def baseline_shift: (String | real value) -> nil
118
+ def font: (string name) -> nil
119
+ def font_family: (string name) -> nil
120
+ def font_size: (magick_real points) -> nil
121
+ def font_stretch: (interned stretch) -> nil
122
+ def font_style: (interned style) -> nil
123
+ def font_weight: (interned | int weight) -> nil
124
+ def glyph_orientation_horizontal: (magick_real deg) -> nil
125
+ def glyph_orientation_vertical: (magick_real deg) -> nil
126
+ def inspect: () -> String
127
+ def letter_spacing: (magick_real value) -> nil
128
+ def push: () -> nil
129
+ def pop: () -> nil
130
+ def rotate: (magick_real degrees) -> nil
131
+ def scale: (magick_real sx, magick_real sy) -> nil
132
+ def shadow: () -> Magick::Draw?
133
+ def skewX: (magick_real degrees) -> nil
134
+ def skewY: (magick_real degrees) -> nil
135
+ def stroke_width: (magick_real width) -> nil
136
+ def text: (magick_real x, magick_real y, string text) -> void
137
+ def text_anchor: (interned anchor) -> nil
138
+ def text_decoration: (interned decoration) -> nil
139
+ def translate: (magick_real tx, magick_real ty) -> nil
140
+ def word_spacing: (magick_real value) -> nil
141
+ def writing_mode: (String mode) -> nil
142
+ end
143
+ end
144
+ end
145
+ end
data/sig/rvg/paint.rbs ADDED
@@ -0,0 +1,55 @@
1
+ module Magick
2
+ class RVG
3
+ class Pattern
4
+ @width: Float
5
+ @height: Float
6
+ @x: Float
7
+ @y: Float
8
+ @content: Content
9
+
10
+ include StructureConstructors
11
+ include UseConstructors
12
+ include ShapeConstructors
13
+ include TextConstructors
14
+ include ImageConstructors
15
+ include Stretchable
16
+ include Duplicatable
17
+ include Stylable
18
+
19
+ # Return upper-left corner, width, height of viewport in user coordinates.
20
+ # Usually these are the values specified when the Pattern object is
21
+ # created, but they can be changed by a call to the viewbox method.
22
+ attr_reader x: Float
23
+
24
+ # Return upper-left corner, width, height of viewport in user coordinates.
25
+ # Usually these are the values specified when the Pattern object is
26
+ # created, but they can be changed by a call to the viewbox method.
27
+ attr_reader y: Float
28
+
29
+ # Return upper-left corner, width, height of viewport in user coordinates.
30
+ # Usually these are the values specified when the Pattern object is
31
+ # created, but they can be changed by a call to the viewbox method.
32
+ attr_reader width: Float
33
+
34
+ # Return upper-left corner, width, height of viewport in user coordinates.
35
+ # Usually these are the values specified when the Pattern object is
36
+ # created, but they can be changed by a call to the viewbox method.
37
+ attr_reader height: Float
38
+
39
+ # Create a pattern that can be used with the :fill or :stroke styles.
40
+ # The +width+ and +height+ arguments define the viewport.
41
+ # The pattern will be repeated at <tt>x+m*width</tt> and <tt>y+n*height</tt>
42
+ # offsets.
43
+ #
44
+ # Define the pattern in the block.
45
+ # The pattern can be composed of shapes (rectangle, circles, etc.), text,
46
+ # raster images and container objects. You can include graphic objects by
47
+ # referring to them with #use.
48
+ def initialize: (?magick_real width, ?magick_real height, ?magick_real x, ?magick_real y) -> void
49
+ | (?magick_real width, ?magick_real height, ?magick_real x, ?magick_real y) { (Pattern) -> void } -> void
50
+
51
+ # @private
52
+ def add_primitives: (Utility::GraphicContext gc, interned style) -> void
53
+ end
54
+ end
55
+ end