rmagick 5.4.4 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +15 -0
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +16 -8
- data/CHANGELOG.md +43 -0
- data/Gemfile +20 -0
- data/Rakefile +11 -0
- data/before_install_osx.sh +1 -1
- data/ext/RMagick/extconf.rb +24 -6
- data/ext/RMagick/rmagick.h +3 -1
- data/ext/RMagick/rmdraw.cpp +10 -10
- data/ext/RMagick/rmfill.cpp +4 -4
- data/ext/RMagick/rmilist.cpp +10 -2
- data/ext/RMagick/rmimage.cpp +321 -294
- data/ext/RMagick/rminfo.cpp +22 -21
- data/ext/RMagick/rmkinfo.cpp +5 -18
- data/ext/RMagick/rmmain.cpp +30 -64
- data/ext/RMagick/rmmontage.cpp +5 -5
- data/ext/RMagick/rmpixel.cpp +1 -1
- data/ext/RMagick/rmutil.cpp +31 -71
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +67 -65
- data/lib/rvg/embellishable.rb +6 -2
- data/lib/rvg/misc.rb +7 -7
- data/lib/rvg/rvg.rb +2 -0
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/transformable.rb +1 -1
- data/rmagick.gemspec +1 -13
- data/sig/rmagick/_draw_common_methods.rbs +64 -0
- data/sig/rmagick/_image_common_methods.rbs +389 -0
- data/sig/rmagick/draw.rbs +38 -0
- data/sig/rmagick/draw_attribute.rbs +28 -0
- data/sig/rmagick/enum.rbs +814 -0
- data/sig/rmagick/error.rbs +11 -0
- data/sig/rmagick/fill.rbs +21 -0
- data/sig/rmagick/geometry.rbs +14 -0
- data/sig/rmagick/image.rbs +194 -0
- data/sig/rmagick/image_list.rbs +181 -0
- data/sig/rmagick/iptc.rbs +101 -0
- data/sig/rmagick/kernel_info.rbs +12 -0
- data/sig/rmagick/optional_method_arguments.rbs +10 -0
- data/sig/rmagick/pixel.rbs +46 -0
- data/sig/rmagick/struct.rbs +90 -0
- data/sig/rmagick.rbs +43 -0
- data/sig/rvg/clippath.rbs +34 -0
- data/sig/rvg/container.rbs +78 -0
- data/sig/rvg/deep_equal.rbs +48 -0
- data/sig/rvg/describable.rbs +30 -0
- data/sig/rvg/embellishable.rbs +226 -0
- data/sig/rvg/misc.rbs +145 -0
- data/sig/rvg/paint.rbs +55 -0
- data/sig/rvg/pathdata.rbs +77 -0
- data/sig/rvg/rvg.rbs +125 -0
- data/sig/rvg/stretchable.rbs +56 -0
- data/sig/rvg/stylable.rbs +66 -0
- data/sig/rvg/text.rbs +118 -0
- data/sig/rvg/transformable.rbs +59 -0
- data/sig/rvg/units.rbs +33 -0
- metadata +32 -128
@@ -0,0 +1,77 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
# The PathData class provides an object-oriented way to produce an SVG
|
4
|
+
# path. Each of the methods corresponds to a path command. Construct a
|
5
|
+
# path by calling one or more methods. The path object can be passed
|
6
|
+
# as an argument to the RVG::ShapeConstructors#path method.
|
7
|
+
class PathData
|
8
|
+
@path: String
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def add_points: (Integer req, *magick_real coords) -> void
|
13
|
+
|
14
|
+
public
|
15
|
+
|
16
|
+
# Construct an empty path
|
17
|
+
def initialize: () -> void
|
18
|
+
|
19
|
+
# Convert the path to its string equivalent.
|
20
|
+
def to_s: () -> String
|
21
|
+
|
22
|
+
# @private
|
23
|
+
def deep_copy: (?untyped? _h) -> String
|
24
|
+
|
25
|
+
# Add a <tt>moveto</tt> command. If <tt>abs</tt> is
|
26
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
27
|
+
# the coordinates are relative.
|
28
|
+
def moveto: (bool abs, magick_real x, magick_real y, *magick_real coords) -> void
|
29
|
+
|
30
|
+
# Add a <tt>closepath</tt> command. The <tt>abs</tt> argument
|
31
|
+
# is ignored.
|
32
|
+
def closepath: (?bool _abs) -> void
|
33
|
+
|
34
|
+
# Add a <tt>lineto</tt> command. Any number of x,y coordinate
|
35
|
+
# pairs may be specified. If <tt>abs</tt> is
|
36
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
37
|
+
# the coordinates are relative.
|
38
|
+
def lineto: (bool abs, magick_real x, magick_real y, *magick_real coords) -> void
|
39
|
+
|
40
|
+
# Add a <tt>horizontal lineto</tt> command. If <tt>abs</tt> is
|
41
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
42
|
+
# the coordinates are relative.
|
43
|
+
def hlineto: (bool abs, magick_real x) -> void
|
44
|
+
|
45
|
+
# Add a <tt>vertical lineto</tt> command. If <tt>abs</tt> is
|
46
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
47
|
+
# the coordinates are relative.
|
48
|
+
def vlineto: (bool abs, magick_real y) -> void
|
49
|
+
|
50
|
+
# Add a <tt>curveto</tt> (<em>cubic Bezier</em>) command.
|
51
|
+
# If <tt>abs</tt> is
|
52
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
53
|
+
# the coordinates are relative.
|
54
|
+
def curveto: (bool abs, magick_real x1, magick_real y1, magick_real x2, magick_real y2, magick_real x, magick_real y, *magick_real coords) -> void
|
55
|
+
|
56
|
+
# Add a <tt>smooth curveto</tt> (<em>cubic Bezier</em>) command.
|
57
|
+
# If <tt>abs</tt> is
|
58
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
59
|
+
# the coordinates are relative.
|
60
|
+
def smooth_curveto: (bool abs, magick_real x2, magick_real y2, magick_real x, magick_real y, *magick_real coords) -> void
|
61
|
+
|
62
|
+
# Add a <tt>quadratic Bezier curveto</tt> command.
|
63
|
+
# If <tt>abs</tt> is
|
64
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
65
|
+
# the coordinates are relative.
|
66
|
+
def quadratic_curveto: (bool abs, magick_real x1, magick_real y1, magick_real x, magick_real y, *magick_real coords) -> void
|
67
|
+
|
68
|
+
# Add a <tt>smooth quadratic Bezier curveto</tt> command.
|
69
|
+
# If <tt>abs</tt> is
|
70
|
+
# <tt>true</tt> the coordinates are absolute, otherwise
|
71
|
+
# the coordinates are relative.
|
72
|
+
def smooth_quadratic_curveto: (bool abs, magick_real x, magick_real y, *magick_real coords) -> void
|
73
|
+
|
74
|
+
def arc: (bool abs, magick_real rx, magick_real ry, magick_real x_axis_rotation, magick_real large_arc_flag, magick_real sweep_flag, magick_real x, magick_real y) -> void
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/sig/rvg/rvg.rbs
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
@background_image: untyped
|
4
|
+
@background_pattern: untyped
|
5
|
+
@background_position: untyped
|
6
|
+
@background_fill: untyped
|
7
|
+
@background_fill_opacity: untyped
|
8
|
+
@width: untyped
|
9
|
+
@height: untyped
|
10
|
+
@content: Content
|
11
|
+
@canvas: Magick::Image
|
12
|
+
@desc: untyped
|
13
|
+
@title: untyped
|
14
|
+
@metadata: untyped
|
15
|
+
@x: untyped
|
16
|
+
@y: untyped
|
17
|
+
@nested: untyped
|
18
|
+
|
19
|
+
include Stylable
|
20
|
+
include Transformable
|
21
|
+
include Stretchable
|
22
|
+
include Embellishable
|
23
|
+
include Describable
|
24
|
+
include Duplicatable
|
25
|
+
|
26
|
+
interface _Duplicatable
|
27
|
+
def deep_copy: (?Hash[untyped, untyped] h) -> self
|
28
|
+
end
|
29
|
+
|
30
|
+
# The background image specified by background_image=
|
31
|
+
attr_reader background_image: Magick::Image
|
32
|
+
|
33
|
+
# The background image layout specified by background_position=
|
34
|
+
attr_reader background_position: Symbol
|
35
|
+
|
36
|
+
# The background fill color specified by background_fill=
|
37
|
+
attr_reader background_fill: Magick::Pixel
|
38
|
+
|
39
|
+
# The background fill color opacity specified by background_fill_opacity=
|
40
|
+
attr_reader background_fill_opacity: Float
|
41
|
+
|
42
|
+
# The image after drawing has completed
|
43
|
+
attr_reader canvas: Magick::Image
|
44
|
+
|
45
|
+
# For embedded RVG objects, the x-axis coordinate of the upper-left corner
|
46
|
+
attr_reader x: Float
|
47
|
+
|
48
|
+
# For embedded RVG objects, the x-axis coordinate of the upper-left corner
|
49
|
+
attr_reader y: Float
|
50
|
+
|
51
|
+
attr_reader width: Float
|
52
|
+
|
53
|
+
attr_reader height: Float
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def bgfill: () -> Magick::Pixel
|
58
|
+
def new_canvas: () -> Magick::Image
|
59
|
+
|
60
|
+
public
|
61
|
+
|
62
|
+
|
63
|
+
# Sets an image to use as the canvas background. See background_position= for layout options.
|
64
|
+
def background_image=: (Magick::Image? bg_image) -> Magick::Image?
|
65
|
+
|
66
|
+
# Sets an object to use to fill the canvas background.
|
67
|
+
# The object must have a <tt>fill</tt> method. See the <b>Fill Classes</b>
|
68
|
+
# section in the RMagick doc for more information.
|
69
|
+
def background_pattern=: (magick_fill filler) -> magick_fill
|
70
|
+
|
71
|
+
# How to position the background image on the canvas. One of the following symbols:
|
72
|
+
# [:scaled] Scale the image to the canvas width and height.
|
73
|
+
# [:tiled] Tile the image across the canvas.
|
74
|
+
# [:fit] Scale the image to fit within the canvas while retaining the
|
75
|
+
# image proportions. Center the image on the canvas. Color any part of
|
76
|
+
# the canvas not covered by the image with the background color.
|
77
|
+
def background_position=: (interned pos) -> Symbol
|
78
|
+
|
79
|
+
# Sets the canvas background color. Either a Magick::Pixel or a color name.
|
80
|
+
# The default fill is "none", that is, transparent black.
|
81
|
+
def background_fill=: (magick_color color) -> Magick::Pixel
|
82
|
+
|
83
|
+
# Opacity of the background fill color, a number between 0.0 (transparent) and
|
84
|
+
# 1.0 (opaque). The default is 1.0 when the background_fill= attribute has been set.
|
85
|
+
def background_fill_opacity=: (magick_real opacity) -> magick_real
|
86
|
+
|
87
|
+
# Draw a +width+ x +height+ image. The image is specified by calling
|
88
|
+
# one or more drawing methods on the RVG object.
|
89
|
+
# You can group the drawing method calls in the optional associated block.
|
90
|
+
# The +x+ and +y+ arguments have no meaning for the outermost RVG object.
|
91
|
+
# On nested RVG objects [+x+, +y+] is the coordinate of the upper-left
|
92
|
+
# corner in the containing canvas on which the nested RVG object is placed.
|
93
|
+
#
|
94
|
+
# Drawing occurs on a +canvas+ created by the #draw method. By default the
|
95
|
+
# canvas is transparent. You can specify a different canvas with the
|
96
|
+
# #background_fill= or #background_image= methods.
|
97
|
+
#
|
98
|
+
# RVG objects are _containers_. That is, styles and transforms defined
|
99
|
+
# on the object are used by contained objects such as shapes, text, and
|
100
|
+
# groups unless overridden by an inner container or the object itself.
|
101
|
+
def initialize: (?magick_real? width, ?magick_real? height) -> void
|
102
|
+
| (?magick_real? width, ?magick_real? height) { (RVG) -> void } -> void
|
103
|
+
|
104
|
+
# Construct a canvas or reuse an existing canvas.
|
105
|
+
# Execute drawing commands. Return the canvas.
|
106
|
+
def draw: () -> Magick::Image
|
107
|
+
|
108
|
+
# Accept #use arguments. Use (x,y) to generate an additional translate.
|
109
|
+
# Override @width and @height if new values are supplied.
|
110
|
+
# @private
|
111
|
+
def ref: (Integer | Float x, Integer | Float y, Integer | Float rw, Integer | Float rh) -> void
|
112
|
+
|
113
|
+
# Used by Magick::Embellishable.rvg to set non-0 x- and y-coordinates
|
114
|
+
# @private
|
115
|
+
def corner: (magick_real x, magick_real y) -> void
|
116
|
+
|
117
|
+
# Primitives for the outermost RVG object
|
118
|
+
# @private
|
119
|
+
def add_outermost_primitives: (Utility::GraphicContext gc) -> self
|
120
|
+
|
121
|
+
# Primitives for nested RVG objects
|
122
|
+
# @private
|
123
|
+
def add_primitives: (Utility::GraphicContext gc) -> void
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
module PreserveAspectRatio
|
4
|
+
@align: String
|
5
|
+
@meet_or_slice: String
|
6
|
+
|
7
|
+
# -
|
8
|
+
# Included in Stretchable module and Image class
|
9
|
+
# +
|
10
|
+
# Specifies how the image within a viewport should be scaled.
|
11
|
+
# [+align+] a combination of 'xMin', 'xMid', or 'xMax', followed by
|
12
|
+
# 'YMin', 'YMid', or 'YMax'
|
13
|
+
# [+meet_or_slice+] one of 'meet' or 'slice'
|
14
|
+
def preserve_aspect_ratio: (interned align, ?interned meet_or_slice) -> self
|
15
|
+
| (interned align, ?interned meet_or_slice) { (self) -> void } -> self
|
16
|
+
end
|
17
|
+
|
18
|
+
# The methods in this module describe the user-coordinate space.
|
19
|
+
# RVG and Pattern objects are stretchable.
|
20
|
+
module Stretchable
|
21
|
+
@vbx_width: Float
|
22
|
+
@vbx_height: Float
|
23
|
+
@vbx_x: Float
|
24
|
+
@vbx_y: Float
|
25
|
+
@meet_or_slice: String
|
26
|
+
@align: String
|
27
|
+
|
28
|
+
include PreserveAspectRatio
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# Scale to fit
|
33
|
+
def set_viewbox_none: (Integer | Float width, Integer | Float height) -> [Integer | Float, Integer | Float]
|
34
|
+
|
35
|
+
# Use align attribute to compute x- and y-offset from viewport's upper-left corner.
|
36
|
+
def align_to_viewport: (Integer | Float width, Integer | Float height, Integer | Float sx, Integer | Float sy) -> [(Integer | Float)?, (Integer | Float)?]
|
37
|
+
|
38
|
+
# Scale to smaller viewbox dimension
|
39
|
+
def set_viewbox_meet: (Integer | Float width, Integer | Float height) -> [(Integer | Float)?, (Integer | Float)?]
|
40
|
+
|
41
|
+
# Scale to larger viewbox dimension
|
42
|
+
def set_viewbox_slice: (Integer | Float width, Integer | Float height) -> [(Integer | Float)?, (Integer | Float)?]
|
43
|
+
|
44
|
+
# Establish the viewbox as necessary
|
45
|
+
def add_viewbox_primitives: (Integer | Float width, Integer | Float height, Utility::GraphicContext gc) -> void
|
46
|
+
|
47
|
+
public
|
48
|
+
|
49
|
+
# Describe a user coordinate system to be imposed on the viewbox.
|
50
|
+
# The arguments must be numbers and the +width+ and +height+
|
51
|
+
# arguments must be positive.
|
52
|
+
def viewbox: (magick_real x, magick_real y, magick_real width, magick_real height) -> self
|
53
|
+
| (magick_real x, magick_real y, magick_real width, magick_real height) { (self) -> void } -> self
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
# Styles is a Struct class with a couple of extra methods
|
4
|
+
class Styles < Struct[untyped]
|
5
|
+
def set: (Hash[Symbol, untyped] styles) -> self
|
6
|
+
|
7
|
+
# Iterate over the style names. Yield for each style that has a value.
|
8
|
+
def each_value: () { (Symbol, untyped) -> void } -> void
|
9
|
+
|
10
|
+
# The "usual" deep_copy method doesn't copy a Struct correctly.
|
11
|
+
def deep_copy: (?untyped? _h) -> Styles
|
12
|
+
|
13
|
+
def self.new: (*untyped obj) -> Styles
|
14
|
+
end
|
15
|
+
|
16
|
+
# This module is mixed into classes that can have styles.
|
17
|
+
module Stylable
|
18
|
+
@styles: Styles
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# For each style that has a value, add a style primitive to the gc.
|
23
|
+
# Use splat to splat out Array arguments such as stroke_dasharray.
|
24
|
+
def add_style_primitives: (Utility::GraphicContext gc) -> void
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
# This method can be used with any RVG, Group, Use, Text, or
|
29
|
+
# shape object. The argument is a hash. The style names are
|
30
|
+
# the hash keys. The style names and values are:
|
31
|
+
# [:baseline_shift] modify the text baseline
|
32
|
+
# [:clip_path] clipping path defined by clip_path
|
33
|
+
# [:clip_rule] 'evenodd' or 'nozero'
|
34
|
+
# [:fill] color name
|
35
|
+
# [:fill_opacity] the fill opacity, 0.0<=N<=1.0
|
36
|
+
# [:fill_rule] 'evenodd' or 'nozero'
|
37
|
+
# [:font] font name or font file name
|
38
|
+
# [:font_family] font family name, ex. 'serif'
|
39
|
+
# [:font_size] font size in points
|
40
|
+
# [:font_stretch] 'normal','ultra_condensed','extra_condensed',
|
41
|
+
# 'condensed','semi_condensed','semi_expanded',
|
42
|
+
# 'expanded','extra_expanded','ultra_expanded'
|
43
|
+
# [:font_style] 'normal','italic','oblique'
|
44
|
+
# [:font_weight] 'normal','bold','bolder','lighter', or
|
45
|
+
# a multiple of 100 between 100 and 900.
|
46
|
+
# [:glyph_orientation_horizontal] 0, 90, 180, 270
|
47
|
+
# [:glyph_orientation_vertical] 0, 90, 180, 270
|
48
|
+
# [:letter_spacing] modify the spacing between letters
|
49
|
+
# [:opacity] both fill and stroke opacity, 0.0<=N<=1.0
|
50
|
+
# [:stroke] color name
|
51
|
+
# [:stroke_dasharray] dash pattern (Array)
|
52
|
+
# [:stroke_dashoffset] initial distance into dash pattern
|
53
|
+
# [:stroke_linecap] 'butt', 'round', 'square'
|
54
|
+
# [:stroke_linejoin] 'miter', 'round', 'bevel'
|
55
|
+
# [:stroke_miterlimit] miter length constraint
|
56
|
+
# [:stroke_opacity] the stroke opacity, 0.0<=N<=1.0
|
57
|
+
# [:stroke_width] stroke width
|
58
|
+
# [:text_anchor] 'start','middle','end'
|
59
|
+
# [:text_decoration] 'none','underline','overline','line_through'
|
60
|
+
# [:word_spacing] modify the spacing between words
|
61
|
+
# [:writing_mode] 'lr-tb', 'lr', 'rt-tb', 'rl', 'tb-rl', 'tb'
|
62
|
+
def styles: (Hash[Symbol, untyped] styles) -> self
|
63
|
+
| (Hash[Symbol, untyped] styles) { (self) -> void } -> self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/sig/rvg/text.rbs
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
# -
|
2
|
+
# $Id: text.rb,v 1.7 2009/02/28 23:52:28 rmagick Exp $
|
3
|
+
# Copyright (C) 2009 Timothy P. Hunter
|
4
|
+
# +
|
5
|
+
# Text-related classes
|
6
|
+
module Magick
|
7
|
+
class RVG
|
8
|
+
# Base class for Tspan, Tref and Text.
|
9
|
+
class TextBase
|
10
|
+
@text: String?
|
11
|
+
@dx: Integer | Float
|
12
|
+
@rotation: Integer | Float
|
13
|
+
@tspans: Content
|
14
|
+
@dy: Integer | Float
|
15
|
+
|
16
|
+
include Stylable
|
17
|
+
include Duplicatable
|
18
|
+
|
19
|
+
def initialize: (interned? text) -> void
|
20
|
+
| (interned? text) { (self) -> void } -> void
|
21
|
+
|
22
|
+
# Create a new text chunk. Each chunk can have its own initial position and styles.
|
23
|
+
# If <tt>x</tt> and <tt>y</tt> are omitted the text starts at the current text
|
24
|
+
# position.
|
25
|
+
def tspan: (interned text, ?magick_real? x, ?magick_real? y) -> Tspan
|
26
|
+
| (interned text, ?magick_real? x, ?magick_real? y) { (self) -> void } -> Tspan
|
27
|
+
|
28
|
+
# Add <tt>x</tt> and <tt>y</tt> to the current text position.
|
29
|
+
def d: (magick_real x, ?magick_real y) -> self
|
30
|
+
| (magick_real x, ?magick_real y) { (self) -> void } -> self
|
31
|
+
|
32
|
+
# Rotate the text about the current text position.
|
33
|
+
def rotate: (magick_real degrees) -> self
|
34
|
+
| (magick_real degrees) { (self) -> void } -> self
|
35
|
+
|
36
|
+
# We do our own transformations.
|
37
|
+
# @private
|
38
|
+
def add_primitives: (Utility::GraphicContext gc) -> void
|
39
|
+
end
|
40
|
+
|
41
|
+
# Tspan and Tref shared methods - read/update @cx, @cy in parent Text object.
|
42
|
+
# @private
|
43
|
+
module TextLink
|
44
|
+
def add_primitives: (Utility::GraphicContext gc) -> void
|
45
|
+
def cx: () -> Float
|
46
|
+
def cy: () -> Float
|
47
|
+
def cx=: (magick_real x) -> magick_real
|
48
|
+
def cy=: (magick_real y) -> magick_real
|
49
|
+
end
|
50
|
+
|
51
|
+
# @private
|
52
|
+
class Tref < TextBase
|
53
|
+
@x: Float
|
54
|
+
@y: Float
|
55
|
+
@parent: TextBase
|
56
|
+
|
57
|
+
include TextLink
|
58
|
+
|
59
|
+
def initialize: (TextBase obj, magick_real x, magick_real y, TextBase parent) -> void
|
60
|
+
end
|
61
|
+
|
62
|
+
# @private
|
63
|
+
class Tspan < TextBase
|
64
|
+
@x: Float
|
65
|
+
@y: Float
|
66
|
+
|
67
|
+
include TextLink
|
68
|
+
|
69
|
+
attr_accessor parent: TextBase
|
70
|
+
|
71
|
+
# Define a text segment starting at (<tt>x</tt>, <tt>y</tt>).
|
72
|
+
# If <tt>x</tt> and <tt>y</tt> are omitted the segment starts
|
73
|
+
# at the current text position.
|
74
|
+
#
|
75
|
+
# Tspan objects can contain Tspan objects.
|
76
|
+
def initialize: (?interned? text, ?magick_real? x, ?magick_real? y) -> void
|
77
|
+
| (?interned? text, ?magick_real? x, ?magick_real? y) { (Tspan) -> void } -> void
|
78
|
+
end
|
79
|
+
|
80
|
+
class Text < TextBase
|
81
|
+
@cx: Float
|
82
|
+
@cy: Float
|
83
|
+
|
84
|
+
# @private
|
85
|
+
attr_accessor cx: Float
|
86
|
+
|
87
|
+
# @private
|
88
|
+
attr_accessor cy: Float
|
89
|
+
|
90
|
+
# Define a text string starting at [<tt>x</tt>, <tt>y</tt>].
|
91
|
+
# Use the RVG::TextConstructors#text method to create Text objects in a container.
|
92
|
+
#
|
93
|
+
# container.text(100, 100, "Simple text").styles(:font=>'Arial')
|
94
|
+
#
|
95
|
+
# Text objects can contain Tspan objects.
|
96
|
+
#
|
97
|
+
# container.text(100, 100).styles(:font=>'Arial') do |t|
|
98
|
+
# t.tspan("Red text").styles(:fill=>'red')
|
99
|
+
# t.tspan("Blue text").styles(:fill=>'blue')
|
100
|
+
# end
|
101
|
+
def initialize: (?magick_real x, ?magick_real y, ?interned? text) -> void
|
102
|
+
| (?magick_real x, ?magick_real y, ?interned? text) { (Text) -> void } -> void
|
103
|
+
|
104
|
+
# Reference a Tspan object. <tt>x</tt> and <tt>y</tt> are just
|
105
|
+
# like <tt>x</tt> and <tt>y</tt> in RVG::TextBase#tspan
|
106
|
+
def tref: (TextBase obj, ?magick_real? x, ?magick_real? y) -> Tref
|
107
|
+
end
|
108
|
+
|
109
|
+
# Methods that construct text objects within a container
|
110
|
+
module TextConstructors
|
111
|
+
# Draw a text string at (<tt>x</tt>,<tt>y</tt>). The string can
|
112
|
+
# be omitted. Optionally, define text chunks within the associated
|
113
|
+
# block.
|
114
|
+
def text: (?magick_real x, ?magick_real y, ?interned? text) -> Text
|
115
|
+
| (?magick_real x, ?magick_real y, ?interned? text) { (Text) -> void } -> Text
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
# Transforms is an Array with a deep_copy method.
|
4
|
+
# During unit-testing it also has a deep_equal method.
|
5
|
+
# @private
|
6
|
+
class Transforms < Array[untyped]
|
7
|
+
def deep_copy: (?untyped? _h) -> Transforms
|
8
|
+
end
|
9
|
+
|
10
|
+
# Transformations are operations on the coordinate system.
|
11
|
+
# All the transformations defined within a container (an RVG object
|
12
|
+
# or a group) are applied before drawing any shapes or text.
|
13
|
+
# All transformations are applied in the order they were
|
14
|
+
# defined. <em>Note:</em> This means that
|
15
|
+
# g.translate(10,20).scale(2)
|
16
|
+
# is not the same as
|
17
|
+
# g.scale(2).translate(10,20)
|
18
|
+
module Transformable
|
19
|
+
@transforms: Transforms
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
# Apply transforms in the same order they were specified!
|
24
|
+
def add_transform_primitives: (Utility::GraphicContext gc) -> void
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
# Applies the transformation matrix [sx, rx, ry, sy, tx, ty]
|
29
|
+
def matrix: (magick_real sx, magick_real rx, magick_real ry, magick_real sy, magick_real tx, magick_real ty) -> self
|
30
|
+
| (magick_real sx, magick_real rx, magick_real ry, magick_real sy, magick_real tx, magick_real ty) { (self) -> void } -> self
|
31
|
+
|
32
|
+
# Add <tt>tx</tt> to all x-coordinates and <tt>ty</tt>
|
33
|
+
# to all y-coordinates. If <tt>ty</tt> is omitted it defaults
|
34
|
+
# to <tt>tx</tt>.
|
35
|
+
def translate: (magick_real tx, ?magick_real? ty) -> self
|
36
|
+
| (magick_real tx, ?magick_real? ty) { (self) -> void } -> self
|
37
|
+
|
38
|
+
# Multiply the x-coordinates by <tt>sx</tt> and the y-coordinates
|
39
|
+
# by <tt>sy</tt>. If <tt>sy</tt> is omitted it defaults to <tt>sx</tt>.
|
40
|
+
def scale: (magick_real sx, ?magick_real? sy) -> self
|
41
|
+
| (magick_real sx, ?magick_real? sy) { (self) -> void } -> self
|
42
|
+
|
43
|
+
# This method can take either of two argument lists:
|
44
|
+
# [rotate(angle)] rotate by <tt>angle</tt> degrees
|
45
|
+
# [rotate(angle, cx, cy)] rotate by <tt>angle</tt> degrees about
|
46
|
+
# the point [<tt>cx</tt>, <tt>cy</tt>].
|
47
|
+
def rotate: (magick_real angle, *magick_real args) -> self
|
48
|
+
| (magick_real angle, *magick_real args) { (self) -> void } -> self
|
49
|
+
|
50
|
+
# Skew the X-axis by <tt>angle</tt> degrees.
|
51
|
+
def skewX: (magick_real angle) -> self
|
52
|
+
| (magick_real angle) { (self) -> void } -> self
|
53
|
+
|
54
|
+
# Skew the Y-axis by <tt>angle</tt> degrees.
|
55
|
+
def skewY: (magick_real angle) -> self
|
56
|
+
| (magick_real angle) { (self) -> void } -> self
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/sig/rvg/units.rbs
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Magick
|
2
|
+
class RVG
|
3
|
+
attr_reader self.dpi: Float
|
4
|
+
|
5
|
+
def self.dpi=: (magick_real n) -> Float
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Float
|
10
|
+
attr_reader px: Float
|
11
|
+
attr_reader in: Float
|
12
|
+
attr_reader mm: Float
|
13
|
+
attr_reader cm: Float
|
14
|
+
attr_reader pt: Float
|
15
|
+
attr_reader pc: Float
|
16
|
+
def pct: (Magick::magick_real of) -> Float
|
17
|
+
attr_reader deg: Float
|
18
|
+
attr_reader rad: Float
|
19
|
+
attr_reader grad: Float
|
20
|
+
end
|
21
|
+
|
22
|
+
class Integer
|
23
|
+
attr_reader px: Integer
|
24
|
+
attr_reader in: Float
|
25
|
+
attr_reader mm: Float
|
26
|
+
attr_reader cm: Float
|
27
|
+
attr_reader pt: Float
|
28
|
+
attr_reader pc: Float
|
29
|
+
def pct: (Magick::magick_real of) -> Float
|
30
|
+
attr_reader deg: Integer
|
31
|
+
attr_reader rad: Float
|
32
|
+
attr_reader grad: Float
|
33
|
+
end
|