Class: SVG::Node::Path
 Defined in:
 lib/svg/node/path.rb
Instance Method Summary collapse

#close_path ⇒ Object
Closes the current subpath by drawing a straight line from the current point to current subpath's initial point.

#curve_to(x1, y1, x2, y2, x, y) ⇒ Object
(also: #c)
Draws a cubic B??zier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve.

#curve_to!(x1, y1, x2, y2, x, y) ⇒ Object
(also: #C)
Draws a cubic B??zier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve.

#initialize(properties = {}) {SVG::Node::Path ... } ⇒ Path
constructor
Creates a new path node.

#line_to(x, y) ⇒ Object
(also: #l)
Draws a line from the current point to the given relative (x,y) coordinate which becomes the new current point.

#line_to!(x, y) ⇒ Object
(also: #L)
Draws a line from the current point to the given absolute (x,y) coordinate which becomes the new current point.

#move_to(x, y) ⇒ Object
(also: #m)
Starts a new subpath at the given relative (x,y) coordinate.

#move_to!(x, y) ⇒ Object
(also: #M)
Starts a new subpath at the given absolute (x,y) coordinate.

#smooth_curve_to(x2, y2, x, y) ⇒ Object
(also: #s)
Draws a smooth B??zier curve.

#smooth_curve_to!(x2, y2, x, y) ⇒ Object
(also: #S)
Draws a smooth B??zier curve.
Methods inherited from SVG::Node
#[]=, #current_transformation, #scale, #translate, #xpath
Methods included from SVG::NodeHelpers
#clip_path, #g, #path, #rect
Constructor Details
#initialize(properties = {}) {SVG::Node::Path ... } ⇒ Path
Creates a new path node.
9 10 11 
# File 'lib/svg/node/path.rb', line 9 def initialize(properties = {}, &block) super "path", properties, &block end 
Instance Method Details
#close_path ⇒ Object
Closes the current subpath by drawing a straight line from the current point to current subpath's initial point. Equivalent to "Z".
15 16 17 
# File 'lib/svg/node/path.rb', line 15 def close_path append_path_data "Z" end 
#curve_to(x1, y1, x2, y2, x, y) ⇒ Object Also known as: c
Draws a cubic B??zier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. All coordinates are relative.
Equivalent to "c".
32 33 34 
# File 'lib/svg/node/path.rb', line 32 def curve_to(x1, y1, x2, y2, x, y) append_path_data "c", x1, y1, x2, y2, x, y end 
#curve_to!(x1, y1, x2, y2, x, y) ⇒ Object Also known as: C
Draws a cubic B??zier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. All coordinates are absolute.
Equivalent to "C".
50 51 52 
# File 'lib/svg/node/path.rb', line 50 def curve_to!(x1, y1, x2, y2, x, y) append_path_data "C", x1, y1, x2, y2, x, y end 
#line_to(x, y) ⇒ Object Also known as: l
Draws a line from the current point to the given relative (x,y) coordinate which becomes the new current point. Equivalent to "L".
60 61 62 
# File 'lib/svg/node/path.rb', line 60 def line_to(x, y) append_path_data "l", x, y end 
#line_to!(x, y) ⇒ Object Also known as: L
Draws a line from the current point to the given absolute (x,y) coordinate which becomes the new current point. Equivalent to "L".
70 71 72 
# File 'lib/svg/node/path.rb', line 70 def line_to!(x, y) append_path_data "L", x, y end 
#move_to(x, y) ⇒ Object Also known as: m
Starts a new subpath at the given relative (x,y) coordinate. Equivalent to "M".
80 81 82 
# File 'lib/svg/node/path.rb', line 80 def move_to(x, y) append_path_data "m", x, y end 
#move_to!(x, y) ⇒ Object Also known as: M
Starts a new subpath at the given absolute (x,y) coordinate. Equivalent to "M".
90 91 92 
# File 'lib/svg/node/path.rb', line 90 def move_to!(x, y) append_path_data "M", x, y end 
#smooth_curve_to(x2, y2, x, y) ⇒ Object Also known as: s
Draws a smooth B??zier curve. See www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands for details. Equivalent to "s"
98 99 100 
# File 'lib/svg/node/path.rb', line 98 def smooth_curve_to(x2, y2, x, y) append_path_data "s", x2, y2, x, y end 
#smooth_curve_to!(x2, y2, x, y) ⇒ Object Also known as: S
Draws a smooth B??zier curve. See www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands for details. Equivalent to "S"
106 107 108 
# File 'lib/svg/node/path.rb', line 106 def smooth_curve_to!(x2, y2, x, y) append_path_data "S", x2, y2, x, y end 