Method: HexaPDF::Content::Canvas#close_subpath

Defined in:
lib/hexapdf/content/canvas.rb

#close_subpathObject

:call-seq:

canvas.close_subpath      => canvas

Closes the current subpath by appending a straight line from the current point to the start point of the subpath which also becomes the new current point. Returns self.

If there is no current path when the method is invoked, an error is raised since a valid current point (#current_point) is needed.

Examples:

#>pdf
canvas.move_to(10, 10).
  line_to(110, 10).
  line_to(60, 60).
  close_subpath.           # Draws the line from (60, 60) to (10, 10)
  stroke

See: PDF2.0 s8.5.2.1



1183
1184
1185
1186
1187
1188
# File 'lib/hexapdf/content/canvas.rb', line 1183

def close_subpath
  raise_unless_in_path
  invoke0(:h)
  @current_point = @start_point
  self
end