# CanvasRenderingContext2D **CanvasRenderingContext2D** allows you to draw rectangles, text, images, and other objects on a canvas. - Example ```
<color> | CanvasGradient | CanvasPattern |
|||
<color> | CanvasGradient | CanvasPattern |
|||
Style of the specified line endpoint. The options are as follows: |
|||
Style of the intersection point between line segments. The options are as follows:
|
|||
Maximum miter length. The miter length is the distance between the inner corner and the outer corner where two lines meet. |
|||
|
Syntax: ctx.font="font-style font-weight font-size font-family"5+
|
|||
Text alignment mode. Available values are as follows: |
|||
Horizontal alignment mode of text. Available values are as follows:
|
|||
Transparency. 0.0: completely transparent; 1.0: completely opaque. |
|||
Composition operation type. Available values are as follows: source-over, source-atop, source-in, source-out, destination-over, destination-atop, destination-in, destination-out, lighter, copy, and xor. For details, see Types. |
|||
Blur level during shadow drawing. A larger value indicates a more blurred effect. The precision is float. |
|||
Whether to adjust the image smoothness during image drawing. The value true indicates that the feature is enabled, and the value false indicates that the feature is disabled. |
X-coordinate of the upper left corner of the rectangle stroke |
||
Y-coordinate of the upper left corner of the rectangle stroke |
||
Object that contains the text width. You can obtain the width by TextMetrics.width. |
Source image. For details, see Image. |
||
Repetition mode. The value can be "repeat", "repeat-x", "repeat-y", or "no-repeat". |
Clockwise rotation angle. You can use Math.PI / 180 to convert the angle to a radian. |
Image resource. For details, see Image. |
||
X-coordinate of the upper left corner of the rectangle used to crop the source image. |
||
Y-coordinate of the upper left corner of the rectangle used to crop the source image. |
||
X-coordinate of the upper left corner of the drawing area on the canvas. |
||
Y-coordinate of the upper left corner of the drawing area on the canvas. |
||
Radius of the start circle, which must be a non-negative finite number. |
||
Radius of the end circle, The value must be non-negative and limited. |
ImageData object with the same width and height copied from the original ImageData object |
ImageData object that contains pixels in the specified area on the canvas |
X-axis offset of the upper left corner of the rectangular area relative to that of the source image |
||
Y-axis offset of the upper left corner of the rectangular area relative to that of the source image |
||
An array describing the interval of alternate line segments and length of spacing |
Interval of alternate line segments and the length of spacing |