1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Filling style algorithm, which determines whether a point is within or outside the path. The following 18 * two configurations are supported: 19 * "evenodd": odd and even round rule 20 * "nonzero": (Default) Non-zero Wrap Rules 21 * 22 * @syscap SystemCapability.ArkUI.ArkUI.Full 23 * @since 8 24 */ 25/** 26 * Filling style algorithm, which determines whether a point is within or outside the path. The following 27 * two configurations are supported: 28 * "evenodd": odd and even round rule 29 * "nonzero": (Default) Non-zero Wrap Rules 30 * 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @since 9 33 * @form 34 */ 35/** 36 * Filling style algorithm, which determines whether a point is within or outside the path. The following 37 * two configurations are supported: 38 * "evenodd": odd and even round rule 39 * "nonzero": (Default) Non-zero Wrap Rules 40 * 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @crossplatform 43 * @since 10 44 * @form 45 */ 46declare type CanvasFillRule = "evenodd" | "nonzero"; 47 48/** 49 * Specifies the attribute of drawing the end of each line segment. The following configurations are supported: 50 * "butt": (Default) Segment Ends in Square 51 * "round": Segment ends in a circle 52 * "square": The end of the segment ends in a square, but a rectangular area is added that is the same width 53 * as the segment and is half the thickness of the segment. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @since 8 57 */ 58/** 59 * Specifies the attribute of drawing the end of each line segment. The following configurations are supported: 60 * "butt": (Default) Segment Ends in Square 61 * "round": Segment ends in a circle 62 * "square": The end of the segment ends in a square, but a rectangular area is added that is the same width 63 * as the segment and is half the thickness of the segment. 64 * 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @since 9 67 * @form 68 */ 69/** 70 * Specifies the attribute of drawing the end of each line segment. The following configurations are supported: 71 * "butt": (Default) Segment Ends in Square 72 * "round": Segment ends in a circle 73 * "square": The end of the segment ends in a square, but a rectangular area is added that is the same width 74 * as the segment and is half the thickness of the segment. 75 * 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @crossplatform 78 * @since 10 79 * @form 80 */ 81declare type CanvasLineCap = "butt" | "round" | "square"; 82 83/** 84 * Sets the attribute of how two connected parts (line segments, arcs, and curves) whose length is not 0 85 * are connected together. The following three configurations are supported: 86 * "bevel": Fill the ends of the connected sections with an additional triangle-base area, 87 * each with its own independent rectangular corner. 88 * "miter": (Default) An additional diamond region is formed by extending the outer edges of the connected portions 89 * so that they intersect at a point. 90 * "round": Draw the shape of the corner by filling in an additional sector with the center at the end of the 91 * connected section. The radius of the fillet is the width of the segment. 92 * 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @since 8 95 */ 96/** 97 * Sets the attribute of how two connected parts (line segments, arcs, and curves) whose length is not 0 98 * are connected together. The following three configurations are supported: 99 * "bevel": Fill the ends of the connected sections with an additional triangle-base area, 100 * each with its own independent rectangular corner. 101 * "miter": (Default) An additional diamond region is formed by extending the outer edges of the connected portions 102 * so that they intersect at a point. 103 * "round": Draw the shape of the corner by filling in an additional sector with the center at the end of the 104 * connected section. The radius of the fillet is the width of the segment. 105 * 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @since 9 108 * @form 109 */ 110/** 111 * Sets the attribute of how two connected parts (line segments, arcs, and curves) whose length is not 0 112 * are connected together. The following three configurations are supported: 113 * "bevel": Fill the ends of the connected sections with an additional triangle-base area, 114 * each with its own independent rectangular corner. 115 * "miter": (Default) An additional diamond region is formed by extending the outer edges of the connected portions 116 * so that they intersect at a point. 117 * "round": Draw the shape of the corner by filling in an additional sector with the center at the end of the 118 * connected section. The radius of the fillet is the width of the segment. 119 * 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @crossplatform 122 * @since 10 123 * @form 124 */ 125declare type CanvasLineJoin = "bevel" | "miter" | "round"; 126 127/** 128 * Indicates the attribute of the current text direction. The options are as follows: 129 * "inherit": (Default) Inherit current Canvas component settings 130 * "ltr": The text direction is left to right. 131 * "rtl": The text direction is from right to left. 132 * 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @since 8 135 */ 136/** 137 * Indicates the attribute of the current text direction. The options are as follows: 138 * "inherit": (Default) Inherit current Canvas component settings 139 * "ltr": The text direction is left to right. 140 * "rtl": The text direction is from right to left. 141 * 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 9 144 * @form 145 */ 146/** 147 * Indicates the attribute of the current text direction. The options are as follows: 148 * "inherit": (Default) Inherit current Canvas component settings 149 * "ltr": The text direction is left to right. 150 * "rtl": The text direction is from right to left. 151 * 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @crossplatform 154 * @since 10 155 * @form 156 */ 157declare type CanvasDirection = "inherit" | "ltr" | "rtl"; 158 159/** 160 * Describes the alignment mode for drawing text. The options are as follows: 161 * "center": The text is centered. 162 * "end": Where text aligns lines end (Left alignment refers to the local from left to right, 163 * and right alignment refers to the local from right to left) 164 * "left": The text is left-aligned. 165 * "right": The text is right-aligned. 166 * "start": (Default) Where the text snap line begins (Left alignment refers to the local from left to right, 167 * and right alignment refers to the local from right to left) 168 * 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @since 8 171 */ 172/** 173 * Describes the alignment mode for drawing text. The options are as follows: 174 * "center": The text is centered. 175 * "end": Where text aligns lines end (Left alignment refers to the local from left to right, 176 * and right alignment refers to the local from right to left) 177 * "left": The text is left-aligned. 178 * "right": The text is right-aligned. 179 * "start": (Default) Where the text snap line begins (Left alignment refers to the local from left to right, 180 * and right alignment refers to the local from right to left) 181 * 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @since 9 184 * @form 185 */ 186/** 187 * Describes the alignment mode for drawing text. The options are as follows: 188 * "center": The text is centered. 189 * "end": Where text aligns lines end (Left alignment refers to the local from left to right, 190 * and right alignment refers to the local from right to left) 191 * "left": The text is left-aligned. 192 * "right": The text is right-aligned. 193 * "start": (Default) Where the text snap line begins (Left alignment refers to the local from left to right, 194 * and right alignment refers to the local from right to left) 195 * 196 * @syscap SystemCapability.ArkUI.ArkUI.Full 197 * @crossplatform 198 * @since 10 199 * @form 200 */ 201declare type CanvasTextAlign = "center" | "end" | "left" | "right" | "start"; 202 203/** 204 * Text baseline, which supports the following configurations: 205 * "alphabetic": (Default) The text baseline is the standard letter baseline. 206 * "bottom": The text baseline is at the bottom of the text block. The difference between the ideographic baseline 207 * and the ideographic baseline is that the ideographic baseline does not need to consider downlink letters. 208 * "hanging": The text baseline is a hanging baseline. 209 * "ideographic": The text baseline is the ideographic baseline; If the character itself exceeds the alphabetic 210 * baseline, the ideographic baseline is at the bottom of the character itself. 211 * "middle": The text baseline is in the middle of the text block. 212 * "top": The text baseline is at the top of the text block. 213 * 214 * @syscap SystemCapability.ArkUI.ArkUI.Full 215 * @since 8 216 */ 217/** 218 * Text baseline, which supports the following configurations: 219 * "alphabetic": (Default) The text baseline is the standard letter baseline. 220 * "bottom": The text baseline is at the bottom of the text block. The difference between the ideographic baseline 221 * and the ideographic baseline is that the ideographic baseline does not need to consider downlink letters. 222 * "hanging": The text baseline is a hanging baseline. 223 * "ideographic": The text baseline is the ideographic baseline; If the character itself exceeds the alphabetic 224 * baseline, the ideographic baseline is at the bottom of the character itself. 225 * "middle": The text baseline is in the middle of the text block. 226 * "top": The text baseline is at the top of the text block. 227 * 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @since 9 230 * @form 231 */ 232/** 233 * Text baseline, which supports the following configurations: 234 * "alphabetic": (Default) The text baseline is the standard letter baseline. 235 * "bottom": The text baseline is at the bottom of the text block. The difference between the ideographic baseline 236 * and the ideographic baseline is that the ideographic baseline does not need to consider downlink letters. 237 * "hanging": The text baseline is a hanging baseline. 238 * "ideographic": The text baseline is the ideographic baseline; If the character itself exceeds the alphabetic 239 * baseline, the ideographic baseline is at the bottom of the character itself. 240 * "middle": The text baseline is in the middle of the text block. 241 * "top": The text baseline is at the top of the text block. 242 * 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @crossplatform 245 * @since 10 246 * @form 247 */ 248declare type CanvasTextBaseline = "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top"; 249 250/** 251 * Sets the image smoothness attribute. The options are as follows: 252 * "high": height 253 * "low": (default)low 254 * "medium": medium 255 * 256 * @syscap SystemCapability.ArkUI.ArkUI.Full 257 * @since 8 258 */ 259/** 260 * Sets the image smoothness attribute. The options are as follows: 261 * "high": height 262 * "low": (default)low 263 * "medium": medium 264 * 265 * @syscap SystemCapability.ArkUI.ArkUI.Full 266 * @since 9 267 * @form 268 */ 269/** 270 * Sets the image smoothness attribute. The options are as follows: 271 * "high": height 272 * "low": (default)low 273 * "medium": medium 274 * 275 * @syscap SystemCapability.ArkUI.ArkUI.Full 276 * @crossplatform 277 * @since 10 278 * @form 279 */ 280declare type ImageSmoothingQuality = "high" | "low" | "medium"; 281 282/** 283 * Opaque objects that describe gradients, created by createLinearGradient() or createRadialGradient() 284 * 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @since 8 287 */ 288/** 289 * Opaque objects that describe gradients, created by createLinearGradient() or createRadialGradient() 290 * 291 * @syscap SystemCapability.ArkUI.ArkUI.Full 292 * @since 9 293 * @form 294 */ 295/** 296 * Opaque objects that describe gradients, created by createLinearGradient() or createRadialGradient() 297 * 298 * @syscap SystemCapability.ArkUI.ArkUI.Full 299 * @crossplatform 300 * @since 10 301 * @form 302 */ 303declare class CanvasGradient { 304 /** 305 * Add a breakpoint defined by offset and color to the gradient 306 * 307 * @param { number } offset - Value between 0 and 1, out of range throws INDEX_SIZE_ERR error 308 * @param { string } color - CSS color value <color>. If the color value cannot be resolved to a valid CSS color value <color> 309 * a SYNTAX_ERR error is thrown. 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @since 8 312 */ 313 /** 314 * Add a breakpoint defined by offset and color to the gradient 315 * 316 * @param { number } offset - Value between 0 and 1, out of range throws INDEX_SIZE_ERR error 317 * @param { string } color - CSS color value <color>. If the color value cannot be resolved to a valid CSS color value <color> 318 * a SYNTAX_ERR error is thrown. 319 * @syscap SystemCapability.ArkUI.ArkUI.Full 320 * @since 9 321 * @form 322 */ 323 /** 324 * Add a breakpoint defined by offset and color to the gradient 325 * 326 * @param { number } offset - Value between 0 and 1, out of range throws INDEX_SIZE_ERR error 327 * @param { string } color - Set the gradient color. 328 * a SYNTAX_ERR error is thrown. 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @crossplatform 331 * @since 10 332 * @form 333 */ 334 addColorStop(offset: number, color: string): void; 335} 336 337/** 338 * Path object, which provides basic methods for drawing paths. 339 * 340 * @syscap SystemCapability.ArkUI.ArkUI.Full 341 * @since 8 342 */ 343/** 344 * Path object, which provides basic methods for drawing paths. 345 * 346 * @syscap SystemCapability.ArkUI.ArkUI.Full 347 * @since 9 348 * @form 349 */ 350/** 351 * Path object, which provides basic methods for drawing paths. 352 * 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @since 10 356 * @form 357 */ 358declare class CanvasPath { 359 /** 360 * Draw an arc path 361 * 362 * @param { number } x - The x-axis coordinate of the center (center of the circle) of the arc. 363 * @param { number } y - The y-axis coordinate of the center (center of the circle) of the arc. 364 * @param { number } radius - Radius of the arc. 365 * @param { number } startAngle - Start point of an arc, which starts to be calculated in the x-axis direction. The unit is radian. 366 * @param { number } endAngle - The end point of the arc, in radians. 367 * @param { boolean } counterclockwise - If the value is true, the arc is drawn counterclockwise. Otherwise, 368 * the arc is drawn clockwise. The default value is false. 369 * @syscap SystemCapability.ArkUI.ArkUI.Full 370 * @since 8 371 */ 372 /** 373 * Draw an arc path 374 * 375 * @param { number } x - The x-axis coordinate of the center (center of the circle) of the arc. 376 * @param { number } y - The y-axis coordinate of the center (center of the circle) of the arc. 377 * @param { number } radius - Radius of the arc. 378 * @param { number } startAngle - Start point of an arc, which starts to be calculated in the x-axis direction. The unit is radian. 379 * @param { number } endAngle - The end point of the arc, in radians. 380 * @param { boolean } counterclockwise - If the value is true, the arc is drawn counterclockwise. Otherwise, 381 * the arc is drawn clockwise. The default value is false. 382 * @syscap SystemCapability.ArkUI.ArkUI.Full 383 * @since 9 384 * @form 385 */ 386 /** 387 * Draw an arc path 388 * 389 * @param { number } x - The x-axis coordinate of the center (center of the circle) of the arc. 390 * @param { number } y - The y-axis coordinate of the center (center of the circle) of the arc. 391 * @param { number } radius - Radius of the arc. 392 * @param { number } startAngle - Start point of an arc, which starts to be calculated in the x-axis direction. The unit is radian. 393 * @param { number } endAngle - The end point of the arc, in radians. 394 * @param { boolean } counterclockwise - If the value is true, the arc is drawn counterclockwise. Otherwise, 395 * the arc is drawn clockwise. The default value is false. 396 * @syscap SystemCapability.ArkUI.ArkUI.Full 397 * @crossplatform 398 * @since 10 399 * @form 400 */ 401 arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; 402 403 /** 404 * Draw arc paths based on control points and radius 405 * 406 * @param { number } x1 - The x-axis coordinate of the first control point. 407 * @param { number } y1 - The y-axis coordinate of the first control point. 408 * @param { number } x2 - The x-axis coordinate of the second control point. 409 * @param { number } y2 - The y-axis coordinate of the second control point. 410 * @param { number } radius - Radius of the arc. 411 * @syscap SystemCapability.ArkUI.ArkUI.Full 412 * @since 8 413 */ 414 /** 415 * Draw arc paths based on control points and radius 416 * 417 * @param { number } x1 - The x-axis coordinate of the first control point. 418 * @param { number } y1 - The y-axis coordinate of the first control point. 419 * @param { number } x2 - The x-axis coordinate of the second control point. 420 * @param { number } y2 - The y-axis coordinate of the second control point. 421 * @param { number } radius - Radius of the arc. 422 * @syscap SystemCapability.ArkUI.ArkUI.Full 423 * @since 9 424 * @form 425 */ 426 /** 427 * Draw arc paths based on control points and radius 428 * 429 * @param { number } x1 - The x-axis coordinate of the first control point. 430 * @param { number } y1 - The y-axis coordinate of the first control point. 431 * @param { number } x2 - The x-axis coordinate of the second control point. 432 * @param { number } y2 - The y-axis coordinate of the second control point. 433 * @param { number } radius - Radius of the arc. 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @crossplatform 436 * @since 10 437 * @form 438 */ 439 arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; 440 441 /** 442 * Drawing Cubic Bessel Curve Paths 443 * 444 * @param { number } cp1x - The x-axis coordinate of the first control point. 445 * @param { number } cp1y - The y-axis coordinate of the first control point. 446 * @param { number } cp2x - The x-axis coordinate of the second control point. 447 * @param { number } cp2y - The y-axis coordinate of the second control point. 448 * @param { number } x - x-axis coordinate of the end point. 449 * @param { number } y - y-axis coordinate of the end point. 450 * @syscap SystemCapability.ArkUI.ArkUI.Full 451 * @since 8 452 */ 453 /** 454 * Drawing Cubic Bessel Curve Paths 455 * 456 * @param { number } cp1x - The x-axis coordinate of the first control point. 457 * @param { number } cp1y - The y-axis coordinate of the first control point. 458 * @param { number } cp2x - The x-axis coordinate of the second control point. 459 * @param { number } cp2y - The y-axis coordinate of the second control point. 460 * @param { number } x - x-axis coordinate of the end point. 461 * @param { number } y - y-axis coordinate of the end point. 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @since 9 464 * @form 465 */ 466 /** 467 * Drawing Cubic Bessel Curve Paths 468 * 469 * @param { number } cp1x - The x-axis coordinate of the first control point. 470 * @param { number } cp1y - The y-axis coordinate of the first control point. 471 * @param { number } cp2x - The x-axis coordinate of the second control point. 472 * @param { number } cp2y - The y-axis coordinate of the second control point. 473 * @param { number } x - x-axis coordinate of the end point. 474 * @param { number } y - y-axis coordinate of the end point. 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @since 10 478 * @form 479 */ 480 bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; 481 482 /** 483 * Returns the pen point to the start point of the current sub-path 484 * 485 * @syscap SystemCapability.ArkUI.ArkUI.Full 486 * @since 8 487 */ 488 /** 489 * Returns the pen point to the start point of the current sub-path 490 * 491 * @syscap SystemCapability.ArkUI.ArkUI.Full 492 * @since 9 493 * @form 494 */ 495 /** 496 * Returns the pen point to the start point of the current sub-path 497 * 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @crossplatform 500 * @since 10 501 * @form 502 */ 503 closePath(): void; 504 505 /** 506 * Draw an Elliptic Path 507 * 508 * @param { number } x - x-axis coordinate of the center of the ellipse. 509 * @param { number } y - y-axis coordinate of the center of the ellipse. 510 * @param { number } radiusX - Radius of the major axis of the ellipse. 511 * @param { number } radiusY - Radius of the minor axis of the ellipse. 512 * @param { number } rotation - The rotation angle of the ellipse, in radians (not angular degrees). 513 * @param { number } startAngle - The angle of the starting point to be drawn, measured from the x-axis in radians 514 * (not angular degrees). 515 * @param { number } endAngle - The angle, in radians, at which the ellipse is to be drawn (not angular degrees). 516 * @param { boolean } counterclockwise - If the value is true, the ellipse is drawn counterclockwise. Otherwise, 517 * the ellipse is drawn clockwise. The default value is false. 518 * @syscap SystemCapability.ArkUI.ArkUI.Full 519 * @since 8 520 */ 521 /** 522 * Draw an Elliptic Path 523 * 524 * @param { number } x - x-axis coordinate of the center of the ellipse. 525 * @param { number } y - y-axis coordinate of the center of the ellipse. 526 * @param { number } radiusX - Radius of the major axis of the ellipse. 527 * @param { number } radiusY - Radius of the minor axis of the ellipse. 528 * @param { number } rotation - The rotation angle of the ellipse, in radians (not angular degrees). 529 * @param { number } startAngle - The angle of the starting point to be drawn, measured from the x-axis in radians 530 * (not angular degrees). 531 * @param { number } endAngle - The angle, in radians, at which the ellipse is to be drawn (not angular degrees). 532 * @param { boolean } counterclockwise - If the value is true, the ellipse is drawn counterclockwise. Otherwise, 533 * the ellipse is drawn clockwise. The default value is false. 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @since 9 536 * @form 537 */ 538 /** 539 * Draw an Elliptic Path 540 * 541 * @param { number } x - x-axis coordinate of the center of the ellipse. 542 * @param { number } y - y-axis coordinate of the center of the ellipse. 543 * @param { number } radiusX - Radius of the major axis of the ellipse. 544 * @param { number } radiusY - Radius of the minor axis of the ellipse. 545 * @param { number } rotation - The rotation angle of the ellipse, in radians (not angular degrees). 546 * @param { number } startAngle - The angle of the starting point to be drawn, measured from the x-axis in radians 547 * (not angular degrees). 548 * @param { number } endAngle - The angle, in radians, at which the ellipse is to be drawn (not angular degrees). 549 * @param { boolean } counterclockwise - If the value is true, the ellipse is drawn counterclockwise. Otherwise, 550 * the ellipse is drawn clockwise. The default value is false. 551 * @syscap SystemCapability.ArkUI.ArkUI.Full 552 * @crossplatform 553 * @since 10 554 * @form 555 */ 556 ellipse( 557 x: number, 558 y: number, 559 radiusX: number, 560 radiusY: number, 561 rotation: number, 562 startAngle: number, 563 endAngle: number, 564 counterclockwise?: boolean, 565 ): void; 566 567 /** 568 * Connect sub-path using straight lines 569 * 570 * @param { number } x - The x-axis coordinate of the end point of the line. 571 * @param { number } y - The y-axis coordinate of the end point of the line. 572 * @syscap SystemCapability.ArkUI.ArkUI.Full 573 * @since 8 574 */ 575 /** 576 * Connect sub-path using straight lines 577 * 578 * @param { number } x - The x-axis coordinate of the end point of the line. 579 * @param { number } y - The y-axis coordinate of the end point of the line. 580 * @syscap SystemCapability.ArkUI.ArkUI.Full 581 * @since 9 582 * @form 583 */ 584 /** 585 * Connect sub-path using straight lines 586 * 587 * @param { number } x - The x-axis coordinate of the end point of the line. 588 * @param { number } y - The y-axis coordinate of the end point of the line. 589 * @syscap SystemCapability.ArkUI.ArkUI.Full 590 * @crossplatform 591 * @since 10 592 * @form 593 */ 594 lineTo(x: number, y: number): void; 595 596 /** 597 * Moves the start point of a new sub-path to the (x, y) coordinate. 598 * 599 * @param { number } x - The x-axis coordinate of the point. 600 * @param { number } y - The y-axis coordinate of the point. 601 * @syscap SystemCapability.ArkUI.ArkUI.Full 602 * @since 8 603 */ 604 /** 605 * Moves the start point of a new sub-path to the (x, y) coordinate. 606 * 607 * @param { number } x - The x-axis coordinate of the point. 608 * @param { number } y - The y-axis coordinate of the point. 609 * @syscap SystemCapability.ArkUI.ArkUI.Full 610 * @since 9 611 * @form 612 */ 613 /** 614 * Moves the start point of a new sub-path to the (x, y) coordinate. 615 * 616 * @param { number } x - The x-axis coordinate of the point. 617 * @param { number } y - The y-axis coordinate of the point. 618 * @syscap SystemCapability.ArkUI.ArkUI.Full 619 * @crossplatform 620 * @since 10 621 * @form 622 */ 623 moveTo(x: number, y: number): void; 624 625 /** 626 * Draw quadratic Bezier curve paths 627 * 628 * @param { number } cpx - The x-axis coordinate of the control point. 629 * @param { number } cpy - The y-axis coordinate of the control point. 630 * @param { number } x - x-axis coordinate of the end point. 631 * @param { number } y - y-axis coordinate of the end point. 632 * @syscap SystemCapability.ArkUI.ArkUI.Full 633 * @since 8 634 */ 635 /** 636 * Draw quadratic Bezier curve paths 637 * 638 * @param { number } cpx - The x-axis coordinate of the control point. 639 * @param { number } cpy - The y-axis coordinate of the control point. 640 * @param { number } x - x-axis coordinate of the end point. 641 * @param { number } y - y-axis coordinate of the end point. 642 * @syscap SystemCapability.ArkUI.ArkUI.Full 643 * @since 9 644 * @form 645 */ 646 /** 647 * Draw quadratic Bezier curve paths 648 * 649 * @param { number } cpx - The x-axis coordinate of the control point. 650 * @param { number } cpy - The y-axis coordinate of the control point. 651 * @param { number } x - x-axis coordinate of the end point. 652 * @param { number } y - y-axis coordinate of the end point. 653 * @syscap SystemCapability.ArkUI.ArkUI.Full 654 * @crossplatform 655 * @since 10 656 * @form 657 */ 658 quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; 659 660 /** 661 * Draw Rectangular Paths 662 * 663 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 664 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 665 * @param { number } w - Width of the rectangle. 666 * @param { number } h - Height of the rectangle. 667 * @syscap SystemCapability.ArkUI.ArkUI.Full 668 * @since 8 669 */ 670 /** 671 * Draw Rectangular Paths 672 * 673 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 674 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 675 * @param { number } w - Width of the rectangle. 676 * @param { number } h - Height of the rectangle. 677 * @syscap SystemCapability.ArkUI.ArkUI.Full 678 * @since 9 679 * @form 680 */ 681 /** 682 * Draw Rectangular Paths 683 * 684 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 685 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 686 * @param { number } w - Width of the rectangle. 687 * @param { number } h - Height of the rectangle. 688 * @syscap SystemCapability.ArkUI.ArkUI.Full 689 * @crossplatform 690 * @since 10 691 * @form 692 */ 693 rect(x: number, y: number, w: number, h: number): void; 694} 695 696/** 697 * 2D path object for path drawing 698 * 699 * @extends CanvasPath 700 * @syscap SystemCapability.ArkUI.ArkUI.Full 701 * @since 8 702 */ 703/** 704 * 2D path object for path drawing 705 * 706 * @extends CanvasPath 707 * @syscap SystemCapability.ArkUI.ArkUI.Full 708 * @since 9 709 * @form 710 */ 711/** 712 * 2D path object for path drawing 713 * 714 * @extends CanvasPath 715 * @syscap SystemCapability.ArkUI.ArkUI.Full 716 * @crossplatform 717 * @since 10 718 * @form 719 */ 720declare class Path2D extends CanvasPath { 721 /** 722 * Adds a path according to the specified path variable. 723 * 724 * @param { Path2D } path - Indicates the path object to be added. 725 * @param { Matrix2D } transform - Transformation matrix of the new trail 726 * @syscap SystemCapability.ArkUI.ArkUI.Full 727 * @since 8 728 */ 729 /** 730 * Adds a path according to the specified path variable. 731 * 732 * @param { Path2D } path - Indicates the path object to be added. 733 * @param { Matrix2D } transform - Transformation matrix of the new trail 734 * @syscap SystemCapability.ArkUI.ArkUI.Full 735 * @since 9 736 * @form 737 */ 738 /** 739 * Adds a path according to the specified path variable. 740 * 741 * @param { Path2D } path - Indicates the path object to be added. 742 * @param { Matrix2D } transform - Transformation matrix of the new trail 743 * @syscap SystemCapability.ArkUI.ArkUI.Full 744 * @crossplatform 745 * @since 10 746 * @form 747 */ 748 addPath(path: Path2D, transform?: Matrix2D): void; 749 750 /** 751 * Create an empty path object. 752 * 753 * @syscap SystemCapability.ArkUI.ArkUI.Full 754 * @since 8 755 */ 756 /** 757 * Create an empty path object. 758 * 759 * @syscap SystemCapability.ArkUI.ArkUI.Full 760 * @since 9 761 * @form 762 */ 763 /** 764 * Create an empty path object. 765 * 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @crossplatform 768 * @since 10 769 * @form 770 */ 771 constructor(); 772 773 /** 774 * Create a copy of a path object 775 * 776 * @param { Path2D } path - Path object to be copied 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @since 8 779 */ 780 /** 781 * Create a copy of a path object 782 * 783 * @param { Path2D } path - Path object to be copied 784 * @syscap SystemCapability.ArkUI.ArkUI.Full 785 * @since 9 786 * @form 787 */ 788 /** 789 * Create a copy of a path object 790 * 791 * @param { Path2D } path - Path object to be copied 792 * @syscap SystemCapability.ArkUI.ArkUI.Full 793 * @crossplatform 794 * @since 10 795 * @form 796 */ 797 constructor(path: Path2D); 798 799 /** 800 * Create a new path according to the description. 801 * 802 * @param { string } d - Indicates the path string that compiles with the SVG path description specifications. 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @since 8 805 */ 806 /** 807 * Create a new path according to the description. 808 * 809 * @param { string } d - Indicates the path string that compiles with the SVG path description specifications. 810 * @syscap SystemCapability.ArkUI.ArkUI.Full 811 * @since 9 812 * @form 813 */ 814 /** 815 * Create a new path according to the description. 816 * 817 * @param { string } d - Indicates the path string that compiles with the SVG path description specifications. 818 * @syscap SystemCapability.ArkUI.ArkUI.Full 819 * @crossplatform 820 * @since 10 821 * @form 822 */ 823 constructor(d: string); 824} 825 826/** 827 * Describes an opaque object of a template, which is created using the createPattern() method. 828 * 829 * @interface CanvasPattern 830 * @syscap SystemCapability.ArkUI.ArkUI.Full 831 * @since 8 832 */ 833/** 834 * Describes an opaque object of a template, which is created using the createPattern() method. 835 * 836 * @interface CanvasPattern 837 * @syscap SystemCapability.ArkUI.ArkUI.Full 838 * @since 9 839 * @form 840 */ 841/** 842 * Describes an opaque object of a template, which is created using the createPattern() method. 843 * 844 * @interface CanvasPattern 845 * @syscap SystemCapability.ArkUI.ArkUI.Full 846 * @crossplatform 847 * @since 10 848 * @form 849 */ 850declare interface CanvasPattern { 851 /** 852 * Adds the matrix transformation effect to the current template. 853 * 854 * @param { Matrix2D } transform - transformation matrix 855 * @syscap SystemCapability.ArkUI.ArkUI.Full 856 * @since 8 857 */ 858 /** 859 * Adds the matrix transformation effect to the current template. 860 * 861 * @param { Matrix2D } transform - transformation matrix 862 * @syscap SystemCapability.ArkUI.ArkUI.Full 863 * @since 9 864 * @form 865 */ 866 /** 867 * Adds the matrix transformation effect to the current template. 868 * 869 * @param { Matrix2D } transform - transformation matrix 870 * @syscap SystemCapability.ArkUI.ArkUI.Full 871 * @crossplatform 872 * @since 10 873 * @form 874 */ 875 setTransform(transform?: Matrix2D): void; 876} 877 878/** 879 * Size information of the text 880 * 881 * @interface TextMetrics 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @since 8 884 */ 885/** 886 * Size information of the text 887 * 888 * @interface TextMetrics 889 * @syscap SystemCapability.ArkUI.ArkUI.Full 890 * @since 9 891 * @form 892 */ 893/** 894 * Size information of the text 895 * 896 * @interface TextMetrics 897 * @syscap SystemCapability.ArkUI.ArkUI.Full 898 * @crossplatform 899 * @since 10 900 * @form 901 */ 902declare interface TextMetrics { 903 /** 904 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of 905 * the rectangular boundary of the rendered text. 906 * 907 * @type { number } 908 * @syscap SystemCapability.ArkUI.ArkUI.Full 909 * @since 8 910 */ 911 /** 912 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of 913 * the rectangular boundary of the rendered text. 914 * 915 * @type { number } 916 * @syscap SystemCapability.ArkUI.ArkUI.Full 917 * @since 9 918 * @form 919 */ 920 /** 921 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of 922 * the rectangular boundary of the rendered text. 923 * 924 * @type { number } 925 * @syscap SystemCapability.ArkUI.ArkUI.Full 926 * @crossplatform 927 * @since 10 928 * @form 929 */ 930 readonly actualBoundingBoxAscent: number; 931 932 /** 933 * Double, the distance from the horizontal line indicated by the textBaseline property to the bottom of 934 * the rectangular boundary of the rendered text. 935 * 936 * @type { number } 937 * @syscap SystemCapability.ArkUI.ArkUI.Full 938 * @since 8 939 */ 940 /** 941 * Double, the distance from the horizontal line indicated by the textBaseline property to the bottom of 942 * the rectangular boundary of the rendered text. 943 * 944 * @type { number } 945 * @syscap SystemCapability.ArkUI.ArkUI.Full 946 * @since 9 947 * @form 948 */ 949 /** 950 * Double, the distance from the horizontal line indicated by the textBaseline property to the bottom of 951 * the rectangular boundary of the rendered text. 952 * 953 * @type { number } 954 * @syscap SystemCapability.ArkUI.ArkUI.Full 955 * @crossplatform 956 * @since 10 957 * @form 958 */ 959 readonly actualBoundingBoxDescent: number; 960 961 /** 962 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 963 * the left of the text rectangle boundary. 964 * 965 * @type { number } 966 * @syscap SystemCapability.ArkUI.ArkUI.Full 967 * @since 8 968 */ 969 /** 970 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 971 * the left of the text rectangle boundary. 972 * 973 * @type { number } 974 * @syscap SystemCapability.ArkUI.ArkUI.Full 975 * @since 9 976 * @form 977 */ 978 /** 979 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 980 * the left of the text rectangle boundary. 981 * 982 * @type { number } 983 * @syscap SystemCapability.ArkUI.ArkUI.Full 984 * @crossplatform 985 * @since 10 986 * @form 987 */ 988 readonly actualBoundingBoxLeft: number; 989 990 /** 991 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 992 * the right of the text rectangle boundary. 993 * 994 * @type { number } 995 * @syscap SystemCapability.ArkUI.ArkUI.Full 996 * @since 8 997 */ 998 /** 999 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 1000 * the right of the text rectangle boundary. 1001 * 1002 * @type { number } 1003 * @syscap SystemCapability.ArkUI.ArkUI.Full 1004 * @since 9 1005 * @form 1006 */ 1007 /** 1008 * Double, parallel to the baseline, distance from the alignment point determined by the textAlign property to 1009 * the right of the text rectangle boundary. 1010 * 1011 * @type { number } 1012 * @syscap SystemCapability.ArkUI.ArkUI.Full 1013 * @crossplatform 1014 * @since 10 1015 * @form 1016 */ 1017 readonly actualBoundingBoxRight: number; 1018 1019 /** 1020 * Double, the distance from the horizontal line indicated by the textBaseline property to the alphabetic baseline of 1021 * the wireframe. 1022 * 1023 * @type { number } 1024 * @syscap SystemCapability.ArkUI.ArkUI.Full 1025 * @since 8 1026 */ 1027 /** 1028 * Double, the distance from the horizontal line indicated by the textBaseline property to the alphabetic baseline of 1029 * the wireframe. 1030 * 1031 * @type { number } 1032 * @syscap SystemCapability.ArkUI.ArkUI.Full 1033 * @since 9 1034 * @form 1035 */ 1036 /** 1037 * Double, the distance from the horizontal line indicated by the textBaseline property to the alphabetic baseline of 1038 * the wireframe. 1039 * 1040 * @type { number } 1041 * @syscap SystemCapability.ArkUI.ArkUI.Full 1042 * @crossplatform 1043 * @since 10 1044 * @form 1045 */ 1046 readonly alphabeticBaseline: number; 1047 1048 /** 1049 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of the 1050 * em square in the wireframe. 1051 * 1052 * @type { number } 1053 * @syscap SystemCapability.ArkUI.ArkUI.Full 1054 * @since 8 1055 */ 1056 /** 1057 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of the 1058 * em square in the wireframe. 1059 * 1060 * @type { number } 1061 * @syscap SystemCapability.ArkUI.ArkUI.Full 1062 * @since 9 1063 * @form 1064 */ 1065 /** 1066 * Double, the distance from the horizontal line indicated by the textBaseline property to the top of the 1067 * em square in the wireframe. 1068 * 1069 * @type { number } 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @since 10 1073 * @form 1074 */ 1075 readonly emHeightAscent: number; 1076 1077 /** 1078 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1079 * em box in the wireframe. 1080 * 1081 * @type { number } 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @since 8 1084 */ 1085 /** 1086 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1087 * em box in the wireframe. 1088 * 1089 * @type { number } 1090 * @syscap SystemCapability.ArkUI.ArkUI.Full 1091 * @since 9 1092 * @form 1093 */ 1094 /** 1095 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1096 * em box in the wireframe. 1097 * 1098 * @type { number } 1099 * @syscap SystemCapability.ArkUI.ArkUI.Full 1100 * @crossplatform 1101 * @since 10 1102 * @form 1103 */ 1104 readonly emHeightDescent: number; 1105 1106 /** 1107 * Double, distance from the horizontal line indicated by the textBaseline property to the top of the 1108 * highest rectangle boundary of all fonts rendering text. 1109 * 1110 * @type { number } 1111 * @syscap SystemCapability.ArkUI.ArkUI.Full 1112 * @since 8 1113 */ 1114 /** 1115 * Double, distance from the horizontal line indicated by the textBaseline property to the top of the 1116 * highest rectangle boundary of all fonts rendering text. 1117 * 1118 * @type { number } 1119 * @syscap SystemCapability.ArkUI.ArkUI.Full 1120 * @since 9 1121 * @form 1122 */ 1123 /** 1124 * Double, distance from the horizontal line indicated by the textBaseline property to the top of the 1125 * highest rectangle boundary of all fonts rendering text. 1126 * 1127 * @type { number } 1128 * @syscap SystemCapability.ArkUI.ArkUI.Full 1129 * @crossplatform 1130 * @since 10 1131 * @form 1132 */ 1133 readonly fontBoundingBoxAscent: number; 1134 1135 /** 1136 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1137 * rectangular boundary of all fonts rendering text. 1138 * 1139 * @type { number } 1140 * @syscap SystemCapability.ArkUI.ArkUI.Full 1141 * @since 8 1142 */ 1143 /** 1144 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1145 * rectangular boundary of all fonts rendering text. 1146 * 1147 * @type { number } 1148 * @syscap SystemCapability.ArkUI.ArkUI.Full 1149 * @since 9 1150 * @form 1151 */ 1152 /** 1153 * Double, distance from the horizontal line indicated by the textBaseline property to the bottom of the 1154 * rectangular boundary of all fonts rendering text. 1155 * 1156 * @type { number } 1157 * @syscap SystemCapability.ArkUI.ArkUI.Full 1158 * @crossplatform 1159 * @since 10 1160 * @form 1161 */ 1162 readonly fontBoundingBoxDescent: number; 1163 1164 /** 1165 * Double, distance from the horizontal line indicated by the textBaseline property to 1166 * the hanging baseline of the wireframe. 1167 * 1168 * @type { number } 1169 * @syscap SystemCapability.ArkUI.ArkUI.Full 1170 * @since 8 1171 */ 1172 /** 1173 * Double, distance from the horizontal line indicated by the textBaseline property to 1174 * the hanging baseline of the wireframe. 1175 * 1176 * @type { number } 1177 * @syscap SystemCapability.ArkUI.ArkUI.Full 1178 * @since 9 1179 * @form 1180 */ 1181 /** 1182 * Double, distance from the horizontal line indicated by the textBaseline property to 1183 * the hanging baseline of the wireframe. 1184 * 1185 * @type { number } 1186 * @syscap SystemCapability.ArkUI.ArkUI.Full 1187 * @crossplatform 1188 * @since 10 1189 * @form 1190 */ 1191 readonly hangingBaseline: number; 1192 1193 /** 1194 * Double, distance from the horizontal line indicated by the textBaseline property to 1195 * the ideographic baseline of the wireframe. 1196 * 1197 * @type { number } 1198 * @syscap SystemCapability.ArkUI.ArkUI.Full 1199 * @since 8 1200 */ 1201 /** 1202 * Double, distance from the horizontal line indicated by the textBaseline property to 1203 * the ideographic baseline of the wireframe. 1204 * 1205 * @type { number } 1206 * @syscap SystemCapability.ArkUI.ArkUI.Full 1207 * @since 9 1208 * @form 1209 */ 1210 /** 1211 * Double, distance from the horizontal line indicated by the textBaseline property to 1212 * the ideographic baseline of the wireframe. 1213 * 1214 * @type { number } 1215 * @syscap SystemCapability.ArkUI.ArkUI.Full 1216 * @crossplatform 1217 * @since 10 1218 * @form 1219 */ 1220 readonly ideographicBaseline: number; 1221 1222 /** 1223 * Indicates the width of a character string. The value is of the double type. 1224 * 1225 * @type { number } 1226 * @syscap SystemCapability.ArkUI.ArkUI.Full 1227 * @since 8 1228 */ 1229 /** 1230 * Indicates the width of a character string. The value is of the double type. 1231 * 1232 * @type { number } 1233 * @syscap SystemCapability.ArkUI.ArkUI.Full 1234 * @since 9 1235 * @form 1236 */ 1237 /** 1238 * Indicates the width of a character string. The value is of the double type. 1239 * 1240 * @type { number } 1241 * @syscap SystemCapability.ArkUI.ArkUI.Full 1242 * @crossplatform 1243 * @since 10 1244 * @form 1245 */ 1246 readonly width: number; 1247 1248 /** 1249 * Indicates the height of a character string. The value is of the double type. 1250 * 1251 * @type { number } 1252 * @syscap SystemCapability.ArkUI.ArkUI.Full 1253 * @since 8 1254 */ 1255 /** 1256 * Indicates the height of a character string. The value is of the double type. 1257 * 1258 * @type { number } 1259 * @syscap SystemCapability.ArkUI.ArkUI.Full 1260 * @since 9 1261 * @form 1262 */ 1263 /** 1264 * Indicates the height of a character string. The value is of the double type. 1265 * 1266 * @type { number } 1267 * @syscap SystemCapability.ArkUI.ArkUI.Full 1268 * @crossplatform 1269 * @since 10 1270 * @form 1271 */ 1272 readonly height: number; 1273} 1274 1275/** 1276 * Bitmap image object that can be drawn onto the current Canvas 1277 * 1278 * @syscap SystemCapability.ArkUI.ArkUI.Full 1279 * @since 8 1280 */ 1281/** 1282 * Bitmap image object that can be drawn onto the current Canvas 1283 * 1284 * @syscap SystemCapability.ArkUI.ArkUI.Full 1285 * @since 9 1286 * @form 1287 */ 1288/** 1289 * Bitmap image object that can be drawn onto the current Canvas 1290 * 1291 * @syscap SystemCapability.ArkUI.ArkUI.Full 1292 * @crossplatform 1293 * @since 10 1294 * @form 1295 */ 1296declare class ImageBitmap { 1297 /** 1298 * Indicates the height of the CSS pixel unit of ImageData. 1299 * 1300 * @type { number } 1301 * @syscap SystemCapability.ArkUI.ArkUI.Full 1302 * @since 8 1303 */ 1304 /** 1305 * Indicates the height of the CSS pixel unit of ImageData. 1306 * 1307 * @type { number } 1308 * @syscap SystemCapability.ArkUI.ArkUI.Full 1309 * @since 9 1310 * @form 1311 */ 1312 /** 1313 * Indicates the height of the CSS pixel unit of ImageData. 1314 * 1315 * @type { number } 1316 * @syscap SystemCapability.ArkUI.ArkUI.Full 1317 * @crossplatform 1318 * @since 10 1319 * @form 1320 */ 1321 readonly height: number; 1322 1323 /** 1324 * Indicates the width of the CSS pixel unit of ImageData. 1325 * 1326 * @type { number } 1327 * @syscap SystemCapability.ArkUI.ArkUI.Full 1328 * @since 8 1329 */ 1330 /** 1331 * Indicates the width of the CSS pixel unit of ImageData. 1332 * 1333 * @type { number } 1334 * @syscap SystemCapability.ArkUI.ArkUI.Full 1335 * @since 9 1336 * @form 1337 */ 1338 /** 1339 * Indicates the width of the CSS pixel unit of ImageData. 1340 * 1341 * @type { number } 1342 * @syscap SystemCapability.ArkUI.ArkUI.Full 1343 * @crossplatform 1344 * @since 10 1345 * @form 1346 */ 1347 readonly width: number; 1348 1349 /** 1350 * Releases all graphics resources associated with an ImageBitmap. 1351 * 1352 * @syscap SystemCapability.ArkUI.ArkUI.Full 1353 * @since 8 1354 */ 1355 /** 1356 * Releases all graphics resources associated with an ImageBitmap. 1357 * 1358 * @syscap SystemCapability.ArkUI.ArkUI.Full 1359 * @since 9 1360 * @form 1361 */ 1362 /** 1363 * Releases all graphics resources associated with an ImageBitmap. 1364 * 1365 * @syscap SystemCapability.ArkUI.ArkUI.Full 1366 * @crossplatform 1367 * @since 10 1368 * @form 1369 */ 1370 close(): void; 1371 1372 /** 1373 * Create an ImageBitmap object based on the transferred image path. 1374 * 1375 * @param { string } src - Path of the image object. 1376 * @syscap SystemCapability.ArkUI.ArkUI.Full 1377 * @since 8 1378 */ 1379 /** 1380 * Create an ImageBitmap object based on the transferred image path. 1381 * 1382 * @param { string } src - Path of the image object. 1383 * @syscap SystemCapability.ArkUI.ArkUI.Full 1384 * @since 9 1385 * @form 1386 */ 1387 /** 1388 * Create an ImageBitmap object based on the transferred image path. 1389 * 1390 * @param { string } src - Path of the image object. 1391 * @syscap SystemCapability.ArkUI.ArkUI.Full 1392 * @crossplatform 1393 * @since 10 1394 * @form 1395 */ 1396 constructor(src: string); 1397 1398 /** 1399 * Transfer a PixelMap object to construct an ImageBitmap object. 1400 * 1401 * @param { PixelMap } data - PixelMap object 1402 * @syscap SystemCapability.ArkUI.ArkUI.Full 1403 * @since 8 1404 */ 1405 /** 1406 * Transfer a PixelMap object to construct an ImageBitmap object. 1407 * 1408 * @param { PixelMap } data - PixelMap object 1409 * @syscap SystemCapability.ArkUI.ArkUI.Full 1410 * @crossplatform 1411 * @since 10 1412 */ 1413 constructor(data: PixelMap); 1414} 1415 1416/** 1417 * Image data object 1418 * 1419 * @syscap SystemCapability.ArkUI.ArkUI.Full 1420 * @since 8 1421 */ 1422/** 1423 * Image data object 1424 * 1425 * @syscap SystemCapability.ArkUI.ArkUI.Full 1426 * @since 9 1427 * @form 1428 */ 1429/** 1430 * Image data object 1431 * 1432 * @syscap SystemCapability.ArkUI.ArkUI.Full 1433 * @crossplatform 1434 * @since 10 1435 * @form 1436 */ 1437declare class ImageData { 1438 /** 1439 * Array containing image pixel data 1440 * 1441 * @type { Uint8ClampedArray } 1442 * @syscap SystemCapability.ArkUI.ArkUI.Full 1443 * @since 8 1444 */ 1445 /** 1446 * Array containing image pixel data 1447 * 1448 * @type { Uint8ClampedArray } 1449 * @syscap SystemCapability.ArkUI.ArkUI.Full 1450 * @since 9 1451 * @form 1452 */ 1453 /** 1454 * Array containing image pixel data 1455 * 1456 * @type { Uint8ClampedArray } 1457 * @syscap SystemCapability.ArkUI.ArkUI.Full 1458 * @crossplatform 1459 * @since 10 1460 * @form 1461 */ 1462 readonly data: Uint8ClampedArray; 1463 1464 /** 1465 * Width of the image. 1466 * 1467 * @type { number } 1468 * @syscap SystemCapability.ArkUI.ArkUI.Full 1469 * @since 8 1470 */ 1471 /** 1472 * Width of the image. 1473 * 1474 * @type { number } 1475 * @syscap SystemCapability.ArkUI.ArkUI.Full 1476 * @since 9 1477 * @form 1478 */ 1479 /** 1480 * Width of the image. 1481 * 1482 * @type { number } 1483 * @syscap SystemCapability.ArkUI.ArkUI.Full 1484 * @crossplatform 1485 * @since 10 1486 * @form 1487 */ 1488 readonly height: number; 1489 1490 /** 1491 * Height of the image. 1492 * 1493 * @type { number } 1494 * @syscap SystemCapability.ArkUI.ArkUI.Full 1495 * @since 8 1496 */ 1497 /** 1498 * Height of the image. 1499 * 1500 * @type { number } 1501 * @syscap SystemCapability.ArkUI.ArkUI.Full 1502 * @since 9 1503 * @form 1504 */ 1505 /** 1506 * Height of the image. 1507 * 1508 * @type { number } 1509 * @syscap SystemCapability.ArkUI.ArkUI.Full 1510 * @crossplatform 1511 * @since 10 1512 * @form 1513 */ 1514 readonly width: number; 1515 1516 /** 1517 * Create an ImageData object based on the input parameters. 1518 * 1519 * @param { number } width - Width of the image. 1520 * @param { number } height - Height of the image. 1521 * @param { Uint8ClampedArray } data - Data of the image. If this parameter is not specified, the default value is a black rectangular image. 1522 * @syscap SystemCapability.ArkUI.ArkUI.Full 1523 * @since 8 1524 */ 1525 /** 1526 * Create an ImageData object based on the input parameters. 1527 * 1528 * @param { number } width - Width of the image. 1529 * @param { number } height - Height of the image. 1530 * @param { Uint8ClampedArray } data - Data of the image. If this parameter is not specified, the default value is a black rectangular image. 1531 * @syscap SystemCapability.ArkUI.ArkUI.Full 1532 * @since 9 1533 * @form 1534 */ 1535 /** 1536 * Create an ImageData object based on the input parameters. 1537 * 1538 * @param { number } width - Width of the image. 1539 * @param { number } height - Height of the image. 1540 * @param { Uint8ClampedArray } data - Data of the image. If this parameter is not specified, the default value is a black rectangular image. 1541 * @syscap SystemCapability.ArkUI.ArkUI.Full 1542 * @crossplatform 1543 * @since 10 1544 * @form 1545 */ 1546 constructor(width: number, height: number, data?: Uint8ClampedArray); 1547} 1548 1549/** 1550 * This object allows you to set properties when creating a rendering context 1551 * 1552 * @syscap SystemCapability.ArkUI.ArkUI.Full 1553 * @since 8 1554 */ 1555/** 1556 * This object allows you to set properties when creating a rendering context 1557 * 1558 * @syscap SystemCapability.ArkUI.ArkUI.Full 1559 * @since 9 1560 * @form 1561 */ 1562/** 1563 * This object allows you to set properties when creating a rendering context 1564 * 1565 * @syscap SystemCapability.ArkUI.ArkUI.Full 1566 * @crossplatform 1567 * @since 10 1568 * @form 1569 */ 1570declare class RenderingContextSettings { 1571 /** 1572 * Indicates whether anti-aliasing is enabled for canvas. The default value is false. 1573 * 1574 * @type { ?boolean } 1575 * @syscap SystemCapability.ArkUI.ArkUI.Full 1576 * @since 8 1577 */ 1578 /** 1579 * Indicates whether anti-aliasing is enabled for canvas. The default value is false. 1580 * 1581 * @type { ?boolean } 1582 * @syscap SystemCapability.ArkUI.ArkUI.Full 1583 * @since 9 1584 * @form 1585 */ 1586 /** 1587 * Indicates whether anti-aliasing is enabled for canvas. The default value is false. 1588 * 1589 * @type { ?boolean } 1590 * @syscap SystemCapability.ArkUI.ArkUI.Full 1591 * @crossplatform 1592 * @since 10 1593 * @form 1594 */ 1595 antialias?: boolean; 1596 1597 /** 1598 * Create an RenderingContextSettings object based on the antialias and alpha. 1599 * 1600 * @param { boolean } antialias - Indicates whether anti-aliasing is enabled for canvas 1601 * @syscap SystemCapability.ArkUI.ArkUI.Full 1602 * @since 8 1603 */ 1604 /** 1605 * Create an RenderingContextSettings object based on the antialias and alpha. 1606 * 1607 * @param { boolean } antialias - Indicates whether anti-aliasing is enabled for canvas 1608 * @syscap SystemCapability.ArkUI.ArkUI.Full 1609 * @since 9 1610 * @form 1611 */ 1612 /** 1613 * Create an RenderingContextSettings object based on the antialias and alpha. 1614 * 1615 * @param { boolean } antialias - Indicates whether anti-aliasing is enabled for canvas 1616 * @syscap SystemCapability.ArkUI.ArkUI.Full 1617 * @crossplatform 1618 * @since 10 1619 * @form 1620 */ 1621 constructor(antialias?: boolean); 1622} 1623 1624/** 1625 * Canvas renderer for drawing shapes, text, images and other objects 1626 * 1627 * @extends CanvasPath 1628 * @syscap SystemCapability.ArkUI.ArkUI.Full 1629 * @since 8 1630 */ 1631/** 1632 * Canvas renderer for drawing shapes, text, images and other objects 1633 * 1634 * @extends CanvasPath 1635 * @syscap SystemCapability.ArkUI.ArkUI.Full 1636 * @since 9 1637 * @form 1638 */ 1639/** 1640 * Canvas renderer for drawing shapes, text, images and other objects 1641 * 1642 * @extends CanvasPath 1643 * @syscap SystemCapability.ArkUI.ArkUI.Full 1644 * @crossplatform 1645 * @since 10 1646 * @form 1647 */ 1648declare class CanvasRenderer extends CanvasPath { 1649 /** 1650 * Transparency. The value ranges from 0.0 (completely transparent) to 1.0 (completely opaque). 1651 * The default value is 1.0. If the value is out of range, the assignment is invalid. 1652 * 1653 * @type { number } 1654 * @syscap SystemCapability.ArkUI.ArkUI.Full 1655 * @since 8 1656 */ 1657 /** 1658 * Transparency. The value ranges from 0.0 (completely transparent) to 1.0 (completely opaque). 1659 * The default value is 1.0. If the value is out of range, the assignment is invalid. 1660 * 1661 * @type { number } 1662 * @syscap SystemCapability.ArkUI.ArkUI.Full 1663 * @since 9 1664 * @form 1665 */ 1666 /** 1667 * Transparency. The value ranges from 0.0 (completely transparent) to 1.0 (completely opaque). 1668 * The default value is 1.0. If the value is out of range, the assignment is invalid. 1669 * 1670 * @type { number } 1671 * @syscap SystemCapability.ArkUI.ArkUI.Full 1672 * @crossplatform 1673 * @since 10 1674 * @form 1675 */ 1676 globalAlpha: number; 1677 1678 /** 1679 * Type of composition operation applied when drawing a new shape. The following types are supported: 1680 * source-over: (Default) Draws a new drawing on top of an existing canvas context. 1681 * source-in: The new drawing is drawn only where the new drawing overlaps the target canvas. 1682 * Everything else is transparent. 1683 * source-out: Draws a new drawing where it does not overlap with the existing canvas content. 1684 * source-atop: The new drawing is drawn only where it overlaps the content of the existing canvas. 1685 * destination-over: Draws a new graphic behind the existing canvas content. 1686 * destination-in: Existing canvas content remains where the new drawing overlaps the existing canvas content. 1687 * Everything else is transparent. 1688 * destination-out: Existing content remains where the new drawing does not overlap. 1689 * destination-atop: The existing canvas retains only the part that overlaps with the new drawing, 1690 * which is drawn behind the canvas content. 1691 * lighter: The color of two overlapping shapes is determined by adding the color values. 1692 * copy: Only new graphics are displayed. 1693 * xor: In the image, those overlaps and other places outside of the normal drawing are transparent. 1694 * multiply: Multiply the top pixel by the bottom pixel, and the result is a darker picture. 1695 * screen: The pixels are inverted, multiplied, and inverted again, and the result is a brighter picture. 1696 * overlay: The combination of multiply and screen enables dark places to be darker and bright places to be brighter. 1697 * darken: Keeps the darkest pixel in both layers. 1698 * lighten: Keeps the brightest pixel in both layers. 1699 * color-dodge: The inverse of dividing the bottom layer by the top layer. 1700 * color-burn: Divide the inverted bottom layer by the top layer, and reverse the result. 1701 * hard-light: A combination of multiplication and screen is similar to overlay, but the layers are interchanged. 1702 * difference: Subtract the bottom from the top or vice versa to get a positive value. 1703 * soft-light: A softer version of hard-light. Pure black or pure white does not result in pure black or pure white. 1704 * exclusion: Similar to difference, but with lower contrast. 1705 * hue: The luminance and chroma of the bottom layer are retained while the hue of the top layer is employed. 1706 * saturation: The luminance (luma) and hue (hue) of the bottom layer are retained while the chroma (chroma) of 1707 * the top layer is used. 1708 * color: The luminance (luma) of the bottom layer is retained while the hue (hue) and chroma (chroma) of 1709 * the top layer are used. 1710 * luminosity: The hue and chroma of the bottom layer are maintained while the luminance of the top layer is used. 1711 * 1712 * @type { string } 1713 * @syscap SystemCapability.ArkUI.ArkUI.Full 1714 * @since 8 1715 */ 1716 /** 1717 * Type of composition operation applied when drawing a new shape. The following types are supported: 1718 * source-over: (Default) Draws a new drawing on top of an existing canvas context. 1719 * source-in: The new drawing is drawn only where the new drawing overlaps the target canvas. 1720 * Everything else is transparent. 1721 * source-out: Draws a new drawing where it does not overlap with the existing canvas content. 1722 * source-atop: The new drawing is drawn only where it overlaps the content of the existing canvas. 1723 * destination-over: Draws a new graphic behind the existing canvas content. 1724 * destination-in: Existing canvas content remains where the new drawing overlaps the existing canvas content. 1725 * Everything else is transparent. 1726 * destination-out: Existing content remains where the new drawing does not overlap. 1727 * destination-atop: The existing canvas retains only the part that overlaps with the new drawing, 1728 * which is drawn behind the canvas content. 1729 * lighter: The color of two overlapping shapes is determined by adding the color values. 1730 * copy: Only new graphics are displayed. 1731 * xor: In the image, those overlaps and other places outside of the normal drawing are transparent. 1732 * multiply: Multiply the top pixel by the bottom pixel, and the result is a darker picture. 1733 * screen: The pixels are inverted, multiplied, and inverted again, and the result is a brighter picture. 1734 * overlay: The combination of multiply and screen enables dark places to be darker and bright places to be brighter. 1735 * darken: Keeps the darkest pixel in both layers. 1736 * lighten: Keeps the brightest pixel in both layers. 1737 * color-dodge: The inverse of dividing the bottom layer by the top layer. 1738 * color-burn: Divide the inverted bottom layer by the top layer, and reverse the result. 1739 * hard-light: A combination of multiplication and screen is similar to overlay, but the layers are interchanged. 1740 * difference: Subtract the bottom from the top or vice versa to get a positive value. 1741 * soft-light: A softer version of hard-light. Pure black or pure white does not result in pure black or pure white. 1742 * exclusion: Similar to difference, but with lower contrast. 1743 * hue: The luminance and chroma of the bottom layer are retained while the hue of the top layer is employed. 1744 * saturation: The luminance (luma) and hue (hue) of the bottom layer are retained while the chroma (chroma) of 1745 * the top layer is used. 1746 * color: The luminance (luma) of the bottom layer is retained while the hue (hue) and chroma (chroma) of 1747 * the top layer are used. 1748 * luminosity: The hue and chroma of the bottom layer are maintained while the luminance of the top layer is used. 1749 * 1750 * @type { string } 1751 * @syscap SystemCapability.ArkUI.ArkUI.Full 1752 * @since 9 1753 * @form 1754 */ 1755 /** 1756 * Type of composition operation applied when drawing a new shape. The following types are supported: 1757 * source-over: (Default) Draws a new drawing on top of an existing canvas context. 1758 * source-in: The new drawing is drawn only where the new drawing overlaps the target canvas. 1759 * Everything else is transparent. 1760 * source-out: Draws a new drawing where it does not overlap with the existing canvas content. 1761 * source-atop: The new drawing is drawn only where it overlaps the content of the existing canvas. 1762 * destination-over: Draws a new graphic behind the existing canvas content. 1763 * destination-in: Existing canvas content remains where the new drawing overlaps the existing canvas content. 1764 * Everything else is transparent. 1765 * destination-out: Existing content remains where the new drawing does not overlap. 1766 * destination-atop: The existing canvas retains only the part that overlaps with the new drawing, 1767 * which is drawn behind the canvas content. 1768 * lighter: The color of two overlapping shapes is determined by adding the color values. 1769 * copy: Only new graphics are displayed. 1770 * xor: In the image, those overlaps and other places outside of the normal drawing are transparent. 1771 * multiply: Multiply the top pixel by the bottom pixel, and the result is a darker picture. 1772 * screen: The pixels are inverted, multiplied, and inverted again, and the result is a brighter picture. 1773 * overlay: The combination of multiply and screen enables dark places to be darker and bright places to be brighter. 1774 * darken: Keeps the darkest pixel in both layers. 1775 * lighten: Keeps the brightest pixel in both layers. 1776 * color-dodge: The inverse of dividing the bottom layer by the top layer. 1777 * color-burn: Divide the inverted bottom layer by the top layer, and reverse the result. 1778 * hard-light: A combination of multiplication and screen is similar to overlay, but the layers are interchanged. 1779 * difference: Subtract the bottom from the top or vice versa to get a positive value. 1780 * soft-light: A softer version of hard-light. Pure black or pure white does not result in pure black or pure white. 1781 * exclusion: Similar to difference, but with lower contrast. 1782 * hue: The luminance and chroma of the bottom layer are retained while the hue of the top layer is employed. 1783 * saturation: The luminance (luma) and hue (hue) of the bottom layer are retained while the chroma (chroma) of 1784 * the top layer is used. 1785 * color: The luminance (luma) of the bottom layer is retained while the hue (hue) and chroma (chroma) of 1786 * the top layer are used. 1787 * luminosity: The hue and chroma of the bottom layer are maintained while the luminance of the top layer is used. 1788 * 1789 * @type { string } 1790 * @syscap SystemCapability.ArkUI.ArkUI.Full 1791 * @crossplatform 1792 * @since 10 1793 * @form 1794 */ 1795 globalCompositeOperation: string; 1796 1797 /** 1798 * Draw an image on a canvas 1799 * 1800 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1801 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1802 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1803 * @syscap SystemCapability.ArkUI.ArkUI.Full 1804 * @since 8 1805 */ 1806 /** 1807 * Draw an image on a canvas 1808 * 1809 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1810 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1811 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1812 * @syscap SystemCapability.ArkUI.ArkUI.Full 1813 * @since 9 1814 * @form 1815 */ 1816 /** 1817 * Draw an image on a canvas 1818 * 1819 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1820 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1821 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1822 * @syscap SystemCapability.ArkUI.ArkUI.Full 1823 * @crossplatform 1824 * @since 10 1825 * @form 1826 */ 1827 drawImage(image: ImageBitmap | PixelMap, dx: number, dy: number): void; 1828 1829 /** 1830 * Draw an image on a canvas 1831 * 1832 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1833 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1834 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1835 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1836 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1837 * @syscap SystemCapability.ArkUI.ArkUI.Full 1838 * @since 8 1839 */ 1840 /** 1841 * Draw an image on a canvas 1842 * 1843 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1844 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1845 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1846 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1847 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1848 * @syscap SystemCapability.ArkUI.ArkUI.Full 1849 * @since 9 1850 * @form 1851 */ 1852 /** 1853 * Draw an image on a canvas 1854 * 1855 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1856 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1857 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1858 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1859 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1860 * @syscap SystemCapability.ArkUI.ArkUI.Full 1861 * @crossplatform 1862 * @since 10 1863 * @form 1864 */ 1865 drawImage(image: ImageBitmap | PixelMap, dx: number, dy: number, dw: number, dh: number): void; 1866 1867 /** 1868 *Draw an image on a canvas 1869 * 1870 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1871 * @param { number } sx - x coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1872 * @param { number } sy - y coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1873 * @param { number } sw - Width of the rectangle (cropping) selection box of the image. 1874 * @param { number } sh - Height of the rectangle (cropping) selection box of the image. 1875 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1876 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1877 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1878 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1879 * @syscap SystemCapability.ArkUI.ArkUI.Full 1880 * @since 8 1881 */ 1882 /** 1883 *Draw an image on a canvas 1884 * 1885 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1886 * @param { number } sx - x coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1887 * @param { number } sy - y coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1888 * @param { number } sw - Width of the rectangle (cropping) selection box of the image. 1889 * @param { number } sh - Height of the rectangle (cropping) selection box of the image. 1890 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1891 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1892 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1893 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1894 * @syscap SystemCapability.ArkUI.ArkUI.Full 1895 * @since 9 1896 * @form 1897 */ 1898 /** 1899 *Draw an image on a canvas 1900 * 1901 * @param { ImageBitmap | PixelMap } image - Picture objects drawn to the canvas. 1902 * @param { number } sx - x coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1903 * @param { number } sy - y coordinate of the upper left corner of the rectangle (cropping) selection box of the image. 1904 * @param { number } sw - Width of the rectangle (cropping) selection box of the image. 1905 * @param { number } sh - Height of the rectangle (cropping) selection box of the image. 1906 * @param { number } dx - x-axis coordinate of the upper left corner of the image on the target canvas. 1907 * @param { number } dy - y-axis coordinate of the upper left corner of the image on the target canvas. 1908 * @param { number } dw - Specifies the drawing width of the image on the target canvas. The width of the drawn image will be scaled. 1909 * @param { number } dh - Specifies the drawing height of the image on the target canvas. The height of the drawn image will be scaled. 1910 * @syscap SystemCapability.ArkUI.ArkUI.Full 1911 * @crossplatform 1912 * @since 10 1913 * @form 1914 */ 1915 drawImage( 1916 image: ImageBitmap | PixelMap, 1917 sx: number, 1918 sy: number, 1919 sw: number, 1920 sh: number, 1921 dx: number, 1922 dy: number, 1923 dw: number, 1924 dh: number, 1925 ): void; 1926 1927 /** 1928 * Clear the sub-path list and start a new path. 1929 * 1930 * @syscap SystemCapability.ArkUI.ArkUI.Full 1931 * @since 8 1932 */ 1933 /** 1934 * Clear the sub-path list and start a new path. 1935 * 1936 * @syscap SystemCapability.ArkUI.ArkUI.Full 1937 * @since 9 1938 * @form 1939 */ 1940 /** 1941 * Clear the sub-path list and start a new path. 1942 * 1943 * @syscap SystemCapability.ArkUI.ArkUI.Full 1944 * @crossplatform 1945 * @since 10 1946 * @form 1947 */ 1948 beginPath(): void; 1949 1950 /** 1951 * Sets the currently created path as the current clipping path 1952 * 1953 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1954 * @syscap SystemCapability.ArkUI.ArkUI.Full 1955 * @since 8 1956 */ 1957 /** 1958 * Sets the currently created path as the current clipping path 1959 * 1960 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1961 * @syscap SystemCapability.ArkUI.ArkUI.Full 1962 * @since 9 1963 * @form 1964 */ 1965 /** 1966 * Sets the currently created path as the current clipping path 1967 * 1968 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1969 * @syscap SystemCapability.ArkUI.ArkUI.Full 1970 * @crossplatform 1971 * @since 10 1972 * @form 1973 */ 1974 clip(fillRule?: CanvasFillRule): void; 1975 1976 /** 1977 * Tailoring according to the specified path 1978 * 1979 * @param { Path2D } path - Path to be cut. 1980 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1981 * @syscap SystemCapability.ArkUI.ArkUI.Full 1982 * @since 8 1983 */ 1984 /** 1985 * Tailoring according to the specified path 1986 * 1987 * @param { Path2D } path - Path to be cut. 1988 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1989 * @syscap SystemCapability.ArkUI.ArkUI.Full 1990 * @since 9 1991 * @form 1992 */ 1993 /** 1994 * Tailoring according to the specified path 1995 * 1996 * @param { Path2D } path - Path to be cut. 1997 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 1998 * @syscap SystemCapability.ArkUI.ArkUI.Full 1999 * @crossplatform 2000 * @since 10 2001 * @form 2002 */ 2003 clip(path: Path2D, fillRule?: CanvasFillRule): void; 2004 2005 /** 2006 * Fills existing paths according to the current fill style. 2007 * 2008 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2009 * @syscap SystemCapability.ArkUI.ArkUI.Full 2010 * @since 8 2011 */ 2012 /** 2013 * Fills existing paths according to the current fill style. 2014 * 2015 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2016 * @syscap SystemCapability.ArkUI.ArkUI.Full 2017 * @since 9 2018 * @form 2019 */ 2020 /** 2021 * Fills existing paths according to the current fill style. 2022 * 2023 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2024 * @syscap SystemCapability.ArkUI.ArkUI.Full 2025 * @crossplatform 2026 * @since 10 2027 * @form 2028 */ 2029 fill(fillRule?: CanvasFillRule): void; 2030 2031 /** 2032 * Fills the specified path according to the current fill style 2033 * 2034 * @param { Path2D } path - Path to be filled. 2035 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2036 * @syscap SystemCapability.ArkUI.ArkUI.Full 2037 * @since 8 2038 */ 2039 /** 2040 * Fills the specified path according to the current fill style 2041 * 2042 * @param { Path2D } path - Path to be filled. 2043 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2044 * @syscap SystemCapability.ArkUI.ArkUI.Full 2045 * @since 9 2046 * @form 2047 */ 2048 /** 2049 * Fills the specified path according to the current fill style 2050 * 2051 * @param { Path2D } path - Path to be filled. 2052 * @param { CanvasFillRule } fillRule - Algorithm rule. For details, see {@link CanvasFillRule}. 2053 * @syscap SystemCapability.ArkUI.ArkUI.Full 2054 * @crossplatform 2055 * @since 10 2056 * @form 2057 */ 2058 fill(path: Path2D, fillRule?: CanvasFillRule): void; 2059 2060 /** 2061 * Draws an existing path according to the current stroke style. 2062 * 2063 * @syscap SystemCapability.ArkUI.ArkUI.Full 2064 * @since 8 2065 */ 2066 /** 2067 * Draws an existing path according to the current stroke style. 2068 * 2069 * @syscap SystemCapability.ArkUI.ArkUI.Full 2070 * @since 9 2071 * @form 2072 */ 2073 /** 2074 * Draws an existing path according to the current stroke style. 2075 * 2076 * @syscap SystemCapability.ArkUI.ArkUI.Full 2077 * @crossplatform 2078 * @since 10 2079 * @form 2080 */ 2081 stroke(): void; 2082 2083 /** 2084 * Draws the specified path according to the current stroke style 2085 * 2086 * @param { Path2D } path - Specified stroke path object 2087 * @syscap SystemCapability.ArkUI.ArkUI.Full 2088 * @since 8 2089 */ 2090 /** 2091 * Draws the specified path according to the current stroke style 2092 * 2093 * @param { Path2D } path - Specified stroke path object 2094 * @syscap SystemCapability.ArkUI.ArkUI.Full 2095 * @since 9 2096 * @form 2097 */ 2098 /** 2099 * Draws the specified path according to the current stroke style 2100 * 2101 * @param { Path2D } path - Specified stroke path object 2102 * @syscap SystemCapability.ArkUI.ArkUI.Full 2103 * @crossplatform 2104 * @since 10 2105 * @form 2106 */ 2107 stroke(path: Path2D): void; 2108 2109 /** 2110 * Attributes that describe the fill color and style. The default value is # 000 (black). The options are as follows: 2111 * color: Color String 2112 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2113 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2114 * 2115 * @type { string | number | CanvasGradient | CanvasPattern } 2116 * @syscap SystemCapability.ArkUI.ArkUI.Full 2117 * @since 8 2118 */ 2119 /** 2120 * Attributes that describe the fill color and style. The default value is # 000 (black). The options are as follows: 2121 * color: Color String 2122 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2123 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2124 * 2125 * @type { string | number | CanvasGradient | CanvasPattern } 2126 * @syscap SystemCapability.ArkUI.ArkUI.Full 2127 * @since 9 2128 * @form 2129 */ 2130 /** 2131 * Attributes that describe the fill color and style. The default value is # 000 (black). The options are as follows: 2132 * 2133 * @type { string | number | CanvasGradient | CanvasPattern } 2134 * string: Color String. 2135 * number: Indicates the color with number. 2136 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2137 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2138 * @syscap SystemCapability.ArkUI.ArkUI.Full 2139 * @crossplatform 2140 * @since 10 2141 * @form 2142 */ 2143 fillStyle: string | number | CanvasGradient | CanvasPattern; 2144 2145 /** 2146 * Attributes of the stroke color and style. The default value is # 000 (black). The options are as follows: 2147 * color: Color String 2148 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2149 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2150 * 2151 * @type { string | number | CanvasGradient | CanvasPattern } 2152 * @syscap SystemCapability.ArkUI.ArkUI.Full 2153 * @since 8 2154 */ 2155 /** 2156 * Attributes of the stroke color and style. The default value is # 000 (black). The options are as follows: 2157 * color: Color String 2158 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2159 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2160 * 2161 * @type { string | number | CanvasGradient | CanvasPattern } 2162 * @syscap SystemCapability.ArkUI.ArkUI.Full 2163 * @since 9 2164 * @form 2165 */ 2166 /** 2167 * Attributes of the stroke color and style. The default value is # 000 (black). The options are as follows: 2168 * 2169 * @type { string | number | CanvasGradient | CanvasPattern } 2170 * string: Color String. 2171 * number: Indicates the color with number. 2172 * CanvasGradient: Color gradient object. For details, see {@link CanvasGradient}. 2173 * CanvasPattern: Template object. For details, see {@link CanvasPattern}. 2174 * @syscap SystemCapability.ArkUI.ArkUI.Full 2175 * @crossplatform 2176 * @since 10 2177 * @form 2178 */ 2179 strokeStyle: string | number | CanvasGradient | CanvasPattern; 2180 2181 /** 2182 * Creates a linear gradient object that is specified along the parameter coordinates 2183 * 2184 * @param { number } x0 - The x-axis coordinate of the start point. 2185 * @param { number } y0 - The y-axis coordinate of the start point. 2186 * @param { number } x1 - x-axis coordinate of the end point. 2187 * @param { number } y1 - y-axis coordinate of the end point. 2188 * @returns { CanvasGradient } 2189 * @syscap SystemCapability.ArkUI.ArkUI.Full 2190 * @since 8 2191 */ 2192 /** 2193 * Creates a linear gradient object that is specified along the parameter coordinates 2194 * 2195 * @param { number } x0 - The x-axis coordinate of the start point. 2196 * @param { number } y0 - The y-axis coordinate of the start point. 2197 * @param { number } x1 - x-axis coordinate of the end point. 2198 * @param { number } y1 - y-axis coordinate of the end point. 2199 * @returns { CanvasGradient } 2200 * @syscap SystemCapability.ArkUI.ArkUI.Full 2201 * @since 9 2202 * @form 2203 */ 2204 /** 2205 * Creates a linear gradient object that is specified along the parameter coordinates 2206 * 2207 * @param { number } x0 - The x-axis coordinate of the start point. 2208 * @param { number } y0 - The y-axis coordinate of the start point. 2209 * @param { number } x1 - x-axis coordinate of the end point. 2210 * @param { number } y1 - y-axis coordinate of the end point. 2211 * @returns { CanvasGradient } 2212 * @syscap SystemCapability.ArkUI.ArkUI.Full 2213 * @crossplatform 2214 * @since 10 2215 * @form 2216 */ 2217 createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; 2218 2219 /** 2220 * Creates a template object using the specified image 2221 * 2222 * @param { ImageBitmap } image - Objects as duplicate image sources 2223 * @param { string | null } repetition - Specifies how to repeat images. The following four modes are supported: 2224 * "repeat": Repeated images in both X and Y directions 2225 * "repeat-x": Repeated images in the X-axis direction but not in the Y-axis direction 2226 * "repeat-y": The image is repeated in the Y axis direction, and the image is not repeated in the X axis direction. 2227 * "no-repeat": Non-repeating images in both X and Y directions 2228 * @returns { CanvasPattern | null } 2229 * @syscap SystemCapability.ArkUI.ArkUI.Full 2230 * @since 8 2231 */ 2232 /** 2233 * Creates a template object using the specified image 2234 * 2235 * @param { ImageBitmap } image - Objects as duplicate image sources 2236 * @param { string | null } repetition - Specifies how to repeat images. The following four modes are supported: 2237 * "repeat": Repeated images in both X and Y directions 2238 * "repeat-x": Repeated images in the X-axis direction but not in the Y-axis direction 2239 * "repeat-y": The image is repeated in the Y axis direction, and the image is not repeated in the X axis direction. 2240 * "no-repeat": Non-repeating images in both X and Y directions 2241 * @returns { CanvasPattern | null } 2242 * @syscap SystemCapability.ArkUI.ArkUI.Full 2243 * @since 9 2244 * @form 2245 */ 2246 /** 2247 * Creates a template object using the specified image 2248 * 2249 * @param { ImageBitmap } image - Objects as duplicate image sources 2250 * @param { string | null } repetition - Specifies how to repeat images. The following four modes are supported: 2251 * "repeat": Repeated images in both X and Y directions 2252 * "repeat-x": Repeated images in the X-axis direction but not in the Y-axis direction 2253 * "repeat-y": The image is repeated in the Y axis direction, and the image is not repeated in the X axis direction. 2254 * "no-repeat": Non-repeating images in both X and Y directions 2255 * "clamp": Replicate the edge color if the shader draws outside of its original bounds. 2256 * "mirror": Repeat the shader's image horizontally and vertically, alternating mirror images so that adjacent images always seam. 2257 * @returns { CanvasPattern | null } 2258 * @syscap SystemCapability.ArkUI.ArkUI.Full 2259 * @crossplatform 2260 * @since 10 2261 * @form 2262 */ 2263 createPattern(image: ImageBitmap, repetition: string | null): CanvasPattern | null; 2264 2265 /** 2266 * Creates a radioactive gradient object based on parameters that determine the coordinates of two circles 2267 * 2268 * @param { number } x0 - The x-axis coordinate of the start circle. 2269 * @param { number } y0 - The y-axis coordinate of the start circle. 2270 * @param { number } r0 - Radius of the starting circle. 2271 * @param { number } x1 - The x-axis coordinate of the end circle. 2272 * @param { number } y1 - The y-axis coordinate of the end circle. 2273 * @param { number } r1 - Radius of the end circle. 2274 * @returns { CanvasGradient } 2275 * @syscap SystemCapability.ArkUI.ArkUI.Full 2276 * @since 8 2277 */ 2278 /** 2279 * Creates a radioactive gradient object based on parameters that determine the coordinates of two circles 2280 * 2281 * @param { number } x0 - The x-axis coordinate of the start circle. 2282 * @param { number } y0 - The y-axis coordinate of the start circle. 2283 * @param { number } r0 - Radius of the starting circle. 2284 * @param { number } x1 - The x-axis coordinate of the end circle. 2285 * @param { number } y1 - The y-axis coordinate of the end circle. 2286 * @param { number } r1 - Radius of the end circle. 2287 * @returns { CanvasGradient } 2288 * @syscap SystemCapability.ArkUI.ArkUI.Full 2289 * @since 9 2290 * @form 2291 */ 2292 /** 2293 * Creates a radioactive gradient object based on parameters that determine the coordinates of two circles 2294 * 2295 * @param { number } x0 - The x-axis coordinate of the start circle. 2296 * @param { number } y0 - The y-axis coordinate of the start circle. 2297 * @param { number } r0 - Radius of the starting circle. 2298 * @param { number } x1 - The x-axis coordinate of the end circle. 2299 * @param { number } y1 - The y-axis coordinate of the end circle. 2300 * @param { number } r1 - Radius of the end circle. 2301 * @returns { CanvasGradient } 2302 * @syscap SystemCapability.ArkUI.ArkUI.Full 2303 * @crossplatform 2304 * @since 10 2305 * @form 2306 */ 2307 createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; 2308 2309 /** 2310 * Creates a gradient around a point with given coordinates. 2311 * 2312 * @param { number } startAngle - The angle at which to begin the gradient, in radians. 2313 * Angle measurements start horizontally the right of the center and move around clockwise. 2314 * @param { number } x - The x-axis coordinate of the center of the gradient. 2315 * @param { number } y - The y-axis coordinate of the center of the gradient. 2316 * @returns { CanvasGradient } A CanvasGradient object that draws a conic gradient around the given coordinates. 2317 * @syscap SystemCapability.ArkUI.ArkUI.Full 2318 * @crossplatform 2319 * @since 10 2320 */ 2321 createConicGradient( 2322 startAngle: number, 2323 x: number, 2324 y: number 2325 ): CanvasGradient; 2326 2327 /** 2328 * Provides filter effects such as blur and grayscale. You can set the following filter effects: 2329 * blur(<length>): Adds a Gaussian blur effect to the drawing 2330 * brightness(<percentage>): Provides a linear multiplication for the drawing and adjusts the brightness level. 2331 * contrast(<percentage>): Adjusts the contrast of the image. When the value is 0%, the image is completely black. 2332 * When the value is 100%, there is no change in the image. 2333 * drop-shadow(<offset-x>, <offset-y>, <blur-radius>, <spread-radius>, <color>): Shading the image 2334 * --- <offset-x>: Describes the horizontal distance of the shadow. 2335 * --- <offset-y>: Describes the vertical distance of the shadow. 2336 * --- <blur-radius>: Blur radius. The larger the value, the greater the blur. The value cannot be a negative number. 2337 * --- <spread-radius>: Positive numbers make the shadow expand larger, negative numbers make the shadow shrink. 2338 * --- <color>: Shadow Color 2339 * grayscale(<percentage>): Converts the image to a gray image. When the value is 100%, the image is completely gray. 2340 * When the value is 0%, there is no change in the image. 2341 * hue-rotate(<degree>): Perform color rotation on an image. When the value is 0 degrees, there is no change in the image. 2342 * invert(<percentage>): Inverted image (representing the effect of a photographic negative). When the value is 100%, 2343 * the image is completely inverted. When the value is 0%, there is no change in the image. 2344 * opacity(<percentage>): Transparency of the image. At 0%, the image is completely transparent. 2345 * When the value is 100%, there is no change in the image. 2346 * saturate(<percentage>): Perform saturation processing on the image. At 0%, the image is completely un-saturated. 2347 * When the value is 100%, there is no change in the image. 2348 * sepia(<percentage>): The image is sepia (nostalgic style). At 100%, the image turns completely sepia. 2349 * When the value is 0%, there is no change in the image. 2350 * none: Turn off filter effects 2351 * 2352 * @type { string } 2353 * @syscap SystemCapability.ArkUI.ArkUI.Full 2354 * @since 8 2355 */ 2356 /** 2357 * Provides filter effects such as blur and grayscale. You can set the following filter effects: 2358 * blur(<length>): Adds a Gaussian blur effect to the drawing 2359 * brightness(<percentage>): Provides a linear multiplication for the drawing and adjusts the brightness level. 2360 * contrast(<percentage>): Adjusts the contrast of the image. When the value is 0%, the image is completely black. 2361 * When the value is 100%, there is no change in the image. 2362 * drop-shadow(<offset-x>, <offset-y>, <blur-radius>, <spread-radius>, <color>): Shading the image 2363 * --- <offset-x>: Describes the horizontal distance of the shadow. 2364 * --- <offset-y>: Describes the vertical distance of the shadow. 2365 * --- <blur-radius>: Blur radius. The larger the value, the greater the blur. The value cannot be a negative number. 2366 * --- <spread-radius>: Positive numbers make the shadow expand larger, negative numbers make the shadow shrink. 2367 * --- <color>: Shadow Color 2368 * grayscale(<percentage>): Converts the image to a gray image. When the value is 100%, the image is completely gray. 2369 * When the value is 0%, there is no change in the image. 2370 * hue-rotate(<degree>): Perform color rotation on an image. When the value is 0 degrees, there is no change in the image. 2371 * invert(<percentage>): Inverted image (representing the effect of a photographic negative). When the value is 100%, 2372 * the image is completely inverted. When the value is 0%, there is no change in the image. 2373 * opacity(<percentage>): Transparency of the image. At 0%, the image is completely transparent. 2374 * When the value is 100%, there is no change in the image. 2375 * saturate(<percentage>): Perform saturation processing on the image. At 0%, the image is completely un-saturated. 2376 * When the value is 100%, there is no change in the image. 2377 * sepia(<percentage>): The image is sepia (nostalgic style). At 100%, the image turns completely sepia. 2378 * When the value is 0%, there is no change in the image. 2379 * none: Turn off filter effects 2380 * 2381 * @type { string } 2382 * @syscap SystemCapability.ArkUI.ArkUI.Full 2383 * @since 9 2384 * @form 2385 */ 2386 /** 2387 * Provides filter effects such as blur and grayscale. You can set the following filter effects: 2388 * blur(<length>): Adds a Gaussian blur effect to the drawing 2389 * brightness(<percentage>): Provides a linear multiplication for the drawing and adjusts the brightness level. 2390 * contrast(<percentage>): Adjusts the contrast of the image. When the value is 0%, the image is completely black. 2391 * When the value is 100%, there is no change in the image. 2392 * drop-shadow(<offset-x>, <offset-y>, <blur-radius>, <spread-radius>, <color>): Shading the image 2393 * --- <offset-x>: Describes the horizontal distance of the shadow. 2394 * --- <offset-y>: Describes the vertical distance of the shadow. 2395 * --- <blur-radius>: Blur radius. The larger the value, the greater the blur. The value cannot be a negative number. 2396 * --- <spread-radius>: Positive numbers make the shadow expand larger, negative numbers make the shadow shrink. 2397 * --- <color>: Shadow Color 2398 * grayscale(<percentage>): Converts the image to a gray image. When the value is 100%, the image is completely gray. 2399 * When the value is 0%, there is no change in the image. 2400 * hue-rotate(<degree>): Perform color rotation on an image. When the value is 0 degrees, there is no change in the image. 2401 * invert(<percentage>): Inverted image (representing the effect of a photographic negative). When the value is 100%, 2402 * the image is completely inverted. When the value is 0%, there is no change in the image. 2403 * opacity(<percentage>): Transparency of the image. At 0%, the image is completely transparent. 2404 * When the value is 100%, there is no change in the image. 2405 * saturate(<percentage>): Perform saturation processing on the image. At 0%, the image is completely un-saturated. 2406 * When the value is 100%, there is no change in the image. 2407 * sepia(<percentage>): The image is sepia (nostalgic style). At 100%, the image turns completely sepia. 2408 * When the value is 0%, there is no change in the image. 2409 * none: Turn off filter effects 2410 * 2411 * @type { string } 2412 * @syscap SystemCapability.ArkUI.ArkUI.Full 2413 * @crossplatform 2414 * @since 10 2415 * @form 2416 */ 2417 filter: string; 2418 2419 /** 2420 * Creates a new, empty ImageData object of the specified size 2421 * 2422 * @param { number } sw - Width of the ImageData object. 2423 * @param { number } sh - Height of the ImageData object. 2424 * @returns { ImageData } 2425 * @syscap SystemCapability.ArkUI.ArkUI.Full 2426 * @since 8 2427 */ 2428 /** 2429 * Creates a new, empty ImageData object of the specified size 2430 * 2431 * @param { number } sw - Width of the ImageData object. 2432 * @param { number } sh - Height of the ImageData object. 2433 * @returns { ImageData } 2434 * @syscap SystemCapability.ArkUI.ArkUI.Full 2435 * @since 9 2436 * @form 2437 */ 2438 /** 2439 * Creates a new, empty ImageData object of the specified size 2440 * 2441 * @param { number } sw - Width of the ImageData object. 2442 * @param { number } sh - Height of the ImageData object. 2443 * @returns { ImageData } 2444 * @syscap SystemCapability.ArkUI.ArkUI.Full 2445 * @crossplatform 2446 * @since 10 2447 * @form 2448 */ 2449 createImageData(sw: number, sh: number): ImageData; 2450 2451 /** 2452 * From an existing ImageData object, copy an object with the same width and height as the image. 2453 * The image content is not copied. 2454 * 2455 * @param { ImageData } imagedata - ImageData object to be copied. 2456 * @returns { ImageData } 2457 * @syscap SystemCapability.ArkUI.ArkUI.Full 2458 * @since 8 2459 */ 2460 /** 2461 * From an existing ImageData object, copy an object with the same width and height as the image. 2462 * The image content is not copied. 2463 * 2464 * @param { ImageData } imagedata - ImageData object to be copied. 2465 * @returns { ImageData } 2466 * @syscap SystemCapability.ArkUI.ArkUI.Full 2467 * @since 9 2468 * @form 2469 */ 2470 /** 2471 * From an existing ImageData object, copy an object with the same width and height as the image. 2472 * The image content is not copied. 2473 * 2474 * @param { ImageData } imagedata - ImageData object to be copied. 2475 * @returns { ImageData } 2476 * @syscap SystemCapability.ArkUI.ArkUI.Full 2477 * @crossplatform 2478 * @since 10 2479 * @form 2480 */ 2481 createImageData(imagedata: ImageData): ImageData; 2482 2483 /** 2484 * Obtains the pixel data of a specified area on the current canvas. 2485 * 2486 * @param { number } sx - x coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2487 * @param { number } sy - y coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2488 * @param { number } sw - The width of the rectangular area of the image data to be extracted. 2489 * @param { number } sh - The height of the rectangular area of the image data to be extracted. 2490 * @returns { ImageData } 2491 * @syscap SystemCapability.ArkUI.ArkUI.Full 2492 * @since 8 2493 */ 2494 /** 2495 * Obtains the pixel data of a specified area on the current canvas. 2496 * 2497 * @param { number } sx - x coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2498 * @param { number } sy - y coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2499 * @param { number } sw - The width of the rectangular area of the image data to be extracted. 2500 * @param { number } sh - The height of the rectangular area of the image data to be extracted. 2501 * @returns { ImageData } 2502 * @syscap SystemCapability.ArkUI.ArkUI.Full 2503 * @since 9 2504 * @form 2505 */ 2506 /** 2507 * Obtains the pixel data of a specified area on the current canvas. 2508 * 2509 * @param { number } sx - x coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2510 * @param { number } sy - y coordinate of the upper left corner of the rectangular area of the image data to be extracted. 2511 * @param { number } sw - The width of the rectangular area of the image data to be extracted. 2512 * @param { number } sh - The height of the rectangular area of the image data to be extracted. 2513 * @returns { ImageData } 2514 * @syscap SystemCapability.ArkUI.ArkUI.Full 2515 * @crossplatform 2516 * @since 10 2517 * @form 2518 */ 2519 getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; 2520 2521 /** 2522 * Obtains the PixelMap of a specified area on the current canvas. 2523 * 2524 * @param { number } sx - x coordinate of the upper left corner of the rectangular area of the PixelMap to be extracted. 2525 * @param { number } sy - y coordinate of the upper left corner of the rectangular area of the PixelMap to be extracted. 2526 * @param { number } sw - The width of the rectangular area of the PixelMap to be extracted. 2527 * @param { number } sh - The height of the rectangular area of the PixelMap to be extracted. 2528 * @returns { PixelMap } 2529 * @syscap SystemCapability.ArkUI.ArkUI.Full 2530 * @since 8 2531 */ 2532 /** 2533 * Obtains the PixelMap of a specified area on the current canvas. 2534 * 2535 * @param { number } sx - x coordinate of the upper left corner of the rectangular area of the PixelMap to be extracted. 2536 * @param { number } sy - y coordinate of the upper left corner of the rectangular area of the PixelMap to be extracted. 2537 * @param { number } sw - The width of the rectangular area of the PixelMap to be extracted. 2538 * @param { number } sh - The height of the rectangular area of the PixelMap to be extracted. 2539 * @returns { PixelMap } 2540 * @syscap SystemCapability.ArkUI.ArkUI.Full 2541 * @crossplatform 2542 * @since 10 2543 */ 2544 getPixelMap(sx: number, sy: number, sw: number, sh: number): PixelMap; 2545 2546 /** 2547 * Draws the specified ImageData object onto the canvas 2548 * 2549 * @param { ImageData } imagedata - ImageData object to be drawn. 2550 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2551 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2552 * @syscap SystemCapability.ArkUI.ArkUI.Full 2553 * @since 8 2554 */ 2555 /** 2556 * Draws the specified ImageData object onto the canvas 2557 * 2558 * @param { ImageData } imagedata - ImageData object to be drawn. 2559 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2560 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2561 * @syscap SystemCapability.ArkUI.ArkUI.Full 2562 * @since 9 2563 * @form 2564 */ 2565 /** 2566 * Draws the specified ImageData object onto the canvas 2567 * 2568 * @param { ImageData } imagedata - ImageData object to be drawn. 2569 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2570 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2571 * @syscap SystemCapability.ArkUI.ArkUI.Full 2572 * @crossplatform 2573 * @since 10 2574 * @form 2575 */ 2576 putImageData(imagedata: ImageData, dx: number | string, dy: number | string): void; 2577 2578 /** 2579 * Draws the specified ImageData object onto the canvas 2580 * 2581 * @param { ImageData } imagedata - ImageData object to be drawn. 2582 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2583 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2584 * @param { number | string } dirtyX - Position of the upper left corner of the rectangular area in the source image data. 2585 * The default is the upper left corner (x coordinate) of the entire image data. 2586 * @param { number | string } dirtyY - Position of the upper left corner of the rectangular area in the source image data. 2587 * The default is the upper left corner (y coordinate) of the entire image data. 2588 * @param { number | string } dirtyWidth - Width of the rectangular area in the source image data. 2589 * The default is the width of the image data. 2590 * @param { number | string } dirtyHeight - Height of the rectangular area in the source image data. 2591 * The default is the height of the image data. 2592 * @syscap SystemCapability.ArkUI.ArkUI.Full 2593 * @since 8 2594 */ 2595 /** 2596 * Draws the specified ImageData object onto the canvas 2597 * 2598 * @param { ImageData } imagedata - ImageData object to be drawn. 2599 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2600 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2601 * @param { number | string } dirtyX - Position of the upper left corner of the rectangular area in the source image data. 2602 * The default is the upper left corner (x coordinate) of the entire image data. 2603 * @param { number | string } dirtyY - Position of the upper left corner of the rectangular area in the source image data. 2604 * The default is the upper left corner (y coordinate) of the entire image data. 2605 * @param { number | string } dirtyWidth - Width of the rectangular area in the source image data. 2606 * The default is the width of the image data. 2607 * @param { number | string } dirtyHeight - Height of the rectangular area in the source image data. 2608 * The default is the height of the image data. 2609 * @syscap SystemCapability.ArkUI.ArkUI.Full 2610 * @since 9 2611 * @form 2612 */ 2613 /** 2614 * Draws the specified ImageData object onto the canvas 2615 * 2616 * @param { ImageData } imagedata - ImageData object to be drawn. 2617 * @param { number | string } dx - Position offset of the source image data in the target canvas (the offset in the x-axis direction). 2618 * @param { number | string } dy - Position offset of the source image data in the target canvas (the offset in the y-axis direction). 2619 * @param { number | string } dirtyX - Position of the upper left corner of the rectangular area in the source image data. 2620 * The default is the upper left corner (x coordinate) of the entire image data. 2621 * @param { number | string } dirtyY - Position of the upper left corner of the rectangular area in the source image data. 2622 * The default is the upper left corner (y coordinate) of the entire image data. 2623 * @param { number | string } dirtyWidth - Width of the rectangular area in the source image data. 2624 * The default is the width of the image data. 2625 * @param { number | string } dirtyHeight - Height of the rectangular area in the source image data. 2626 * The default is the height of the image data. 2627 * @syscap SystemCapability.ArkUI.ArkUI.Full 2628 * @crossplatform 2629 * @since 10 2630 * @form 2631 */ 2632 putImageData( 2633 imagedata: ImageData, 2634 dx: number | string, 2635 dy: number | string, 2636 dirtyX: number | string, 2637 dirtyY: number | string, 2638 dirtyWidth: number | string, 2639 dirtyHeight: number | string 2640 ): void; 2641 2642 /** 2643 * Specifies whether to smooth the image. The value true indicates that the image is smooth (default value). 2644 * The value false indicates that the image is not smooth. 2645 * 2646 * @type { boolean } 2647 * @syscap SystemCapability.ArkUI.ArkUI.Full 2648 * @since 8 2649 */ 2650 /** 2651 * Specifies whether to smooth the image. The value true indicates that the image is smooth (default value). 2652 * The value false indicates that the image is not smooth. 2653 * 2654 * @type { boolean } 2655 * @syscap SystemCapability.ArkUI.ArkUI.Full 2656 * @since 9 2657 * @form 2658 */ 2659 /** 2660 * Specifies whether to smooth the image. The value true indicates that the image is smooth (default value). 2661 * The value false indicates that the image is not smooth. 2662 * 2663 * @type { boolean } 2664 * @syscap SystemCapability.ArkUI.ArkUI.Full 2665 * @crossplatform 2666 * @since 10 2667 * @form 2668 */ 2669 imageSmoothingEnabled: boolean; 2670 2671 /** 2672 * Smoothness level of the current image. For details, see {@link ImageSmoothingQuality}. 2673 * 2674 * @type { ImageSmoothingQuality } 2675 * @syscap SystemCapability.ArkUI.ArkUI.Full 2676 * @since 8 2677 */ 2678 /** 2679 * Smoothness level of the current image. For details, see {@link ImageSmoothingQuality}. 2680 * 2681 * @type { ImageSmoothingQuality } 2682 * @syscap SystemCapability.ArkUI.ArkUI.Full 2683 * @since 9 2684 * @form 2685 */ 2686 /** 2687 * Smoothness level of the current image. For details, see {@link ImageSmoothingQuality}. 2688 * 2689 * @type { ImageSmoothingQuality } 2690 * @syscap SystemCapability.ArkUI.ArkUI.Full 2691 * @crossplatform 2692 * @since 10 2693 * @form 2694 */ 2695 imageSmoothingQuality: ImageSmoothingQuality; 2696 2697 /** 2698 * Line segment endpoint attribute. For details, see {@link CanvasLineCap}. 2699 * 2700 * @type { CanvasLineCap } 2701 * @syscap SystemCapability.ArkUI.ArkUI.Full 2702 * @since 8 2703 */ 2704 /** 2705 * Line segment endpoint attribute. For details, see {@link CanvasLineCap}. 2706 * 2707 * @type { CanvasLineCap } 2708 * @syscap SystemCapability.ArkUI.ArkUI.Full 2709 * @since 9 2710 * @form 2711 */ 2712 /** 2713 * Line segment endpoint attribute. For details, see {@link CanvasLineCap}. 2714 * 2715 * @type { CanvasLineCap } 2716 * @syscap SystemCapability.ArkUI.ArkUI.Full 2717 * @crossplatform 2718 * @since 10 2719 * @form 2720 */ 2721 lineCap: CanvasLineCap; 2722 2723 /** 2724 * Dotted line offset attribute. The default value is 0.0. 2725 * 2726 * @type { number } 2727 * @syscap SystemCapability.ArkUI.ArkUI.Full 2728 * @since 8 2729 */ 2730 /** 2731 * Dotted line offset attribute. The default value is 0.0. 2732 * 2733 * @type { number } 2734 * @syscap SystemCapability.ArkUI.ArkUI.Full 2735 * @since 9 2736 * @form 2737 */ 2738 /** 2739 * Dotted line offset attribute. The default value is 0.0. 2740 * 2741 * @type { number } 2742 * @syscap SystemCapability.ArkUI.ArkUI.Full 2743 * @crossplatform 2744 * @since 10 2745 * @form 2746 */ 2747 lineDashOffset: number; 2748 2749 /** 2750 * Line segment connection point attribute. For details, see {@link CanvasLineJoin}. 2751 * 2752 * @type { CanvasLineJoin } 2753 * @syscap SystemCapability.ArkUI.ArkUI.Full 2754 * @since 8 2755 */ 2756 /** 2757 * Line segment connection point attribute. For details, see {@link CanvasLineJoin}. 2758 * 2759 * @type { CanvasLineJoin } 2760 * @syscap SystemCapability.ArkUI.ArkUI.Full 2761 * @since 9 2762 * @form 2763 */ 2764 /** 2765 * Line segment connection point attribute. For details, see {@link CanvasLineJoin}. 2766 * 2767 * @type { CanvasLineJoin } 2768 * @syscap SystemCapability.ArkUI.ArkUI.Full 2769 * @crossplatform 2770 * @since 10 2771 * @form 2772 */ 2773 lineJoin: CanvasLineJoin; 2774 2775 /** 2776 * Line thickness attribute. The value cannot be 0 or a negative number. 2777 * 2778 * @type { number } 2779 * @syscap SystemCapability.ArkUI.ArkUI.Full 2780 * @since 8 2781 */ 2782 /** 2783 * Line thickness attribute. The value cannot be 0 or a negative number. 2784 * 2785 * @type { number } 2786 * @syscap SystemCapability.ArkUI.ArkUI.Full 2787 * @since 9 2788 * @form 2789 */ 2790 /** 2791 * Line thickness attribute. The value cannot be 0 or a negative number. 2792 * 2793 * @type { number } 2794 * @syscap SystemCapability.ArkUI.ArkUI.Full 2795 * @crossplatform 2796 * @since 10 2797 * @form 2798 */ 2799 lineWidth: number; 2800 2801 /** 2802 * The value of this parameter cannot be 0 or a negative number. 2803 * 2804 * @type { number } 2805 * @syscap SystemCapability.ArkUI.ArkUI.Full 2806 * @since 8 2807 */ 2808 /** 2809 * The value of this parameter cannot be 0 or a negative number. 2810 * 2811 * @type { number } 2812 * @syscap SystemCapability.ArkUI.ArkUI.Full 2813 * @since 9 2814 * @form 2815 */ 2816 /** 2817 * The value of this parameter cannot be 0 or a negative number. 2818 * 2819 * @type { number } 2820 * @syscap SystemCapability.ArkUI.ArkUI.Full 2821 * @crossplatform 2822 * @since 10 2823 * @form 2824 */ 2825 miterLimit: number; 2826 2827 /** 2828 * Gets the current segment style. 2829 * 2830 * @returns { number[] } 2831 * @syscap SystemCapability.ArkUI.ArkUI.Full 2832 * @since 8 2833 */ 2834 /** 2835 * Gets the current segment style. 2836 * 2837 * @returns { number[] } 2838 * @syscap SystemCapability.ArkUI.ArkUI.Full 2839 * @since 9 2840 * @form 2841 */ 2842 /** 2843 * Gets the current segment style. 2844 * 2845 * @returns { number[] } 2846 * @syscap SystemCapability.ArkUI.ArkUI.Full 2847 * @crossplatform 2848 * @since 10 2849 * @form 2850 */ 2851 getLineDash(): number[]; 2852 2853 /** 2854 * Sets the dashed line mode for line drawing. 2855 * 2856 * @param { number[] } segments - A set of numbers that describe the length of alternating drawn lines segments and 2857 * spacing (coordinate space units). 2858 * @syscap SystemCapability.ArkUI.ArkUI.Full 2859 * @since 8 2860 */ 2861 /** 2862 * Sets the dashed line mode for line drawing. 2863 * 2864 * @param { number[] } segments - A set of numbers that describe the length of alternating drawn lines segments and 2865 * spacing (coordinate space units). 2866 * @syscap SystemCapability.ArkUI.ArkUI.Full 2867 * @since 9 2868 * @form 2869 */ 2870 /** 2871 * Sets the dashed line mode for line drawing. 2872 * 2873 * @param { number[] } segments - A set of numbers that describe the length of alternating drawn lines segments and 2874 * spacing (coordinate space units). 2875 * @syscap SystemCapability.ArkUI.ArkUI.Full 2876 * @crossplatform 2877 * @since 10 2878 * @form 2879 */ 2880 setLineDash(segments: number[]): void; 2881 2882 /** 2883 * Clears the drawing content of a rectangular area. 2884 * 2885 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2886 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2887 * @param { number } w - Width of the rectangle. 2888 * @param { number } h - Height of the rectangle. 2889 * @syscap SystemCapability.ArkUI.ArkUI.Full 2890 * @since 8 2891 */ 2892 /** 2893 * Clears the drawing content of a rectangular area. 2894 * 2895 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2896 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2897 * @param { number } w - Width of the rectangle. 2898 * @param { number } h - Height of the rectangle. 2899 * @syscap SystemCapability.ArkUI.ArkUI.Full 2900 * @since 9 2901 * @form 2902 */ 2903 /** 2904 * Clears the drawing content of a rectangular area. 2905 * 2906 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2907 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2908 * @param { number } w - Width of the rectangle. 2909 * @param { number } h - Height of the rectangle. 2910 * @syscap SystemCapability.ArkUI.ArkUI.Full 2911 * @crossplatform 2912 * @since 10 2913 * @form 2914 */ 2915 clearRect(x: number, y: number, w: number, h: number): void; 2916 2917 /** 2918 * Fills a specified rectangular area 2919 * 2920 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2921 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2922 * @param { number } w - Width of the rectangle. 2923 * @param { number } h - Height of the rectangle. 2924 * @syscap SystemCapability.ArkUI.ArkUI.Full 2925 * @since 8 2926 */ 2927 /** 2928 * Fills a specified rectangular area 2929 * 2930 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2931 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2932 * @param { number } w - Width of the rectangle. 2933 * @param { number } h - Height of the rectangle. 2934 * @syscap SystemCapability.ArkUI.ArkUI.Full 2935 * @since 9 2936 * @form 2937 */ 2938 /** 2939 * Fills a specified rectangular area 2940 * 2941 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2942 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2943 * @param { number } w - Width of the rectangle. 2944 * @param { number } h - Height of the rectangle. 2945 * @syscap SystemCapability.ArkUI.ArkUI.Full 2946 * @crossplatform 2947 * @since 10 2948 * @form 2949 */ 2950 fillRect(x: number, y: number, w: number, h: number): void; 2951 2952 /** 2953 * Stroke Specify Rectangular Area 2954 * 2955 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2956 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2957 * @param { number } w - Width of the rectangle. 2958 * @param { number } h - Height of the rectangle. 2959 * @syscap SystemCapability.ArkUI.ArkUI.Full 2960 * @since 8 2961 */ 2962 /** 2963 * Stroke Specify Rectangular Area 2964 * 2965 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2966 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2967 * @param { number } w - Width of the rectangle. 2968 * @param { number } h - Height of the rectangle. 2969 * @syscap SystemCapability.ArkUI.ArkUI.Full 2970 * @since 9 2971 * @form 2972 */ 2973 /** 2974 * Stroke Specify Rectangular Area 2975 * 2976 * @param { number } x - The x-axis coordinate of the start point of the rectangle. 2977 * @param { number } y - The y-axis coordinate of the start point of the rectangle. 2978 * @param { number } w - Width of the rectangle. 2979 * @param { number } h - Height of the rectangle. 2980 * @syscap SystemCapability.ArkUI.ArkUI.Full 2981 * @crossplatform 2982 * @since 10 2983 * @form 2984 */ 2985 strokeRect(x: number, y: number, w: number, h: number): void; 2986 2987 /** 2988 * Shadow blur radius. The default value is 0. The value cannot be a negative number. 2989 * 2990 * @type { number } 2991 * @syscap SystemCapability.ArkUI.ArkUI.Full 2992 * @since 8 2993 */ 2994 /** 2995 * Shadow blur radius. The default value is 0. The value cannot be a negative number. 2996 * 2997 * @type { number } 2998 * @syscap SystemCapability.ArkUI.ArkUI.Full 2999 * @since 9 3000 * @form 3001 */ 3002 /** 3003 * Shadow blur radius. The default value is 0. The value cannot be a negative number. 3004 * 3005 * @type { number } 3006 * @syscap SystemCapability.ArkUI.ArkUI.Full 3007 * @crossplatform 3008 * @since 10 3009 * @form 3010 */ 3011 shadowBlur: number; 3012 3013 /** 3014 * Shadow color. The default value is transparent black. 3015 * 3016 * @type { string } 3017 * @syscap SystemCapability.ArkUI.ArkUI.Full 3018 * @since 8 3019 */ 3020 /** 3021 * Shadow color. The default value is transparent black. 3022 * 3023 * @type { string } 3024 * @syscap SystemCapability.ArkUI.ArkUI.Full 3025 * @since 9 3026 * @form 3027 */ 3028 /** 3029 * Shadow color. The default value is transparent black. 3030 * 3031 * @type { string } 3032 * @syscap SystemCapability.ArkUI.ArkUI.Full 3033 * @crossplatform 3034 * @since 10 3035 * @form 3036 */ 3037 shadowColor: string; 3038 3039 /** 3040 * Horizontal offset distance of the shadow. The default value is 0. 3041 * 3042 * @type { number } 3043 * @syscap SystemCapability.ArkUI.ArkUI.Full 3044 * @since 8 3045 */ 3046 /** 3047 * Horizontal offset distance of the shadow. The default value is 0. 3048 * 3049 * @type { number } 3050 * @syscap SystemCapability.ArkUI.ArkUI.Full 3051 * @since 9 3052 * @form 3053 */ 3054 /** 3055 * Horizontal offset distance of the shadow. The default value is 0. 3056 * 3057 * @type { number } 3058 * @syscap SystemCapability.ArkUI.ArkUI.Full 3059 * @crossplatform 3060 * @since 10 3061 * @form 3062 */ 3063 shadowOffsetX: number; 3064 3065 /** 3066 * Vertical offset distance of the shadow. The default value is 0. 3067 * 3068 * @type { number } 3069 * @syscap SystemCapability.ArkUI.ArkUI.Full 3070 * @since 8 3071 */ 3072 /** 3073 * Vertical offset distance of the shadow. The default value is 0. 3074 * 3075 * @type { number } 3076 * @syscap SystemCapability.ArkUI.ArkUI.Full 3077 * @since 9 3078 * @form 3079 */ 3080 /** 3081 * Vertical offset distance of the shadow. The default value is 0. 3082 * 3083 * @type { number } 3084 * @syscap SystemCapability.ArkUI.ArkUI.Full 3085 * @crossplatform 3086 * @since 10 3087 * @form 3088 */ 3089 shadowOffsetY: number; 3090 3091 /** 3092 * Top of the stack pop-up state in the drawing state stack 3093 * 3094 * @syscap SystemCapability.ArkUI.ArkUI.Full 3095 * @since 8 3096 */ 3097 /** 3098 * Top of the stack pop-up state in the drawing state stack 3099 * 3100 * @syscap SystemCapability.ArkUI.ArkUI.Full 3101 * @since 9 3102 * @form 3103 */ 3104 /** 3105 * Top of the stack pop-up state in the drawing state stack 3106 * 3107 * @syscap SystemCapability.ArkUI.ArkUI.Full 3108 * @crossplatform 3109 * @since 10 3110 * @form 3111 */ 3112 restore(): void; 3113 3114 /** 3115 * Saves the current drawing state to the drawing state stack 3116 * 3117 * @syscap SystemCapability.ArkUI.ArkUI.Full 3118 * @since 8 3119 */ 3120 /** 3121 * Saves the current drawing state to the drawing state stack 3122 * 3123 * @syscap SystemCapability.ArkUI.ArkUI.Full 3124 * @since 9 3125 * @form 3126 */ 3127 /** 3128 * Saves the current drawing state to the drawing state stack 3129 * 3130 * @syscap SystemCapability.ArkUI.ArkUI.Full 3131 * @crossplatform 3132 * @since 10 3133 * @form 3134 */ 3135 save(): void; 3136 3137 /** 3138 * Fills the specified text at the specified location 3139 * 3140 * @param { string } text - Text string to be drawn. 3141 * @param { number } x - The x-axis coordinate of the start point of the text. 3142 * @param { number } y - The y-axis coordinate of the start point of the text. 3143 * @param { number } maxWidth - Maximum width of the drawing. 3144 * @syscap SystemCapability.ArkUI.ArkUI.Full 3145 * @since 8 3146 */ 3147 /** 3148 * Fills the specified text at the specified location 3149 * 3150 * @param { string } text - Text string to be drawn. 3151 * @param { number } x - The x-axis coordinate of the start point of the text. 3152 * @param { number } y - The y-axis coordinate of the start point of the text. 3153 * @param { number } maxWidth - Maximum width of the drawing. 3154 * @syscap SystemCapability.ArkUI.ArkUI.Full 3155 * @since 9 3156 * @form 3157 */ 3158 /** 3159 * Fills the specified text at the specified location 3160 * 3161 * @param { string } text - Text string to be drawn. 3162 * @param { number } x - The x-axis coordinate of the start point of the text. 3163 * @param { number } y - The y-axis coordinate of the start point of the text. 3164 * @param { number } maxWidth - Maximum width of the drawing. 3165 * @syscap SystemCapability.ArkUI.ArkUI.Full 3166 * @crossplatform 3167 * @since 10 3168 * @form 3169 */ 3170 fillText(text: string, x: number, y: number, maxWidth?: number): void; 3171 3172 /** 3173 * Measure the size of a specified text. For details about the return value, see {@link TextMetrics}. 3174 * 3175 * @param { string } text - Text string to be measured. 3176 * @returns { TextMetrics } 3177 * @syscap SystemCapability.ArkUI.ArkUI.Full 3178 * @since 8 3179 */ 3180 /** 3181 * Measure the size of a specified text. For details about the return value, see {@link TextMetrics}. 3182 * 3183 * @param { string } text - Text string to be measured. 3184 * @returns { TextMetrics } 3185 * @syscap SystemCapability.ArkUI.ArkUI.Full 3186 * @since 9 3187 * @form 3188 */ 3189 /** 3190 * Measure the size of a specified text. For details about the return value, see {@link TextMetrics}. 3191 * 3192 * @param { string } text - Text string to be measured. 3193 * @returns { TextMetrics } 3194 * @syscap SystemCapability.ArkUI.ArkUI.Full 3195 * @crossplatform 3196 * @since 10 3197 * @form 3198 */ 3199 measureText(text: string): TextMetrics; 3200 3201 /** 3202 * Stroke specified text at specified position 3203 * 3204 * @param { string } text - Text string to be stroked. 3205 * @param { number } x - The x-axis coordinate of the start point of the text. 3206 * @param { number } y - The y-axis-axis coordinate of the start point of the text. 3207 * @param { number } maxWidth - Maximum width of the stroke. 3208 * @syscap SystemCapability.ArkUI.ArkUI.Full 3209 * @since 8 3210 */ 3211 /** 3212 * Stroke specified text at specified position 3213 * 3214 * @param { string } text - Text string to be stroked. 3215 * @param { number } x - The x-axis coordinate of the start point of the text. 3216 * @param { number } y - The y-axis-axis coordinate of the start point of the text. 3217 * @param { number } maxWidth - Maximum width of the stroke. 3218 * @syscap SystemCapability.ArkUI.ArkUI.Full 3219 * @since 9 3220 * @form 3221 */ 3222 /** 3223 * Stroke specified text at specified position 3224 * 3225 * @param { string } text - Text string to be stroked. 3226 * @param { number } x - The x-axis coordinate of the start point of the text. 3227 * @param { number } y - The y-axis-axis coordinate of the start point of the text. 3228 * @param { number } maxWidth - Maximum width of the stroke. 3229 * @syscap SystemCapability.ArkUI.ArkUI.Full 3230 * @crossplatform 3231 * @since 10 3232 * @form 3233 */ 3234 strokeText(text: string, x: number, y: number, maxWidth?: number): void; 3235 3236 /** 3237 * Text drawing direction. For details, see {@link CanvasDirection}. 3238 * 3239 * @syscap SystemCapability.ArkUI.ArkUI.Full 3240 * @since 8 3241 */ 3242 /** 3243 * Text drawing direction. For details, see {@link CanvasDirection}. 3244 * 3245 * @syscap SystemCapability.ArkUI.ArkUI.Full 3246 * @since 9 3247 * @form 3248 */ 3249 /** 3250 * Text drawing direction. For details, see {@link CanvasDirection}. 3251 * 3252 * @syscap SystemCapability.ArkUI.ArkUI.Full 3253 * @crossplatform 3254 * @since 10 3255 * @form 3256 */ 3257 direction: CanvasDirection; 3258 3259 /** 3260 * Font style. The default value is 10px sans-serif. 3261 * 3262 * @type { string } 3263 * @syscap SystemCapability.ArkUI.ArkUI.Full 3264 * @since 8 3265 */ 3266 /** 3267 * Font style. The default value is 10px sans-serif. 3268 * 3269 * @type { string } 3270 * @syscap SystemCapability.ArkUI.ArkUI.Full 3271 * @since 9 3272 * @form 3273 */ 3274 /** 3275 * Font style. The default value is 10px sans-serif. 3276 * 3277 * @type { string } 3278 * @syscap SystemCapability.ArkUI.ArkUI.Full 3279 * @crossplatform 3280 * @since 10 3281 * @form 3282 */ 3283 font: string; 3284 3285 /** 3286 * Text alignment mode. For details, see {@link CanvasTextAlign}. 3287 * 3288 * @type { CanvasTextAlign } 3289 * @syscap SystemCapability.ArkUI.ArkUI.Full 3290 * @since 8 3291 */ 3292 /** 3293 * Text alignment mode. For details, see {@link CanvasTextAlign}. 3294 * 3295 * @type { CanvasTextAlign } 3296 * @syscap SystemCapability.ArkUI.ArkUI.Full 3297 * @since 9 3298 * @form 3299 */ 3300 /** 3301 * Text alignment mode. For details, see {@link CanvasTextAlign}. 3302 * 3303 * @type { CanvasTextAlign } 3304 * @syscap SystemCapability.ArkUI.ArkUI.Full 3305 * @crossplatform 3306 * @since 10 3307 * @form 3308 */ 3309 textAlign: CanvasTextAlign; 3310 3311 /** 3312 * Text baseline. For details, see {@link CanvasTextBaseline}. 3313 * 3314 * @type { CanvasTextBaseline } 3315 * @syscap SystemCapability.ArkUI.ArkUI.Full 3316 * @since 8 3317 */ 3318 /** 3319 * Text baseline. For details, see {@link CanvasTextBaseline}. 3320 * 3321 * @type { CanvasTextBaseline } 3322 * @syscap SystemCapability.ArkUI.ArkUI.Full 3323 * @since 9 3324 * @form 3325 */ 3326 /** 3327 * Text baseline. For details, see {@link CanvasTextBaseline}. 3328 * 3329 * @type { CanvasTextBaseline } 3330 * @syscap SystemCapability.ArkUI.ArkUI.Full 3331 * @crossplatform 3332 * @since 10 3333 * @form 3334 */ 3335 textBaseline: CanvasTextBaseline; 3336 3337 /** 3338 * Obtains the currently applied transformation matrix. 3339 * 3340 * @returns { Matrix2D } 3341 * @syscap SystemCapability.ArkUI.ArkUI.Full 3342 * @since 8 3343 */ 3344 /** 3345 * Obtains the currently applied transformation matrix. 3346 * 3347 * @returns { Matrix2D } 3348 * @syscap SystemCapability.ArkUI.ArkUI.Full 3349 * @since 9 3350 * @form 3351 */ 3352 /** 3353 * Obtains the currently applied transformation matrix. 3354 * 3355 * @returns { Matrix2D } 3356 * @syscap SystemCapability.ArkUI.ArkUI.Full 3357 * @crossplatform 3358 * @since 10 3359 * @form 3360 */ 3361 getTransform(): Matrix2D; 3362 3363 /** 3364 * Resets the current transformation matrix using the identity matrix 3365 * 3366 * @syscap SystemCapability.ArkUI.ArkUI.Full 3367 * @since 8 3368 */ 3369 /** 3370 * Resets the current transformation matrix using the identity matrix 3371 * 3372 * @syscap SystemCapability.ArkUI.ArkUI.Full 3373 * @since 9 3374 * @form 3375 */ 3376 /** 3377 * Resets the current transformation matrix using the identity matrix 3378 * 3379 * @syscap SystemCapability.ArkUI.ArkUI.Full 3380 * @crossplatform 3381 * @since 10 3382 * @form 3383 */ 3384 resetTransform(): void; 3385 3386 /** 3387 * Adds the effect of a rotation 3388 * 3389 * @param { number } angle - The radian of clockwise rotation, which can be converted to an angle value using the formula: 3390 * degree * Math.PI / 180 3391 * @syscap SystemCapability.ArkUI.ArkUI.Full 3392 * @since 8 3393 */ 3394 /** 3395 * Adds the effect of a rotation 3396 * 3397 * @param { number } angle - The radian of clockwise rotation, which can be converted to an angle value using the formula: 3398 * degree * Math.PI / 180 3399 * @syscap SystemCapability.ArkUI.ArkUI.Full 3400 * @since 9 3401 * @form 3402 */ 3403 /** 3404 * Adds the effect of a rotation 3405 * 3406 * @param { number } angle - The radian of clockwise rotation, which can be converted to an angle value using the formula: 3407 * degree * Math.PI / 180 3408 * @syscap SystemCapability.ArkUI.ArkUI.Full 3409 * @crossplatform 3410 * @since 10 3411 * @form 3412 */ 3413 rotate(angle: number): void; 3414 3415 /** 3416 * Increases the scaling effect of the X and Y axes. 3417 * 3418 * @param { number } x - Horizontal scaling factor 3419 * @param { number } y - Vertical scaling factor 3420 * @syscap SystemCapability.ArkUI.ArkUI.Full 3421 * @since 8 3422 */ 3423 /** 3424 * Increases the scaling effect of the X and Y axes. 3425 * 3426 * @param { number } x - Horizontal scaling factor 3427 * @param { number } y - Vertical scaling factor 3428 * @syscap SystemCapability.ArkUI.ArkUI.Full 3429 * @since 9 3430 * @form 3431 */ 3432 /** 3433 * Increases the scaling effect of the X and Y axes. 3434 * 3435 * @param { number } x - Horizontal scaling factor 3436 * @param { number } y - Vertical scaling factor 3437 * @syscap SystemCapability.ArkUI.ArkUI.Full 3438 * @crossplatform 3439 * @since 10 3440 * @form 3441 */ 3442 scale(x: number, y: number): void; 3443 3444 /** 3445 * Adds 2D transformation effects, including rotation, translation, and scaling. 3446 * The current transformation matrix will not be overwritten. Multiple transformations will be superimposed. 3447 * 3448 * @param { number } a - Horizontal Zoom 3449 * @param { number } b - Vertical Tilt 3450 * @param { number } c - Horizontal Tilt 3451 * @param { number } d - Vertical Zoom 3452 * @param { number } e - Horizontal movement 3453 * @param { number } f - Vertical movement 3454 * @syscap SystemCapability.ArkUI.ArkUI.Full 3455 * @since 8 3456 */ 3457 /** 3458 * Adds 2D transformation effects, including rotation, translation, and scaling. 3459 * The current transformation matrix will not be overwritten. Multiple transformations will be superimposed. 3460 * 3461 * @param { number } a - Horizontal Zoom 3462 * @param { number } b - Vertical Tilt 3463 * @param { number } c - Horizontal Tilt 3464 * @param { number } d - Vertical Zoom 3465 * @param { number } e - Horizontal movement 3466 * @param { number } f - Vertical movement 3467 * @syscap SystemCapability.ArkUI.ArkUI.Full 3468 * @since 9 3469 * @form 3470 */ 3471 /** 3472 * Adds 2D transformation effects, including rotation, translation, and scaling. 3473 * The current transformation matrix will not be overwritten. Multiple transformations will be superimposed. 3474 * 3475 * @param { number } a - Horizontal Zoom 3476 * @param { number } b - Vertical Tilt 3477 * @param { number } c - Horizontal Tilt 3478 * @param { number } d - Vertical Zoom 3479 * @param { number } e - Horizontal movement 3480 * @param { number } f - Vertical movement 3481 * @syscap SystemCapability.ArkUI.ArkUI.Full 3482 * @crossplatform 3483 * @since 10 3484 * @form 3485 */ 3486 setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; 3487 3488 /** 3489 * The 2D transformation effect is added. The current transformation matrix is not overwritten and 3490 * the transformations are superimposed for multiple times. 3491 * 3492 * @param { Matrix2D } transform - 2D transformation matrix. For details, see {@link Matrix2D}. 3493 * @syscap SystemCapability.ArkUI.ArkUI.Full 3494 * @since 8 3495 */ 3496 /** 3497 * The 2D transformation effect is added. The current transformation matrix is not overwritten and 3498 * the transformations are superimposed for multiple times. 3499 * 3500 * @param { Matrix2D } transform - 2D transformation matrix. For details, see {@link Matrix2D}. 3501 * @syscap SystemCapability.ArkUI.ArkUI.Full 3502 * @since 9 3503 * @form 3504 */ 3505 /** 3506 * The 2D transformation effect is added. The current transformation matrix is not overwritten and 3507 * the transformations are superimposed for multiple times. 3508 * 3509 * @param { Matrix2D } transform - 2D transformation matrix. For details, see {@link Matrix2D}. 3510 * @syscap SystemCapability.ArkUI.ArkUI.Full 3511 * @crossplatform 3512 * @since 10 3513 * @form 3514 */ 3515 setTransform(transform?: Matrix2D): void; 3516 3517 /** 3518 * Adds the 2D transformation effect, including rotation, translation, and scaling, 3519 * and overwrites the current transformation matrix. 3520 * 3521 * @param { number } a - Horizontal Zoom 3522 * @param { number } b - Vertical Tilt 3523 * @param { number } c - Horizontal Tilt 3524 * @param { number } d - Vertical Zoom 3525 * @param { number } e - Horizontal movement 3526 * @param { number } f - Vertical movement 3527 * @syscap SystemCapability.ArkUI.ArkUI.Full 3528 * @since 8 3529 */ 3530 /** 3531 * Adds the 2D transformation effect, including rotation, translation, and scaling, 3532 * and overwrites the current transformation matrix. 3533 * 3534 * @param { number } a - Horizontal Zoom 3535 * @param { number } b - Vertical Tilt 3536 * @param { number } c - Horizontal Tilt 3537 * @param { number } d - Vertical Zoom 3538 * @param { number } e - Horizontal movement 3539 * @param { number } f - Vertical movement 3540 * @syscap SystemCapability.ArkUI.ArkUI.Full 3541 * @since 9 3542 * @form 3543 */ 3544 /** 3545 * Adds the 2D transformation effect, including rotation, translation, and scaling, 3546 * and overwrites the current transformation matrix. 3547 * 3548 * @param { number } a - Horizontal Zoom 3549 * @param { number } b - Vertical Tilt 3550 * @param { number } c - Horizontal Tilt 3551 * @param { number } d - Vertical Zoom 3552 * @param { number } e - Horizontal movement 3553 * @param { number } f - Vertical movement 3554 * @syscap SystemCapability.ArkUI.ArkUI.Full 3555 * @crossplatform 3556 * @since 10 3557 * @form 3558 */ 3559 transform(a: number, b: number, c: number, d: number, e: number, f: number): void; 3560 3561 /** 3562 * Increases the translation effect of the X and Y axes 3563 * 3564 * @param { number } x - Horizontal movement distance 3565 * @param { number } y - Vertical travel distance 3566 * @syscap SystemCapability.ArkUI.ArkUI.Full 3567 * @since 8 3568 */ 3569 /** 3570 * Increases the translation effect of the X and Y axes 3571 * 3572 * @param { number } x - Horizontal movement distance 3573 * @param { number } y - Vertical travel distance 3574 * @syscap SystemCapability.ArkUI.ArkUI.Full 3575 * @since 9 3576 * @form 3577 */ 3578 /** 3579 * Increases the translation effect of the X and Y axes 3580 * 3581 * @param { number } x - Horizontal movement distance 3582 * @param { number } y - Vertical travel distance 3583 * @syscap SystemCapability.ArkUI.ArkUI.Full 3584 * @crossplatform 3585 * @since 10 3586 * @form 3587 */ 3588 translate(x: number, y: number): void; 3589 3590 /** 3591 * Set a PixelMap to the current context. The drawing content is synchronized to the PixelMap. 3592 * 3593 * @param { PixelMap } value - PixelMap object 3594 * @syscap SystemCapability.ArkUI.ArkUI.Full 3595 * @since 8 3596 */ 3597 /** 3598 * Set a PixelMap to the current context. The drawing content is synchronized to the PixelMap. 3599 * 3600 * @param { PixelMap } value - PixelMap object 3601 * @syscap SystemCapability.ArkUI.ArkUI.Full 3602 * @crossplatform 3603 * @since 10 3604 */ 3605 setPixelMap(value?: PixelMap): void; 3606 3607 /** 3608 * transfer ImageBitmap to content. 3609 * 3610 * @param { ImageBitmap } bitmap 3611 * @syscap SystemCapability.ArkUI.ArkUI.Full 3612 * @since 8 3613 */ 3614 /** 3615 * transfer ImageBitmap to content. 3616 * 3617 * @param { ImageBitmap } bitmap 3618 * @syscap SystemCapability.ArkUI.ArkUI.Full 3619 * @since 9 3620 * @form 3621 */ 3622 /** 3623 * transfer ImageBitmap to content. 3624 * 3625 * @param { ImageBitmap } bitmap 3626 * @syscap SystemCapability.ArkUI.ArkUI.Full 3627 * @crossplatform 3628 * @since 10 3629 * @form 3630 */ 3631 transferFromImageBitmap(bitmap: ImageBitmap): void; 3632} 3633 3634/** 3635 * Draw context object for the Canvas component. 3636 * 3637 * @extends CanvasRenderer 3638 * @syscap SystemCapability.ArkUI.ArkUI.Full 3639 * @since 8 3640 */ 3641/** 3642 * Draw context object for the Canvas component. 3643 * 3644 * @extends CanvasRenderer 3645 * @syscap SystemCapability.ArkUI.ArkUI.Full 3646 * @since 9 3647 * @form 3648 */ 3649/** 3650 * Draw context object for the Canvas component. 3651 * 3652 * @extends CanvasRenderer 3653 * @syscap SystemCapability.ArkUI.ArkUI.Full 3654 * @crossplatform 3655 * @since 10 3656 * @form 3657 */ 3658declare class CanvasRenderingContext2D extends CanvasRenderer { 3659 /** 3660 * The default value is 0, which is bound to the height of the specified canvas. The value is read-only. 3661 * 3662 * @type { number } 3663 * @syscap SystemCapability.ArkUI.ArkUI.Full 3664 * @since 8 3665 */ 3666 /** 3667 * The default value is 0, which is bound to the height of the specified canvas. The value is read-only. 3668 * 3669 * @type { number } 3670 * @syscap SystemCapability.ArkUI.ArkUI.Full 3671 * @since 9 3672 * @form 3673 */ 3674 /** 3675 * The default value is 0, which is bound to the height of the specified canvas. The value is read-only. 3676 * 3677 * @type { number } 3678 * @syscap SystemCapability.ArkUI.ArkUI.Full 3679 * @crossplatform 3680 * @since 10 3681 * @form 3682 */ 3683 readonly height: number; 3684 3685 /** 3686 * The default value is 0, which is bound to the width of the specified canvas. The value is read-only. 3687 * 3688 * @type { number } 3689 * @syscap SystemCapability.ArkUI.ArkUI.Full 3690 * @since 8 3691 */ 3692 /** 3693 * The default value is 0, which is bound to the width of the specified canvas. The value is read-only. 3694 * 3695 * @type { number } 3696 * @syscap SystemCapability.ArkUI.ArkUI.Full 3697 * @since 9 3698 * @form 3699 */ 3700 /** 3701 * The default value is 0, which is bound to the width of the specified canvas. The value is read-only. 3702 * 3703 * @type { number } 3704 * @syscap SystemCapability.ArkUI.ArkUI.Full 3705 * @crossplatform 3706 * @since 10 3707 * @form 3708 */ 3709 readonly width: number; 3710 3711 /** 3712 * Generate a character string in the data url format. 3713 * 3714 * @param { string } type - Image format. The default value is image/png. 3715 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3716 * If the value is out of the range, the default value 0.92 is used. 3717 * @returns { string } 3718 * @syscap SystemCapability.ArkUI.ArkUI.Full 3719 * @since 8 3720 */ 3721 /** 3722 * Generate a character string in the data url format. 3723 * 3724 * @param { string } type - Image format. The default value is image/png. 3725 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3726 * If the value is out of the range, the default value 0.92 is used. 3727 * @returns { string } 3728 * @syscap SystemCapability.ArkUI.ArkUI.Full 3729 * @since 9 3730 * @form 3731 */ 3732 /** 3733 * Generate a character string in the data url format. 3734 * 3735 * @param { string } type - Image format. The default value is image/png. 3736 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3737 * If the value is out of the range, the default value 0.92 is used. 3738 * @returns { string } 3739 * @syscap SystemCapability.ArkUI.ArkUI.Full 3740 * @crossplatform 3741 * @since 10 3742 * @form 3743 */ 3744 toDataURL(type?: string, quality?: any): string; 3745 3746 /** 3747 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3748 * 3749 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3750 * @syscap SystemCapability.ArkUI.ArkUI.Full 3751 * @since 8 3752 */ 3753 /** 3754 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3755 * 3756 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3757 * @syscap SystemCapability.ArkUI.ArkUI.Full 3758 * @since 9 3759 * @form 3760 */ 3761 /** 3762 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3763 * 3764 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3765 * @syscap SystemCapability.ArkUI.ArkUI.Full 3766 * @crossplatform 3767 * @since 10 3768 * @form 3769 */ 3770 constructor(settings?: RenderingContextSettings); 3771} 3772 3773/** 3774 * Draw context object for the OffscreenCanvas component. 3775 * 3776 * @extends CanvasRenderer 3777 * @syscap SystemCapability.ArkUI.ArkUI.Full 3778 * @since 8 3779 */ 3780/** 3781 * Draw context object for the OffscreenCanvas component. 3782 * 3783 * @extends CanvasRenderer 3784 * @syscap SystemCapability.ArkUI.ArkUI.Full 3785 * @since 9 3786 * @form 3787 */ 3788/** 3789 * Draw context object for the OffscreenCanvas component. 3790 * 3791 * @extends CanvasRenderer 3792 * @syscap SystemCapability.ArkUI.ArkUI.Full 3793 * @crossplatform 3794 * @since 10 3795 * @form 3796 */ 3797declare class OffscreenCanvasRenderingContext2D extends CanvasRenderer { 3798 /** 3799 * Generate a character string in the data url format. 3800 * 3801 * @param { string } type - Image format. The default value is image/png. 3802 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3803 * If the value is out of the range, the default value 0.92 is used. 3804 * @returns { string } 3805 * @syscap SystemCapability.ArkUI.ArkUI.Full 3806 * @since 8 3807 */ 3808 /** 3809 * Generate a character string in the data url format. 3810 * 3811 * @param { string } type - Image format. The default value is image/png. 3812 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3813 * If the value is out of the range, the default value 0.92 is used. 3814 * @returns { string } 3815 * @syscap SystemCapability.ArkUI.ArkUI.Full 3816 * @since 9 3817 * @form 3818 */ 3819 /** 3820 * Generate a character string in the data url format. 3821 * 3822 * @param { string } type - Image format. The default value is image/png. 3823 * @param { any } quality - If the image format is image/jpeg or image/webp, you can select the image quality from 0 to 1. 3824 * If the value is out of the range, the default value 0.92 is used. 3825 * @returns { string } 3826 * @syscap SystemCapability.ArkUI.ArkUI.Full 3827 * @crossplatform 3828 * @since 10 3829 * @form 3830 */ 3831 toDataURL(type?: string, quality?: any): string; 3832 3833 /** 3834 * transfer the content to ImageBitmap 3835 * 3836 * @returns { ImageBitmap } 3837 * @syscap SystemCapability.ArkUI.ArkUI.Full 3838 * @since 8 3839 */ 3840 /** 3841 * transfer the content to ImageBitmap 3842 * 3843 * @returns { ImageBitmap } 3844 * @syscap SystemCapability.ArkUI.ArkUI.Full 3845 * @since 9 3846 * @form 3847 */ 3848 /** 3849 * transfer the content to ImageBitmap 3850 * 3851 * @returns { ImageBitmap } 3852 * @syscap SystemCapability.ArkUI.ArkUI.Full 3853 * @crossplatform 3854 * @since 10 3855 * @form 3856 */ 3857 transferToImageBitmap(): ImageBitmap; 3858 3859 /** 3860 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3861 * 3862 * @param { number } width - the width of the OffscreenCanvas 3863 * @param { number } height - the height of the OffscreenCanvas 3864 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3865 * @syscap SystemCapability.ArkUI.ArkUI.Full 3866 * @since 8 3867 */ 3868 /** 3869 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3870 * 3871 * @param { number } width - the width of the OffscreenCanvas 3872 * @param { number } height - the height of the OffscreenCanvas 3873 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3874 * @syscap SystemCapability.ArkUI.ArkUI.Full 3875 * @since 9 3876 * @form 3877 */ 3878 /** 3879 * Constructor of the canvas drawing context object, which is used to create a drawing context object. 3880 * 3881 * @param { number } width - the width of the OffscreenCanvas 3882 * @param { number } height - the height of the OffscreenCanvas 3883 * @param { RenderingContextSettings } settings - Drawing attribute. For details, see {@link RenderingContextSettings}. 3884 * @syscap SystemCapability.ArkUI.ArkUI.Full 3885 * @crossplatform 3886 * @since 10 3887 * @form 3888 */ 3889 constructor(width: number, height: number, settings?: RenderingContextSettings); 3890} 3891 3892/** 3893 * Draw an object off the screen. The drawing content is not directly displayed on the screen. 3894 * 3895 * @extends CanvasRenderer 3896 * @syscap SystemCapability.ArkUI.ArkUI.Full 3897 * @since 8 3898 */ 3899/** 3900 * Draw an object off the screen. The drawing content is not directly displayed on the screen. 3901 * 3902 * @extends CanvasRenderer 3903 * @syscap SystemCapability.ArkUI.ArkUI.Full 3904 * @since 9 3905 * @form 3906 */ 3907/** 3908 * Draw an object off the screen. The drawing content is not directly displayed on the screen. 3909 * 3910 * @extends CanvasRenderer 3911 * @syscap SystemCapability.ArkUI.ArkUI.Full 3912 * @crossplatform 3913 * @since 10 3914 * @form 3915 */ 3916declare class OffscreenCanvas extends CanvasRenderer { 3917 /** 3918 * Height of the off-screen canvas. 3919 * 3920 * @type { number } 3921 * @syscap SystemCapability.ArkUI.ArkUI.Full 3922 * @since 8 3923 */ 3924 /** 3925 * Height of the off-screen canvas. 3926 * 3927 * @type { number } 3928 * @syscap SystemCapability.ArkUI.ArkUI.Full 3929 * @since 9 3930 * @form 3931 */ 3932 /** 3933 * Height of the off-screen canvas. 3934 * 3935 * @type { number } 3936 * @syscap SystemCapability.ArkUI.ArkUI.Full 3937 * @crossplatform 3938 * @since 10 3939 * @form 3940 */ 3941 height: number; 3942 3943 /** 3944 * Width of the off-screen canvas. 3945 * 3946 * @type { number } 3947 * @syscap SystemCapability.ArkUI.ArkUI.Full 3948 * @since 8 3949 */ 3950 /** 3951 * Width of the off-screen canvas. 3952 * 3953 * @type { number } 3954 * @syscap SystemCapability.ArkUI.ArkUI.Full 3955 * @since 9 3956 * @form 3957 */ 3958 /** 3959 * Width of the off-screen canvas. 3960 * 3961 * @type { number } 3962 * @syscap SystemCapability.ArkUI.ArkUI.Full 3963 * @crossplatform 3964 * @since 10 3965 * @form 3966 */ 3967 width: number; 3968 3969 /** 3970 * Exports rendered content as an ImageBitmap object 3971 * 3972 * @returns { ImageBitmap } 3973 * @syscap SystemCapability.ArkUI.ArkUI.Full 3974 * @since 8 3975 */ 3976 /** 3977 * Exports rendered content as an ImageBitmap object 3978 * 3979 * @returns { ImageBitmap } 3980 * @syscap SystemCapability.ArkUI.ArkUI.Full 3981 * @since 9 3982 * @form 3983 */ 3984 /** 3985 * Exports rendered content as an ImageBitmap object 3986 * 3987 * @returns { ImageBitmap } 3988 * @syscap SystemCapability.ArkUI.ArkUI.Full 3989 * @crossplatform 3990 * @since 10 3991 * @form 3992 */ 3993 transferToImageBitmap(): ImageBitmap; 3994 3995 /** 3996 * Creates the context from the current OffscreenCanvas. 3997 * 3998 * @param { "2d" } contextType - The context type, only "2d" be supported now. 3999 * "2d": Creates a {@link OffscreenCanvasRenderingContext2D} object representing a two-dimensional rendering context. 4000 * @param { RenderingContextSettings } options - Drawing attribute. For details, see {@link RenderingContextSettings}. 4001 * @returns { OffscreenCanvasRenderingContext2D } The rendering context of offscreen canvas, see {@link OffscreenCanvasRenderingContext2D}. 4002 * @syscap SystemCapability.ArkUI.ArkUI.Full 4003 * @crossplatform 4004 * @since 10 4005 */ 4006 getContext(contextType: "2d", options?: RenderingContextSettings): OffscreenCanvasRenderingContext2D; 4007 4008 /** 4009 * Constructor of the off-screen canvas, which is used to create an off-screen canvas object. 4010 * 4011 * @param { number } width - Width of the off-screen canvas. 4012 * @param { number } height - Height of the off-screen canvas. 4013 * @syscap SystemCapability.ArkUI.ArkUI.Full 4014 * @since 8 4015 */ 4016 /** 4017 * Constructor of the off-screen canvas, which is used to create an off-screen canvas object. 4018 * 4019 * @param { number } width - Width of the off-screen canvas. 4020 * @param { number } height - Height of the off-screen canvas. 4021 * @syscap SystemCapability.ArkUI.ArkUI.Full 4022 * @since 9 4023 * @form 4024 */ 4025 /** 4026 * Constructor of the off-screen canvas, which is used to create an off-screen canvas object. 4027 * 4028 * @param { number } width - Width of the off-screen canvas. 4029 * @param { number } height - Height of the off-screen canvas. 4030 * @syscap SystemCapability.ArkUI.ArkUI.Full 4031 * @crossplatform 4032 * @since 10 4033 * @form 4034 */ 4035 constructor(width: number, height: number); 4036} 4037 4038/** 4039 *TextTimer component, which provides the text timer capability. 4040 * 4041 * @interface CanvasInterface 4042 * @syscap SystemCapability.ArkUI.ArkUI.Full 4043 * @since 8 4044 */ 4045/** 4046 *TextTimer component, which provides the text timer capability. 4047 * 4048 * @interface CanvasInterface 4049 * @syscap SystemCapability.ArkUI.ArkUI.Full 4050 * @since 9 4051 * @form 4052 */ 4053/** 4054 *TextTimer component, which provides the text timer capability. 4055 * 4056 * @interface CanvasInterface 4057 * @syscap SystemCapability.ArkUI.ArkUI.Full 4058 * @crossplatform 4059 * @since 10 4060 * @form 4061 */ 4062interface CanvasInterface { 4063 /** 4064 * Construct a canvas component. 4065 * 4066 * @param { CanvasRenderingContext2D } context - Canvas context object. For details, see {@link CanvasRenderingContext2D}. 4067 * @returns { CanvasAttribute } 4068 * @syscap SystemCapability.ArkUI.ArkUI.Full 4069 * @since 8 4070 */ 4071 /** 4072 * Construct a canvas component. 4073 * 4074 * @param { CanvasRenderingContext2D } context - Canvas context object. For details, see {@link CanvasRenderingContext2D}. 4075 * @returns { CanvasAttribute } 4076 * @syscap SystemCapability.ArkUI.ArkUI.Full 4077 * @since 9 4078 * @form 4079 */ 4080 /** 4081 * Construct a canvas component. 4082 * 4083 * @param { CanvasRenderingContext2D } context - Canvas context object. For details, see {@link CanvasRenderingContext2D}. 4084 * @returns { CanvasAttribute } 4085 * @syscap SystemCapability.ArkUI.ArkUI.Full 4086 * @crossplatform 4087 * @since 10 4088 * @form 4089 */ 4090 (context?: CanvasRenderingContext2D): CanvasAttribute; 4091} 4092 4093declare class CanvasAttribute extends CommonMethod<CanvasAttribute> { 4094 /** 4095 * Event notification after the canvas component is constructed. You can draw the canvas at this time. 4096 * 4097 * @param { function } event 4098 * @returns { CanvasAttribute } 4099 * @syscap SystemCapability.ArkUI.ArkUI.Full 4100 * @since 8 4101 */ 4102 /** 4103 * Event notification after the canvas component is constructed. You can draw the canvas at this time. 4104 * 4105 * @param { function } event 4106 * @returns { CanvasAttribute } 4107 * @syscap SystemCapability.ArkUI.ArkUI.Full 4108 * @since 9 4109 * @form 4110 */ 4111 /** 4112 * Event notification after the canvas component is constructed. You can draw the canvas at this time. 4113 * 4114 * @param { function } event 4115 * @returns { CanvasAttribute } 4116 * @syscap SystemCapability.ArkUI.ArkUI.Full 4117 * @crossplatform 4118 * @since 10 4119 * @form 4120 */ 4121 onReady(event: () => void): CanvasAttribute; 4122} 4123 4124/** 4125 * Defines Canvas Component. 4126 * 4127 * @syscap SystemCapability.ArkUI.ArkUI.Full 4128 * @since 8 4129 */ 4130/** 4131 * Defines Canvas Component. 4132 * 4133 * @syscap SystemCapability.ArkUI.ArkUI.Full 4134 * @since 9 4135 * @form 4136 */ 4137/** 4138 * Defines Canvas Component. 4139 * 4140 * @syscap SystemCapability.ArkUI.ArkUI.Full 4141 * @crossplatform 4142 * @since 10 4143 * @form 4144 */ 4145declare const Canvas: CanvasInterface; 4146 4147/** 4148 * Defines Canvas Component instance. 4149 * 4150 * @syscap SystemCapability.ArkUI.ArkUI.Full 4151 * @since 8 4152 */ 4153/** 4154 * Defines Canvas Component instance. 4155 * 4156 * @syscap SystemCapability.ArkUI.ArkUI.Full 4157 * @since 9 4158 * @form 4159 */ 4160/** 4161 * Defines Canvas Component instance. 4162 * 4163 * @syscap SystemCapability.ArkUI.ArkUI.Full 4164 * @crossplatform 4165 * @since 10 4166 * @form 4167 */ 4168declare const CanvasInstance: CanvasAttribute; 4169