Name
CRC.fill() — fills the path
Synopsis
void fill()
Description
fill()
fills the current path with the color,
gradient, or pattern specified by the fillStyle
property. Any subpaths that are not closed are filled as if the
closePath()
method had been called on them. (Note,
however, that this does not actually cause those subpaths to become
closed.)
Filling a path does not clear the path. You may call
stroke()
after calling fill()
without redefining the path.
When the path intersects itself or when subpaths overlap,
fill()
uses the “nonzero winding rule” to determine
which points are inside the path and which are outside. This means, for
example, that if your path defines a square inside of a circle and the
square’s subpath winds in the opposite direction of the circle’s path,
then the interior of the square will be outside of the path and will not
be filled.
See Also
Get Canvas Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.