提交 588a87ab 编写于 作者: E ester.zhou

update docs

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 525141cf
...@@ -80,7 +80,7 @@ In addition to [universal events](ts-universal-events-click.md), the following ...@@ -80,7 +80,7 @@ In addition to [universal events](ts-universal-events-click.md), the following
@Entry @Entry
@Component @Component
struct CanvasExample { struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
build() { build() {
......
...@@ -57,7 +57,7 @@ Adds a color stop for the **CanvasGradient** object based on the specified off ...@@ -57,7 +57,7 @@ Adds a color stop for the **CanvasGradient** object based on the specified off
@Entry @Entry
@Component @Component
struct Page45 { struct Page45 {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private gra:CanvasGradient = new CanvasGradient() private gra:CanvasGradient = new CanvasGradient()
...@@ -69,9 +69,9 @@ Adds a color stop for the **CanvasGradient** object based on the specified off ...@@ -69,9 +69,9 @@ Adds a color stop for the **CanvasGradient** object based on the specified off
.backgroundColor('#ffff00') .backgroundColor('#ffff00')
.onReady(() =>{ .onReady(() =>{
var grad = this.context.createLinearGradient(50,0, 300,100) var grad = this.context.createLinearGradient(50,0, 300,100)
this.gra.addColorStop(0.0, 'red') gra.addColorStop(0.0, 'red')
this.gra.addColorStop(0.5, 'white') gra.addColorStop(0.5, 'white')
this.gra.addColorStop(1.0, 'green') gra.addColorStop(1.0, 'green')
this.context.fillStyle = grad this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500) this.context.fillRect(0, 0, 500, 500)
}) })
...@@ -84,4 +84,3 @@ Adds a color stop for the **CanvasGradient** object based on the specified off ...@@ -84,4 +84,3 @@ Adds a color stop for the **CanvasGradient** object based on the specified off
![](figures/en-us_image_0000001192915130.png) ![](figures/en-us_image_0000001192915130.png)
...@@ -85,7 +85,7 @@ Example ...@@ -85,7 +85,7 @@ Example
@Entry @Entry
@Component @Component
struct DrawImageExample { struct DrawImageExample {
private settings:RenderingContextSettings = new RenderingContextSettings(true,true) private settings:RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private img:ImageBitmap = new ImageBitmap("common/images/example.jpg") private img:ImageBitmap = new ImageBitmap("common/images/example.jpg")
......
...@@ -46,7 +46,7 @@ Adds a path to this path. ...@@ -46,7 +46,7 @@ Adds a path to this path.
@Entry @Entry
@Component @Component
struct AddPath { struct AddPath {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Da: Path2D = new Path2D("M250 150 L150 350 L350 350 Z") private path2Da: Path2D = new Path2D("M250 150 L150 350 L350 350 Z")
...@@ -84,7 +84,7 @@ Moves the current point of the path back to the start point of the path, and dra ...@@ -84,7 +84,7 @@ Moves the current point of the path back to the start point of the path, and dra
@Entry @Entry
@Component @Component
struct ClosePath { struct ClosePath {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -163,7 +163,7 @@ Moves the current coordinate point of the path to the target point, without draw ...@@ -163,7 +163,7 @@ Moves the current coordinate point of the path to the target point, without draw
@Entry @Entry
@Component @Component
struct MoveTo { struct MoveTo {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -242,7 +242,7 @@ Draws a straight line from the current point to the target point. ...@@ -242,7 +242,7 @@ Draws a straight line from the current point to the target point.
@Entry @Entry
@Component @Component
struct LineTo { struct LineTo {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -367,7 +367,7 @@ Draws a cubic bezier curve on the canvas. ...@@ -367,7 +367,7 @@ Draws a cubic bezier curve on the canvas.
@Entry @Entry
@Component @Component
struct BezierCurveTo { struct BezierCurveTo {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -465,7 +465,7 @@ Draws a quadratic curve on the canvas. ...@@ -465,7 +465,7 @@ Draws a quadratic curve on the canvas.
@Entry @Entry
@Component @Component
struct QuadraticCurveTo { struct QuadraticCurveTo {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -586,7 +586,7 @@ Draws an arc on the canvas. ...@@ -586,7 +586,7 @@ Draws an arc on the canvas.
@Entry @Entry
@Component @Component
struct Arc { struct Arc {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -694,7 +694,7 @@ Draws an arc based on the radius and points on the arc. ...@@ -694,7 +694,7 @@ Draws an arc based on the radius and points on the arc.
@Entry @Entry
@Component @Component
struct ArcTo { struct ArcTo {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -835,8 +835,8 @@ Draws an ellipse in the specified rectangular region. ...@@ -835,8 +835,8 @@ Draws an ellipse in the specified rectangular region.
``` ```
@Entry @Entry
@Component @Component
struct Ellipse { struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -933,8 +933,8 @@ Creates a rectangle. ...@@ -933,8 +933,8 @@ Creates a rectangle.
``` ```
@Entry @Entry
@Component @Component
struct Rect { struct CanvasExample {
private settings: RenderingContextSettings = new RenderingContextSettings(true,true) private settings: RenderingContextSettings = new RenderingContextSettings(true)
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
private path2Db: Path2D = new Path2D() private path2Db: Path2D = new Path2D()
...@@ -956,4 +956,3 @@ Creates a rectangle. ...@@ -956,4 +956,3 @@ Creates a rectangle.
![](figures/en-us_image_0000001192755174.png) ![](figures/en-us_image_0000001192755174.png)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册