Contents

CanvasRenderingContext2D

The CanvasRenderingContext2D class provides a 2D drawing context for a canvas element. Use the methods of this class to draw on the canvas. To obtain an instance of the CanvasRenderingContext2D, call the getContext('2d') method on a canvas object. See Devlink 1744220 for usage examples.

Declaration

interface CanvasRenderingContext2D

Topics

Drawing Rectangles

Creating Paths (Lines, Curves, Arcs, and Shapes)

Filling and Stroking Lines and Paths

Drawing Images

Drawing Text

Changing the Coordinate System

Saving and Restoring Settings

Compositing

Creating Gradients and Patterns

Manipulating Pixels

Working with Shadows

Constants

Instance Properties

Instance Methods