The CanvasRenderingContext2D type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() |
arc |
Adds an arc to the current path using a radius and specified angles(in radians).
|
![]() |
arcTo |
Adds an arc of a circle to the current sub path by using a radius and tangent points.
|
![]() |
beginPath |
Creates a new path in the canvas and sets the starting point to the coordinate (0,0).
|
![]() |
bezierCurveTo |
Adds a cubic Bezier's curve to the current sub path using two control points.
|
![]() |
clearRect |
Clears the specified rectangle region and makes it transparent.
|
![]() |
closePath |
Closes an open path and attempts to draw a straight line from the current point to starting point of the path.
The use of closePath() is optional.
|
![]() |
createLinearGradient |
The createLinearGradient(x0, y0, x1, y1) method takes four arguments that represent the start point (x0, y0) and end point (x1, y1) of the gradient. If any of the arguments to createLinearGradient() are infinite or NaN, the method must raise a NOT_SUPPORTED_ERR exception. Otherwise, the method must return a linear CanvasGradient initialized with the specified line.
|
![]() |
drawImage(Object, Int32, Int32) |
Draws the image.
|
![]() |
drawImage(Object, Int32, Int32, Int32, Int32) |
Draws the image.
|
![]() |
drawImage(Object, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) |
Draws the subsection of the image specified source and destination parameters.
|
![]() |
fill |
Closes the current path and paints the area within it.
|
![]() |
fillRect |
Draws a filled rectangle.
|
![]() |
lineTo |
Adds a line segment from the current point to the specified coordinate.
|
![]() |
moveTo |
Moves the starting point to a new coordinate specified by x,y values.
|
![]() |
quadraticCurveTo |
Adds a quadratic Bezier's curve to the current sub path.
|
![]() |
rect |
Adds a rectangle.
|
![]() |
restore |
Restores the state of the saved context space.
|
![]() |
rotate |
Rotate the entire context on specified angle(in radians).
|
![]() |
save |
Save the state of the original context space so that you can restore later.
|
![]() |
scale |
Add the scaling transformation described by the arguments to the transformation matrix. The x argument represents the scale factor in the horizontal direction and the y argument represents the scale factor in the vertical direction. The factors are multiples.
|
![]() |
stroke |
Draws a line along the current path.
|
![]() |
strokeRect |
Draws a rectangular outline.
|
![]() |
translate |
Translate the origin of the context space to the specified of the canvas.
|
Fields
Name | Description | |
---|---|---|
![]() |
fillStyle |
The strokeStyle attribute represents the color or style to use for the lines around shapes, and the fillStyle attribute represents the color or style to use inside the shapes. (default black)
|
![]() |
globalAlpha |
The globalAlpha attribute gives an alpha value that is applied to shapes and images before they are composited onto the canvas. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional transparency). If an attempt is made to set the attribute to a value outside this range, the attribute must retain its previous value. When the context is created, the globalAlpha attribute must initially have the value 1.0.
|
![]() |
globalCompositeOperation |
The globalCompositeOperation attribute sets how shapes and images are drawn onto the existing bitmap, once they have had globalAlpha and the current transformation matrix applied. It must be set to a value from the following list. In the descriptions below, the source image, A, is the shape or image being rendered, and the destination image, B, is the current state of the bitmap.
|
![]() |
strokeStyle |
The strokeStyle attribute represents the color or style to use for the lines around shapes, and the fillStyle attribute represents the color or style to use inside the shapes. (default black)
|