• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2020-2021 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
16import { Image, ImageData, ImageBitmap } from "./global";
17import image from "../../@ohos.multimedia.image";
18import { CanvasPattern } from './canvaspattern';
19
20/**
21 * Defines the focus param.
22 *
23 * @interface FocusParamObj
24 * @syscap SystemCapability.ArkUI.ArkUI.Full
25 * @since 3
26 */
27export interface FocusParamObj {
28  /**
29   * Whether needs to focus.
30   *
31   * @type { boolean }
32   * @syscap SystemCapability.ArkUI.ArkUI.Full
33   * @since 3
34   */
35  focus: boolean;
36}
37
38/**
39 * RectObj
40 *
41 * @interface RectObj
42 * @syscap SystemCapability.ArkUI.ArkUI.Full
43 * @since 6
44 */
45export interface RectObj {
46  /**
47   * @type { number }
48   * @syscap SystemCapability.ArkUI.ArkUI.Full
49   * @since 6
50   */
51  width: number;
52  /**
53   * @type { number }
54   * @syscap SystemCapability.ArkUI.ArkUI.Full
55   * @since 6
56   */
57  height: number;
58  /**
59   * @type { number }
60   * @syscap SystemCapability.ArkUI.ArkUI.Full
61   * @since 6
62   */
63  left: number;
64  /**
65   * @type { number }
66   * @syscap SystemCapability.ArkUI.ArkUI.Full
67   * @since 6
68   */
69  top: number;
70}
71
72/**
73 * ContextAttrOptions
74 *
75 * @interface ContextAttrOptions
76 * @syscap SystemCapability.ArkUI.ArkUI.Full
77 * @since 6
78 */
79export interface ContextAttrOptions {
80  /**
81   * @type { boolean }
82   * @syscap SystemCapability.ArkUI.ArkUI.Full
83   * @since 6
84   */
85  antialias: boolean;
86}
87
88/**
89 * AnimateStyle
90 *
91 * @interface AnimateStyle
92 * @syscap SystemCapability.ArkUI.ArkUI.Full
93 * @since 4
94 */
95export interface AnimateStyle {
96  /**
97   * Width value applied to the component after the animation is executed.
98   *
99   * @type { number }
100   * @syscap SystemCapability.ArkUI.ArkUI.Full
101   * @since 4
102   */
103  width: number;
104  /**
105   * Height value applied to the component after the animation is executed.
106   *
107   * @type { number }
108   * @syscap SystemCapability.ArkUI.ArkUI.Full
109   * @since 4
110   */
111  height: number;
112  /**
113   * left offset applied to the component after the animation is executed.
114   *
115   * @type { number }
116   * @syscap SystemCapability.ArkUI.ArkUI.Full
117   * @since 4
118   */
119  left: number;
120  /**
121   * top offset applied to the component after the animation is executed.
122   *
123   * @type { number }
124   * @syscap SystemCapability.ArkUI.ArkUI.Full
125   * @since 4
126   */
127  top: number;
128  /**
129   * right offset applied to the component after the animation is executed.
130   *
131   * @type { number }
132   * @syscap SystemCapability.ArkUI.ArkUI.Full
133   * @since 4
134   */
135  right: number;
136  /**
137   * bottom offset applied to the component after the animation is executed.
138   *
139   * @type { number }
140   * @syscap SystemCapability.ArkUI.ArkUI.Full
141   * @since 4
142   */
143  bottom: number;
144  /**
145   * Background color applied to the component after the animation is executed.
146   * The default value is none.
147   *
148   * @type { string }
149   * @syscap SystemCapability.ArkUI.ArkUI.Full
150   * @since 4
151   */
152  backgroundColor: string;
153  /**
154   * Opacity applied to the component. The value ranges from 0 to 1.
155   * The default value is 1.
156   *
157   * @type { number }
158   * @syscap SystemCapability.ArkUI.ArkUI.Full
159   * @since 4
160   */
161  opacity: number;
162  /**
163   * The value format is "x y", in percentage or pixels.
164   * The first value indicates the horizontal position, and the second value indicates the vertical position.
165   * If only one value is specified, the other value is 50% by default.
166   *
167   * @type { string }
168   * @syscap SystemCapability.ArkUI.ArkUI.Full
169   * @since 4
170   */
171  backgroundPosition: string;
172  /**
173   * Origin position of the transformed element.
174   * The first value indicates the x-axis position. The value can be left, center, right, a length, or percentage.
175   * The second value indicates the y-axis position. The value can be top, center, bottom, a length, or a percentage.
176   *
177   * @type { string }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @since 4
180   */
181  transformOrigin: string;
182  /**
183   * Transformation type applied to an element.
184   *
185   * @type { "none" | TransformObject }
186   * @syscap SystemCapability.ArkUI.ArkUI.Full
187   * @since 4
188   */
189  transform: "none" | TransformObject;
190  /**
191   * The value of offset must be within (0.0,1.0] and sorted in ascending order if it is provided.
192   * If there are only two frames, offset can be left empty.
193   * If there are more than two frames, offset is mandatory.
194   *
195   * @type { ?number }
196   * @syscap SystemCapability.ArkUI.ArkUI.Full
197   * @since 4
198   */
199  offset?: number;
200}
201
202/**
203 * TransformObject
204 *
205 * @interface TransformObject
206 * @syscap SystemCapability.ArkUI.ArkUI.Full
207 * @since 4
208 */
209export interface TransformObject {
210  /**
211   * Defines a 2D transformation, using a matrix of six values..
212   *
213   * @param { number } scaleX - the scale value for x-axis
214   * @param { number } skewX - the skew value for y-axis
215   * @param { number } skewY - the skew value for x-axis
216   * @param { number } scaleY - the scale value for y-axis
217   * @param { number } translateX - the translate value for x-axis
218   * @param { number } translateY - the translate value for y-axis
219   * @syscap SystemCapability.ArkUI.ArkUI.Full
220   * @since 6
221   */
222  matrix(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number): void;
223  /**
224   * Defines a 3D transformation using a 4x4 matrix of 16 values.
225   *
226   * @param { number } n00 - the value of the 0 row and 0 column of the 4x4 matrix
227   * @param { number } n01 - the value of the 0 row and 1 column of the 4x4 matrix
228   * @param { number } n02 - the value of the 0 row and 2 column of the 4x4 matrix
229   * @param { number } n03 - the value of the 0 row and 3 column of the 4x4 matrix
230   * @param { number } n10 - the value of the 1 row and 0 column of the 4x4 matrix
231   * @param { number } n11 - the value of the 1 row and 1 column of the 4x4 matrix
232   * @param { number } n12 - the value of the 1 row and 2 column of the 4x4 matrix
233   * @param { number } n13 - the value of the 1 row and 3 column of the 4x4 matrix
234   * @param { number } n20 - the value of the 2 row and 0 column of the 4x4 matrix
235   * @param { number } n21 - the value of the 2 row and 1 column of the 4x4 matrix
236   * @param { number } n22 - the value of the 2 row and 2 column of the 4x4 matrix
237   * @param { number } n23 - the value of the 2 row and 3 column of the 4x4 matrix
238   * @param { number } n30 - the value of the 3 row and 0 column of the 4x4 matrix
239   * @param { number } n31 - the value of the 3 row and 1 column of the 4x4 matrix
240   * @param { number } n32 - the value of the 3 row and 2 column of the 4x4 matrix
241   * @param { number } n33 - the value of the 3 row and 3 column of the 4x4 matrix
242   * @syscap SystemCapability.ArkUI.ArkUI.Full
243   * @since 6
244   */
245  matrix3d(
246    n00: number,
247    n01: number,
248    n02: number,
249    n03: number,
250    n10: number,
251    n11: number,
252    n12: number,
253    n13: number,
254    n20: number,
255    n21: number,
256    n22: number,
257    n23: number,
258    n30: number,
259    n31: number,
260    n32: number,
261    n33: number,
262  ): void;
263  /**
264   * Defines 2D transformations for translation of the X and Y axes
265   *
266   * @param { number } x - the translate value for x-axis
267   * @param { number } y - the translate value for y-axis
268   * @syscap SystemCapability.ArkUI.ArkUI.Full
269   * @since 4
270   */
271  translate(x: number, y: number): void;
272  /**
273   * Defines 3D transformations for translation of the X / Y / Z axes
274   *
275   * @param { number } x - the translate value for x-axis
276   * @param { number } y - the translate value for y-axis
277   * @param { number } z - the translate value for z-axis
278   * @syscap SystemCapability.ArkUI.ArkUI.Full
279   * @since 6
280   */
281  translate3d(x: number, y: number, z: number): void;
282  /**
283   * Defines 2D transformations for translation of the X axes
284   *
285   * @param { number } x - the translate value for x-axis
286   * @syscap SystemCapability.ArkUI.ArkUI.Full
287   * @since 4
288   */
289  translateX(x: number): void;
290  /**
291   * Defines 2D transformations for translation of the Y axes
292   *
293   * @param { number } y - the translate value for y-axis
294   * @syscap SystemCapability.ArkUI.ArkUI.Full
295   * @since 4
296   */
297  translateY(y: number): void;
298  /**
299   * Defines 3D transformations for translation of the Z axes
300   *
301   * @param { number } z the translate value for z-axis
302   * @syscap SystemCapability.ArkUI.ArkUI.Full
303   * @since 6
304   */
305  translateZ(z: number): void;
306  /**
307   * Defines 2D transformations for scaling of the X and Y axes
308   *
309   * @param { number } x - the scale value for x-axis
310   * @param { number } y - the scale value for y-axis
311   * @syscap SystemCapability.ArkUI.ArkUI.Full
312   * @since 4
313   */
314  scale(x: number, y: number): void;
315  /**
316   * Defines 3D transformations for scaling of the X / Y / Z axes
317   *
318   * @param { number } x - the scale value for x-axis
319   * @param { number } y - the scale value for y-axis
320   * @param { number } z - the scale value for z-axis
321   * @syscap SystemCapability.ArkUI.ArkUI.Full
322   * @since 6
323   */
324  scale3d(x: number, y: number, z: number): void;
325  /**
326   * Defines 2D transformations for scaling of the X axes
327   *
328   * @param { number } x - the scale value for x-axis
329   * @syscap SystemCapability.ArkUI.ArkUI.Full
330   * @since 4
331   */
332  scaleX(x: number): void;
333  /**
334   * Defines 2D transformations for scaling of the Y axes
335   *
336   * @param { number } y - the scale value for y-axis
337   * @syscap SystemCapability.ArkUI.ArkUI.Full
338   * @since 4
339   */
340  scaleY(y: number): void;
341  /**
342   * Defines 3D transformations for scaling of the Z axes
343   *
344   * @param { number } z - the scale value for z-axis
345   * @syscap SystemCapability.ArkUI.ArkUI.Full
346   * @since 6
347   */
348  scaleZ(z: number): void;
349  /**
350   * Define the 2D rotation and specify the angle in the parameters.
351   *
352   * @param { number } angle - the rotate value for z-axis
353   * @syscap SystemCapability.ArkUI.ArkUI.Full
354   * @since 4
355   */
356  rotate(angle: number): void;
357  /**
358   * Defines a 3D transformation for rotating the X / Y / Z axes.
359   *
360   * @param { number } x - the vector value of the x-axis
361   * @param { number } y - the vector value of the y-axis
362   * @param { number } z - the vector value of the z-axis
363   * @param { number } angle - the rotate value for x&y&z vector.
364   * @syscap SystemCapability.ArkUI.ArkUI.Full
365   * @since 6
366   */
367  rotate3d(x: number, y: number, z: number, angle: number): void;
368  /**
369   * Defines 3D transformations for rotating of the X axes.
370   *
371   * @param { number } angle - the scale value for x-axis
372   * @syscap SystemCapability.ArkUI.ArkUI.Full
373   * @since 4
374   */
375  rotateX(angle: number): void;
376  /**
377   * Defines 3D transformations for rotating of the Y axes.
378   *
379   * @param { number } angle - the scale value for y-axis
380   * @syscap SystemCapability.ArkUI.ArkUI.Full
381   * @since 4
382   */
383  rotateY(angle: number): void;
384  /**
385   * Defines 3D transformations for rotating of the Z axes.
386   *
387   * @param { number } angle - the scale value for z-axis
388   * @syscap SystemCapability.ArkUI.ArkUI.Full
389   * @since 6
390   */
391  rotateZ(angle: number): void;
392  /**
393   * Defines the 2D skew transition along the X and Y axes.
394   *
395   * @param { number } xAngle - the angle of inclination along the x axis.
396   * @param { number } yAngle - the angle of inclination along the y axis.
397   * @syscap SystemCapability.ArkUI.ArkUI.Full
398   * @since 6
399   */
400  skew(xAngle: number, yAngle: number): void;
401  /**
402   * Defines the 2D skew transition along the X axes.
403   *
404   * @param { number } angle - the angle of inclination along the x axis.
405   * @syscap SystemCapability.ArkUI.ArkUI.Full
406   * @since 6
407   */
408  skewX(angle: number): void;
409  /**
410   * Defines the 2D skew transition along the Y axes.
411   *
412   * @param { number } angle - the angle of inclination along the y axis.
413   * @syscap SystemCapability.ArkUI.ArkUI.Full
414   * @since 6
415   */
416  skewY(angle: number): void;
417  /**
418   * Defines a perspective view for the 3D transformation element.
419   *
420   * @param { number } verticalDistance - the vertical distance from the observation point to the component plane.
421   * @syscap SystemCapability.ArkUI.ArkUI.Full
422   * @since 6
423   */
424  perspective(verticalDistance: number): void;
425}
426
427/**
428 * AnimateOptions
429 *
430 * @interface AnimateOptions
431 * @syscap SystemCapability.ArkUI.ArkUI.Full
432 * @since 4
433 */
434export interface AnimateOptions {
435  /**
436   * Duration of the animation, in milliseconds.
437   * The default value is 0.
438   *
439   * @type { number }
440   * @syscap SystemCapability.ArkUI.ArkUI.Full
441   * @since 4
442   */
443  duration: number;
444
445  /**
446   * Time curve of the animation. For details about the supported types.
447   * linear The animation speed keeps unchanged.
448   * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0).
449   * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0).
450   * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0).
451   * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0).
452   * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0).
453   * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0).
454   * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0).
455   * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0).
456   * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0).
457   * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0).
458   * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0).
459   * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0).
460   * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function.
461   * The x and y values of each input parameter must be between 0 and 1.
462   * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end.
463   * The default value is ease.
464   *
465   * @type { string }
466   * @syscap SystemCapability.ArkUI.ArkUI.Full
467   * @since 4
468   */
469  easing: string;
470
471  /**
472   * Delay for the animation start. The default value indicates no delay.
473   * The default value is 0.
474   *
475   * @type { number }
476   * @syscap SystemCapability.ArkUI.ArkUI.Full
477   * @since 4
478   */
479  delay: number;
480
481  /**
482   * Number of times the animation will be played. number indicates a fixed number of playback operations,
483   * and Infinity indicates an unlimited number of playback operations.
484   * The default value is 1.
485   *
486   * @type { number | string }
487   * @syscap SystemCapability.ArkUI.ArkUI.Full
488   * @since 4
489   */
490  iterations: number | string;
491
492  /**
493   * The animation playback mode.
494   * The default value is "normal".
495   *
496   * @type { "normal" | "reverse" | "alternate" | "alternate-reverse" }
497   * @syscap SystemCapability.ArkUI.ArkUI.Full
498   * @since 6
499   */
500  direction: "normal" | "reverse" | "alternate" | "alternate-reverse";
501
502  /**
503   * Whether to resume to the initial state after the animation is executed.
504   * none: The initial state is restored after the animation is executed.
505   * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed.
506   *
507   * @type { "none" | "forwards" | "backwards" | "both" }
508   * @syscap SystemCapability.ArkUI.ArkUI.Full
509   * @since 4
510   */
511  fill: "none" | "forwards" | "backwards" | "both";
512}
513
514/**
515 * AnimationResult
516 *
517 * @interface AnimationResult
518 * @syscap SystemCapability.ArkUI.ArkUI.Full
519 * @since 4
520 */
521export interface AnimationResult {
522  /**
523   * Read-only attribute, which indicates whether the animation playback is complete.
524   *
525   * @type { boolean }
526   * @syscap SystemCapability.ArkUI.ArkUI.Full
527   * @since 4
528   */
529  finished: boolean;
530  /**
531   * Read-only attribute, which indicates whether an animation is waiting for the completion of other asynchronous operations
532   * (for example, start an animation with a delay).
533   *
534   * @type { boolean }
535   * @syscap SystemCapability.ArkUI.ArkUI.Full
536   * @since 4
537   */
538  pending: boolean;
539  /**
540   * Animation running state:
541   * idle: The animation is not running (playback ended or not started).
542   * running: The animation is running.
543   * paused: The animation is paused.
544   * finished: Animation playback ends.
545   *
546   * @type { string }
547   * @syscap SystemCapability.ArkUI.ArkUI.Full
548   * @since 4
549   */
550  playstate: string;
551  /**
552   * Animation start time. This attribute is similar to that of delay in the options parameters.
553   *
554   * @type { number }
555   * @syscap SystemCapability.ArkUI.ArkUI.Full
556   * @since 4
557   */
558  startTime: number;
559  /**
560   * Starts the animation.
561   *
562   * @syscap SystemCapability.ArkUI.ArkUI.Full
563   * @since 4
564   */
565  play(): void;
566  /**
567   * Ends the animation.
568   *
569   * @syscap SystemCapability.ArkUI.ArkUI.Full
570   * @since 4
571   */
572  finish(): void;
573  /**
574   * Pauses the animation.
575   *
576   * @syscap SystemCapability.ArkUI.ArkUI.Full
577   * @since 4
578   */
579  pause(): void;
580  /**
581   * Cancels the animation.
582   *
583   * @syscap SystemCapability.ArkUI.ArkUI.Full
584   * @since 4
585   */
586  cancel(): void;
587  /**
588   * Plays the animation in reverse direction.
589   *
590   * @syscap SystemCapability.ArkUI.ArkUI.Full
591   * @since 4
592   */
593  reverse(): void;
594  /**
595   * The animation is started.
596   *
597   * @type { function }
598   * @syscap SystemCapability.ArkUI.ArkUI.Full
599   * @since 4
600   */
601  onstart: () => void;
602  /**
603   * The animation is finished.
604   *
605   * @type { function }
606   * @syscap SystemCapability.ArkUI.ArkUI.Full
607   * @since 4
608   */
609  onfinish: () => void;
610  /**
611   * The animation is canceled.
612   *
613   * @type { function }
614   * @syscap SystemCapability.ArkUI.ArkUI.Full
615   * @since 4
616   */
617  oncancel: () => void;
618  /**
619   * The animation is repeated.
620   *
621   * @type { function }
622   * @syscap SystemCapability.ArkUI.ArkUI.Full
623   * @since 4
624   */
625  onrepeat: () => void;
626}
627
628/**
629 * Element
630 *
631 * @interface Element
632 * @syscap SystemCapability.ArkUI.ArkUI.Full
633 * @since 4
634 */
635export interface Element {
636  /**
637   * Requests or cancels the focus for a component.
638   * If focus is set to true, the focus is requested for the component.
639   * If focus is set to false, the focus is canceled for the component.
640   * This attribute can be defaulted to true.
641   *
642   * @param { FocusParamObj } [obj] - { focus: true | false }
643   * @syscap SystemCapability.ArkUI.ArkUI.Full
644   * @since 4
645   */
646  focus(obj?: FocusParamObj): void;
647
648  /**
649   * Requests or cancels the crown rotation focus for a component.
650   * If focus is set to true, the crown event focus is requested.
651   * If focus is set to false, the crown event focus is canceled.
652   * This attribute can be defaulted to true.
653   *
654   * @param { FocusParamObj } [obj] - { focus: true | false }
655   * @syscap SystemCapability.ArkUI.ArkUI.Full
656   * @since 4
657   */
658  rotation(obj?: FocusParamObj): void;
659
660  /**
661   * Creates and runs an animation shortcut on the component. Specify the keyframes and options required for the animation.
662   *
663   * @param { Array<AnimateStyle> } keyframes - keyframes is used to describe key frame parameters of the animation.
664   * @param { AnimateOptions } options - Options. is used to describe animation parameters.
665   * @returns { AnimationResult } This method returns the animation object.
666   * @syscap SystemCapability.ArkUI.ArkUI.Full
667   * @since 4
668   */
669  animate(keyframes: Array<AnimateStyle>, options: AnimateOptions): AnimationResult;
670
671  /**
672   * Obtains the size and position of the element.
673   *
674   * @returns { RectObj } RectObj the size position of the element.
675   * @syscap SystemCapability.ArkUI.ArkUI.Full
676   * @since 6
677   */
678  getBoundingClientRect(): RectObj;
679
680  /**
681   * Obtains attributes of the element.
682   *
683   * @returns { string } attributes of the element in json string.
684   * @syscap SystemCapability.ArkUI.ArkUI.Full
685   * @systemapi
686   * @since 8
687   */
688  getInspector(): string;
689
690  /**
691   * If 0.5 is returned, 50% of the current component is visible.
692   *
693   * @param { object } param - Scope of Monitoring components.
694   * @returns { observer }
695   * @syscap SystemCapability.ArkUI.ArkUI.Full
696   * @since 6
697   */
698  createIntersectionObserver(param: { ratios: Array<number> }): observer;
699
700  /**
701   * Adds a node to the end of the child node list of the current node.
702   *
703   * @param { Element } child - Subnode object to be added
704   * @syscap SystemCapability.ArkUI.ArkUI.Full
705   * @since 8
706   */
707  addChild(child: Element): void;
708
709  /**
710   * Sets the value of an attribute on a specified element. If the attribute already exists, update the value. Otherwise, a new attribute is added with the specified name and value.
711   *
712   * @param { string } name - attribute name
713   * @param { string } value - attribute value¡¢
714   * @syscap SystemCapability.ArkUI.ArkUI.Full
715   * @since 8
716   */
717  setAttribute(name: string, value: string): void;
718
719  /**
720   * Sets a style value on a specified element. If the style exists and the style value is valid, the setting is successful. Otherwise, the setting is invalid.
721   *
722   * @param { string } name - style name
723   * @param { string } value - style value
724   * @returns { boolean } If the setting is successful, true is returned. If the setting fails, false is returned.
725   * @syscap SystemCapability.ArkUI.ArkUI.Full
726   * @since 8
727   */
728  setStyle(name: string, value: string): boolean;
729}
730
731/**
732 * Defines the observer interface.
733 *
734 * @interface observer
735 * @syscap SystemCapability.ArkUI.ArkUI.Full
736 * @since 6
737 */
738export interface observer {
739  /**
740   * Turn on the listener.
741   *
742   * @param { string } callback
743   * @syscap SystemCapability.ArkUI.ArkUI.Full
744   * @since 6
745   */
746  observe(callback: string): void;
747
748  /**
749   * Turn off the listener.
750   *
751   * @syscap SystemCapability.ArkUI.ArkUI.Full
752   * @since 6
753   */
754  unobserve(): void;
755}
756
757/**
758 * animation element
759 *
760 * @interface AnimationElement
761 * @syscap SystemCapability.ArkUI.ArkUI.Full
762 * @since 4
763 */
764export interface AnimationElement extends Element {
765  /**
766   * Starts the animation.
767   *
768   * @syscap SystemCapability.ArkUI.ArkUI.Full
769   * @since 4
770   */
771  play(): void;
772  /**
773   * Ends the animation.
774   *
775   * @syscap SystemCapability.ArkUI.ArkUI.Full
776   * @since 4
777   */
778  finish(): void;
779  /**
780   * Pauses the animation.
781   *
782   * @syscap SystemCapability.ArkUI.ArkUI.Full
783   * @since 4
784   */
785  pause(): void;
786  /**
787   * Cancels the animation.
788   *
789   * @syscap SystemCapability.ArkUI.ArkUI.Full
790   * @since 4
791   */
792  cancel(): void;
793  /**
794   * Plays the animation in reverse direction.
795   *
796   * @syscap SystemCapability.ArkUI.ArkUI.Full
797   * @since 4
798   */
799  reverse(): void;
800}
801
802/**
803 * ScrollParam
804 *
805 * @interface ScrollParam
806 * @syscap SystemCapability.ArkUI.ArkUI.Full
807 * @since 4
808 */
809export interface ScrollParam {
810  /**
811   * Offset for scrolling in the horizontal direction, in px.
812   *
813   * @type { ?number }
814   * @syscap SystemCapability.ArkUI.ArkUI.Full
815   * @since 4
816   */
817  dx?: number;
818
819  /**
820   * Offset for scrolling in the vertical direction, in px.
821   *
822   * @type { ?number }
823   * @syscap SystemCapability.ArkUI.ArkUI.Full
824   * @since 4
825   */
826  dy?: number;
827
828  /**
829   * Whether a sliding animation is displayed when scroll position is changed.
830   *
831   * @type { ?boolean }
832   * @syscap SystemCapability.ArkUI.ArkUI.Full
833   * @since 4
834   */
835  smooth?: boolean;
836}
837
838/**
839 * CurrentOffsetResultValue
840 *
841 * @interface CurrentOffsetResultValue
842 * @syscap SystemCapability.ArkUI.ArkUI.Full
843 * @since 4
844 */
845export interface CurrentOffsetResultValue {
846  /**
847   * Scrolling offset in the x-axis, in px.
848   *
849   * @type { number }
850   * @syscap SystemCapability.ArkUI.ArkUI.Full
851   * @since 4
852   */
853  x: number;
854
855  /**
856   * Scrolling offset in the y-axis, in px.
857   *
858   * @type { number }
859   * @syscap SystemCapability.ArkUI.ArkUI.Full
860   * @since 4
861   */
862  y: number;
863}
864
865/**
866 * ListScrollToOptions
867 *
868 * @interface ListScrollToOptions
869 * @syscap SystemCapability.ArkUI.ArkUI.Full
870 * @since 4
871 */
872export interface ListScrollToOptions {
873  /**
874   * specified position.
875   *
876   * @type { number }
877   * @syscap SystemCapability.ArkUI.ArkUI.Full
878   * @since 4
879   */
880  index: number;
881}
882
883/**
884 * The <list> component provides a list container.
885 *
886 * @interface ListElement
887 * @syscap SystemCapability.ArkUI.ArkUI.Full
888 * @since 4
889 */
890export interface ListElement extends Element {
891  /**
892   * Scrolls the list to the position of the item at the specified index.
893   *
894   * @param { ListScrollToOptions } position
895   * @syscap SystemCapability.ArkUI.ArkUI.Full
896   * @since 4
897   */
898  scrollTo(position: ListScrollToOptions): void;
899
900  /**
901   * Scrolls the list for a certain distance.
902   * This method applies only to smart TVs.
903   *
904   * @param { ScrollParam } data
905   * @syscap SystemCapability.ArkUI.ArkUI.Full
906   * @since 4
907   */
908  scrollBy(data: ScrollParam): void;
909
910  /**
911   * If smooth is set to false (default value), the list is directly scrolled to the top.
912   * If smooth is set to true, the list is smoothly scrolled to the top.
913   *
914   * @param { object } param
915   * @syscap SystemCapability.ArkUI.ArkUI.Full
916   * @since 4
917   */
918  scrollTop(param: { smooth: boolean }): void;
919
920  /**
921   * If smooth is set to false (default value), the list is directly scrolled to the bottom.
922   * If smooth is set to true, the list is smoothly scrolled to the bottom.
923   *
924   * @param { object } param
925   * @syscap SystemCapability.ArkUI.ArkUI.Full
926   * @since 4
927   */
928  scrollBottom(param: { smooth: boolean }): void;
929
930  /**
931   * If reverse is set to false (default value), the next page is displayed. If there is no next page, the list scrolls to the bottom.
932   * If reverse is set to true, the previous page is displayed. If there is no previous page, the list scrolls to the top.
933   * If smooth is set to false (default value), the list is directly scrolled to another page.
934   * If smooth is set to true, the list is smoothly scrolled to another page.
935   *
936   * @param { object } params
937   * @syscap SystemCapability.ArkUI.ArkUI.Full
938   * @since 4
939   */
940  scrollPage(params: { reverse: boolean; smooth: boolean }): void;
941
942  /**
943   * If reverse is set to false (default value), the list scrolls towards the bottom for a certain distance. If there is no sufficient distance, the list scrolls to the bottom.
944   * If reverse is set to true, the list scrolls towards the top for a certain distance. If there is no sufficient distance, the list scrolls to the top.
945   * If smooth is set to false (default value), the list is directly scrolled.
946   * If smooth is set to true, the list is smoothly scrolled.
947   *
948   * @param { object } params
949   * @syscap SystemCapability.ArkUI.ArkUI.Full
950   * @since 4
951   */
952  scrollArrow(params: { reverse: boolean; smooth: boolean }): void;
953
954  /**
955   * Collapses a group.
956   *
957   * @param { object } param
958   * @syscap SystemCapability.ArkUI.ArkUI.Full
959   * @since 4
960   */
961  collapseGroup(param: {
962    /**
963     * groupid: ID of the group to collapse.
964     * All groups are collapsed when groupid is not specified.
965     *
966     * @type { string }
967     * @syscap SystemCapability.ArkUI.ArkUI.Full
968     * @since 4
969     */
970    groupid: string;
971  }): void;
972
973  /**
974   * Expands a group.
975   *
976   * @param { object } param
977   * @syscap SystemCapability.ArkUI.ArkUI.Full
978   * @since 4
979   */
980  expandGroup(param: {
981    /**
982     * groupid: ID of the group to expand.
983     * All groups are expanded when groupid is not specified.
984     *
985     * @type { string }
986     * @syscap SystemCapability.ArkUI.ArkUI.Full
987     * @since 4
988     */
989    groupid: string;
990  }): void;
991
992  /**
993   * Returns the offset of the current scrolling. The return value type is Object.
994   *
995   * @returns { CurrentOffsetResultValue }
996   * @syscap SystemCapability.ArkUI.ArkUI.Full
997   * @since 4
998   */
999  currentOffset(): CurrentOffsetResultValue;
1000}
1001
1002/**
1003 * The <swiper> component provides a swiper container.
1004 *
1005 * @interface SwiperElement
1006 * @syscap SystemCapability.ArkUI.ArkUI.Full
1007 * @since 4
1008 */
1009export interface SwiperElement extends Element {
1010  /**
1011   * Scrolls the child component to the position at the specified index.
1012   *
1013   * @param { object } position
1014   * @syscap SystemCapability.ArkUI.ArkUI.Full
1015   * @since 4
1016   */
1017  swipeTo(position: {
1018    /**
1019     * specified position.
1020     *
1021     * @type { number }
1022     * @syscap SystemCapability.ArkUI.ArkUI.Full
1023     * @since 4
1024     */
1025    index: number;
1026  }): void;
1027
1028  /**
1029   * Shows the next child component.
1030   *
1031   * @syscap SystemCapability.ArkUI.ArkUI.Full
1032   * @since 4
1033   */
1034  showNext(): void;
1035
1036  /**
1037   * Shows the previous child component.
1038   *
1039   * @syscap SystemCapability.ArkUI.ArkUI.Full
1040   * @since 4
1041   */
1042  showPrevious(): void;
1043}
1044
1045/**
1046 * CameraTakePhotoOptions
1047 *
1048 * @interface CameraTakePhotoOptions
1049 * @syscap SystemCapability.ArkUI.ArkUI.Full
1050 * @since 6
1051 */
1052export interface CameraTakePhotoOptions {
1053  /**
1054   * Picture quality.
1055   *
1056   * @type { "high" | "normal" | "low" }
1057   * @syscap SystemCapability.ArkUI.ArkUI.Full
1058   * @since 6
1059   */
1060  quality: "high" | "normal" | "low";
1061
1062  /**
1063   * Callback function for successful interface invocation.
1064   *
1065   * @type { ?function }
1066   * @syscap SystemCapability.ArkUI.ArkUI.Full
1067   * @since 6
1068   */
1069  success?: (result: Object) => void;
1070
1071  /**
1072   * Callback function for interface invocation failure.
1073   *
1074   * @type { ?function }
1075   * @syscap SystemCapability.ArkUI.ArkUI.Full
1076   * @since 6
1077   */
1078  fail?: (result: Object) => void;
1079
1080  /**
1081   * Callback function at the end of the interface invoking (executed both successfully and unsuccessfully).
1082   *
1083   * @type { ?function }
1084   * @syscap SystemCapability.ArkUI.ArkUI.Full
1085   * @since 6
1086   */
1087  complete?: (result: Object) => void;
1088}
1089
1090/**
1091 * The <camera> component provides preview and photographing functions.
1092 *
1093 * @interface CameraElement
1094 * @syscap SystemCapability.ArkUI.ArkUI.Full
1095 * @since 6
1096 */
1097export interface CameraElement extends Element {
1098  /**
1099   * Take photos with specified parameters.
1100   *
1101   * @param { CameraTakePhotoOptions } options - the parameters of camera.
1102   * @syscap SystemCapability.ArkUI.ArkUI.Full
1103   * @since 6
1104   */
1105  takePhoto(options: CameraTakePhotoOptions): void;
1106}
1107
1108/**
1109 * The <web> component is a container for displaying web page content.
1110 *
1111 * @interface WebElement
1112 * @syscap SystemCapability.ArkUI.ArkUI.Full
1113 * @since 6
1114 */
1115export interface WebElement extends Element {
1116  /**
1117   * Reload the web page content
1118   *
1119   * @syscap SystemCapability.ArkUI.ArkUI.Full
1120   * @since 6
1121   */
1122  reload(): void;
1123}
1124
1125/**
1126 * The <dialog> component is a custom pop-up container.
1127 *
1128 * @interface DialogElement
1129 * @syscap SystemCapability.ArkUI.ArkUI.Full
1130 * @since 4
1131 */
1132export interface DialogElement extends Element {
1133  /**
1134   * Shows a dialog box.
1135   *
1136   * @syscap SystemCapability.ArkUI.ArkUI.Full
1137   * @since 4
1138   */
1139  show(): void;
1140  /**
1141   * Closes a dialog box.
1142   *
1143   * @syscap SystemCapability.ArkUI.ArkUI.Full
1144   * @since 4
1145   */
1146  close(): void;
1147}
1148
1149/**
1150 * The <image-animator> component is used to provide an image frame animator.
1151 *
1152 * @interface ImageAnimatorElement
1153 * @syscap SystemCapability.ArkUI.ArkUI.Full
1154 * @since 4
1155 */
1156export interface ImageAnimatorElement extends Element {
1157  /**
1158   * Starts to play the frame animation of an image. If this method is called again, the playback starts from the first frame.
1159   *
1160   * @syscap SystemCapability.ArkUI.ArkUI.Full
1161   * @since 4
1162   */
1163  start(): void;
1164  /**
1165   * Pauses the frame animation playback of an image.
1166   *
1167   * @syscap SystemCapability.ArkUI.ArkUI.Full
1168   * @since 4
1169   */
1170  pause(): void;
1171  /**
1172   * Stops the frame animation playback of an image.
1173   *
1174   * @syscap SystemCapability.ArkUI.ArkUI.Full
1175   * @since 4
1176   */
1177  stop(): void;
1178  /**
1179   * Resumes the frame animation playback of an image.
1180   *
1181   * @syscap SystemCapability.ArkUI.ArkUI.Full
1182   * @since 4
1183   */
1184  resume(): void;
1185  /**
1186   * Obtains the playback state. Available values are as follows:
1187   * Playing
1188   * Paused
1189   * Stopped
1190   *
1191   * @returns { "Playing" | "Paused" | "Stopped" }
1192   * @syscap SystemCapability.ArkUI.ArkUI.Full
1193   * @since 4
1194   */
1195  getState(): "Playing" | "Paused" | "Stopped";
1196}
1197
1198/**
1199 * The <marquee> component inserts scrolling text, which is displayed in a single line by default.
1200 * When the text length exceeds the display area of the component, the marquee effect is displayed.
1201 *
1202 * @interface MarqueeElement
1203 * @syscap SystemCapability.ArkUI.ArkUI.Full
1204 * @since 4
1205 */
1206export interface MarqueeElement extends Element {
1207  /**
1208   * Starts scrolling.
1209   *
1210   * @syscap SystemCapability.ArkUI.ArkUI.Full
1211   * @since 4
1212   */
1213  start(): void;
1214
1215  /**
1216   * Stops scrolling.
1217   *
1218   * @syscap SystemCapability.ArkUI.ArkUI.Full
1219   * @since 4
1220   */
1221  stop(): void;
1222}
1223
1224/**
1225 * The <menu> component provides menus as temporary pop-up windows to display operations that can be performed by users.
1226 *
1227 * @interface MenuElement
1228 * @syscap SystemCapability.ArkUI.ArkUI.Full
1229 * @since 4
1230 */
1231export interface MenuElement extends Element {
1232  /**
1233   * Displays the menu.
1234   * x and y specify the position of the displayed menu.
1235   * x indicates the X-axis coordinate from the left edge of the visible area, and does not include any scrolling offset.
1236   * y indicates the Y-axis coordinate from the upper edge of the visible area, and does not include any scrolling offset or a status bar.
1237   * The menu is preferentially displayed in the lower right corner.
1238   * When the visible space on the right is insufficient, the menu is moved leftward.
1239   * When the visible space in the lower part is insufficient, the menu is moved upward.
1240   *
1241   * @param { object } position
1242   * @syscap SystemCapability.ArkUI.ArkUI.Full
1243   * @since 4
1244   */
1245  show(position: { x: number; y: number }): void;
1246}
1247
1248/**
1249 * The <chart> component displays line charts, gauge charts, and bar charts.
1250 *
1251 * @interface ChartElement
1252 * @syscap SystemCapability.ArkUI.ArkUI.Full
1253 * @since 4
1254 */
1255export interface ChartElement extends Element {
1256  /**
1257   * Data is dynamically added to an existing data sequence.
1258   * The target sequence is specified based on serial, which is the subscript of the datasets array and starts from 0.
1259   * datasets[index].data is not updated. Only line charts support this attribute.
1260   * The value is incremented by 1 based on the horizontal coordinate and is related to the xAxis min/max setting.
1261   *
1262   * @param { object } params
1263   * @syscap SystemCapability.ArkUI.ArkUI.Full
1264   * @since 4
1265   */
1266  append(params: {
1267    /**
1268     * Set the data subscript of the line chart to be updated.
1269     *
1270     * @type { number }
1271     * @syscap SystemCapability.ArkUI.ArkUI.Full
1272     * @since 4
1273     */
1274    serial: number;
1275    /**
1276     * Set the new data.
1277     *
1278     * @type { Array<number> }
1279     * @syscap SystemCapability.ArkUI.ArkUI.Full
1280     * @since 4
1281     */
1282    data: Array<number>;
1283  }): void;
1284}
1285
1286/**
1287 * The <input> component provides an interactive interface to receive user input, which is displayed in a single line by default.
1288 *
1289 * @interface InputElement
1290 * @syscap SystemCapability.ArkUI.ArkUI.Full
1291 * @since 4
1292 */
1293export interface InputElement extends Element {
1294  /**
1295   * Obtains or loses the focus of a component.
1296   * When the component type is set to text, email, date, time, number, or password, the input method can be displayed or collapsed.
1297   *
1298   * @param { object } param - If focus is not passed, the default value true is used.
1299   * @syscap SystemCapability.ArkUI.ArkUI.Full
1300   * @since 4
1301   */
1302  focus(param: { focus: boolean }): void;
1303
1304  /**
1305   * Displays the error message.
1306   * This attribute is available when the component type is set to text, email, date, time, number, or password.
1307   *
1308   * @param { object } param
1309   * @syscap SystemCapability.ArkUI.ArkUI.Full
1310   * @since 4
1311   */
1312  showError(param: { error: string }): void;
1313
1314  /**
1315   * Deletes the previous character at the cursor position.
1316   *
1317   * @syscap SystemCapability.ArkUI.ArkUI.Full
1318   * @since 6
1319   */
1320  delete(): void;
1321}
1322
1323/**
1324 * The <button> component includes capsule, circle, text, arc, and download buttons.
1325 *
1326 * @interface ButtonElement
1327 * @syscap SystemCapability.ArkUI.ArkUI.Full
1328 * @since 4
1329 */
1330export interface ButtonElement extends Element {
1331  /**
1332   * Progress bar of the download button.
1333   * The value ranges from 0 to 100. The progress bar is displayed if the value is greater than 0.
1334   * If the value is greater than or equal to 100, the progress bar is not displayed.
1335   * NOTE
1336   * The text displayed on the progress bar is changed based on the value.
1337   *
1338   * @param { object } param
1339   * @syscap SystemCapability.ArkUI.ArkUI.Full
1340   * @since 4
1341   */
1342  setProgress(param: { progress: number }): void;
1343}
1344
1345/**
1346 * The <textarea> component provides an interactive interface to receive user input, which is displayed in multiple lines by default.
1347 *
1348 * @interface TextAreaElement
1349 * @syscap SystemCapability.ArkUI.ArkUI.Full
1350 * @since 4
1351 */
1352export interface TextAreaElement extends Element {
1353  /**
1354   * Obtains or loses the focus of a component, which can display or collapse the input method.
1355   *
1356   * @param { object } param - If focus is not passed, the default value true is used.
1357   * @syscap SystemCapability.ArkUI.ArkUI.Full
1358   * @since 4
1359   */
1360  focus(param: { focus: boolean }): void;
1361}
1362
1363/**
1364 * The <picker> component supports common, date, time, and multi-column text selectors.
1365 *
1366 * @interface PickerElement
1367 * @syscap SystemCapability.ArkUI.ArkUI.Full
1368 * @since 4
1369 */
1370export interface PickerElement extends Element {
1371  /**
1372   * Displays the picker.
1373   *
1374   * @syscap SystemCapability.ArkUI.ArkUI.Full
1375   * @since 4
1376   */
1377  show(): void;
1378}
1379
1380/**
1381 * The <video> component provides a video player.
1382 *
1383 * @interface VideoElement
1384 * @syscap SystemCapability.ArkUI.ArkUI.Full
1385 * @since 4
1386 */
1387export interface VideoElement extends Element {
1388  /**
1389   * Requests to start playing a video.
1390   *
1391   * @syscap SystemCapability.ArkUI.ArkUI.Full
1392   * @since 4
1393   */
1394  start(): void;
1395
1396  /**
1397   * Requests to pause a video.
1398   *
1399   * @syscap SystemCapability.ArkUI.ArkUI.Full
1400   * @since 4
1401   */
1402  pause(): void;
1403
1404  /**
1405   * Specifies the video playing position.
1406   *
1407   * @param { object } param
1408   * @syscap SystemCapability.ArkUI.ArkUI.Full
1409   * @since 4
1410   */
1411  setCurrentTime(param: { currenttime: number }): void;
1412
1413  /**
1414   * Requests to enter the full screen mode.
1415   *
1416   * @param { object } param
1417   * @syscap SystemCapability.ArkUI.ArkUI.Full
1418   * @since 4
1419   */
1420  requestFullscreen(param: { screenOrientation: "default" }): void;
1421
1422  /**
1423   * Requests to exit the full screen mode.
1424   *
1425   * @syscap SystemCapability.ArkUI.ArkUI.Full
1426   * @since 4
1427   */
1428  exitFullscreen(): void;
1429
1430  /**
1431   * Requests to stop playing a video.
1432   *
1433   * @syscap SystemCapability.ArkUI.ArkUI.Full
1434   * @since 6
1435   */
1436  stop(): void;
1437}
1438
1439/**
1440 * TextMetrics
1441 *
1442 * @interface TextMetrics
1443 * @syscap SystemCapability.ArkUI.ArkUI.Full
1444 * @since 4
1445 */
1446export interface TextMetrics {
1447  /**
1448   * @type { number }
1449   * @syscap SystemCapability.ArkUI.ArkUI.Full
1450   * @since 4
1451   */
1452  width: number;
1453  /**
1454   * @type { number }
1455   * @syscap SystemCapability.ArkUI.ArkUI.Full
1456   * @since 8
1457   */
1458  height: number;
1459}
1460
1461/**
1462 * Provides a 2D rendering context for the drawing surface of the < Canvas > element.
1463 * It is used to draw shapes, text, images and other objects.
1464 *
1465 * @interface OffscreenCanvasRenderingContext2D
1466 * @syscap SystemCapability.ArkUI.ArkUI.Full
1467 * @since 7
1468 */
1469export interface OffscreenCanvasRenderingContext2D {
1470  /**
1471   * Gets the dotted spacing of a line.
1472   * Returns the current line segment style array containing an even number of non-negative numbers.
1473   *
1474   * @syscap SystemCapability.ArkUI.ArkUI.Full
1475   * @since 7
1476   */
1477  getLineDash: Array<number>;
1478
1479  /**
1480   * Fill style attribute.
1481   * Paint color used to fill the area.
1482   * Canvas gradient object used by the paint. You can call createLinearGradient() to create a CanvasGradient object.
1483   * Canvas pattern. You can call createPattern() to create a CanvasPattern object.
1484   *
1485   * @type { ?(string | CanvasGradient | CanvasPattern) }
1486   * @syscap SystemCapability.ArkUI.ArkUI.Full
1487   * @since 7
1488   */
1489  fillStyle?: string | CanvasGradient | CanvasPattern;
1490
1491  /**
1492   * Sets the stroke paint style.
1493   * Color of the stroke paint.
1494   * Canvas gradient object used by the paint. You can call createLinearGradient() to create a CanvasGradient object.
1495   * Canvas pattern. You can call createPattern() to create a CanvasPattern object.
1496   *
1497   * @type { ?(string | CanvasGradient | CanvasPattern) }
1498   * @syscap SystemCapability.ArkUI.ArkUI.Full
1499   * @since 7
1500   */
1501  strokeStyle?: string | CanvasGradient | CanvasPattern;
1502
1503  /**
1504   * Sets the dotted spacing of a line.
1505   *
1506   * @param { Array<number> } segments - A set of numbers describing the length of alternating drawn line segments and spacing (coordinate space units).
1507   * @syscap SystemCapability.ArkUI.ArkUI.Full
1508   * @since 7
1509   */
1510  setLineDash(segments: Array<number>): void;
1511
1512  /**
1513   * Draw an Image object.
1514   *
1515   * @param { Image } image - An element drawn to the context.
1516   * @param { number } dx - The top left corner of the image is the X-axis coordinates on the target canvas.
1517   * @param { number } dy - The top left corner of the image is the Y-axis coordinates on the target canvas.
1518   * @param { number } dw - Image The width drawn on the target canvas.
1519   * @param { number } dh - Image The height drawn on the target canvas.
1520   * @syscap SystemCapability.ArkUI.ArkUI.Full
1521   * @since 7
1522   */
1523  drawImage(image: Image, dx: number, dy: number, dw: number, dh: number): void;
1524
1525  /**
1526   * Draw an Image object.
1527   *
1528   * @param { Image } image - An element drawn to the context.
1529   * @param { number } sx - The upper-left X-axis coordinates of the image's rectangular (clipped) selection box that need to be drawn into the target context.
1530   * @param { number } sy - The upper-left Y-axis coordinates of the image's rectangular (clipped) selection box that need to be drawn into the target context.
1531   * @param { number } sw - The width of the image's rectangular (clipped) selection box that needs to be drawn into the target context.
1532   * @param { number } sh - The height of the image's rectangular (clipped) selection box that needs to be drawn into the target context.
1533   * @param { number } dx - The top left corner of the image is the X-axis coordinates on the target canvas.
1534   * @param { number } dy - The top left corner of the image is the Y-axis coordinates on the target canvas.
1535   * @param { number } dw - Image The width drawn on the target canvas.
1536   * @param { number } dh - Image The height drawn on the target canvas.
1537   * @syscap SystemCapability.ArkUI.ArkUI.Full
1538   * @since 7
1539   */
1540  drawImage(
1541    image: Image,
1542    sx: number,
1543    sy: number,
1544    sw: number,
1545    sh: number,
1546    dx: number,
1547    dy: number,
1548    dw: number,
1549    dh: number,
1550  ): void;
1551
1552  /**
1553   * Draw an Image object.
1554   *
1555   * @param { image.PixelMap } image - An element drawn to the context.
1556   * @param { number } dx - The top left corner of the image is the X-axis coordinates on the target canvas.
1557   * @param { number } dy - The top left corner of the image is the Y-axis coordinates on the target canvas.
1558   * @param { number } dw - Image The width drawn on the target canvas.
1559   * @param { number } dh - Image The height drawn on the target canvas.
1560   * @syscap SystemCapability.ArkUI.ArkUI.Full
1561   * @since 9
1562   */
1563  drawImage(image: image.PixelMap, dx: number, dy: number, dw: number, dh: number): void;
1564
1565  /**
1566   * Draw an Image object.
1567   *
1568   * @param { image.PixelMap } image - An element drawn to the context.
1569   * @param { number } sx - The upper-left X-axis coordinates of the image's rectangular (clipped) selection box that need to be drawn into the target context.
1570   * @param { number } sy - The upper-left Y-axis coordinates of the image's rectangular (clipped) selection box that need to be drawn into the target context.
1571   * @param { number } sw - The width of the image's rectangular (clipped) selection box that needs to be drawn into the target context.
1572   * @param { number } sh - The height of the image's rectangular (clipped) selection box that needs to be drawn into the target context.
1573   * @param { number } dx - The top left corner of the image is the X-axis coordinates on the target canvas.
1574   * @param { number } dy - The top left corner of the image is the Y-axis coordinates on the target canvas.
1575   * @param { number } dw - Image The width drawn on the target canvas.
1576   * @param { number } dh - Image The height drawn on the target canvas.
1577   * @syscap SystemCapability.ArkUI.ArkUI.Full
1578   * @since 9
1579   */
1580  drawImage(
1581    image: image.PixelMap,
1582    sx: number,
1583    sy: number,
1584    sw: number,
1585    sh: number,
1586    dx: number,
1587    dy: number,
1588    dw: number,
1589    dh: number,
1590  ): void;
1591
1592  /**
1593   * Creates a drawing path.
1594   *
1595   * @syscap SystemCapability.ArkUI.ArkUI.Full
1596   * @since 7
1597   */
1598  beginPath(): void;
1599
1600  /**
1601   * Crop the current canvas.
1602   *
1603   * @syscap SystemCapability.ArkUI.ArkUI.Full
1604   * @since 7
1605   */
1606  clip(): void;
1607
1608  /**
1609   * Fills the current canvas with color.
1610   *
1611   * @syscap SystemCapability.ArkUI.ArkUI.Full
1612   * @since 7
1613   */
1614  fill(): void;
1615
1616  /**
1617   * Check whether the specified coordinate point is on the Path.
1618   *
1619   * @param { number } x - The X coordinate of the detection point.
1620   * @param { number } y - The Y coordinate of the detection point.
1621   * @returns { boolean } boolean Return true if the detection point is contained within the current or specified path Otherwise return false.
1622   * @syscap SystemCapability.ArkUI.ArkUI.Full
1623   * @since 7
1624   */
1625  isPointInPath(x: number, y: number): boolean;
1626
1627  /**
1628   * Check whether the specified coordinate point is on the Path.
1629   *
1630   * @param { Path2D } path - The Path2D path that needs to be populated.
1631   * @param { number } x - The X coordinate of the detection point.
1632   * @param { number } y - The Y coordinate of the detection point.
1633   * @returns { boolean } boolean Return true if the detection point is contained within the current or specified path Otherwise return false.
1634   * @syscap SystemCapability.ArkUI.ArkUI.Full
1635   * @since 7
1636   */
1637  isPointInPath(path: Path2D, x: number, y: number): boolean;
1638
1639  /**
1640   * Checks whether the specified coordinate point is on the stroke edge.
1641   *
1642   * @param { number } x - The X coordinate of the detection point.
1643   * @param { number } y - The Y coordinate of the detection point.
1644   * @returns { boolean } boolean A Boolean value that returns true when the point is on the line of the path, false otherwise.
1645   * @syscap SystemCapability.ArkUI.ArkUI.Full
1646   * @since 7
1647   */
1648  isPointInStroke(x: number, y: number): boolean;
1649
1650  /**
1651   * Checks whether the specified coordinate point is on the stroke edge.
1652   *
1653   * @param { Path2D } path - Path2D path.
1654   * @param { number } x - The X coordinate of the detection point.
1655   * @param { number } y - The Y coordinate of the detection point.
1656   * @returns { boolean } boolean A Boolean value that returns true when the point is on the line of the path, false otherwise.
1657   * @syscap SystemCapability.ArkUI.ArkUI.Full
1658   * @since 7
1659   */
1660  isPointInStroke(path: Path2D, x: number, y: number): boolean;
1661
1662  /**
1663   * Stroke draws the current path.
1664   *
1665   * @syscap SystemCapability.ArkUI.ArkUI.Full
1666   * @since 7
1667   */
1668  stroke(): void;
1669
1670  /**
1671   * Stroke draws the current path.
1672   *
1673   * @param { Path2D } path - The object of Path2D.
1674   * @syscap SystemCapability.ArkUI.ArkUI.Full
1675   * @since 7
1676   */
1677  stroke(path: Path2D): void;
1678
1679  /**
1680   * Create a radial tween object.
1681   *
1682   * @param { number } x0 - The x coordinate of the circle at the beginning.
1683   * @param { number } y0 - The y coordinate of the circle at the beginning.
1684   * @param { number } r0 - The radius of the starting circle.
1685   * @param { number } x1 - X-coordinate of the end point.
1686   * @param { number } y1 - Y-coordinate of the end point.
1687   * @param { number } r1 - The radius of End Circle.
1688   * @returns { CanvasGradient } RadialGradient object.
1689   * @syscap SystemCapability.ArkUI.ArkUI.Full
1690   * @since 7
1691   */
1692  createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
1693
1694  /**
1695   * Create a drawing style template.
1696   *
1697   * @param { Image } image - The CanvasImageSource object that is the source of the duplicate image.
1698   * @param { string } repetition - Specify how to repeat images.
1699   * @returns { CanvasPattern } CanvasPattern An opaque object that describes a schema.
1700   * @syscap SystemCapability.ArkUI.ArkUI.Full
1701   * @since 7
1702   */
1703  createPattern(image: Image, repetition: string): CanvasPattern;
1704
1705  /**
1706   * Creates a linear gradient color.
1707   *
1708   * @param { number } x0 - X-coordinate of the start point.
1709   * @param { number } y0 - Y-coordinate of the start point.
1710   * @param { number } x1 - X-coordinate of the end point.
1711   * @param { number } y1 - Y-coordinate of the end point.
1712   * @returns { CanvasGradient } LinearGradient object.
1713   * @syscap SystemCapability.ArkUI.ArkUI.Full
1714   * @since 7
1715   */
1716  createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
1717
1718  /**
1719   * Create an ImageData object.
1720   *
1721   * @param { number } sw - The width of the new object.
1722   * @param { number } sh - The height of the new object.
1723   * @returns { ImageData } ImageData New ImageData object with width and height specified.
1724   * @syscap SystemCapability.ArkUI.ArkUI.Full
1725   * @since 7
1726   */
1727  createImageData(sw: number, sh: number): ImageData;
1728
1729  /**
1730   * Create an ImageData object.
1731   *
1732   * @param { ImageData } imagedata - Copy an object of the same width and height from an existing ImageData object
1733   * The image itself is not allowed to be copied.
1734   * @returns { ImageData } ImageData New ImageData object with width and height specified.
1735   * @syscap SystemCapability.ArkUI.ArkUI.Full
1736   * @since 7
1737   */
1738  createImageData(imagedata: ImageData): ImageData;
1739
1740  /**
1741   * Creates a path that is later used by the CanvasRenderingContext2D object.
1742   *
1743   * @param { Path2D } [path] - another created Path2D object.
1744   * @returns { Path2D } the object of Path2D.
1745   * @syscap SystemCapability.ArkUI.ArkUI.Full
1746   * @since 7
1747   */
1748  createPath2D(path?: Path2D): Path2D;
1749
1750  /**
1751   * Creates a path that is later used by the CanvasRenderingContext2D object.
1752   *
1753   * @param { string } [cmds] - a string defined using the SVG path command.
1754   * @returns { Path2D } the object of Path2D.
1755   * @syscap SystemCapability.ArkUI.ArkUI.Full
1756   * @since 7
1757   */
1758  createPath2D(cmds?: string): Path2D;
1759
1760  /**
1761   * Get an ImageData object.
1762   *
1763   * @param { number } sx - The upper-left x-coordinate of the rectangular area of the image data to be extracted.
1764   * @param { number } sy - The upper-left y coordinate of the rectangular region of the image data to be extracted.
1765   * @param { number } sw - The width of the rectangular area of the image data to be extracted.
1766   * @param { number } sh - The height of the rectangular area of the image data to be extracted.
1767   * @returns { ImageData } ImageData An ImageData object that contains the rectangular ImageData given by the canvas.
1768   * @syscap SystemCapability.ArkUI.ArkUI.Full
1769   * @since 7
1770   */
1771  getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
1772
1773  /**
1774   * Get an PixelMap object.
1775   *
1776   * @param { number } sx - The upper-left x-coordinate of the rectangular area of the image data to be extracted.
1777   * @param { number } sy - The upper-left y coordinate of the rectangular region of the image data to be extracted.
1778   * @param { number } sw - The width of the rectangular area of the image data to be extracted.
1779   * @param { number } sh - The height of the rectangular area of the image data to be extracted.
1780   * @returns { image.PixelMap } PixelMap A PixelMap object that contains the rectangular ImageData given by the canvas.
1781   * @syscap SystemCapability.ArkUI.ArkUI.Full
1782   * @since 9
1783   */
1784  getPixelMap(sx: number, sy: number, sw: number, sh: number): image.PixelMap
1785
1786  /**
1787   * Draws the specified ImageData object to the canvas.
1788   *
1789   * @param { ImageData } imagedata - An array object containing pixel values.
1790   * @param { number } dx - The offset of the position of the source image data in the target canvas (the offset in the X-axis direction).
1791   * @param { number } dy - The offset of the position of the source image data in the target canvas (the Y-axis offset).
1792   * @syscap SystemCapability.ArkUI.ArkUI.Full
1793   * @since 7
1794   */
1795  putImageData(imagedata: ImageData, dx: number, dy: number): void;
1796
1797  /**
1798   * Draws the specified ImageData object to the canvas.
1799   *
1800   * @param { ImageData } imagedata - An array object containing pixel values.
1801   * @param { number } dx - The offset of the position of the source image data in the target canvas (the offset in the X-axis direction).
1802   * @param { number } dy - he offset of the position of the source image data in the target canvas (the Y-axis offset).
1803   * @param { number } dirtyX - In the source image data,
1804   * the position of the upper left corner of the rectangular region Default is the upper left corner of the entire image data (x coordinate).
1805   * @param { number } dirtyY - In the source image data,
1806   * the position of the upper left corner of the rectangular region Default is the top left corner (y coordinate) of the entire image data.
1807   * @param { number } dirtyWidth - In the source image data, the width of a rectangular region. Default is the width of the image data.
1808   * @param { number } dirtyHeight - In the source image data, the height of a rectangular region. Default is the height of the image data.
1809   * @syscap SystemCapability.ArkUI.ArkUI.Full
1810   * @since 7
1811   */
1812  putImageData(
1813    imagedata: ImageData,
1814    dx: number,
1815    dy: number,
1816    dirtyX: number,
1817    dirtyY: number,
1818    dirtyWidth: number,
1819    dirtyHeight: number,
1820  ): void;
1821
1822  /**
1823   * Draw an arc.
1824   *
1825   * @param { number } radius - Radius of an arc.
1826   * @param { number } x - The X-axis coordinates of the center of the circle.
1827   * @param { number } y - The Y-axis coordinates of the center of an arc (center of a circle).
1828   * @param { number } startAngle - The starting point of the arc, in the X-axis direction, is calculated in radians.
1829   * @param { number } endAngle - The end point of an arc, expressed in radians.
1830   * @param { boolean } [anticlockwise] - An optional Boolean value. If true, the arc is drawn counterclockwise, and otherwise clockwise.
1831   * @syscap SystemCapability.ArkUI.ArkUI.Full
1832   * @since 7
1833   */
1834  arc(radius: number, x: number, y: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
1835
1836  /**
1837   * Draws an arc from the beginning to the end.
1838   *
1839   * @param { number } x1 - The X-axis coordinates of the first control point.
1840   * @param { number } x2 - The X-axis coordinates of the second control point.
1841   * @param { number } y1 - The y-coordinate of the first control point.
1842   * @param { number } y2 - The Y-axis coordinates of the second control point.
1843   * @param { number } radius - Radius of an arc.
1844   * @syscap SystemCapability.ArkUI.ArkUI.Full
1845   * @since 7
1846   */
1847  arcTo(x1: number, x2: number, y1: number, y2: number, radius: number): void;
1848
1849  /**
1850   * Draw a third order Bezier curve.
1851   *
1852   * @param { number } cp1x - The X-axis coordinates of the first control point.
1853   * @param { number } cp1y - The y-coordinate of the first control point.
1854   * @param { number } cp2x - The X-axis coordinates of the second control point.
1855   * @param { number } cp2y - The Y-axis coordinates of the second control point.
1856   * @param { number } x - The x-coordinate of the end point.
1857   * @param { number } y - The y-coordinate of the end point
1858   * @syscap SystemCapability.ArkUI.ArkUI.Full
1859   * @since 7
1860   */
1861  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
1862
1863  /**
1864   * Closing the current path.
1865   *
1866   * @syscap SystemCapability.ArkUI.ArkUI.Full
1867   * @since 7
1868   */
1869  closePath(): void;
1870
1871  /**
1872   * Draw a straight line.
1873   *
1874   * @param { number } x - The X-axis coordinates at the end of the line.
1875   * @param { number } y - The Y-axis coordinates at the end of the line.
1876   * @syscap SystemCapability.ArkUI.ArkUI.Full
1877   * @since 7
1878   */
1879  lineTo(x: number, y: number): void;
1880
1881  /**
1882   * Draw an ellipse.
1883   *
1884   * @param { number } x - The X-axis coordinates of the center of the ellipse.
1885   * @param { number } y - The Y-axis coordinates of the center of the ellipse.
1886   * @param { number } radiusX - The radius of the major axis of an ellipse.
1887   * @param { number } radiusY - The radius of the short axis of an ellipse.
1888   * @param { number } rotation - The Angle of rotation of an ellipse, expressed in radians.
1889   * @param { number } startAngle - The starting point Angle to be plotted, measured from the X-axis, is expressed in radians.
1890   * @param { number } endAngle - The Angle, expressed in radians, at which the ellipse will be drawn.
1891   * @param { boolean } [anticlockwise] - If true, the ellipse is drawn counterclockwise (counterclockwise) and clockwise otherwise.
1892   * @syscap SystemCapability.ArkUI.ArkUI.Full
1893   * @since 7
1894   */
1895  ellipse(
1896    x: number,
1897    y: number,
1898    radiusX: number,
1899    radiusY: number,
1900    rotation: number,
1901    startAngle: number,
1902    endAngle: number,
1903    anticlockwise?: boolean,
1904  ): void;
1905
1906  /**
1907   * Moves the current canvas to the specified coordinate point.
1908   *
1909   * @param { number } x - The x axis.
1910   * @param { number } y - The y axis.
1911   * @syscap SystemCapability.ArkUI.ArkUI.Full
1912   * @since 7
1913   */
1914  moveTo(x: number, y: number): void;
1915
1916  /**
1917   * Draw a second order Bezier curve.
1918   *
1919   * @param { number } cpx - The X-axis coordinates of the control points.
1920   * @param { number } cpy - The y-coordinate of the control point.
1921   * @param { number } x - The X-axis of the end point.
1922   * @param { number } y - The Y-axis of the end point.
1923   * @syscap SystemCapability.ArkUI.ArkUI.Full
1924   * @since 7
1925   */
1926  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
1927
1928  /**
1929   * Draw a rectangle.
1930   *
1931   * @param { number } x - The X-axis coordinates at the beginning of the rectangle.
1932   * @param { number } y - The Y-axis coordinates at the beginning of the rectangle.
1933   * @param { number } w - The width of a rectangle.
1934   * @param { number } h - The height of a rectangle.
1935   * @syscap SystemCapability.ArkUI.ArkUI.Full
1936   * @since 7
1937   */
1938  rect(x: number, y: number, w: number, h: number): void;
1939
1940  /**
1941   * Clears the contents of the specified rectangular area.
1942   *
1943   * @param { number } x - The X-axis coordinates at the beginning of the rectangle.
1944   * @param { number } y - The Y-axis coordinates at the beginning of the rectangle.
1945   * @param { number } w - The width of a rectangle.
1946   * @param { number } h - The height of a rectangle.
1947   * @syscap SystemCapability.ArkUI.ArkUI.Full
1948   * @since 7
1949   */
1950  clearRect(x: number, y: number, w: number, h: number): void;
1951
1952  /**
1953   * Fills a rectangular area.
1954   *
1955   * @param { number } x - The X-axis coordinates at the beginning of the rectangle.
1956   * @param { number } y - The Y-axis coordinates at the beginning of the rectangle.
1957   * @param { number } w - The width of a rectangle.
1958   * @param { number } h - The height of a rectangle.
1959   * @syscap SystemCapability.ArkUI.ArkUI.Full
1960   * @since 7
1961   */
1962  fillRect(x: number, y: number, w: number, h: number): void;
1963
1964  /**
1965   * Stroke a rectangular area.
1966   *
1967   * @param { number } x - The X-axis coordinates at the beginning of the rectangle.
1968   * @param { number } y - The Y-axis coordinates at the beginning of the rectangle.
1969   * @param { number } w - The width of the rectangle. Positive values on the right, negative values on the left.
1970   * @param { number } h - The height of the rectangle. Positive values are down, negative values are up.
1971   * @syscap SystemCapability.ArkUI.ArkUI.Full
1972   * @since 7
1973   */
1974  strokeRect(x: number, y: number, w: number, h: number): void;
1975
1976  /**
1977   * Stroke a rectangular area.
1978   *
1979   * @param { string } text - Render text using the current values of font, textAlign, textBaseline, and direction.
1980   * @param { number } y - The Y-axis coordinates of the starting point of the text.
1981   * @param { number } x - The X-axis coordinates of the starting point of the text.
1982   * @syscap SystemCapability.ArkUI.ArkUI.Full
1983   * @since 7
1984   */
1985  fillText(text: string, y: number, x: number /*, maxWidth?: number*/): void;
1986
1987  /**
1988   * Returns a TextMetrics object used to obtain the width of specified text.
1989   *
1990   * @param { string } text - Text to be measured.
1991   * @returns { TextMetrics } Object that contains the text width. You can obtain the width by TextMetrics.width.
1992   * @syscap SystemCapability.ArkUI.ArkUI.Full
1993   * @since 7
1994   */
1995  measureText(text: string): TextMetrics;
1996
1997  /**
1998   * Draws the stroke of a text string.
1999   *
2000   * @param { string } text - Text stroke to draw.
2001   * @param { number } x - X-coordinate of the lower left corner of the text stroke.
2002   * @param { number } y - Y-coordinate of the lower left corner of the text stroke.
2003   * @syscap SystemCapability.ArkUI.ArkUI.Full
2004   * @since 7
2005   */
2006  strokeText(text: string, x: number, y: number /*, maxWidth?: number*/): void;
2007
2008  /**
2009   * Resets the current matrix transformation effect.
2010   *
2011   * @syscap SystemCapability.ArkUI.ArkUI.Full
2012   * @since 7
2013   */
2014  resetTransform(): void;
2015
2016  /**
2017   * Adds a rotation effect to the current canvas.
2018   *
2019   * @param { number } angle - The radian of clockwise rotation.
2020   * @syscap SystemCapability.ArkUI.ArkUI.Full
2021   * @since 7
2022   */
2023  rotate(angle: number): void;
2024
2025  /**
2026   * Adds a zoom effect to the current canvas.
2027   *
2028   * @param { number } x - The horizontal scaling factor.
2029   * @param { number } y - The scaling factor in the vertical direction.
2030   * @syscap SystemCapability.ArkUI.ArkUI.Full
2031   * @since 7
2032   */
2033  scale(x: number, y: number): void;
2034
2035  /**
2036   * Set the rotation, pan, and zoom effects.
2037   *
2038   * @param { number } a - The level of zoom.
2039   * @param { number } b - Vertical tilt.
2040   * @param { number } c - Horizontal tilt.
2041   * @param { number } d - Vertical scaling.
2042   * @param { number } e - The level of mobile.
2043   * @param { number } f - Vertical movement.
2044   * @syscap SystemCapability.ArkUI.ArkUI.Full
2045   * @since 7
2046   */
2047  setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
2048
2049  /**
2050   * Set the rotation, pan, and zoom effects.
2051   *
2052   * @param { number } a - The level of zoom.
2053   * @param { number } b - Vertical tilt.
2054   * @param { number } c - Horizontal tilt.
2055   * @param { number } d - Vertical scaling.
2056   * @param { number } e - The level of mobile.
2057   * @param { number } f - Vertical movement.
2058   * @syscap SystemCapability.ArkUI.ArkUI.Full
2059   * @since 7
2060   */
2061  transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
2062
2063  /**
2064   * Adds a pan effect to the current canvas.
2065   *
2066   * @param { number } x - Horizontal movement distance.
2067   * @param { number } y - Vertical movement.
2068   * @syscap SystemCapability.ArkUI.ArkUI.Full
2069   * @since 7
2070   */
2071  translate(x: number, y: number): void;
2072
2073  /**
2074   * Restores the configuration information of the last saved canvas context.
2075   *
2076   * @syscap SystemCapability.ArkUI.ArkUI.Full
2077   * @since 7
2078   */
2079  restore(): void;
2080
2081  /**
2082   * Saves configuration information for the current canvas context.
2083   *
2084   * @syscap SystemCapability.ArkUI.ArkUI.Full
2085   * @since 7
2086   */
2087  save(): void;
2088}
2089
2090/**
2091 * CanvasRenderingContext2D allows you to draw rectangles, text, images, and other objects on a canvas.
2092 * You can call getContext('2d') on canvas to obtain a CanvasRenderingContext2D object.
2093 *
2094 * @interface CanvasRenderingContext2D
2095 * @syscap SystemCapability.ArkUI.ArkUI.Full
2096 * @since 4
2097 */
2098export interface CanvasRenderingContext2D {
2099  /**
2100   * Fills a rectangle on the canvas.
2101   *
2102   * @param { number } x - X-coordinate of the upper left corner of the rectangle.
2103   * @param { number } y - Y-coordinate of the upper left corner of the rectangle.
2104   * @param { number } width - Width of the rectangle.
2105   * @param { number } height - Height of the rectangle.
2106   * @syscap SystemCapability.ArkUI.ArkUI.Full
2107   * @since 4
2108   */
2109  fillRect(x: number, y: number, width: number, height: number): void;
2110
2111  /**
2112   * Sets the style of a paint to fill an area.
2113   * Paint color used to fill the area.
2114   * Canvas gradient object used by the paint. You can call createLinearGradient() to create a CanvasGradient object.
2115   * Canvas pattern. You can call createPattern() to create a CanvasPattern object.
2116   *
2117   * @type { ?(string | CanvasGradient | CanvasPattern) }
2118   * @syscap SystemCapability.ArkUI.ArkUI.Full
2119   * @since 4
2120   */
2121  fillStyle?: string | CanvasGradient | CanvasPattern;
2122
2123  /**
2124   * Clears the content in a rectangle on the canvas.
2125   *
2126   * @param { number } x - X-coordinate of the upper left corner of the rectangle.
2127   * @param { number } y - Y-coordinate of the upper left corner of the rectangle.
2128   * @param { number } width - Width of the rectangle.
2129   * @param { number } height - Height of the rectangle.
2130   * @syscap SystemCapability.ArkUI.ArkUI.Full
2131   * @since 4
2132   */
2133  clearRect(x: number, y: number, width: number, height: number): void;
2134
2135  /**
2136   * Draws a rectangle stroke on the canvas.
2137   *
2138   * @param { number } x - X-coordinate of the upper left corner of the rectangle stroke.
2139   * @param { number } y - Y-coordinate of the upper left corner of the rectangle stroke.
2140   * @param { number } width - Width of the rectangle stroke.
2141   * @param { number } height - Height of the rectangle stroke.
2142   * @syscap SystemCapability.ArkUI.ArkUI.Full
2143   * @since 4
2144   */
2145  strokeRect(x: number, y: number, width: number, height: number): void;
2146
2147  /**
2148   * Draws filled text on the canvas.
2149   *
2150   * @param { string } text - Text to draw.
2151   * @param { number } x - X-coordinate of the lower left corner of the text.
2152   * @param { number } y - Y-coordinate of the lower left corner of the text.
2153   * @syscap SystemCapability.ArkUI.ArkUI.Full
2154   * @since 4
2155   */
2156  fillText(text: string, x: number, y: number): void;
2157
2158  /**
2159   * Draws a text stroke on the canvas.
2160   *
2161   * @param { string } text - Text stroke to draw.
2162   * @param { number } x - X-coordinate of the lower left corner of the text stroke.
2163   * @param { number } y - Y-coordinate of the lower left corner of the text stroke.
2164   * @syscap SystemCapability.ArkUI.ArkUI.Full
2165   * @since 4
2166   */
2167  strokeText(text: string, x: number, y: number): void;
2168
2169  /**
2170   * Returns a TextMetrics object used to obtain the width of specified text.
2171   *
2172   * @param { string } text - Text to be measured.
2173   * @returns { TextMetrics } Object that contains the text width. You can obtain the width by TextMetrics.width.
2174   * @syscap SystemCapability.ArkUI.ArkUI.Full
2175   * @since 4
2176   */
2177  measureText(text: string): TextMetrics;
2178
2179  /**
2180   * Sets the width of a line.
2181   *
2182   * @type { ?number }
2183   * @syscap SystemCapability.ArkUI.ArkUI.Full
2184   * @since 4
2185   */
2186  lineWidth?: number;
2187
2188  /**
2189   * Sets the stroke paint style.
2190   * Color of the stroke paint.
2191   * Canvas gradient object used by the paint. You can call createLinearGradient() to create a CanvasGradient object.
2192   * Canvas pattern. You can call createPattern() to create a CanvasPattern object.
2193   *
2194   * @type { ?(string | CanvasGradient | CanvasPattern) }
2195   * @syscap SystemCapability.ArkUI.ArkUI.Full
2196   * @since 4
2197   */
2198  strokeStyle?: string | CanvasGradient | CanvasPattern;
2199
2200  /**
2201   * Draws a border stroke.
2202   *
2203   * @syscap SystemCapability.ArkUI.ArkUI.Full
2204   * @since 4
2205   */
2206  stroke(): void;
2207
2208  /**
2209   * Draws a path stroke.
2210   *
2211   * @param { Path2D } path - The object of Path2D.
2212   * @syscap SystemCapability.ArkUI.ArkUI.Full
2213   * @since 4
2214   */
2215  stroke(path: Path2D): void;
2216
2217  /**
2218   * Creates a drawing path.
2219   *
2220   * @syscap SystemCapability.ArkUI.ArkUI.Full
2221   * @since 4
2222   */
2223  beginPath(): void;
2224
2225  /**
2226   * Moves a drawing path to a target position on the canvas.
2227   *
2228   * @param { number } x - X-coordinate of the target position.
2229   * @param { number } y - Y-coordinate of the target position.
2230   * @syscap SystemCapability.ArkUI.ArkUI.Full
2231   * @since 4
2232   */
2233  moveTo(x: number, y: number): void;
2234
2235  /**
2236   * Connects the current point to a target position using a straight line.
2237   *
2238   * @param { number } x - X-coordinate of the target position.
2239   * @param { number } y - Y-coordinate of the target position.
2240   * @syscap SystemCapability.ArkUI.ArkUI.Full
2241   * @since 4
2242   */
2243  lineTo(x: number, y: number): void;
2244
2245  /**
2246   * Draws a closed path.
2247   *
2248   * @syscap SystemCapability.ArkUI.ArkUI.Full
2249   * @since 4
2250   */
2251  closePath(): void;
2252
2253  /**
2254   * Sets the style of line endpoints.
2255   * Style of line endpoints. Available values include:
2256   * butt (default): The endpoints of the line are in square.
2257   * round: The endpoints of the line are rounded.
2258   * square: The endpoints of the line are in square,
2259   * and each end of the line is added with a rectangle whose length is the same as the line thickness and whose width is half of the line thickness.
2260   *
2261   * @type { string }
2262   * @syscap SystemCapability.ArkUI.ArkUI.Full
2263   * @since 4
2264   */
2265  lineCap: string;
2266
2267  /**
2268   * Sets the style for an intersection point where a line joins another.
2269   * Style of the intersection point of lines. Available values include:
2270   * round: The intersection part is a sector. The radius of a rounded corner is equal to the line width.
2271   * bevel: The intersection part is a triangle. The rectangular corner of each line is independent.
2272   * miter (default): The intersection part has a miter corner by extending the outside edges of the lines until they meet.
2273   * You can view the effect of this attribute in miterLimit.
2274   *
2275   * @type { string }
2276   * @syscap SystemCapability.ArkUI.ArkUI.Full
2277   * @since 4
2278   */
2279  lineJoin: string;
2280
2281  /**
2282   * Sets the maximum miter length. The miter length is the distance between the inner corner and the outer corner where two lines meet.
2283   * Maximum miter length. The default value is 10.
2284   *
2285   * @type { number }
2286   * @syscap SystemCapability.ArkUI.ArkUI.Full
2287   * @since 4
2288   */
2289  miterLimit: number;
2290
2291  /**
2292   * Sets the font style.
2293   * Font style.
2294   * The default value is 10px sans-serif in tv, phone, tablet, wearable.
2295   * The default value is 30px SourceHanSansSC-Regular in smartVision.
2296   *
2297   * @type { string }
2298   * @syscap SystemCapability.ArkUI.ArkUI.Full
2299   * @since 4
2300   */
2301  font: string;
2302
2303  /**
2304   * Sets the text alignment mode.
2305   * Text alignment mode. Available values include:
2306   * left (default): The text is left-aligned.
2307   * right: The text is right-aligned.
2308   * center: The text is center-aligned.
2309   * start: The text is aligned with the start bound. Can't be supported by smartVision.
2310   * end: The text is aligned with the end bound. Can't be supported by smartVision.
2311   * NOTE
2312   * In the ltr layout mode, the value start equals to left. In the rtl layout mode, the value start equals to right.
2313   *
2314   * @type { "left" | "right" | "center" | "start" | "end" }
2315   * @syscap SystemCapability.ArkUI.ArkUI.Full
2316   * @since 4
2317   */
2318  textAlign: "left" | "right" | "center" | "start" | "end";
2319
2320  /**
2321   * Sets whether an image is smooth.
2322   * default value is true.
2323   *
2324   * @type { boolean }
2325   * @syscap SystemCapability.ArkUI.ArkUI.Full
2326   * @since 4
2327   */
2328  imageSmoothingEnabled: boolean;
2329
2330  /**
2331   * Sets a text baseline in the horizontal direction for text alignment.
2332   * Text baseline. Available values include:
2333   * alphabetic (default): The text baseline is the normal alphabetic baseline.
2334   * top: The text baseline is on the top of the text bounding box.
2335   * hanging: The text baseline is a hanging baseline over the text.
2336   * middle: The text baseline is in the middle of the text bounding box.
2337   * ideographic: The text baseline is the ideographic baseline. If a character exceeds the alphabetic baseline,
2338   * the ideographic baseline is located at the bottom of the excessive character.
2339   * bottom: The text baseline is at the bottom of the text bounding box.
2340   * Its difference from the ideographic baseline is that the ideographic baseline does not consider letters in the next line.
2341   *
2342   * @type { string }
2343   * @syscap SystemCapability.ArkUI.ArkUI.Full
2344   * @since 4
2345   */
2346  textBaseline: string;
2347
2348  /**
2349   * Creates a linear gradient color.
2350   *
2351   * @param { number } x0 - X-coordinate of the start point.
2352   * @param { number } y0 - Y-coordinate of the start point.
2353   * @param { number } x1 - X-coordinate of the end point.
2354   * @param { number } y1 - Y-coordinate of the end point.
2355   * @returns { CanvasGradient } LinearGradient object.
2356   * @syscap SystemCapability.ArkUI.ArkUI.Full
2357   * @since 6
2358   */
2359  createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
2360
2361  /**
2362   * Creates a radial gradient color.
2363   *
2364   * @param { number } x0 - X-coordinate of the start point.
2365   * @param { number } y0 - Y-coordinate of the start point.
2366   * @param { number } r0 - The radius of the starting circle.
2367   * @param { number } x1 - X-coordinate of the end point.
2368   * @param { number } y1 - Y-coordinate of the end point.
2369   * @param { number } r1 - The radius of End Circle.
2370   * @returns { CanvasGradient } RadialGradient object.
2371   * @syscap SystemCapability.ArkUI.ArkUI.Full
2372   * @since 6
2373   */
2374  createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
2375
2376  /**
2377   * Creates a pattern for image filling based on a specified source image and repetition mode.
2378   *
2379   * @param { Image } image - Source image.
2380   * @param { string } repetition - Repetition mode. The value can be "repeat", "repeat-x", "repeat-y", or "no-repeat".
2381   * @returns { object } Pattern of image filling.
2382   * @syscap SystemCapability.ArkUI.ArkUI.Full
2383   * @since 4
2384   */
2385  createPattern(image: Image, repetition: string): object;
2386
2387  /**
2388   * Creates a path that is later used by the CanvasRenderingContext2D object.
2389   *
2390   * @param { Path2D } [path] - another created Path2D object.
2391   * @returns { Path2D } the object of Path2D.
2392   * @syscap SystemCapability.ArkUI.ArkUI.Full
2393   * @since 4
2394   */
2395  createPath2D(path?: Path2D): Path2D;
2396
2397  /**
2398   * Creates a path that is later used by the CanvasRenderingContext2D object.
2399   *
2400   * @param { string } [cmds] - a string defined using the SVG path command.
2401   * @returns { Path2D } the object of Path2D.
2402   * @syscap SystemCapability.ArkUI.ArkUI.Full
2403   * @since 4
2404   */
2405  createPath2D(cmds?: string): Path2D;
2406
2407  /**
2408   * Draws a cubic bezier curve on the canvas.
2409   *
2410   * @param { number } cp1x - X-coordinate of the first parameter of the bezier curve.
2411   * @param { number } cp1y - Y-coordinate of the first parameter of the bezier curve.
2412   * @param { number } cp2x - X-coordinate of the second parameter of the bezier curve.
2413   * @param { number } cp2y - Y-coordinate of the second parameter of the bezier curve.
2414   * @param { number } x - End point x-coordinate of the bezier curve.
2415   * @param { number } y - End point y-coordinate of the bezier curve.
2416   * @syscap SystemCapability.ArkUI.ArkUI.Full
2417   * @since 4
2418   */
2419  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
2420
2421  /**
2422   * Draws a quadratic curve on the canvas.
2423   *
2424   * @param { number } cpx - X-coordinate of the bezier curve parameter.
2425   * @param { number } cpy - Y-coordinate of the bezier curve parameter.
2426   * @param { number } x - End point x-coordinate of the bezier curve.
2427   * @param { number } y - End point y-coordinate of the bezier curve.
2428   * @syscap SystemCapability.ArkUI.ArkUI.Full
2429   * @since 4
2430   */
2431  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
2432
2433  /**
2434   * Draws an arc on the canvas.
2435   *
2436   * @param { number } x - X-coordinate of the center point of the arc.
2437   * @param { number } y - Y-coordinate of the center point of the arc.
2438   * @param { number } radius - Radius of the arc.
2439   * @param { number } startAngle - Start radian of the arc.
2440   * @param { number } endAngel - End radian of the arc.
2441   * @param { boolean } [anticlockwise] - Whether to draw the arc counterclockwise.
2442   * @syscap SystemCapability.ArkUI.ArkUI.Full
2443   * @since 4
2444   */
2445  arc(x: number, y: number, radius: number, startAngle: number, endAngel: number, anticlockwise?: boolean): void;
2446
2447  /**
2448   * Draws an arc based on the radius and points on the arc.
2449   *
2450   * @param { number } x1 - X-coordinate of the first point on the arc.
2451   * @param { number } y1 - Y-coordinate of the first point on the arc.
2452   * @param { number } x2 - X-coordinate of the second point on the arc.
2453   * @param { number } y2 - Y-coordinate of the second point on the arc.
2454   * @param { number } radius - Radius of the arc.
2455   * @syscap SystemCapability.ArkUI.ArkUI.Full
2456   * @since 4
2457   */
2458  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
2459
2460  /**
2461   * Draws an ellipse based on the coordinate and radius.
2462   *
2463   * @param { number } x - X-coordinate of the center point on the ellipse.
2464   * @param { number } y - Y-coordinate of the center point on the ellipse.
2465   * @param { number } radiusX - X-coordinate of the radius Length on the ellipse.
2466   * @param { number } radiusY - Y-coordinate of the radius Length on the ellipse.
2467   * @param { number } rotation - The rotation angle of the ellipse, in radians.
2468   * @param { number } startAngle - Angle of the start point for ellipse drawing.
2469   * @param { number } endAngle - End Point Angle for Ellipse Drawing.
2470   * @param { number } anticlockwise - Indicates whether to draw an ellipse counterclockwise.
2471   * 0: clockwise; 1: counterclockwise. The default value is 0.
2472   * @syscap SystemCapability.ArkUI.ArkUI.Full
2473   * @since 4
2474   */
2475  ellipse(
2476    x: number,
2477    y: number,
2478    radiusX: number,
2479    radiusY: number,
2480    rotation: number,
2481    startAngle: number,
2482    endAngle: number,
2483    anticlockwise?: number,
2484  ): void;
2485
2486  /**
2487   * Creates a rectangular.
2488   *
2489   * @param { number } x - X-coordinate of the upper left corner of the rectangle.
2490   * @param { number } y - Y-coordinate of the upper left corner of the rectangle.
2491   * @param { number } width - Width of the rectangle.
2492   * @param { number } height - Height of the rectangle.
2493   * @syscap SystemCapability.ArkUI.ArkUI.Full
2494   * @since 4
2495   */
2496  rect(x: number, y: number, width: number, height: number): void;
2497
2498  /**
2499   * Fills the area inside a closed path.
2500   *
2501   * @syscap SystemCapability.ArkUI.ArkUI.Full
2502   * @since 4
2503   */
2504  fill(): void;
2505
2506  /**
2507   * Sets a path as the clipping path.
2508   *
2509   * @syscap SystemCapability.ArkUI.ArkUI.Full
2510   * @since 4
2511   */
2512  clip(): void;
2513
2514  /**
2515   * Rotates a canvas clockwise around its coordinate axes.
2516   *
2517   * @param { number } rotate - Clockwise rotation angle. You can use Math.PI / 180 to convert the angle to radian.
2518   * @syscap SystemCapability.ArkUI.ArkUI.Full
2519   * @since 4
2520   */
2521  rotate(rotate: number): void;
2522
2523  /**
2524   * Scales a canvas based on scaling factors.
2525   *
2526   * @param { number } x - Horizontal scale factor.
2527   * @param { number } y - Vertical scale factor.
2528   * @syscap SystemCapability.ArkUI.ArkUI.Full
2529   * @since 4
2530   */
2531  scale(x: number, y: number): void;
2532
2533  /**
2534   * Defines a transformation matrix.
2535   * To transform a graph, you only need to set parameters of the matrix.
2536   * The coordinates of the corresponding graph are multiplied by the matrix values to obtain new coordinates of the transformed graph.
2537   * You can use the matrix to implement multiple transform effects.
2538   *
2539   * @param { number } scaleX - X-axis scale.
2540   * @param { number } skewX - X-axis skew.
2541   * @param { number } skewY - Y-axis skew.
2542   * @param { number } scaleY - Y-axis scale.
2543   * @param { number } translateX - X-axis translation.
2544   * @param { number } translateY - Y-axis translation.
2545   * @syscap SystemCapability.ArkUI.ArkUI.Full
2546   * @since 4
2547   */
2548  transform(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number): void;
2549
2550  /**
2551   * Uses same parameters as the transform() function to reset the existing transformation matrix and create a new transformation matrix.
2552   *
2553   * @param { number } scaleX - X-axis scale.
2554   * @param { number } skewX - X-axis skew.
2555   * @param { number } skewY - Y-axis skew.
2556   * @param { number } scaleY - Y-axis scale.
2557   * @param { number } translateX - X-axis translation.
2558   * @param { number } translateY - Y-axis translation.
2559   * @syscap SystemCapability.ArkUI.ArkUI.Full
2560   * @since 4
2561   */
2562  setTransform(
2563    scaleX: number,
2564    skewX: number,
2565    skewY: number,
2566    scaleY: number,
2567    translateX: number,
2568    translateY: number,
2569  ): void;
2570
2571  /**
2572   * Moves the origin of the coordinate system.
2573   *
2574   * @param { number } x - X-axis translation.
2575   * @param { number } y - Y-axis translation.
2576   * @syscap SystemCapability.ArkUI.ArkUI.Full
2577   * @since 4
2578   */
2579  translate(x: number, y: number): void;
2580
2581  /**
2582   * Sets the alpha value.
2583   * Global alpha value to set.
2584   * The value ranges from 0.0 (completely transparent) to 1.0 (completely opaque).
2585   *
2586   * @type { number }
2587   * @syscap SystemCapability.ArkUI.ArkUI.Full
2588   * @since 4
2589   */
2590  globalAlpha: number;
2591
2592  /**
2593   * Draws an image.
2594   *
2595   * @param { Image } image - Image resource.
2596   * @param { number } dx - X-coordinate of the upper left corner of the drawing area on the canvas.
2597   * @param { number } dy - Y-coordinate of the upper left corner of the drawing area on the canvas.
2598   * @param { number } dWidth - Width of the drawing area.
2599   * @param { number } dHeight - Height of the drawing area.
2600   * @syscap SystemCapability.ArkUI.ArkUI.Full
2601   * @since 4
2602   */
2603  drawImage(image: Image, dx: number, dy: number, dWidth: number, dHeight: number): void;
2604
2605  /**
2606   * Draws an image.
2607   *
2608   * @param { Image } image - Image resource.
2609   * @param { number } sx - X-coordinate of the upper left corner of the rectangle used to crop the source image.
2610   * @param { number } sy - Y-coordinate of the upper left corner of the rectangle used to crop the source image.
2611   * @param { number } sWidth - Target width of the image to crop.
2612   * @param { number } sHeight - Target height of the image to crop.
2613   * @param { number } dx - X-coordinate of the upper left corner of the drawing area on the canvas.
2614   * @param { number } dy - Y-coordinate of the upper left corner of the drawing area on the canvas.
2615   * @param { number } dWidth - Width of the drawing area.
2616   * @param { number } dHeight - Height of the drawing area.
2617   * @syscap SystemCapability.ArkUI.ArkUI.Full
2618   * @since 4
2619   */
2620  drawImage(
2621    image: Image,
2622    sx: number,
2623    sy: number,
2624    sWidth: number,
2625    sHeight: number,
2626    dx: number,
2627    dy: number,
2628    dWidth: number,
2629    dHeight: number,
2630  ): void;
2631
2632  /**
2633   * Draws an image.
2634   *
2635   * @param { image.PixelMap } image - Image resource.
2636   * @param { number } dx - X-coordinate of the upper left corner of the drawing area on the canvas.
2637   * @param { number } dy - Y-coordinate of the upper left corner of the drawing area on the canvas.
2638   * @param { number } dWidth - Width of the drawing area.
2639   * @param { number } dHeight - Height of the drawing area.
2640   * @syscap SystemCapability.ArkUI.ArkUI.Full
2641   * @since 9
2642   */
2643  drawImage(image: image.PixelMap, dx: number, dy: number, dWidth: number, dHeight: number): void;
2644
2645  /**
2646   * Draws an image.
2647   *
2648   * @param { image.PixelMap } image - Image resource.
2649   * @param { number } sx - X-coordinate of the upper left corner of the rectangle used to crop the source image.
2650   * @param { number } sy - Y-coordinate of the upper left corner of the rectangle used to crop the source image.
2651   * @param { number } sWidth - Target width of the image to crop.
2652   * @param { number } sHeight - Target height of the image to crop.
2653   * @param { number } dx - X-coordinate of the upper left corner of the drawing area on the canvas.
2654   * @param { number } dy - Y-coordinate of the upper left corner of the drawing area on the canvas.
2655   * @param { number } dWidth - Width of the drawing area.
2656   * @param { number } dHeight - Height of the drawing area.
2657   * @syscap SystemCapability.ArkUI.ArkUI.Full
2658   * @since 9
2659   */
2660  drawImage(
2661    image: image.PixelMap,
2662    sx: number,
2663    sy: number,
2664    sWidth: number,
2665    sHeight: number,
2666    dx: number,
2667    dy: number,
2668    dWidth: number,
2669    dHeight: number,
2670  ): void;
2671
2672  /**
2673   * Restores the saved drawing context.
2674   *
2675   * @syscap SystemCapability.ArkUI.ArkUI.Full
2676   * @since 4
2677   */
2678  restore: () => void;
2679
2680  /**
2681   * Saves the current drawing context.
2682   *
2683   * @syscap SystemCapability.ArkUI.ArkUI.Full
2684   * @since 4
2685   */
2686  save: () => void;
2687
2688  /**
2689   * Creates an ImageData object.
2690   *
2691   * @param { number } width - Width of the ImageData object.
2692   * @param { number } height - Height of the ImageData object.
2693   * @returns { ImageData } Returns the newly created FunctionCallable object.
2694   * @syscap SystemCapability.ArkUI.ArkUI.Full
2695   * @since 4
2696   */
2697  createImageData(width: number, height: number): ImageData;
2698  /**
2699   * Creates an ImageData object.
2700   *
2701   * @param { ImageData } imagedata - ImageData object with the same width and height copied from the original ImageData object.
2702   * @returns { ImageData } Returns the newly created FunctionCallable object.
2703   * @syscap SystemCapability.ArkUI.ArkUI.Full
2704   * @since 4
2705   */
2706  createImageData(imagedata: ImageData): ImageData;
2707
2708  /**
2709   * ImageData object created with pixels in the specified area on the canvas.
2710   *
2711   * @param { number } sx - X-coordinate of the upper left corner of the output area.
2712   * @param { number } sy - Y-coordinate of the upper left corner of the output area.
2713   * @param { number } sw - Width of the output area.
2714   * @param { number } sh - Height of the output area.
2715   * @returns { ImageData } ImageData object that contains pixels in the specified area on the canvas.
2716   * @syscap SystemCapability.ArkUI.ArkUI.Full
2717   * @since 4
2718   */
2719  getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
2720
2721  /**
2722   * Get an PixelMap object.
2723   *
2724   * @param { number } sx - The upper-left x-coordinate of the rectangular area of the image data to be extracted.
2725   * @param { number } sy - The upper-left y coordinate of the rectangular region of the image data to be extracted.
2726   * @param { number } sw - The width of the rectangular area of the image data to be extracted.
2727   * @param { number } sh - The height of the rectangular area of the image data to be extracted.
2728   * @returns { image.PixelMap } PixelMap A PixelMap object that contains the rectangular ImageData given by the canvas.
2729   * @syscap SystemCapability.ArkUI.ArkUI.Full
2730   * @since 9
2731   */
2732  getPixelMap(sx: number, sy: number, sw: number, sh: number): image.PixelMap
2733
2734  /**
2735   * Puts the ImageData onto a rectangular area on the canvas.
2736   *
2737   * @param { ImageData } imageData - ImageData object with pixels to put onto the canvas.
2738   * @param { number } dx - X-axis offset of the rectangle area on the canvas.
2739   * @param { number } dy - Y-axis offset of the rectangle area on the canvas.
2740   * @syscap SystemCapability.ArkUI.ArkUI.Full
2741   * @since 4
2742   */
2743  putImageData(imageData: ImageData, dx: number, dy: number): void;
2744
2745  /**
2746   * Puts the ImageData onto a rectangular area on the canvas.
2747   *
2748   * @param { ImageData } imageData - ImageData object with pixels to put onto the canvas.
2749   * @param { number } dx - X-axis offset of the rectangle area on the canvas.
2750   * @param { number } dy - Y-axis offset of the rectangle area on the canvas.
2751   * @param { number } dirtyX - X-axis offset of the upper left corner of the rectangle area relative to that of the source image.
2752   * @param { number } dirtyY - Y-axis offset of the upper left corner of the rectangle area relative to that of the source image.
2753   * @param { number } dirtyWidth - Width of the rectangle area to cop the source image.
2754   * @param { number } dirtyHeight - Height of the rectangle area to cop the source image.
2755   * @syscap SystemCapability.ArkUI.ArkUI.Full
2756   * @since 4
2757   */
2758  putImageData(
2759    imageData: ImageData,
2760    dx: number,
2761    dy: number,
2762    dirtyX: number,
2763    dirtyY: number,
2764    dirtyWidth: number,
2765    dirtyHeight: number,
2766  ): void;
2767
2768  /**
2769   * Sets the dash line style.
2770   *
2771   * @param { Array<number> } segments - Interval of alternate line segments and the length of spacing.
2772   * @syscap SystemCapability.ArkUI.ArkUI.Full
2773   * @since 4
2774   */
2775  setLineDash(segments: Array<number>): void;
2776
2777  /**
2778   * Obtains the dash line style.
2779   *
2780   * @returns { Array<number> } Interval of alternate line segments and the length of spacing.
2781   * @syscap SystemCapability.ArkUI.ArkUI.Full
2782   * @since 4
2783   */
2784  getLineDash(): Array<number>;
2785
2786  /**
2787   * Sets the dash line offset.
2788   * Dash line offset. The value is a float number starting from 0.0.
2789   *
2790   * @type { number }
2791   * @syscap SystemCapability.ArkUI.ArkUI.Full
2792   * @since 4
2793   */
2794  lineDashOffset: number;
2795
2796  /**
2797   * Sets the composite operation type.
2798   * source-over Default value. Displays the new drawing above the existing drawing.
2799   * source-atop Displays the new drawing on the top of the existing drawing.
2800   * source-in Displays the new drawing inside the existing drawing.
2801   * source-out Displays part of the new drawing that is outside of the existing drawing.
2802   * destination-over Displays the existing drawing above the new drawing.
2803   * destination-atop Displays the existing drawing above the new drawing.
2804   * destination-in Displays the existing drawing inside the new drawing.
2805   * destination-out Displays part of the existing drawing that is outside of the new drawing.
2806   * lighter Displays both the new drawing and the existing drawing.
2807   * copy Displays the new drawing and neglects the existing drawing.
2808   * xor Combines the new drawing and existing drawing using the XOR operation.
2809   *
2810   * @type { string }
2811   * @syscap SystemCapability.ArkUI.ArkUI.Full
2812   * @since 4
2813   */
2814  globalCompositeOperation: string;
2815
2816  /**
2817   * Sets the shadow blur degree.
2818   * Shadow blur degree. A larger value indicates a more blurred shadow. The value is of the float type, and the default value is 0.
2819   *
2820   * @type { number }
2821   * @syscap SystemCapability.ArkUI.ArkUI.Full
2822   * @since 4
2823   */
2824  shadowBlur: number;
2825
2826  /**
2827   * Sets the shadow color.
2828   *
2829   * @type { string }
2830   * @syscap SystemCapability.ArkUI.ArkUI.Full
2831   * @since 4
2832   */
2833  shadowColor: string;
2834
2835  /**
2836   * Sets the x-axis shadow offset relative to the original object.
2837   * X-axis shadow offset relative to the original object.
2838   *
2839   * @type { number }
2840   * @syscap SystemCapability.ArkUI.ArkUI.Full
2841   * @since 4
2842   */
2843  shadowOffsetX: number;
2844
2845  /**
2846   * Sets the y-axis shadow offset relative to the original object.
2847   * Y-axis shadow offset relative to the original object.
2848   *
2849   * @type { number }
2850   * @syscap SystemCapability.ArkUI.ArkUI.Full
2851   * @since 4
2852   */
2853  shadowOffsetY: number;
2854
2855  /**
2856   * Draws the Bitmap to the current canvas.
2857   *
2858   * @param { ImageBitmap } bitmap
2859   * @syscap SystemCapability.ArkUI.ArkUI.Full
2860   * @since 7
2861   */
2862  transferFromImageBitmap(bitmap: ImageBitmap): void;
2863}
2864
2865/**
2866 * You can create a gradient object on the canvas by calling CanvasRenderingContext2D.createLinearGradient().
2867 *
2868 * @interface CanvasGradient
2869 * @syscap SystemCapability.ArkUI.ArkUI.Full
2870 * @since 4
2871 */
2872export interface CanvasGradient {
2873  /**
2874   * Adds a color stop for the CanvasGradient object based on the specified offset and gradient color.
2875   *
2876   * @param { number } offset - Proportion of the distance between the color stop and the start point to the total length.
2877   * The value ranges from 0 to 1.
2878   * @param { string } color - Sets the gradient color.
2879   * @syscap SystemCapability.ArkUI.ArkUI.Full
2880   * @since 4
2881   */
2882  addColorStop(offset: number, color: string): void;
2883}
2884
2885/**
2886 * Path2D
2887 *
2888 * @interface Path2D
2889 * @syscap SystemCapability.ArkUI.ArkUI.Full
2890 * @since 4
2891 */
2892export interface Path2D {
2893  /**
2894   * Add another path to current path.
2895   *
2896   * @param { Path2D } path - another created Path2D object.
2897   * @syscap SystemCapability.ArkUI.ArkUI.Full
2898   * @since 4
2899   */
2900  addPath(path: Path2D): void;
2901
2902  /**
2903   * Uses same parameters as the transform() function to reset the existing transformation matrix and create a new transformation matrix.
2904   *
2905   * @param { number } scaleX - X-axis scale.
2906   * @param { number } skewX - X-axis skew.
2907   * @param { number } skewY - Y-axis skew.
2908   * @param { number } scaleY - Y-axis scale.
2909   * @param { number } translateX - X-axis translation.
2910   * @param { number } translateY - Y-axis translation.
2911   * @syscap SystemCapability.ArkUI.ArkUI.Full
2912   * @since 4
2913   */
2914  setTransform(
2915    scaleX: number,
2916    skewX: number,
2917    skewY: number,
2918    scaleY: number,
2919    translateX: number,
2920    translateY: number,
2921  ): void;
2922
2923  /**
2924   * Draws a closed path.
2925   *
2926   * @syscap SystemCapability.ArkUI.ArkUI.Full
2927   * @since 4
2928   */
2929  closePath(): void;
2930
2931  /**
2932   * Moves a drawing path to a target position on the canvas.
2933   *
2934   * @param { number } x - X-coordinate of the target position.
2935   * @param { number } y - Y-coordinate of the target position.
2936   * @syscap SystemCapability.ArkUI.ArkUI.Full
2937   * @since 4
2938   */
2939  moveTo(x: number, y: number): void;
2940
2941  /**
2942   * Connects the current point to a target position using a straight line.
2943   *
2944   * @param { number } x - X-coordinate of the target position.
2945   * @param { number } y - Y-coordinate of the target position.
2946   * @syscap SystemCapability.ArkUI.ArkUI.Full
2947   * @since 4
2948   */
2949  lineTo(x: number, y: number): void;
2950
2951  /**
2952   * Draws a cubic bezier curve on the canvas.
2953   *
2954   * @param { number } cp1x - X-coordinate of the first parameter of the bezier curve.
2955   * @param { number } cp1y - Y-coordinate of the first parameter of the bezier curve.
2956   * @param { number } cp2x - X-coordinate of the second parameter of the bezier curve.
2957   * @param { number } cp2y - Y-coordinate of the second parameter of the bezier curve.
2958   * @param { number } x - End point x-coordinate of the bezier curve.
2959   * @param { number } y - End point y-coordinate of the bezier curve.
2960   * @syscap SystemCapability.ArkUI.ArkUI.Full
2961   * @since 4
2962   */
2963  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
2964
2965  /**
2966   * Draws a quadratic curve on the canvas.
2967   *
2968   * @param { number } cpx - X-coordinate of the bezier curve parameter.
2969   * @param { number } cpy - Y-coordinate of the bezier curve parameter.
2970   * @param { number } x - End point x-coordinate of the bezier curve.
2971   * @param { number } y - End point y-coordinate of the bezier curve.
2972   * @syscap SystemCapability.ArkUI.ArkUI.Full
2973   * @since 4
2974   */
2975  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
2976
2977  /**
2978   * Draws an arc on the canvas.
2979   *
2980   * @param { number } x - X-coordinate of the center point of the arc.
2981   * @param { number } y - Y-coordinate of the center point of the arc.
2982   * @param { number } radius - Radius of the arc.
2983   * @param { number } startAngle - Start radian of the arc.
2984   * @param { number } endAngel - End radian of the arc.
2985   * @param { boolean } [anticlockwise] - Whether to draw the arc counterclockwise.
2986   * @syscap SystemCapability.ArkUI.ArkUI.Full
2987   * @since 4
2988   */
2989  arc(x: number, y: number, radius: number, startAngle: number, endAngel: number, anticlockwise?: boolean): void;
2990
2991  /**
2992   * Draws an arc based on the radius and points on the arc.
2993   *
2994   * @param { number } x1 - X-coordinate of the first point on the arc.
2995   * @param { number } y1 - Y-coordinate of the first point on the arc.
2996   * @param { number } x2 - X-coordinate of the second point on the arc.
2997   * @param { number } y2 - Y-coordinate of the second point on the arc.
2998   * @param { number } radius - Radius of the arc.
2999   * @syscap SystemCapability.ArkUI.ArkUI.Full
3000   * @since 4
3001   */
3002  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
3003
3004  /**
3005   * Draws an ellipse based on the coordinate and radius.
3006   *
3007   * @param { number } x - X-coordinate of the center point on the ellipse.
3008   * @param { number } y - Y-coordinate of the center point on the ellipse.
3009   * @param { number } radiusX - X-coordinate of the radius Length on the ellipse.
3010   * @param { number } radiusY - Y-coordinate of the radius Length on the ellipse.
3011   * @param { number } rotation - The rotation angle of the ellipse, in radians.
3012   * @param { number } startAngle - Angle of the start point for ellipse drawing.
3013   * @param { number } endAngle - End Point Angle for Ellipse Drawing.
3014   * @param { number } anticlockwise - Indicates whether to draw an ellipse counterclockwise.
3015   * 0: clockwise; 1: counterclockwise. The default value is 0.
3016   * @syscap SystemCapability.ArkUI.ArkUI.Full
3017   * @since 4
3018   */
3019  ellipse(
3020    x: number,
3021    y: number,
3022    radiusX: number,
3023    radiusY: number,
3024    rotation: number,
3025    startAngle: number,
3026    endAngle: number,
3027    anticlockwise?: number,
3028  ): void;
3029
3030  /**
3031   * Creates a rectangular.
3032   *
3033   * @param { number } x - X-coordinate of the upper left corner of the rectangle.
3034   * @param { number } y - Y-coordinate of the upper left corner of the rectangle.
3035   * @param { number } width - Width of the rectangle.
3036   * @param { number } height - Height of the rectangle.
3037   * @syscap SystemCapability.ArkUI.ArkUI.Full
3038   * @since 4
3039   */
3040  rect(x: number, y: number, width: number, height: number): void;
3041}
3042
3043/**
3044 * <canvas> provides a rectangular canvas component for drawing graphics on the screen.
3045 * You can control each pixel to draw on the canvas.
3046 * <canvas> offers a variety of functions for drawing paths, rectangles, circles, text, and allows for adding images to it.
3047 *
3048 * @interface CanvasElement
3049 * @syscap SystemCapability.ArkUI.ArkUI.Full
3050 * @since 4
3051 */
3052export interface CanvasElement extends Element {
3053  /**
3054   * Obtains the context of 2D canvas drawing.
3055   * Only parameters related to 2D canvas drawing are supported.
3056   * The return value is a 2D drawing object that provides specific 2D drawing operations.
3057   *
3058   * @param { "2d" } type - identifier defining the drawing context associated to the canvas.
3059   * @param { ContextAttrOptions } [options] - use this context attributes to creating rendering context.
3060   * @returns { CanvasRenderingContext2D }
3061   * @syscap SystemCapability.ArkUI.ArkUI.Full
3062   * @since 4
3063   */
3064  getContext(type: "2d", options?: ContextAttrOptions): CanvasRenderingContext2D;
3065
3066  /**
3067   * Obtains the context of webgl canvas drawing.
3068   * Only parameters related to webgl canvas drawing are supported.
3069   * The return value is a webgl drawing object that provides specific webgl drawing operations.
3070   *
3071   * @param { "webgl" } type - identifier defining the drawing context associated to the canvas.
3072   * @param { WebGLContextAttributes } [options] - use this context attributes to creating rendering context.
3073   * @returns { WebGLRenderingContext }
3074   * @syscap SystemCapability.ArkUI.ArkUI.Full
3075   * @since 6
3076   */
3077  getContext(type: "webgl", options?: WebGLContextAttributes): WebGLRenderingContext;
3078
3079  /**
3080   * Obtains the context of webgl2 canvas drawing.
3081   * Only parameters related to webgl2 canvas drawing are supported.
3082   * The return value is a webgl2 drawing object that provides specific webgl2 drawing operations.
3083   *
3084   * @param { "webgl2" } type - identifier defining the drawing context associated to the canvas.
3085   * @param { WebGLContextAttributes } [options] - use this context attributes to creating rendering context.
3086   * @returns { WebGL2RenderingContext }
3087   * @syscap SystemCapability.ArkUI.ArkUI.Full
3088   * @since 4
3089   */
3090  getContext(type: "webgl2", options?: WebGLContextAttributes): WebGL2RenderingContext;
3091
3092  /**
3093   * Creates a data URI that contains the image display.
3094   *
3095   * @param { string } type - A DOMString indicating the image format. The default type is image/png.
3096   * @param { number } [quality] - A Number between 0 and 1 indicating image quality if the type option
3097   * is image/jpeg or image/webp. If this argument is anything else,
3098   * the default value for image quality is used. Other arguments are ignored.
3099   * @returns { string }
3100   * @syscap SystemCapability.ArkUI.ArkUI.Full
3101   * @since 4
3102   */
3103  toDataURL(type?: string, quality?: number): string;
3104}
3105
3106/**
3107 * ScrollOptions
3108 *
3109 * @interface ScrollOptions
3110 * @syscap SystemCapability.ArkUI.ArkUI.Full
3111 * @since 6
3112 */
3113export interface ScrollOptions {
3114  /**
3115   * Scroll to the target position of the page. Unit: px
3116   *
3117   * @type { number }
3118   * @syscap SystemCapability.ArkUI.ArkUI.Full
3119   * @since 6
3120   */
3121  position: number;
3122
3123  /**
3124   * Duration of the scrolling animation, in ms.
3125   *
3126   * @type { number }
3127   * @syscap SystemCapability.ArkUI.ArkUI.Full
3128   * @since 6
3129   */
3130  duration: number;
3131
3132  /**
3133   * The selector for current scroll.
3134   *
3135   * @type { ?string }
3136   * @syscap SystemCapability.ArkUI.ArkUI.Full
3137   * @since 6
3138   */
3139  id?: string;
3140
3141  /**
3142   * The timing function for current scroll animation.
3143   *
3144   * @type { ?string }
3145   * @syscap SystemCapability.ArkUI.ArkUI.Full
3146   * @since 6
3147   */
3148  timingFunction?: string;
3149
3150  /**
3151   * Callback function for successful interface invocation.
3152   *
3153   * @type { ?function }
3154   * @syscap SystemCapability.ArkUI.ArkUI.Full
3155   * @since 6
3156   */
3157  success?: (result: Object) => void;
3158
3159  /**
3160   * Callback function for interface invocation failure.
3161   *
3162   * @type { ?function }
3163   * @syscap SystemCapability.ArkUI.ArkUI.Full
3164   * @since 6
3165   */
3166  fail?: (result: Object) => void;
3167
3168  /**
3169   * Callback function at the end of the interface invoking (executed both successfully and unsuccessfully).
3170   *
3171   * @type { ?function }
3172   * @syscap SystemCapability.ArkUI.ArkUI.Full
3173   * @since 6
3174   */
3175  complete?: (result: Object) => void;
3176}
3177
3178/**
3179 * ScrollOffset
3180 *
3181 * @interface ScrollOffset
3182 * @syscap SystemCapability.ArkUI.ArkUI.Full
3183 * @since 6
3184 */
3185export interface ScrollOffset {
3186  /**
3187   * Scrolling offset in the x-axis, in px.
3188   *
3189   * @type { number }
3190   * @syscap SystemCapability.ArkUI.ArkUI.Full
3191   * @since 6
3192   */
3193  x: number;
3194
3195  /**
3196   * Scrolling offset in the y-axis, in px.
3197   *
3198   * @type { number }
3199   * @syscap SystemCapability.ArkUI.ArkUI.Full
3200   * @since 6
3201   */
3202  y: number;
3203}
3204
3205/**
3206 * The <div> component provides a div container.
3207 *
3208 * @interface DivElement
3209 * @syscap SystemCapability.ArkUI.ArkUI.Full
3210 * @since 6
3211 */
3212export interface DivElement extends Element {
3213  /**
3214   * Scrolls the div for a certain distance.
3215   *
3216   * @param { ScrollParam } data
3217   * @syscap SystemCapability.ArkUI.ArkUI.Full
3218   * @since 6
3219   */
3220  scrollBy(data: ScrollParam): void;
3221
3222  /**
3223   * Returns the offset of the current scrolling. The return value type is Object.
3224   *
3225   * @returns { ScrollOffset }
3226   * @syscap SystemCapability.ArkUI.ArkUI.Full
3227   * @since 6
3228   */
3229  getScrollOffset(): ScrollOffset;
3230}
3231
3232/**
3233 * Application
3234 *
3235 * @interface Application
3236 * @syscap SystemCapability.ArkUI.ArkUI.Full
3237 * @since 4
3238 */
3239export interface Application {
3240  /**
3241   * Object that is exposed in the app.js file and obtained by this.$app.$def.
3242   *
3243   * @type { any }
3244   * @syscap SystemCapability.ArkUI.ArkUI.Full
3245   * @since 4
3246   */
3247  $def: any;
3248}
3249
3250/**
3251 * ViewModel
3252 *
3253 * @interface ViewModel
3254 * @syscap SystemCapability.ArkUI.ArkUI.Full
3255 * @since 4
3256 */
3257export interface ViewModel {
3258  $app: Application;
3259
3260  /**
3261   * Sets the parameters based on the system language, for example, this.$t('strings.hello').
3262   *
3263   * @param { string } path - Path of the language resource key.
3264   * @param { object | Array<any> } [params] - Content used to replace placeholders during runtime.
3265   * @returns { string } Content.
3266   * There are two types of placeholders available:Named placeholder, for example, {name}.
3267   * The actual content must be of the object type, for example, $t('strings.object', { name: 'Hello world' }).
3268   * Digit placeholder, for example, {0}. The actual content must be of the array type, for example, $t('strings.array', ['Hello world'].
3269   * @syscap SystemCapability.ArkUI.ArkUI.Full
3270   * @since 4
3271   */
3272  $t(path: string, params?: object | Array<any>): string;
3273
3274  /**
3275   * Converse between singular and plural forms based on the system language, for example, this.$tc('strings.plurals').
3276   * NOTE
3277   * The resource content is distinguished by the following JSON keys: zero, one, two, few, many, and other.
3278   *
3279   * @param { string } path - Resource file path.
3280   * @param { number } count - Value.
3281   * @returns { string } Content.
3282   * @syscap SystemCapability.ArkUI.ArkUI.Full
3283   * @since 4
3284   */
3285  $tc(path: string, count: number): string;
3286
3287  /**
3288   * Replace the resource path based on the DPI of the current device: this.$r('image.tv').
3289   *
3290   * @param { string } path - Resource file path.
3291   * @returns { string } Content.
3292   * @syscap SystemCapability.ArkUI.ArkUI.Full
3293   * @since 4
3294   */
3295  $r(path: string): string;
3296
3297  /**
3298   * Adds an attribute or modifies an existing attribute.
3299   * Usage: this.$set('key',value): Add an attribute.
3300   *
3301   * @param { string } key
3302   * @param { any } value
3303   * @syscap SystemCapability.ArkUI.ArkUI.Full
3304   * @since 4
3305   */
3306  $set(key: string, value: any): void;
3307
3308  /**
3309   * Deletes an attribute.
3310   * Usage:this.$delete('key'): Delete an attribute.
3311   *
3312   * @param { string } key
3313   * @syscap SystemCapability.ArkUI.ArkUI.Full
3314   * @since 4
3315   */
3316  $delete(key: string): void;
3317
3318  /**
3319   * Obtains the component with a specified ID. If no ID is specified, the root component is returned.
3320   * Usage:
3321   * <div id='xxx'></div>
3322   * this.$element('xxx'): Obtain the component whose ID is xxx.
3323   * this.$element(): Obtain the root component.
3324   *
3325   * @param { string } [id] - Component ID.
3326   * @returns {AnimationElement &CanvasElement &
3327   * object &WebElement &CameraElement &ListElement &
3328   * SwiperElement &DialogElement &ImageAnimatorElement &
3329   * MarqueeElement &MenuElement &ChartElement &InputElement &
3330   * ButtonElement &TextAreaElement &PickerElement &VideoElement &DivElement}
3331   * @syscap SystemCapability.ArkUI.ArkUI.Full
3332   * @since 4
3333   */
3334  $element(
3335    id?: string,
3336  ): AnimationElement &
3337    CanvasElement &
3338    object &
3339    WebElement &
3340    CameraElement &
3341    ListElement &
3342    SwiperElement &
3343    DialogElement &
3344    ImageAnimatorElement &
3345    MarqueeElement &
3346    MenuElement &
3347    ChartElement &
3348    InputElement &
3349    ButtonElement &
3350    TextAreaElement &
3351    PickerElement &
3352    VideoElement &
3353    DivElement;
3354
3355  /**
3356   * Obtains the root ViewModel instance.
3357   *
3358   * @returns { ViewModel & object }
3359   * @syscap SystemCapability.ArkUI.ArkUI.Full
3360   * @since 4
3361   */
3362  $root(): ViewModel & object;
3363
3364  /**
3365   * Obtains the parent ViewModel instance.
3366   *
3367   * @returns { ViewModel & object }
3368   * @syscap SystemCapability.ArkUI.ArkUI.Full
3369   * @since 4
3370   */
3371  $parent(): ViewModel & object;
3372
3373  /**
3374   * Obtains the ViewModel instance of a custom child component with a specified ID.
3375   * Usage:this.$child('xxx'): Obtain the ViewModel instance of a custom child component whose ID is xxx.
3376   *
3377   * @param { string } id - Component ID.
3378   * @returns { ViewModel & object }
3379   * @syscap SystemCapability.ArkUI.ArkUI.Full
3380   * @since 4
3381   */
3382  $child(id: string): ViewModel & object;
3383
3384  /**
3385   * Listens for attribute changes. If the value of the data attribute changes, the bound event is triggered.
3386   *
3387   * @param { string } data - Attribute.
3388   * @param { string } callback - Function name.
3389   * @syscap SystemCapability.ArkUI.ArkUI.Full
3390   * @since 4
3391   */
3392  $watch(data: string, callback: string): void;
3393
3394  /**
3395   * An object that holds all DOM elements and component instances that have been registered with the refs attribute.
3396   *
3397   * @type { ElementReferences }
3398   * @syscap SystemCapability.ArkUI.ArkUI.Full
3399   * @since 4
3400   */
3401  $refs: ElementReferences;
3402
3403  /**
3404   * Custom events.
3405   *
3406   * @param { string } event - The name of event.
3407   * @param { object } [params] - The params of event.
3408   * @syscap SystemCapability.ArkUI.ArkUI.Full
3409   * @since 4
3410   */
3411  $emit(event: string, params?: object): void;
3412
3413  /**
3414   * Scroll the page to the destination.
3415   *
3416   * @param { ScrollOptions } options - The properties of event.
3417   * @syscap SystemCapability.ArkUI.ArkUI.Full
3418   * @since 6
3419   */
3420  scrollTo(options: ScrollOptions): void;
3421}
3422
3423/**
3424 * ElementReferences
3425 *
3426 * @interface ElementReferences
3427 * @syscap SystemCapability.ArkUI.ArkUI.Full
3428 * @since 4
3429 */
3430export interface ElementReferences {
3431  [k: string]: AnimationElement &
3432  CanvasElement &
3433  object &
3434  WebElement &
3435  CameraElement &
3436  ListElement &
3437  SwiperElement &
3438  DialogElement &
3439  ImageAnimatorElement &
3440  MarqueeElement &
3441  MenuElement &
3442  ChartElement &
3443  InputElement &
3444  ButtonElement &
3445  TextAreaElement &
3446  PickerElement &
3447  VideoElement &
3448  DivElement;
3449}
3450
3451/**
3452 * @syscap SystemCapability.ArkUI.ArkUI.Full
3453 * @since 4
3454 */
3455export declare class Locate {
3456  /**
3457   * language, such as 'zh'.
3458   *
3459   * @type { string }
3460   * @syscap SystemCapability.ArkUI.ArkUI.Full
3461   * @since 4
3462   */
3463  language: string;
3464
3465  /**
3466   * country or region, such ass 'CN'.
3467   *
3468   * @type { string }
3469   * @syscap SystemCapability.ArkUI.ArkUI.Full
3470   * @since 4
3471   */
3472  countryOrRegion: string;
3473
3474  /**
3475   * text layout direction, ltr or rtl.
3476   *
3477   * @type { "ltr" | "rtl" }
3478   * @syscap SystemCapability.ArkUI.ArkUI.Full
3479   * @since 4
3480   */
3481  dir: "ltr" | "rtl";
3482
3483  /**
3484   * The Unicode locale key set defined by the locale. If this locale does not have a specific key set, an empty set is
3485   * returned. For example: {"nu": "arab"}, which means that the numbers in the current environment use Arabic numbers.
3486   *
3487   * @syscap SystemCapability.ArkUI.ArkUI.Full
3488   * @since 5
3489   */
3490  unicodeSetting: object;
3491}
3492
3493/**
3494 * @syscap SystemCapability.ArkUI.ArkUI.Full
3495 * @since 6
3496 */
3497export declare class Configuration {
3498  /**
3499   * Internationalization related information, such as language, country, text layout direction, etc.
3500   *
3501   * @type { Locate }
3502   * @syscap SystemCapability.ArkUI.ArkUI.Full
3503   * @since 6
3504   */
3505  locate: Locate;
3506
3507  /**
3508   * The magnification of the current system font.
3509   *
3510   * @type { number }
3511   * @syscap SystemCapability.ArkUI.ArkUI.Full
3512   * @since 6
3513   */
3514  fontScale: number;
3515}
3516
3517/**
3518 * Options
3519 *
3520 * @interface Options
3521 * @syscap SystemCapability.ArkUI.ArkUI.Full
3522 * @since 4
3523 */
3524export interface Options<T extends ViewModel, Data = DefaultData<T>> {
3525  /**
3526   * Data model of the page that can be converted into a JSON object.
3527   * The attribute name cannot start with $ or an underscore (_) or contain the reserved words such as for, if, show, and tid.
3528   * For a function, the return value must be an object.
3529   * Set the value of data to the return value of the function during page initialization.
3530   *
3531   * @type { ?Data }
3532   * @syscap SystemCapability.ArkUI.ArkUI.Full
3533   * @since 4
3534   */
3535  data?: Data;
3536
3537  /**
3538   * Listens for page initialization.
3539   * Called when page initialization is complete. This function is called only once in a lifecycle.
3540   *
3541   * @syscap SystemCapability.ArkUI.ArkUI.Full
3542   * @since 4
3543   */
3544  onInit?(): void;
3545
3546  /**
3547   * Listens for page creation.
3548   * Called when a page is created. This function is called only once in a lifecycle.
3549   *
3550   * @syscap SystemCapability.ArkUI.ArkUI.Full
3551   * @since 4
3552   */
3553  onReady?(): void;
3554
3555  /**
3556   * Listens for page display.
3557   * Called when the page is displayed.
3558   *
3559   * @syscap SystemCapability.ArkUI.ArkUI.Full
3560   * @since 4
3561   */
3562  onShow?(): void;
3563
3564  /**
3565   * Listens for page hiding.
3566   * Called when the page disappears.
3567   *
3568   * @syscap SystemCapability.ArkUI.ArkUI.Full
3569   * @since 4
3570   */
3571  onHide?(): void;
3572
3573  /**
3574   * Listens for page destruction.
3575   * Called when the page is destroyed.
3576   *
3577   * @syscap SystemCapability.ArkUI.ArkUI.Full
3578   * @since 4
3579   */
3580  onDestroy?(): void;
3581
3582  /**
3583   * Listens for the back button action.
3584   * The back button is tapped:
3585   *
3586   * @returns { boolean } true means that the page processes the return logic.
3587   * false means that the default return logic is used.
3588   * If no value is returned, the default return logic is used.
3589   * @syscap SystemCapability.ArkUI.ArkUI.Full
3590   * @since 4
3591   */
3592  onBackPress?(): boolean;
3593
3594  /**
3595   * Listens for page active.
3596   * Called when the page is active.
3597   *
3598   * @syscap SystemCapability.ArkUI.ArkUI.Full
3599   * @since 5
3600   */
3601  onActive?(): void;
3602
3603  /**
3604   * Listens for page inactive.
3605   * Called when the page is paused.
3606   *
3607   * @syscap SystemCapability.ArkUI.ArkUI.Full
3608   * @since 5
3609   */
3610  onInactive?(): void;
3611
3612  /**
3613   * This callback is triggered when a new request is received when the FA has started.
3614   *
3615   * @syscap SystemCapability.ArkUI.ArkUI.Full
3616   * @since 5
3617   */
3618  onNewRequest?(): void;
3619
3620  /**
3621   * Callback when FA initiates a migration, in this callback, the application can decide whether
3622   * to migrate according to the current state.
3623   *
3624   * @returns { boolean }
3625   * @syscap SystemCapability.ArkUI.ArkUI.Full
3626   * @since 5
3627   */
3628  onStartContinuation?(): boolean;
3629
3630  /**
3631   * For the callback of saving state data, the developer needs to fill in the parameter object
3632   * the data to be migrated to the target device.
3633   *
3634   * @param { object } value
3635   * @syscap SystemCapability.ArkUI.ArkUI.Full
3636   * @since 5
3637   */
3638  onSaveData?(value: object): void;
3639
3640  /**
3641   * The callback to restore the data saved by the onSaveData method when the migration was initiated.
3642   *
3643   * @param { object } value
3644   * @syscap SystemCapability.ArkUI.ArkUI.Full
3645   * @since 5
3646   */
3647  onRestoreData?(value: object): void;
3648
3649  /**
3650   * The callback for the completion of the migration, which is triggered on the calling side, indicates
3651   * the result of the application migration to the target device.
3652   *
3653   * @param { number } code
3654   * @syscap SystemCapability.ArkUI.ArkUI.Full
3655   * @since 5
3656   */
3657  onCompleteContinuation?(code: number): void;
3658
3659  /**
3660   * This callback is triggered when the corresponding system configuration changes, such as system font size,
3661   * language region, etc.
3662   *
3663   * @param { Configuration } configuration
3664   * @syscap SystemCapability.ArkUI.ArkUI.Full
3665   * @since 6
3666   */
3667  onConfigurationUpdated?(configuration: Configuration): void;
3668
3669  /**
3670   * Listens for application creation.
3671   * Called when the application is created.
3672   *
3673   * @syscap SystemCapability.ArkUI.ArkUI.Full
3674   * @since 4
3675   */
3676  onCreate?(): void;
3677}
3678
3679/**
3680 * Used for ide.
3681 *
3682 * @syscap SystemCapability.ArkUI.ArkUI.Full
3683 * @systemapi
3684 * @since 4
3685 */
3686type DefaultData<T> = object;
3687/**
3688 * Used for ide.
3689 *
3690 * @syscap SystemCapability.ArkUI.ArkUI.Full
3691 * @systemapi
3692 * @since 4
3693 */
3694type CombinedOptions<T extends ViewModel, Data> = object & Options<T, Data> & ThisType<T & ViewModel & Data>;
3695/**
3696 * @param { CombinedOptions<T, Data> } options
3697 * @returns { ViewModel & Data }
3698 * @syscap SystemCapability.ArkUI.ArkUI.Full
3699 * @systemapi
3700 * @since 4
3701 */
3702export declare function extendViewModel<T extends ViewModel, Data>(options: CombinedOptions<T, Data>): ViewModel & Data;
3703