Home

LineTo

LineTo is a path drawing command used in vector graphics to add a straight line segment from the current point to a specified coordinate. It is a common operation in path-based drawing models found in several graphic APIs and file formats. LineTo typically follows a MoveTo command, which sets the starting point of the path. When LineTo is invoked, it creates a line from the current point to the given coordinates and then updates the current point to those coordinates. LineTo itself does not render the stroke; rendering occurs when the path is stroked or filled.

In HTML5 canvas, lineTo is a method of the drawing context. Typical usage involves beginPath, moveTo(x0, y0),

LineTo supports absolute coordinates and, in some APIs, relative coordinates depending on the context. It is

See also MoveTo, CurveTo, Path, Stroke, Fill.

lineTo(x1,
y1),
and
stroke.
In
SVG,
line
segments
can
be
specified
as
part
of
a
path
using
the
L
command
(absolute)
or
the
l
command
(relative).
Other
environments,
such
as
PostScript
and
PDF,
implement
similar
operators
often
named
lineto
or
lineTo.
usually
employed
alongside
MoveTo
and
other
path
commands
to
construct
shapes,
polylines,
or
complex
outlines.
The
operation
is
lightweight
when
used
in
sequence,
and
performance
can
be
improved
by
batching
multiple
lineTo
calls
before
issuing
a
stroke
or
fill.