Expression painter:closepath() closes the current subpath by appending a straight line segment connecting the current point to the subpath to its starting point. This function does nothing if the current subpath is already closed.

Using function painter:closepath is better than specifying the line segment using painter:lineto because it will ensure that the line segments are joined using the current pen capStyle and joinStyle attributes.

After calling this function, the current point is left unset.

See also: PostScript operator closepath.