xref: /interface/sdk-js/api/arkui/Graphics.d.ts (revision 61847f8e)
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20import drawing from '../@ohos.graphics.drawing';
21import type common2D from '../@ohos.graphics.common2D';
22import { Resource } from '../global/resource';
23
24/**
25 * Size info.
26 *
27 * @interface Size
28 * @syscap SystemCapability.ArkUI.ArkUI.Full
29 * @crossplatform
30 * @since 11
31 */
32/**
33 * Size info.
34 *
35 * @interface Size
36 * @syscap SystemCapability.ArkUI.ArkUI.Full
37 * @crossplatform
38 * @atomicservice
39 * @since 12
40 */
41export interface Size {
42  /**
43   * Get the width of the Size.
44   *
45   * @type { number }
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @crossplatform
48   * @since 11
49   */
50  /**
51   * Get the width of the Size.
52   *
53   * @type { number }
54   * @syscap SystemCapability.ArkUI.ArkUI.Full
55   * @crossplatform
56   * @atomicservice
57   * @since 12
58   */
59  width: number;
60
61  /**
62   * Get the height of the Size.
63   *
64   * @type { number }
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @crossplatform
67   * @since 11
68   */
69  /**
70   * Get the height of the Size.
71   *
72   * @type { number }
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @crossplatform
75   * @atomicservice
76   * @since 12
77   */
78  height: number;
79}
80
81/**
82 * Defines DrawContext.
83 *
84 * @syscap SystemCapability.ArkUI.ArkUI.Full
85 * @crossplatform
86 * @since 11
87 */
88/**
89 * Defines DrawContext.
90 *
91 * @syscap SystemCapability.ArkUI.ArkUI.Full
92 * @crossplatform
93 * @atomicservice
94 * @since 12
95 */
96export class DrawContext {
97
98  /**
99   * Get size of the DrawContext.
100   *
101   * @returns { Size } The size of the DrawContext.
102   * @syscap SystemCapability.ArkUI.ArkUI.Full
103   * @crossplatform
104   * @since 11
105   */
106  /**
107   * Get size of the DrawContext.
108   *
109   * @returns { Size } The size of the DrawContext.
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @crossplatform
112   * @atomicservice
113   * @since 12
114   */
115  get size(): Size;
116
117  /**
118   * Get size of the DrawContext with pixel unit.
119   *
120   * @returns { Size } The size of the DrawContext with pixel unit.
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @crossplatform
123   * @atomicservice
124   * @since 12
125   */
126  get sizeInPixel(): Size;
127
128  /**
129   * Get canvas of the DrawContext.
130   *
131   * @returns { drawing.Canvas } The canvas of the DrawContext.
132   * @syscap SystemCapability.ArkUI.ArkUI.Full
133   * @crossplatform
134   * @since 11
135   */
136  /**
137   * Get canvas of the DrawContext.
138   *
139   * @returns { drawing.Canvas } The canvas of the DrawContext.
140   * @syscap SystemCapability.ArkUI.ArkUI.Full
141   * @crossplatform
142   * @atomicservice
143   * @since 12
144   */
145  get canvas(): drawing.Canvas;
146}
147
148/**
149  * Defined a vector with two values.
150  *
151  * @interface Vector2
152  * @syscap SystemCapability.ArkUI.ArkUI.Full
153  * @crossplatform
154  * @since 11
155  */
156 /**
157  * Defined a vector with two values.
158  *
159  * @interface Vector2
160  * @syscap SystemCapability.ArkUI.ArkUI.Full
161  * @crossplatform
162  * @atomicservice
163  * @since 12
164  */
165interface Vector2 {
166  /**
167   * Value for x-axis of the vector.
168   *
169   * @type { number }
170   * @syscap SystemCapability.ArkUI.ArkUI.Full
171   * @crossplatform
172   * @since 11
173   */
174  /**
175   * Value for x-axis of the vector.
176   *
177   * @type { number }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @crossplatform
180   * @atomicservice
181   * @since 12
182   */
183  x: number
184
185  /**
186   * Value for y-axis of the vector.
187   *
188   * @type { number }
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @crossplatform
191   * @since 11
192   */
193  /**
194   * Value for y-axis of the vector.
195   *
196   * @type { number }
197   * @syscap SystemCapability.ArkUI.ArkUI.Full
198   * @crossplatform
199   * @atomicservice
200   * @since 12
201   */
202  y: number
203}
204
205 /**
206  * Defined a vector with two T type values.
207  *
208  * @interface Vector2T
209  * @syscap SystemCapability.ArkUI.ArkUI.Full
210  * @crossplatform
211  * @atomicservice
212  * @since 12
213  */
214 interface Vector2T<T> {
215
216  /**
217   * Value for x-axis of the vector.
218   *
219   * @type { T }
220   * @syscap SystemCapability.ArkUI.ArkUI.Full
221   * @crossplatform
222   * @atomicservice
223   * @since 12
224   */
225  x: T
226
227  /**
228   * Value for y-axis of the vector.
229   *
230   * @type { T }
231   * @syscap SystemCapability.ArkUI.ArkUI.Full
232   * @crossplatform
233   * @atomicservice
234   * @since 12
235   */
236  y: T
237}
238
239/**
240 * Defined a vector with three values.
241 *
242 * @interface Vector3
243 * @syscap SystemCapability.ArkUI.ArkUI.Full
244 * @crossplatform
245 * @since 11
246 */
247/**
248 * Defined a vector with three values.
249 *
250 * @interface Vector3
251 * @syscap SystemCapability.ArkUI.ArkUI.Full
252 * @crossplatform
253 * @atomicservice
254 * @since 12
255 */
256interface Vector3 {
257  /**
258   * Value for x-axis of the vector.
259   *
260   * @type { number }
261   * @syscap SystemCapability.ArkUI.ArkUI.Full
262   * @crossplatform
263   * @since 11
264   */
265  /**
266   * Value for x-axis of the vector.
267   *
268   * @type { number }
269   * @syscap SystemCapability.ArkUI.ArkUI.Full
270   * @crossplatform
271   * @atomicservice
272   * @since 12
273   */
274  x: number;
275
276  /**
277   * Value for y-axis of the vector.
278   *
279   * @type { number }
280   * @syscap SystemCapability.ArkUI.ArkUI.Full
281   * @crossplatform
282   * @since 11
283   */
284  /**
285   * Value for y-axis of the vector.
286   *
287   * @type { number }
288   * @syscap SystemCapability.ArkUI.ArkUI.Full
289   * @crossplatform
290   * @atomicservice
291   * @since 12
292   */
293  y: number;
294
295  /**
296   * Value for z-axis of the vector.
297   *
298   * @type { number }
299   * @syscap SystemCapability.ArkUI.ArkUI.Full
300   * @crossplatform
301   * @since 11
302   */
303  /**
304   * Value for z-axis of the vector.
305   *
306   * @type { number }
307   * @syscap SystemCapability.ArkUI.ArkUI.Full
308   * @crossplatform
309   * @atomicservice
310   * @since 12
311   */
312  z: number;
313}
314
315/**
316 * It's a 4x4 matrix, represent by number[].
317 *
318 * @typedef { number[] } Matrix4
319 * @syscap SystemCapability.ArkUI.ArkUI.Full
320 * @crossplatform
321 * @since 11
322 */
323/**
324 * It's a 4x4 matrix, represent by number[].
325 *
326 * @typedef { number[] } Matrix4
327 * @syscap SystemCapability.ArkUI.ArkUI.Full
328 * @crossplatform
329 * @atomicservice
330 * @since 12
331 */
332export type Matrix4 = [
333  number,
334  number,
335  number,
336  number,
337  number,
338  number,
339  number,
340  number,
341  number,
342  number,
343  number,
344  number,
345  number,
346  number,
347  number,
348  number
349];
350
351/**
352 * Offset info.
353 *
354 * @typedef { Vector2 } Offset
355 * @syscap SystemCapability.ArkUI.ArkUI.Full
356 * @crossplatform
357 * @since 11
358 */
359/**
360 * Offset info.
361 *
362 * @typedef { Vector2 } Offset
363 * @syscap SystemCapability.ArkUI.ArkUI.Full
364 * @crossplatform
365 * @atomicservice
366 * @since 12
367 */
368export type Offset = Vector2;
369
370/**
371 * Position info.
372 *
373 * @typedef { Vector2 } Position
374 * @syscap SystemCapability.ArkUI.ArkUI.Full
375 * @crossplatform
376 * @since 11
377 */
378/**
379 * Position info.
380 *
381 * @typedef { Vector2 } Position
382 * @syscap SystemCapability.ArkUI.ArkUI.Full
383 * @crossplatform
384 * @atomicservice
385 * @since 12
386 */
387export type Position = Vector2;
388
389/**
390 * PositionT info.
391 * @typedef {Vector2T<T> }
392 * @syscap SystemCapability.ArkUI.ArkUI.Full
393 * @crossplatform
394 * @atomicservice
395 * @since 12
396 */
397export type PositionT<T> = Vector2T<T>;
398
399/**
400 * Pivot info.
401 *
402 * @typedef { Vector2 } Pivot
403 * @syscap SystemCapability.ArkUI.ArkUI.Full
404 * @crossplatform
405 * @since 11
406 */
407/**
408 * Pivot info.
409 *
410 * @typedef { Vector2 } Pivot
411 * @syscap SystemCapability.ArkUI.ArkUI.Full
412 * @crossplatform
413 * @atomicservice
414 * @since 12
415 */
416export type Pivot = Vector2;
417
418/**
419 * Scale info.
420 *
421 * @typedef { Vector2 } Scale
422 * @syscap SystemCapability.ArkUI.ArkUI.Full
423 * @crossplatform
424 * @since 11
425 */
426/**
427 * Scale info.
428 *
429 * @typedef { Vector2 } Scale
430 * @syscap SystemCapability.ArkUI.ArkUI.Full
431 * @crossplatform
432 * @atomicservice
433 * @since 12
434 */
435export type Scale = Vector2;
436
437/**
438 * Translation info.
439 *
440 * @typedef { Vector2 } Translation
441 * @syscap SystemCapability.ArkUI.ArkUI.Full
442 * @crossplatform
443 * @since 11
444 */
445/**
446 * Translation info.
447 *
448 * @typedef { Vector2 } Translation
449 * @syscap SystemCapability.ArkUI.ArkUI.Full
450 * @crossplatform
451 * @atomicservice
452 * @since 12
453 */
454export type Translation = Vector2;
455
456/**
457 * Rotation info.
458 *
459 * @typedef { Vector3 } Rotation
460 * @syscap SystemCapability.ArkUI.ArkUI.Full
461 * @crossplatform
462 * @since 11
463 */
464/**
465 * Rotation info.
466 *
467 * @typedef { Vector3 } Rotation
468 * @syscap SystemCapability.ArkUI.ArkUI.Full
469 * @crossplatform
470 * @atomicservice
471 * @since 12
472 */
473export type Rotation = Vector3;
474
475/**
476 * Frame info, include the position info and size info.
477 *
478 * @interface Frame
479 * @syscap SystemCapability.ArkUI.ArkUI.Full
480 * @crossplatform
481 * @since 11
482 */
483/**
484 * Frame info, include the position info and size info.
485 *
486 * @interface Frame
487 * @syscap SystemCapability.ArkUI.ArkUI.Full
488 * @crossplatform
489 * @atomicservice
490 * @since 12
491 */
492export declare interface Frame {
493  /**
494   * Position value for x-axis of the frame info.
495   *
496   * @type { number }
497   * @syscap SystemCapability.ArkUI.ArkUI.Full
498   * @crossplatform
499   * @since 11
500   */
501  /**
502   * Position value for x-axis of the frame info.
503   *
504   * @type { number }
505   * @syscap SystemCapability.ArkUI.ArkUI.Full
506   * @crossplatform
507   * @atomicservice
508   * @since 12
509   */
510  x: number;
511
512  /**
513   * Position value for y-axis of the frame info.
514   *
515   * @type { number }
516   * @syscap SystemCapability.ArkUI.ArkUI.Full
517   * @crossplatform
518   * @since 11
519   */
520  /**
521   * Position value for y-axis of the frame info.
522   *
523   * @type { number }
524   * @syscap SystemCapability.ArkUI.ArkUI.Full
525   * @crossplatform
526   * @atomicservice
527   * @since 12
528   */
529  y: number;
530
531  /**
532   * Size value for width of the frame info.
533   *
534   * @type { number }
535   * @syscap SystemCapability.ArkUI.ArkUI.Full
536   * @crossplatform
537   * @since 11
538   */
539  /**
540   * Size value for width of the frame info.
541   *
542   * @type { number }
543   * @syscap SystemCapability.ArkUI.ArkUI.Full
544   * @crossplatform
545   * @atomicservice
546   * @since 12
547   */
548  width: number;
549
550  /**
551   * Size value for height of the frame info.
552   *
553   * @type { number }
554   * @syscap SystemCapability.ArkUI.ArkUI.Full
555   * @crossplatform
556   * @since 11
557   */
558  /**
559   * Size value for height of the frame info.
560   *
561   * @type { number }
562   * @syscap SystemCapability.ArkUI.ArkUI.Full
563   * @crossplatform
564   * @atomicservice
565   * @since 12
566   */
567  height: number;
568}
569
570/**
571 * Defines the Edge property.
572 *
573 * @interface Edges
574 * @syscap SystemCapability.ArkUI.ArkUI.Full
575 * @crossplatform
576 * @atomicservice
577 * @since 12
578 */
579export interface Edges<T> {
580  /**
581   * Left property.
582   *
583   * @type { T }
584   * @syscap SystemCapability.ArkUI.ArkUI.Full
585   * @crossplatform
586   * @atomicservice
587   * @since 12
588   */
589  left: T,
590
591  /**
592   * Right property.
593   *
594   * @type { T }
595   * @syscap SystemCapability.ArkUI.ArkUI.Full
596   * @crossplatform
597   * @atomicservice
598   * @since 12
599   */
600  right: T,
601
602  /**
603   * Top property.
604   *
605   * @type { T }
606   * @syscap SystemCapability.ArkUI.ArkUI.Full
607   * @crossplatform
608   * @atomicservice
609   * @since 12
610   */
611  top: T,
612
613  /**
614   * Bottom property.
615   *
616   * @type { T }
617   * @syscap SystemCapability.ArkUI.ArkUI.Full
618   * @crossplatform
619   * @atomicservice
620   * @since 12
621   */
622  bottom: T
623}
624
625/**
626 * Defines the Length Unit.
627 *
628 * @enum { number }
629 * @syscap SystemCapability.ArkUI.ArkUI.Full
630 * @crossplatform
631 * @atomicservice
632 * @since 12
633 */
634declare enum LengthUnit {
635  /**
636   * Logical pixel used in Ace1.0. It's based on frontend design width.
637   * For example, when a frontend with 750px design width running on a
638   * device with 1080 pixels width, 1px represents 1.44 pixels.
639   *
640   * @syscap SystemCapability.ArkUI.ArkUI.Full
641   * @crossplatform
642   * @atomicservice
643   * @since 12
644   */
645  PX = 0,
646
647  /**
648   * Density independent pixels, one vp is one pixel on a 160 dpi screen.
649   *
650   * @syscap SystemCapability.ArkUI.ArkUI.Full
651   * @crossplatform
652   * @atomicservice
653   * @since 12
654   */
655  VP = 1,
656
657  /**
658   * Scale independent pixels. This is like VP but will be scaled by
659   * user's font size preference.
660   *
661   * @syscap SystemCapability.ArkUI.ArkUI.Full
662   * @crossplatform
663   * @atomicservice
664   * @since 12
665   */
666  FP = 2,
667
668  /**
669   * The percentage of either a value from the element's parent or from
670   * another property of the element itself.
671   *
672   * @syscap SystemCapability.ArkUI.ArkUI.Full
673   * @crossplatform
674   * @atomicservice
675   * @since 12
676   */
677  PERCENT = 3,
678
679  /**
680   * Logic pixels used in ACE2.0 instead of PX, and PX is the physical pixels in ACE2.0.
681   *
682   * @syscap SystemCapability.ArkUI.ArkUI.Full
683   * @crossplatform
684   * @atomicservice
685   * @since 12
686   */
687  LPX = 4,
688}
689
690/**
691 * Defines the Size property.
692 *
693 * @interface SizeT
694 * @syscap SystemCapability.ArkUI.ArkUI.Full
695 * @crossplatform
696 * @atomicservice
697 * @since 12
698 */
699export interface SizeT<T> {
700  /**
701   * Width property.
702   *
703   * @type { T }
704   * @syscap SystemCapability.ArkUI.ArkUI.Full
705   * @crossplatform
706   * @atomicservice
707   * @since 12
708   */
709  width: T;
710
711  /**
712   * Height property.
713   *
714   * @type { T }
715   * @syscap SystemCapability.ArkUI.ArkUI.Full
716   * @crossplatform
717   * @atomicservice
718   * @since 12
719   */
720  height: T;
721}
722
723/**
724 * Enumerates the length metrics unit.
725 *
726 * @enum { number }
727 * @syscap SystemCapability.ArkUI.ArkUI.Full
728 * @crossplatform
729 * @atomicservice
730 * @since 12
731 */
732export enum LengthMetricsUnit {
733
734  /**
735   * The default length metrics unit.
736   *
737   * @syscap SystemCapability.ArkUI.ArkUI.Full
738   * @crossplatform
739   * @atomicservice
740   * @since 12
741   */
742  DEFAULT = 0,
743
744  /**
745   * The pixel length metrics unit.
746   *
747   * @syscap SystemCapability.ArkUI.ArkUI.Full
748   * @crossplatform
749   * @atomicservice
750   * @since 12
751   */
752  PX = 1
753}
754
755/**
756 * Defines the Length Metrics.
757 *
758 * @syscap SystemCapability.ArkUI.ArkUI.Full
759 * @crossplatform
760 * @atomicservice
761 * @since 12
762 */
763declare class LengthMetrics {
764  /**
765   * Constructor.
766   *
767   * @param { number } value - The value of length.
768   * @param { LengthUnit } [unit] - The length unit.
769   * @syscap SystemCapability.ArkUI.ArkUI.Full
770   * @crossplatform
771   * @atomicservice
772   * @since 12
773   */
774  constructor(value: number, unit?:LengthUnit);
775
776  /**
777   * Init a lengthMetrics with px unit.
778   *
779   * @param { number } value - The value of the length metrics.
780   * @returns { LengthMetrics } Returns the lengthMetrics object with unit px.
781   * @static
782   * @syscap SystemCapability.ArkUI.ArkUI.Full
783   * @crossplatform
784   * @atomicservice
785   * @since 12
786   */
787  static px(value: number): LengthMetrics;
788
789  /**
790   * Init a lengthMetrics with vp unit.
791   *
792   * @param { number } value - The value of the length metrics.
793   * @returns { LengthMetrics } - Returns the lengthMetrics object with unit vp.
794   * @static
795   * @syscap SystemCapability.ArkUI.ArkUI.Full
796   * @crossplatform
797   * @atomicservice
798   * @since 12
799   */
800  static vp(value: number): LengthMetrics;
801
802  /**
803   * Init a lengthMetrics with fp unit.
804   *
805   * @param { number } value - The value of the length metrics.
806   * @returns { LengthMetrics } Returns the lengthMetrics object with unit fp.
807   * @static
808   * @syscap SystemCapability.ArkUI.ArkUI.Full
809   * @crossplatform
810   * @atomicservice
811   * @since 12
812   */
813  static fp(value: number): LengthMetrics;
814
815  /**
816   * Init a lengthMetrics with percent unit.
817   *
818   * @param { number } value - The value of the length metrics.
819   * @returns { LengthMetrics } Returns the lengthMetrics object with unit percent.
820   * @static
821   * @syscap SystemCapability.ArkUI.ArkUI.Full
822   * @crossplatform
823   * @atomicservice
824   * @since 12
825   */
826  static percent(value: number): LengthMetrics;
827
828  /**
829   * Init a lengthMetrics with lpx unit.
830   *
831   * @param { number } value - The value of the length metrics.
832   * @returns { LengthMetrics } Returns the lengthMetrics object with unit lpx.
833   * @static
834   * @syscap SystemCapability.ArkUI.ArkUI.Full
835   * @crossplatform
836   * @atomicservice
837   * @since 12
838   */
839  static lpx(value: number): LengthMetrics;
840
841  /**
842   * Init a lengthMetrics with Resource unit.
843   *
844   * @param { Resource } value - The value of the length metrics.
845   * @returns { LengthMetrics } Returns the lengthMetrics object with unit Resource.
846   * @throws { BusinessError } 180001 - System resources does not exist.
847   * @throws { BusinessError } 180002 - The type of system resources is incorrect.
848   * @static
849   * @syscap SystemCapability.ArkUI.ArkUI.Full
850   * @crossplatform
851   * @atomicservice
852   * @since 12
853   */
854  static resource(value: Resource): LengthMetrics;
855  
856  /**
857   * The unit of the LengthMetrics. The default value is VP.
858   *
859   * @type { LengthUnit }
860   * @default VP
861   * @syscap SystemCapability.ArkUI.ArkUI.Full
862   * @crossplatform
863   * @atomicservice
864   * @since 12
865   */
866  public unit: LengthUnit;
867
868  /**
869   * The value of the LengthMetrics.
870   *
871   * @type { number }
872   * @syscap SystemCapability.ArkUI.ArkUI.Full
873   * @crossplatform
874   * @atomicservice
875   * @since 12
876   */
877  public value: number;
878}
879
880/**
881 * Defines the ColorMetrics class.
882 *
883 * @syscap SystemCapability.ArkUI.ArkUI.Full
884 * @crossplatform
885 * @atomicservice
886 * @since 12
887 */
888declare class ColorMetrics {
889  /**
890   * Instantiate the ColorMetrics class using color number
891   *
892   * @param { number } value - color number
893   * @returns { ColorMetrics } ColorMetrics class
894   * @syscap SystemCapability.ArkUI.ArkUI.Full
895   * @crossplatform
896   * @atomicservice
897   * @since 12
898   */
899  static numeric(value: number): ColorMetrics;
900
901  /**
902   * Instantiate the ColorMetrics class using color rgb
903   *
904   * @param { number } red - red value of rgba
905   * @param { number } green - green value of rgba
906   * @param { number } blue - blue value of rgba
907   * @param { number } alpha - opacity value of rgba
908   * @returns { ColorMetrics } ColorMetrics class
909   * @syscap SystemCapability.ArkUI.ArkUI.Full
910   * @crossplatform
911   * @atomicservice
912   * @since 12
913   */
914  static rgba(red: number, green: number, blue: number, alpha?: number): ColorMetrics;
915
916  /**
917   * Instantiate the ColorMetrics class using ResourceColor
918   *
919   * @param { ResourceColor } color - resource color
920   * @returns { ColorMetrics } ColorMetrics class
921   * @throws { BusinessError } 180003 - Failed to obtain the color resource.
922   * @throws { BusinessError } 401 - Parameter error. Possible cause:
923   * 1. The type of the input color parameter is not ResourceColor.
924   * 2. The format of the input color string is not RGB or RGBA.
925   * @syscap SystemCapability.ArkUI.ArkUI.Full
926   * @crossplatform
927   * @atomicservice
928   * @since 12
929   */
930  static resourceColor(color: ResourceColor): ColorMetrics;
931	
932  /**
933   * blend color
934   *
935   * @param { ColorMetrics } overlayColor - overlay color
936   * @returns { ColorMetrics } ColorMetrics class
937   * @throws { BusinessError } 401 - Parameter error. The type of the input parameter is not ColorMetrics.
938   * @syscap SystemCapability.ArkUI.ArkUI.Full
939   * @crossplatform
940   * @atomicservice
941   * @since 12
942   */
943  blendColor(overlayColor: ColorMetrics): ColorMetrics;
944	
945  /**
946   * Get color of the ColorMetrics.
947   *
948   * @returns { string } The color of the ColorMetrics.
949   * @syscap SystemCapability.ArkUI.ArkUI.Full
950   * @crossplatform
951   * @atomicservice
952   * @since 12
953   */
954   get color(): string;
955
956  /**
957   * Get red value of the ColorMetrics.
958   *
959   * @returns { number } The red value of the ColorMetrics.
960   * @syscap SystemCapability.ArkUI.ArkUI.Full
961   * @crossplatform
962   * @atomicservice
963   * @since 12
964   */
965   get red(): number;
966
967  /**
968   * Get green value of the ColorMetrics.
969   *
970   * @returns { number } The green value of the ColorMetrics.
971   * @syscap SystemCapability.ArkUI.ArkUI.Full
972   * @crossplatform
973   * @atomicservice
974   * @since 12
975   */
976  get green(): number;
977
978  /**
979   * Get blue value of the ColorMetrics.
980   *
981   * @returns { number } The blue value of the ColorMetrics.
982   * @syscap SystemCapability.ArkUI.ArkUI.Full
983   * @crossplatform
984   * @atomicservice
985   * @since 12
986   */
987  get blue(): number;
988
989  /**
990   * Get opacity value of the ColorMetrics.
991   *
992   * @returns { number } The opacity value of the ColorMetrics.
993   * @syscap SystemCapability.ArkUI.ArkUI.Full
994   * @crossplatform
995   * @atomicservice
996   * @since 12
997   */
998  get alpha(): number;
999}
1000
1001/**
1002 * Defines the Corner property.
1003 *
1004 * @interface Corners
1005 * @syscap SystemCapability.ArkUI.ArkUI.Full
1006 * @crossplatform
1007 * @atomicservice
1008 * @since 12
1009 */
1010interface Corners<T> {
1011  /**
1012   * TopLeft property.
1013   *
1014   * @type { T }
1015   * @syscap SystemCapability.ArkUI.ArkUI.Full
1016   * @crossplatform
1017   * @atomicservice
1018   * @since 12
1019   */
1020  topLeft: T,
1021
1022  /**
1023   * TopRight property.
1024   *
1025   * @type { T }
1026   * @syscap SystemCapability.ArkUI.ArkUI.Full
1027   * @crossplatform
1028   * @atomicservice
1029   * @since 12
1030   */
1031  topRight: T,
1032
1033  /**
1034   * BottomLeft property.
1035   *
1036   * @type { T }
1037   * @syscap SystemCapability.ArkUI.ArkUI.Full
1038   * @crossplatform
1039   * @atomicservice
1040   * @since 12
1041   */
1042  bottomLeft: T,
1043
1044  /**
1045   * BottomRight property.
1046   *
1047   * @type { T }
1048   * @syscap SystemCapability.ArkUI.ArkUI.Full
1049   * @crossplatform
1050   * @atomicservice
1051   * @since 12
1052   */
1053  bottomRight: T
1054}
1055
1056/**
1057 * Defines the Corner radius.
1058 *
1059 * @typedef { Corners<Vector2> } CornerRadius
1060 * @syscap SystemCapability.ArkUI.ArkUI.Full
1061 * @crossplatform
1062 * @atomicservice
1063 * @since 12
1064 */
1065export type CornerRadius = Corners<Vector2>;
1066
1067/**
1068 * BorderRadiuses info.
1069 *
1070 * @typedef { Corners<number> } BorderRadiuses
1071 * @syscap SystemCapability.ArkUI.ArkUI.Full
1072 * @crossplatform
1073 * @atomicservice
1074 * @since 12
1075 */
1076export type BorderRadiuses = Corners<number>;
1077
1078/**
1079 * Rect info.
1080 *
1081 * @typedef { common2D.Rect } Rect
1082 * @syscap SystemCapability.ArkUI.ArkUI.Full
1083 * @crossplatform
1084 * @atomicservice
1085 * @since 12
1086 */
1087export type Rect = common2D.Rect;
1088
1089/**
1090 * Defines the RoundRect.
1091 *
1092 * @interface RoundRect
1093 * @syscap SystemCapability.ArkUI.ArkUI.Full
1094 * @crossplatform
1095 * @atomicservice
1096 * @since 12
1097 */
1098export interface RoundRect {
1099  /**
1100   * Rect property.
1101   *
1102   * @type { Rect }
1103   * @syscap SystemCapability.ArkUI.ArkUI.Full
1104   * @crossplatform
1105   * @atomicservice
1106   * @since 12
1107   */
1108  rect: Rect,
1109
1110  /**
1111   * Corners property.
1112   *
1113   * @type { CornerRadius }
1114   * @syscap SystemCapability.ArkUI.ArkUI.Full
1115   * @crossplatform
1116   * @atomicservice
1117   * @since 12
1118   */
1119  corners: CornerRadius
1120}
1121
1122/**
1123 * Defines the Circle.
1124 *
1125 * @interface Circle
1126 * @syscap SystemCapability.ArkUI.ArkUI.Full
1127 * @crossplatform
1128 * @atomicservice
1129 * @since 12
1130 */
1131export interface Circle {
1132  /**
1133   * The x-coordinate of the center of the Circle.
1134   *
1135   * @type { number }
1136   * @syscap SystemCapability.ArkUI.ArkUI.Full
1137   * @crossplatform
1138   * @atomicservice
1139   * @since 12
1140   */
1141  centerX: number,
1142
1143  /**
1144   * The y-coordinate of the center of the Circle.
1145   *
1146   * @type { number }
1147   * @syscap SystemCapability.ArkUI.ArkUI.Full
1148   * @crossplatform
1149   * @atomicservice
1150   * @since 12
1151   */
1152  centerY: number,
1153
1154  /**
1155   * The radius of the Circle.
1156   *
1157   * @type { number }
1158   * @syscap SystemCapability.ArkUI.ArkUI.Full
1159   * @crossplatform
1160   * @atomicservice
1161   * @since 12
1162   */
1163  radius: number
1164}
1165
1166/**
1167 * Defines the CommandPath.
1168 *
1169 * @interface CommandPath
1170 * @syscap SystemCapability.ArkUI.ArkUI.Full
1171 * @crossplatform
1172 * @atomicservice
1173 * @since 12
1174 */
1175export interface CommandPath {
1176  /**
1177   * The commands of CommandPath.
1178   *
1179   * @type { string }
1180   * @syscap SystemCapability.ArkUI.ArkUI.Full
1181   * @crossplatform
1182   * @atomicservice
1183   * @since 12
1184   */
1185  commands: string
1186}
1187
1188/**
1189 * Defines ShapeMask. 
1190 *
1191 * @syscap SystemCapability.ArkUI.ArkUI.Full
1192 * @crossplatform
1193 * @atomicservice
1194 * @since 12
1195 */
1196export declare class ShapeMask {
1197  /**
1198   * Constructor.
1199   *
1200   * @syscap SystemCapability.ArkUI.ArkUI.Full
1201   * @crossplatform
1202   * @atomicservice
1203   * @since 12
1204   */
1205  constructor();
1206
1207  /**
1208   * Set the rect shape of the ShapeMask.
1209   *
1210   * @param { Rect } rect - The rect shape will be set.
1211   * @syscap SystemCapability.ArkUI.ArkUI.Full
1212   * @crossplatform
1213   * @atomicservice
1214   * @since 12
1215   */
1216  setRectShape(rect: Rect): void;
1217
1218  /**
1219   * Set the round rect shape of the ShapeMask.
1220   *
1221   * @param { RoundRect } roundRect - The round rect shape will be set.
1222   * @syscap SystemCapability.ArkUI.ArkUI.Full
1223   * @crossplatform
1224   * @atomicservice
1225   * @since 12
1226   */
1227  setRoundRectShape(roundRect: RoundRect): void;
1228
1229  /**
1230   * Set the circle shape of the ShapeMask.
1231   *
1232   * @param { Circle } circle - The circle shape will be set.
1233   * @syscap SystemCapability.ArkUI.ArkUI.Full
1234   * @crossplatform
1235   * @atomicservice
1236   * @since 12
1237   */
1238  setCircleShape(circle: Circle): void;
1239
1240  /**
1241   * Set the oval shape of the ShapeMask.
1242   *
1243   * @param { Rect } oval - The oval shape will be set.
1244   * @syscap SystemCapability.ArkUI.ArkUI.Full
1245   * @crossplatform
1246   * @atomicservice
1247   * @since 12
1248   */
1249  setOvalShape(oval: Rect): void;
1250
1251  /**
1252   * Set the command path of the ShapeMask.
1253   *
1254   * @param { CommandPath } path - The command path will be set.
1255   * @syscap SystemCapability.ArkUI.ArkUI.Full
1256   * @crossplatform
1257   * @atomicservice
1258   * @since 12
1259   */
1260  setCommandPath(path: CommandPath): void;
1261
1262  /**
1263   * The fill color of the ShapeMask.
1264   *
1265   * @type { number }
1266   * @default 0XFF000000
1267   * @syscap SystemCapability.ArkUI.ArkUI.Full
1268   * @crossplatform
1269   * @atomicservice
1270   * @since 12
1271   */
1272  fillColor: number;
1273
1274  /**
1275   * The stroke color of the ShapeMask.
1276   *
1277   * @type { number }
1278   * @default 0XFF000000
1279   * @syscap SystemCapability.ArkUI.ArkUI.Full
1280   * @crossplatform
1281   * @atomicservice
1282   * @since 12
1283   */
1284  strokeColor: number;
1285
1286  /**
1287   * The stroke width of the ShapeMask.
1288   *
1289   * @type { number }
1290   * @default 0
1291   * @syscap SystemCapability.ArkUI.ArkUI.Full
1292   * @crossplatform
1293   * @atomicservice
1294   * @since 12
1295   */
1296  strokeWidth: number;
1297}
1298
1299
1300/**
1301 * Define ShapeClip. Record the type and parameters of the shape used for clipping.
1302 *
1303 * @syscap SystemCapability.ArkUI.ArkUI.Full
1304 * @crossplatform
1305 * @atomicservice
1306 * @since 12
1307 */
1308export declare class ShapeClip {
1309  /**
1310   * Constructor.
1311   *
1312   * @syscap SystemCapability.ArkUI.ArkUI.Full
1313   * @crossplatform
1314   * @atomicservice
1315   * @since 12
1316   */
1317  constructor();
1318
1319  /**
1320   * Set the rect shape of the ShapeClip.
1321   *
1322   * @param { Rect } rect - The rect shape will be set.
1323   * @syscap SystemCapability.ArkUI.ArkUI.Full
1324   * @crossplatform
1325   * @atomicservice
1326   * @since 12
1327   */
1328  setRectShape(rect: Rect): void;
1329
1330  /**
1331   * Set the round rect shape of the ShapeClip.
1332   *
1333   * @param { RoundRect } roundRect - The round rect shape will be set.
1334   * @syscap SystemCapability.ArkUI.ArkUI.Full
1335   * @crossplatform
1336   * @atomicservice
1337   * @since 12
1338   */
1339  setRoundRectShape(roundRect: RoundRect): void;
1340
1341  /**
1342   * Set the circle shape of the ShapeClip.
1343   *
1344   * @param { Circle } circle - The circle shape will be set.
1345   * @syscap SystemCapability.ArkUI.ArkUI.Full
1346   * @crossplatform
1347   * @atomicservice
1348   * @since 12
1349   */
1350  setCircleShape(circle: Circle): void;
1351
1352  /**
1353   * Set the oval shape of the ShapeClip.
1354   *
1355   * @param { Rect } oval - The oval shape will be set.
1356   * @syscap SystemCapability.ArkUI.ArkUI.Full
1357   * @crossplatform
1358   * @atomicservice
1359   * @since 12
1360   */
1361  setOvalShape(oval: Rect): void;
1362
1363  /**
1364   * Set the command path of the ShapeClip.
1365   *
1366   * @param { CommandPath } path - The command path will be set.
1367   * @syscap SystemCapability.ArkUI.ArkUI.Full
1368   * @crossplatform
1369   * @atomicservice
1370   * @since 12
1371   */
1372  setCommandPath(path: CommandPath): void;
1373}
1374
1375/**
1376 * Obtain a object with all edges are set to the same color.
1377 *
1378 * @param { number } all - The edge color will be set.
1379 * @returns { Edges<number> } - The object with all edges are set to the same color.
1380 * @syscap SystemCapability.ArkUI.ArkUI.Full
1381 * @crossplatform
1382 * @atomicservice
1383 * @since 12
1384 */
1385export function edgeColors(all: number): Edges<number>;
1386
1387/**
1388 * Obtain a object with all edges are set to the same width.
1389 *
1390 * @param { number } all - The edge width will be set.
1391 * @returns { Edges<number> } - The object with all edges are set to the same width.
1392 * @syscap SystemCapability.ArkUI.ArkUI.Full
1393 * @crossplatform
1394 * @atomicservice
1395 * @since 12
1396 */
1397export function edgeWidths(all: number): Edges<number>;
1398
1399/**
1400 * Obtain a object with all edges are set to the same style.
1401 *
1402 * @param { BorderStyle } all - The edge style will be set.
1403 * @returns { Edges<BorderStyle> } - The object with all edges are set to the same style.
1404 * @syscap SystemCapability.ArkUI.ArkUI.Full
1405 * @crossplatform
1406 * @atomicservice
1407 * @since 12
1408 */
1409export function borderStyles(all: BorderStyle): Edges<BorderStyle>;
1410
1411/**
1412 * Obtain a BorderRadiuses object with all edges are set to the same radius.
1413 *
1414 * @param { number } all - The edge radius will be set.
1415 * @returns { BorderRadiuses } - The BorderRadiuses object.
1416 * @syscap SystemCapability.ArkUI.ArkUI.Full
1417 * @crossplatform
1418 * @atomicservice
1419 * @since 12
1420 */
1421export function borderRadiuses(all: number): BorderRadiuses;
1422