Method: HexaPDF::Content::Canvas#polyline
- Defined in:
- lib/hexapdf/content/canvas.rb
#polyline(*points) ⇒ Object
:call-seq:
canvas.polyline(x0, y0, x1, y1, x2, y2, ...) => canvas
Moves the current point to (x0, y0) and appends line segments between all given consecutive points, i.e. between (x0, y0) and (x1, y1), between (x1, y1) and (x2, y2) and so on. The last point becomes the new current point. Returns self.
If there is no current path when the method is invoked, a new path is automatically begun.
Examples:
#>pdf
canvas.polyline(50, 50, 150, 50, 150, 150, 50, 150, 50, 50).stroke
See: #move_to, #line_to, #polygon
1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File 'lib/hexapdf/content/canvas.rb', line 1224 def polyline(*points) check_poly_points(points) move_to(points[0], points[1]) i = 2 while i < points.length line_to(points[i], points[i + 1]) i += 2 end self end |