Methods
This section contains the HTML5 Canvas methods reference documentation.
In this section
| Topic | Description |
|---|---|
|
Adds the specified colors and the position in a CanvasGradient object. | |
|
Adds points to a path that represents an arc. | |
|
Draws an arc of a fixed radius between two tangents that are defined by the current point in a path and two additional points. | |
|
Resets the current path. | |
|
Adds a point to the current subpath by using the specified control points that represent a cubic Bézier curve. | |
|
Clears the pixels on a CanvasRenderingContext2D object within a given rectangle. | |
|
Specifies a new clipping region. | |
|
Closes the current subpath and starts a new subpath that has a start point that is equal to the end of the closed subpath. | |
|
Returns a CanvasImageData object with the given dimensions in CSS pixels. | |
|
Creates an object that represents a linear gradient to use in a canvas context. | |
|
Returns a CanvasPattern object that repeats the specified element in the specified direction. | |
|
Returns an object that represents a radial or circular gradient to use in a canvas context. | |
|
Draws a specified image onto a canvas. | |
|
Adds points to a path that represents an ellipse. | |
|
Fills subpaths by using the current fill style. | |
|
Paints a rectangle onto a CanvasRenderingContext2D object by using the current fill style. | |
|
Renders filled text to the canvas by using the current fill style and font. | |
|
Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. | |
|
Returns an ICanvasImageData object that represents the pixel data for the specified rectangle on a canvas. Use the data property to get a CanvasPixelArray to manipulate individual pixel data. | |
|
Gets the current dash list sequence. | |
|
Determines if the specified point is in the current path. | |
|
Adds a new point to a subpath and connects that point to the last point in the subpath by using a straight line. | |
|
Returns a CanvasTextMetrics object that contains the width of the specified text. | |
|
Creates a new subpath by using the specified point. | |
|
Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. | |
|
Paints the data from a specified CanvasImageData object onto a canvas. | |
|
Adds a point to the current subpath by using the specified control points that represent a quadratic Bézier curve. | |
|
Creates a new closed rectangular subpath. | |
|
Returns previously saved CanvasRenderingContext2D path state and attributes. | |
|
Rotates the current context coordinates (that is, a transformation matrix). | |
|
Saves the state of the current context. | |
|
Scales the current context by the specified horizontal (x) and vertical (y) factors. | |
|
Sets the current line dash pattern. The argument is a even numbered list of distances to alternately produce a line and a space. | |
|
Resets the current transformation matrix of the context back to the identity matrix and then multiplies it by the specified matrix. | |
|
Renders the strokes of the current subpath by using the current stroke styles. | |
|
Creates an outline of the specified rectangle on a canvas by using the current stroke, line width, and join styles. | |
|
Renders the specified text at the specified position by using the current font, lineWidth, and strokeStyle property. | |
|
Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element (such as img). | |
|
Modifies the transformation matrix of the current context. | |
|
Specifies values to move the origin point in a canvas. |