Canvas
is a widget that you use to draw arbitrary graphics. When you want to draw a shape, you set the current path to that shape and then paint the shape by stroking, filling, or both stroking and filling. Stroking is the process of painting a line along the current path. Filling is the process of painting the area contained within the path.
You use paths to draw both simple shapes (for example, lines, circles, or rectangles) and complex shapes (such as the silhouette of a mountain range) in a canvas. You can use a path to both draw the outline of a shape and fill the inside of a shape. Prior to building the path, you can define properties such as fillStyle or strokeStyle that can be used by drawing primitives to fill or stroke the path.
When you close the path, the canvas connects the end of the last line segment to the start of the first segment and terminates the current subpath. If you don’t close the path by calling closePath before painting, the path is implicitly closed for you by drawing primitives that fill or clip (but it is not closed for stroking).
|
|