1e41f4b71Sopenharmony_ci# DrawingRenderingContext 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci**DrawingRenderingContext** provides a rendering context for drawing rectangles, text, images, and other objects on a canvas. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> This feature is supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## Attributes 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci| Name | Type | Description | 15e41f4b71Sopenharmony_ci| ---------- | ------------------------------------------------------------ | --------------------------------------------------------- | 16e41f4b71Sopenharmony_ci| size | {width: number, height: number} | Width and height of the context, in vp. | 17e41f4b71Sopenharmony_ci| canvas | [Canvas](../../apis-arkgraphics2d/js-apis-graphics-drawing.md#canvas) | **Canvas** object. For details, see [Canvas](../../apis-arkgraphics2d/js-apis-graphics-drawing.md#canvas).| 18e41f4b71Sopenharmony_ci| invalidate | void | Triggers re-rendering of the component. | 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci**Example** 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ciThis example shows how to use the APIs in **DrawingRenderingContext** for drawing. 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci```ts 25e41f4b71Sopenharmony_ci// xxx.ets 26e41f4b71Sopenharmony_ci@Entry 27e41f4b71Sopenharmony_ci@Component 28e41f4b71Sopenharmony_cistruct CanvasExample { 29e41f4b71Sopenharmony_ci private context: DrawingRenderingContext = new DrawingRenderingContext() 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci build() { 32e41f4b71Sopenharmony_ci Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { 33e41f4b71Sopenharmony_ci Canvas(this.context) 34e41f4b71Sopenharmony_ci .width('100%') 35e41f4b71Sopenharmony_ci .height('100%') 36e41f4b71Sopenharmony_ci .backgroundColor('#ffff00') 37e41f4b71Sopenharmony_ci .onReady(() => { 38e41f4b71Sopenharmony_ci this.context.canvas.drawCircle(200, 200, 100) 39e41f4b71Sopenharmony_ci this.context.invalidate() 40e41f4b71Sopenharmony_ci }) 41e41f4b71Sopenharmony_ci } 42e41f4b71Sopenharmony_ci .width('100%') 43e41f4b71Sopenharmony_ci .height('100%') 44e41f4b71Sopenharmony_ci } 45e41f4b71Sopenharmony_ci} 46e41f4b71Sopenharmony_ci``` 47e41f4b71Sopenharmony_ci  48