• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2024 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 ArkGraphics2D
19 */
20
21import type image from './@ohos.multimedia.image';
22import type common2D from './@ohos.graphics.common2D';
23
24/**
25 * Provides functions such as 2D graphics rendering, text drawing, and image display.
26 *
27 * @namespace drawing
28 * @syscap SystemCapability.Graphics.Drawing
29 * @since 11
30 */
31declare namespace drawing {
32  /**
33   * Enumerate blending modes for colors.
34   * Blend is a operation that use 4 components(red, green, blue, alpha) to generate
35   * a new color from two colors(source, destination).
36   * @enum { number }
37   * @syscap SystemCapability.Graphics.Drawing
38   * @since 11
39   */
40  enum BlendMode {
41    /**
42     * Disable 4 regions(red, green, blue, alpha)
43     * @syscap SystemCapability.Graphics.Drawing
44     * @since 11
45     */
46    CLEAR = 0,
47    /**
48     * Use components of the source
49     * @syscap SystemCapability.Graphics.Drawing
50     * @since 11
51     */
52    SRC = 1,
53    /**
54     * Use components of the destination
55     * @syscap SystemCapability.Graphics.Drawing
56     * @since 11
57     */
58    DST = 2,
59    /**
60     * The source is placed above the destination.
61     * @syscap SystemCapability.Graphics.Drawing
62     * @since 11
63     */
64    SRC_OVER = 3,
65    /**
66     * The Destination is placed above the source.
67     * @syscap SystemCapability.Graphics.Drawing
68     * @since 11
69     */
70    DST_OVER = 4,
71    /**
72     * Use source replaces the destination, and will not exceed the boundaries of the destination
73     * @syscap SystemCapability.Graphics.Drawing
74     * @since 11
75     */
76    SRC_IN = 5,
77    /**
78     * Use destination, and will not exceed the boundaries of the source
79     * @syscap SystemCapability.Graphics.Drawing
80     * @since 11
81     */
82    DST_IN = 6,
83    /**
84     * Source is use in outside of the boundaries of the destination.
85     * @syscap SystemCapability.Graphics.Drawing
86     * @since 11
87     */
88    SRC_OUT = 7,
89    /**
90     * Destination is use in outside of the boundaries of the source.
91     * @syscap SystemCapability.Graphics.Drawing
92     * @since 11
93     */
94    DST_OUT = 8,
95    /**
96     * Source which overlaps the destination will replaces the destination.
97     * @syscap SystemCapability.Graphics.Drawing
98     * @since 11
99     */
100    SRC_ATOP = 9,
101    /**
102     * Destination which overlaps the source will replaces the source.
103     * @syscap SystemCapability.Graphics.Drawing
104     * @since 11
105     */
106    DST_ATOP = 10,
107    /**
108     * Combine regions where source and destination do not overlap.
109     * @syscap SystemCapability.Graphics.Drawing
110     * @since 11
111     */
112    XOR = 11,
113    /**
114     * The sum of the source and destination.
115     * @syscap SystemCapability.Graphics.Drawing
116     * @since 11
117     */
118    PLUS = 12,
119    /**
120     * All components are multiplied.
121     * @syscap SystemCapability.Graphics.Drawing
122     * @since 11
123     */
124    MODULATE = 13,
125    /**
126     * Multiply the complement values of the background and source color values,
127     * and then complement the result.
128     * @syscap SystemCapability.Graphics.Drawing
129     * @since 11
130     */
131    SCREEN = 14,
132    /**
133     * Multiplies or screens the colors, depending on destination
134     * @syscap SystemCapability.Graphics.Drawing
135     * @since 11
136     */
137    OVERLAY = 15,
138    /**
139     * Choose a darker background and source color.
140     * @syscap SystemCapability.Graphics.Drawing
141     * @since 11
142     */
143    DARKEN = 16,
144    /**
145     * Choose a lighter background and source color.
146     * @syscap SystemCapability.Graphics.Drawing
147     * @since 11
148     */
149    LIGHTEN = 17,
150    /**
151     * Brightens destination color to reflect the source color.
152     * @syscap SystemCapability.Graphics.Drawing
153     * @since 11
154     */
155    COLOR_DODGE = 18,
156    /**
157     * Darkens destination color to reflect the source color.
158     * @syscap SystemCapability.Graphics.Drawing
159     * @since 11
160     */
161    COLOR_BURN = 19,
162    /**
163     * Multiplies or screens the colors, depending on source
164     * @syscap SystemCapability.Graphics.Drawing
165     * @since 11
166     */
167    HARD_LIGHT = 20,
168    /**
169     * Lightens or Darkens the colors, depending on the source.
170     * @syscap SystemCapability.Graphics.Drawing
171     * @since 11
172     */
173    SOFT_LIGHT = 21,
174    /**
175     * Subtract the darker of the two colors from the brighter color.
176     * @syscap SystemCapability.Graphics.Drawing
177     * @since 11
178     */
179    DIFFERENCE = 22,
180    /**
181     * Produces an effect similar to difference mode, but with lower contrast.
182     * @syscap SystemCapability.Graphics.Drawing
183     * @since 11
184     */
185    EXCLUSION = 23,
186    /**
187     * Multiply the source color by the destination color and replace the destination.
188     * @syscap SystemCapability.Graphics.Drawing
189     * @since 11
190     */
191    MULTIPLY = 24,
192    /**
193     * Use the hue of the source and the saturation and brightness of the destination.
194     * @syscap SystemCapability.Graphics.Drawing
195     * @since 11
196     */
197    HUE = 25,
198    /**
199     * Use the saturation of the source and the hue and brightness of the destination.
200     * @syscap SystemCapability.Graphics.Drawing
201     * @since 11
202     */
203    SATURATION = 26,
204    /**
205     * Use the hue and saturation of the source and the brightness of the destination.
206     * @syscap SystemCapability.Graphics.Drawing
207     * @since 11
208     */
209    COLOR = 27,
210    /**
211     * Use the brightness of the source and the hue and saturation of the destination.
212     * @syscap SystemCapability.Graphics.Drawing
213     * @since 11
214     */
215    LUMINOSITY = 28,
216  }
217
218  /**
219   * Enumerates direction for adding closed contours.
220   * @enum { number }
221   * @syscap SystemCapability.Graphics.Drawing
222   * @since 12
223   */
224  enum PathDirection {
225    /**
226     * Clockwise direction for adding closed contours.
227     * @syscap SystemCapability.Graphics.Drawing
228     * @since 12
229     */
230    CLOCKWISE = 0,
231
232    /**
233     * Counter-clockwise direction for adding closed contours.
234     * @syscap SystemCapability.Graphics.Drawing
235     * @since 12
236     */
237    COUNTER_CLOCKWISE = 1,
238  }
239
240  /**
241   * Enumerates fill type of path.
242   * @enum { number }
243   * @syscap SystemCapability.Graphics.Drawing
244   * @since 12
245   */
246  enum PathFillType {
247    /**
248     * Specifies that "inside" is computed by a non-zero sum of signed edge crossings.
249     * @syscap SystemCapability.Graphics.Drawing
250     * @since 12
251     */
252    WINDING = 0,
253
254    /**
255     * Specifies that "inside" is computed by an odd number of edge crossings.
256     * @syscap SystemCapability.Graphics.Drawing
257     * @since 12
258     */
259    EVEN_ODD = 1,
260
261    /**
262     * Same as winding, but draws outside of the path, rather than inside.
263     * @syscap SystemCapability.Graphics.Drawing
264     * @since 12
265     */
266    INVERSE_WINDING = 2,
267
268    /**
269     * Same as evenOdd, but draws outside of the path, rather than inside.
270     * @syscap SystemCapability.Graphics.Drawing
271     * @since 12
272     */
273    INVERSE_EVEN_ODD = 3,
274  }
275
276  /**
277  * Enumerate path measure flags for matrix.
278  * @enum { number }
279  * @syscap SystemCapability.Graphics.Drawing
280  * @since 12
281  */
282  enum PathMeasureMatrixFlags {
283    /**
284     * Gets position.
285     * @syscap SystemCapability.Graphics.Drawing
286     * @since 12
287     */
288    GET_POSITION_MATRIX = 0,
289    /**
290     * Gets tangent.
291     * @syscap SystemCapability.Graphics.Drawing
292     * @since 12
293     */
294    GET_TANGENT_MATRIX = 1,
295    /**
296     * Gets both position and tangent.
297     * @syscap SystemCapability.Graphics.Drawing
298     * @since 12
299     */
300    GET_POSITION_AND_TANGENT_MATRIX = 2,
301  }
302
303  /**
304   * Provides the definition of the roundRect.
305   *
306   * @syscap SystemCapability.Graphics.Drawing
307   * @since 12
308   */
309  class RoundRect {
310    /**
311     * Creates a simple round rect with the same four corner radii.
312     * @param { common2D.Rect } rect - Indicates the Rect object.
313     * @param { number } xRadii - Indicates the corner radii on x-axis.
314     * @param { number } yRadii - Indicates the corner radii on y-axis.
315     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
316     * <br>2. Incorrect parameter types.
317     * @syscap SystemCapability.Graphics.Drawing
318     * @since 12
319     */
320    constructor(rect: common2D.Rect, xRadii: number, yRadii: number);
321
322    /**
323     * Sets the radiusX and radiusY for a specific corner position.
324     * @param { CornerPos } pos - Indicates the corner radius position.
325     * @param { number } x - Indicates the corner radius on x-axis.
326     * @param { number } y - Indicates the corner radius on y-axis.
327     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
328     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
329     * @syscap SystemCapability.Graphics.Drawing
330     * @since 12
331     */
332    setCorner(pos: CornerPos, x: number, y: number): void;
333
334    /**
335     * Gets a point with the values of x-axis and y-axis of the selected corner radius.
336     * @param { CornerPos } pos - Indicates the corner radius position.
337     * @returns { common2D.Point } Returns a point with the values of x-axis and y-axis of the corner radius.
338     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
339     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
340     * @syscap SystemCapability.Graphics.Drawing
341     * @since 12
342     */
343    getCorner(pos: CornerPos): common2D.Point;
344
345    /**
346     * Translates round rect by (dx, dy).
347     * @param { number } dx - Indicates the offsets added to rect left and rect right.
348     * @param { number } dy - Indicates the offsets added to rect top and rect bottom.
349     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
350     * <br>2. Incorrect parameter types.
351     * @syscap SystemCapability.Graphics.Drawing
352     * @since 12
353     */
354    offset(dx: number, dy: number): void;
355  }
356
357  /**
358   * Enumerates of operations when two paths are combined.
359   * @enum { number }
360   * @syscap SystemCapability.Graphics.Drawing
361   * @since 12
362   */
363  enum PathOp {
364    /**
365     * Difference operation.
366     * @syscap SystemCapability.Graphics.Drawing
367     * @since 12
368     */
369    DIFFERENCE = 0,
370
371    /**
372     * Intersect operation.
373     * @syscap SystemCapability.Graphics.Drawing
374     * @since 12
375     */
376    INTERSECT = 1,
377
378    /**
379     * Union operation.
380     * @syscap SystemCapability.Graphics.Drawing
381     * @since 12
382     */
383    UNION = 2,
384
385    /**
386     * Xor operation.
387     * @syscap SystemCapability.Graphics.Drawing
388     * @since 12
389     */
390    XOR = 3,
391
392    /**
393     * Reverse difference operation.
394     * @syscap SystemCapability.Graphics.Drawing
395     * @since 12
396     */
397    REVERSE_DIFFERENCE = 4,
398  }
399
400  /**
401   * Describes a path object.
402   *
403   * @syscap SystemCapability.Graphics.Drawing
404   * @since 11
405   */
406  class Path {
407    /**
408     * Creates a Path.
409     * @syscap SystemCapability.Graphics.Drawing
410     * @since 12
411     */
412    constructor();
413
414    /**
415     * Creates a Path from other path.
416     * @param { Path } path - the path to copy content from.
417     * @syscap SystemCapability.Graphics.Drawing
418     * @since 12
419     */
420    constructor(path: Path);
421
422    /**
423     * Sets the start point of a path
424     * @param { number } x - Indicates the x coordinate of the start point.
425     * @param { number } y - Indicates the y coordinate of the start point.
426     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
427     * <br>2. Incorrect parameter types.
428     * @syscap SystemCapability.Graphics.Drawing
429     * @since 11
430     */
431    moveTo(x: number, y: number): void;
432
433    /**
434     * Draws a line segment from the last point of a path to the target point.
435     * @param { number } x - Indicates the x coordinate of the target point.
436     * @param { number } y - Indicates the y coordinate of the target point.
437     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
438     * <br>2. Incorrect parameter types.
439     * @syscap SystemCapability.Graphics.Drawing
440     * @since 11
441     */
442    lineTo(x: number, y: number): void;
443
444    /**
445     * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first,
446     * and then a start angle and a sweep angle are specified.
447     * The arc is a portion of the ellipse defined by the start angle and the sweep angle.
448     * By default, a line segment from the last point of the path to the start point of the arc is also added.
449     * @param { number } x1 - Indicates the x coordinate of the upper left corner of the rectangle.
450     * @param { number } y1 - Indicates the y coordinate of the upper left corner of the rectangle.
451     * @param { number } x2 - Indicates the x coordinate of the lower right corner of the rectangle.
452     * @param { number } y2 - Indicates the y coordinate of the lower right corner of the rectangle.
453     * @param { number } startDeg - Indicates the start angle, in degrees.
454     * @param { number } sweepDeg - Indicates the angle to sweep, in degrees.
455     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
456     * <br>2. Incorrect parameter types.
457     * @syscap SystemCapability.Graphics.Drawing
458     * @since 11
459     */
460    arcTo(x1: number, y1: number, x2: number, y2: number, startDeg: number, sweepDeg: number): void;
461
462    /**
463     * Draws a quadratic Bezier curve from the last point of a path to the target point.
464     * @param { number } ctrlX - Indicates the x coordinate of the control point.
465     * @param { number } ctrlY - Indicates the y coordinate of the control point.
466     * @param { number } endX - Indicates the x coordinate of the target point.
467     * @param { number } endY - Indicates the y coordinate of the target point.
468     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
469     * <br>2. Incorrect parameter types.
470     * @syscap SystemCapability.Graphics.Drawing
471     * @since 11
472     */
473    quadTo(ctrlX: number, ctrlY: number, endX: number, endY: number): void;
474
475    /**
476     * Draws a conic from the last point of a path to the target point.
477     * @param { number } ctrlX - Indicates the x coordinate of the control point.
478     * @param { number } ctrlY - Indicates the y coordinate of the control point.
479     * @param { number } endX - Indicates the x coordinate of the target point.
480     * @param { number } endY - Indicates the y coordinate of the target point.
481     * @param { number } weight - Indicates the weight of added conic.
482     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
483     * <br>2. Incorrect parameter types.
484     * @syscap SystemCapability.Graphics.Drawing
485     * @since 12
486     */
487    conicTo(ctrlX: number, ctrlY: number, endX: number, endY: number, weight: number): void;
488
489    /**
490     * Draws a cubic Bezier curve from the last point of a path to the target point.
491     * @param { number } ctrlX1 - Indicates the x coordinate of the first control point.
492     * @param { number } ctrlY1 - Indicates the y coordinate of the first control point.
493     * @param { number } ctrlX2 - Indicates the x coordinate of the second control point.
494     * @param { number } ctrlY2 - Indicates the y coordinate of the second control point.
495     * @param { number } endX - Indicates the x coordinate of the target point.
496     * @param { number } endY - Indicates the y coordinate of the target point.
497     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
498     * <br>2. Incorrect parameter types.
499     * @syscap SystemCapability.Graphics.Drawing
500     * @since 11
501     */
502    cubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void;
503
504    /**
505     * Sets the relative starting point of a path.
506     * @param { number } dx - Indicates the x coordinate of the relative starting point.
507     * @param { number } dy - Indicates the y coordinate of the relative starting point.
508     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
509     * <br>2. Incorrect parameter types.
510     * @syscap SystemCapability.Graphics.Drawing
511     * @since 12
512     */
513    rMoveTo(dx: number, dy: number): void;
514
515    /**
516     * Draws a line segment from the last point of a path to the relative target point.
517     * @param { number } dx - Indicates the x coordinate of the relative target point.
518     * @param { number } dy - Indicates the y coordinate of the relative target point.
519     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
520     * <br>2. Incorrect parameter types.
521     * @syscap SystemCapability.Graphics.Drawing
522     * @since 12
523     */
524    rLineTo(dx: number, dy: number): void;
525
526    /**
527     * Draws a quadratic bezier curve from the last point of a path to the relative target point.
528     * @param { number } dx1 - Indicates the x coordinate of the relative control point.
529     * @param { number } dy1 - Indicates the y coordinate of the relative control point.
530     * @param { number } dx2 - Indicates the x coordinate of the relative target point.
531     * @param { number } dy2 - Indicates the y coordinate of the relative target point.
532     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
533     * <br>2. Incorrect parameter types.
534     * @syscap SystemCapability.Graphics.Drawing
535     * @since 12
536     */
537    rQuadTo(dx1: number, dy1: number, dx2: number, dy2: number): void;
538
539    /**
540     * Draws a conic from the last point of a path to the relative target point.
541     * @param { number } ctrlX - Indicates the x coordinate of the relative control point.
542     * @param { number } ctrlY - Indicates the y coordinate of the relative control point.
543     * @param { number } endX - Indicates the x coordinate of the relative target point.
544     * @param { number } endY - Indicates the y coordinate of the relative target point.
545     * @param { number } weight - Indicates the weight of added conic.
546     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
547     * <br>2. Incorrect parameter types.
548     * @syscap SystemCapability.Graphics.Drawing
549     * @since 12
550     */
551    rConicTo(ctrlX: number, ctrlY: number, endX: number, endY: number, weight: number): void;
552
553    /**
554     * Draws a cubic bezier curve from the last point of a path to the relative target point.
555     * @param { number } ctrlX1 - Indicates the x coordinate of the first relative control point.
556     * @param { number } ctrlY1 - Indicates the y coordinate of the first relative control point.
557     * @param { number } ctrlX2 - Indicates the x coordinate of the second relative control point.
558     * @param { number } ctrlY2 - Indicates the y coordinate of the second relative control point.
559     * @param { number } endX - Indicates the x coordinate of the relative target point.
560     * @param { number } endY - Indicates the y coordinate of the relative target point.
561     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
562     * <br>2. Incorrect parameter types.
563     * @syscap SystemCapability.Graphics.Drawing
564     * @since 12
565     */
566    rCubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void;
567
568    /**
569     * Adds contour created from point array, adding (count - 1) line segments.
570     * @param { Array<common2D.Point> } points - Indicates the point array.
571     * @param { boolean } close - Indicates Whether to add lines that connect the end and start.
572     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
573     * <br>2. Incorrect parameter types.
574     * @syscap SystemCapability.Graphics.Drawing
575     * @since 12
576     */
577    addPolygon(points: Array<common2D.Point>, close: boolean): void;
578
579    /**
580     * Combines two paths.
581     * @param { Path } path - Indicates the Path object.
582     * @param { PathOp } pathOp - Indicates the operator to apply path.
583     * @returns { boolean } boolean - Returns true if constructed path is not empty; returns false otherwise.
584     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
585     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
586     * @syscap SystemCapability.Graphics.Drawing
587     * @since 12
588     */
589    op(path: Path, pathOp: PathOp): boolean;
590
591    /**
592     * Appends arc to path, as the start of new contour.
593     * Arc added is part of ellipse bounded by oval, from startAngle through sweepAngle.
594     * @param { common2D.Rect } rect - The bounds of the arc is described by a rect.
595     * @param { number } startAngle - Indicates the starting angle of arc in degrees.
596     * @param { number } sweepAngle - Indicates the sweep, in degrees. Positive is clockwise.
597     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
598     * <br>2. Incorrect parameter types.
599     * @syscap SystemCapability.Graphics.Drawing
600     * @since 12
601     */
602    addArc(rect: common2D.Rect, startAngle: number, sweepAngle: number): void;
603
604    /**
605     * Adds a circle to the path, and wound in the specified direction.
606     * @param { number } x - Indicates the x coordinate of the center of the circle.
607     * @param { number } y - Indicates the y coordinate of the center of the circle.
608     * @param { number } radius - Indicates the radius of the circle.
609     * @param { PathDirection } pathDirection - The default value is CLOCKWISE.
610     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
611     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
612     * @syscap SystemCapability.Graphics.Drawing
613     * @since 12
614     */
615    addCircle(x: number, y: number, radius: number, pathDirection?: PathDirection): void;
616
617    /**
618     * Adds a oval to the path, defined by the rect, and wound in the specified direction.
619     * @param { common2D.Rect } rect - The bounds of the oval is described by a rect.
620     * @param { number } start - Indicates the index of initial point of ellipse.
621     * @param { PathDirection } pathDirection - The default value is CLOCKWISE.
622     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
623     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
624     * @syscap SystemCapability.Graphics.Drawing
625     * @since 12
626     */
627    addOval(rect: common2D.Rect, start: number, pathDirection?: PathDirection): void;
628
629    /**
630     * Adds a new contour to the path, defined by the rect, and wound in the specified direction.
631     * @param { common2D.Rect } rect - Indicates the Rect object.
632     * @param { PathDirection } pathDirection - The default value is CLOCKWISE.
633     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
634     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
635     * @syscap SystemCapability.Graphics.Drawing
636     * @since 12
637     */
638    addRect(rect: common2D.Rect, pathDirection?: PathDirection): void;
639
640    /**
641     * Adds a new contour to the path, defined by the round rect, and wound in the specified direction.
642     * @param { RoundRect } roundRect - Indicates the RoundRect object.
643     * @param { PathDirection } pathDirection - The default value is CLOCKWISE.
644     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
645     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
646     * @syscap SystemCapability.Graphics.Drawing
647     * @since 12
648     */
649    addRoundRect(roundRect: RoundRect, pathDirection?: PathDirection): void;
650
651    /**
652     * Appends src path to path, transformed by matrix.
653     * @param { Path } path - Indicates the Path object.
654     * @param { Matrix | null } matrix - Indicates transform applied to path. The default value is null.
655     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
656     * <br>2. Incorrect parameter types.
657     * @syscap SystemCapability.Graphics.Drawing
658     * @since 12
659     */
660    addPath(path: Path, matrix?: Matrix | null): void;
661
662    /**
663     * Path is replaced by transformed data.
664     * @param { Matrix } matrix - Indicates transform applied to path.
665     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
666     * <br>2. Incorrect parameter types.
667     * @syscap SystemCapability.Graphics.Drawing
668     * @since 12
669     */
670    transform(matrix: Matrix): void;
671
672    /**
673     * Returns the status that point (x, y) is contained by path.
674     * @param { number } x - Indicates the x-axis value of containment test.
675     * @param { number } y - Indicates the y-axis value of containment test.
676     * @returns { boolean } Returns true if the point (x, y) is contained by path; returns false otherwise.
677     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
678     * <br>2. Incorrect parameter types.
679     * @syscap SystemCapability.Graphics.Drawing
680     * @since 12
681     */
682    contains(x: number, y: number): boolean;
683
684    /**
685     * Sets fill type, the rule used to fill path.
686     * @param { PathFillType } pathFillType - Indicates the enum path fill type.
687     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
688     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
689     * @syscap SystemCapability.Graphics.Drawing
690     * @since 12
691     */
692    setFillType(pathFillType: PathFillType): void;
693
694    /**
695     * Gets the smallest bounding box that contains the path.
696     * @returns { common2D.Rect } Rect object.
697     * @syscap SystemCapability.Graphics.Drawing
698     * @since 12
699     */
700    getBounds(): common2D.Rect;
701
702    /**
703     * Closes a path. A line segment from the start point to the last point of the path is added.
704     * @syscap SystemCapability.Graphics.Drawing
705     * @since 11
706     */
707    close(): void;
708
709    /**
710     * Offsets point array by (dx, dy). Path is replaced by offset data.
711     * @param { number } dx - Indicates offset added to dst path x-axis coordinates.
712     * @param { number } dy - Indicates offset added to dst path y-axis coordinates.
713     * @returns { Path } Returns a new Path object.
714     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
715     * <br>2. Incorrect parameter types.
716     * @syscap SystemCapability.Graphics.Drawing
717     * @since 12
718     */
719    offset(dx: number, dy: number): Path;
720
721    /**
722     * Resets path data.
723     * @syscap SystemCapability.Graphics.Drawing
724     * @since 11
725     */
726    reset(): void;
727
728    /**
729     * Get path length.
730     * @param { boolean } forceClosed - Whether to close the Path.
731     * @returns { number } Return path length.
732     * @syscap SystemCapability.Graphics.Drawing
733     * @since 12
734     */
735    getLength(forceClosed: boolean): number;
736
737    /**
738     * Gets the position and tangent of the distance from the starting position of the path.
739     *
740     * @param { boolean } forceClosed - Whether to close the path.
741     * @param { number } distance - The distance from the start of the path, should be greater than 0 and less than 'GetLength()'
742     * @param { common2D.Point } position - Sets to the position of distance from the starting position of the path.
743     * @param { common2D.Point } tangent - Sets to the tangent of distance from the starting position of the path.
744     * @returns { boolean } - Returns true if succeeded, otherwise false.
745     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
746     * <br>2. Incorrect parameter types.
747     * @syscap SystemCapability.Graphics.Drawing
748     * @since 12
749     */
750    getPositionAndTangent(forceClosed: boolean, distance: number, position: common2D.Point, tangent: common2D.Point): boolean;
751
752    /**
753     * Determines whether the current contour is closed.
754     *
755     * @returns { boolean } - Returns true if the current contour is closed, otherwise false.
756     * @syscap SystemCapability.Graphics.Drawing
757     * @since 12
758     */
759    isClosed(): boolean;
760
761    /**
762     * Computes the corresponding matrix at the specified distance.
763     *
764     * @param { boolean } forceClosed - Whether to close the path.
765     * @param { number } distance - The distance from the start of the path.
766     * @param { Matrix } matrix - Indicates the pointer to an Matrix object.
767     * @param { PathMeasureMatrixFlags } flags - Indicates what should be returned in the matrix.
768     * @returns { boolean } - Returns false if there is no path, or a zero-length path was specified, in which case matrix is unchanged.
769     * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified.
770     * @syscap SystemCapability.Graphics.Drawing
771     * @since 12
772    */
773    getMatrix(forceClosed: boolean, distance: number, matrix: Matrix, flags: PathMeasureMatrixFlags): boolean;
774
775    /**
776     * Parses the SVG format string that describes the drawing path, and sets the path.
777     *
778     * @param { string } str - A string in SVG format that describes the drawing path.
779     * @returns { boolean } true if build succeeded, otherwise false.
780     * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified.
781     * @syscap SystemCapability.Graphics.Drawing
782     * @since 12
783     */
784    buildFromSvgString(str: string): boolean;
785  }
786
787  /**
788   * Enumerates of scale to fit flags, selects if an array of points are drawn as discrete points,
789   * as lines, or as an open polygon.
790   * @enum { number }
791   * @syscap SystemCapability.Graphics.Drawing
792   * @since 12
793   */
794  enum PointMode {
795    /**
796     * Draws each point separately.
797     * @syscap SystemCapability.Graphics.Drawing
798     * @since 12
799     */
800    POINTS = 0,
801
802    /**
803     * Draws each pair of points as a line segment.
804     * @syscap SystemCapability.Graphics.Drawing
805     * @since 12
806     */
807    LINES = 1,
808
809    /**
810     * Draws the array of points as a open polygon.
811     * @syscap SystemCapability.Graphics.Drawing
812     * @since 12
813     */
814    POLYGON = 2,
815  }
816
817  /**
818   * Enumerates storage filter mode.
819   * @enum { number }
820   * @syscap SystemCapability.Graphics.Drawing
821   * @since 12
822   */
823  enum FilterMode {
824    /**
825     * Single sample point (nearest neighbor).
826     * @syscap SystemCapability.Graphics.Drawing
827     * @since 12
828     */
829    FILTER_MODE_NEAREST = 0,
830
831    /**
832     * Interpolate between 2x2 sample points (bilinear interpolation).
833     * @syscap SystemCapability.Graphics.Drawing
834     * @since 12
835     */
836    FILTER_MODE_LINEAR = 1,
837  }
838
839  /**
840   * Enumerates of shadow flags.
841   * @enum { number }
842   * @syscap SystemCapability.Graphics.Drawing
843   * @since 12
844   */
845  enum ShadowFlag {
846    /**
847     * Use no shadow flags.
848     * @syscap SystemCapability.Graphics.Drawing
849     * @since 12
850     */
851    NONE = 0,
852
853    /**
854     * The occluding object is transparent.
855     * @syscap SystemCapability.Graphics.Drawing
856     * @since 12
857     */
858    TRANSPARENT_OCCLUDER = 1,
859
860    /**
861     * No need to analyze shadows.
862     * @syscap SystemCapability.Graphics.Drawing
863     * @since 12
864     */
865    GEOMETRIC_ONLY = 2,
866
867    /**
868     * Use all shadow flags.
869     * @syscap SystemCapability.Graphics.Drawing
870     * @since 12
871     */
872    ALL = 3,
873  }
874
875  /**
876   * Provides an interface to the drawing, and samplingOptions used when sampling from the image.
877   * @syscap SystemCapability.Graphics.Drawing
878   * @since 12
879   */
880  class SamplingOptions {
881    /**
882     * Constructor for the samplingOptions.
883     * @syscap SystemCapability.Graphics.Drawing
884     * @since 12
885     */
886    constructor();
887    /**
888     * Constructor for the samplingOptions with filter mode.
889     * @param { FilterMode } filterMode - Storage filter mode.
890     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
891     * <br>2. Incorrect parameter types.
892     * @syscap SystemCapability.Graphics.Drawing
893     * @since 12
894     */
895    constructor(filterMode: FilterMode);
896  }
897
898  /**
899   * Provides an interface to the drawing, and how to clip and transform the drawing.
900   * @syscap SystemCapability.Graphics.Drawing
901   * @since 11
902   */
903  class Canvas {
904    /**
905     * Constructor for the Canvas.
906     * @param { image.PixelMap } pixelmap - PixelMap.
907     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
908     * <br>2. Incorrect parameter types.
909     * @syscap SystemCapability.Graphics.Drawing
910     * @since 11
911     */
912    constructor(pixelmap: image.PixelMap);
913
914    /**
915     * If rectangle is stroked, use pen to stroke width describes the line thickness,
916     * else use brush to fill the rectangle.
917     * @param { common2D.Rect } rect - Rectangle to draw.
918     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
919     * <br>2. Incorrect parameter types.
920     * @syscap SystemCapability.Graphics.Drawing
921     * @since 11
922     */
923    drawRect(rect: common2D.Rect): void;
924
925    /**
926     * If rectangle is stroked, use pen to stroke width describes the line thickness,
927     * else use brush to fill the rectangle.
928     * @param { number } left - Indicates the left position of the rectangle.
929     * @param { number } top - Indicates the top position of the rectangle.
930     * @param { number } right - Indicates the right position of the rectangle.
931     * @param { number } bottom - Indicates the bottom position of the rectangle.
932     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
933     * <br>2. Incorrect parameter types.
934     * @syscap SystemCapability.Graphics.Drawing
935     * @since 12
936     */
937    drawRect(left: number, top: number, right: number, bottom: number): void;
938
939    /**
940     * Draws a RoundRect.
941     * @param { RoundRect } roundRect - Indicates the RectRound object.
942     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
943     * <br>2. Incorrect parameter types.
944     * @syscap SystemCapability.Graphics.Drawing
945     * @since 12
946     */
947    drawRoundRect(roundRect: RoundRect): void;
948
949    /**
950     * Draws a nested RoundRect.
951     * @param { RoundRect } outer - Indicates the outer RectRound object.
952     * @param { RoundRect } inner - Indicates the inner RectRound object.
953     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
954     * <br>2. Incorrect parameter types.
955     * @syscap SystemCapability.Graphics.Drawing
956     * @since 12
957     */
958    drawNestedRoundRect(outer: RoundRect, inner: RoundRect): void;
959
960    /**
961     * Fills clipped canvas area with brush.
962     * @param { Brush } brush - Indicates the Brush object.
963     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
964     * <br>2. Incorrect parameter types.
965     * @syscap SystemCapability.Graphics.Drawing
966     * @since 12
967     */
968    drawBackground(brush: Brush): void;
969
970    /**
971     * Draws an offset spot shadow and outlining ambient shadow for the given path with circular light.
972     * @param { Path } path - Indicates the Path object.
973     * @param { common2D.Point3d } planeParams - Represents z offset of the occluder from the canvas based on x and y.
974     * @param { common2D.Point3d } devLightPos - Represents the position of the light relative to the canvas.
975     * @param { number } lightRadius - The radius of the circular light.
976     * @param { common2D.Color } ambientColor - Ambient shadow's color.
977     * @param { common2D.Color } spotColor - Spot shadow's color.
978     * @param { ShadowFlag } flag - Indicates the flag to control opaque occluder, shadow, and light position.
979     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
980     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
981     * @syscap SystemCapability.Graphics.Drawing
982     * @since 12
983     */
984    drawShadow(path: Path, planeParams: common2D.Point3d, devLightPos: common2D.Point3d, lightRadius: number,
985      ambientColor: common2D.Color, spotColor: common2D.Color, flag: ShadowFlag) : void;
986
987    /**
988     * If radius is zero or less, nothing is drawn. If circle is stroked, use pen to
989     * stroke width describes the line thickness, else use brush to fill the circle.
990     * @param { number } x - X coordinate of the circle center.
991     * @param { number } y - Y coordinate of the circle center.
992     * @param { number } radius - The radius of the circle must be greater than 0.
993     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
994     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
995     * @syscap SystemCapability.Graphics.Drawing
996     * @since 11
997     */
998    drawCircle(x: number, y: number, radius: number): void;
999
1000    /**
1001     * Draw a pixelmap, with the upper left corner at (left, top).
1002     * @param { image.PixelMap } pixelmap - PixelMap.
1003     * @param { number } left - Left side of image.
1004     * @param { number } top - Top side of image.
1005     * @throws { BusinessError } 401 - Parameter error.
1006     * @syscap SystemCapability.Graphics.Drawing
1007     * @since 11
1008     */
1009    /**
1010     * Draw a pixelmap, with the upper left corner at (left, top).
1011     * @param { image.PixelMap } pixelmap - PixelMap.
1012     * @param { number } left - Left side of image.
1013     * @param { number } top - Top side of image.
1014     * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode.
1015     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1016     * <br>2. Incorrect parameter types.
1017     * @syscap SystemCapability.Graphics.Drawing
1018     * @since 12
1019     */
1020    drawImage(pixelmap: image.PixelMap, left: number, top: number, samplingOptions?: SamplingOptions): void;
1021
1022    /**
1023     * Draws the specified source image onto the canvas,
1024     * scaled and translated to the destination rectangle.
1025     * @param { image.PixelMap } pixelmap - The source image.
1026     * @param { common2D.Rect } dstRect - The area of destination canvas.
1027     * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode.
1028     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1029     * <br>2. Incorrect parameter types.
1030     * @syscap SystemCapability.Graphics.Drawing
1031     * @since 12
1032     */
1033    drawImageRect(pixelmap: image.PixelMap, dstRect: common2D.Rect, samplingOptions?: SamplingOptions): void;
1034
1035    /**
1036     * Draws the specified source rectangle of the image onto the canvas,
1037     * scaled and translated to the destination rectangle.
1038     * @param { image.PixelMap } pixelmap - The source image.
1039     * @param { common2D.Rect } srcRect - The area of source image.
1040     * @param { common2D.Rect } dstRect - The area of destination canvas.
1041     * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode.
1042     * @param { SrcRectConstraint } constraint - Constraint type. The default value is STRICT.
1043     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1044     * <br>2. Incorrect parameter types.
1045     * @syscap SystemCapability.Graphics.Drawing
1046     * @since 12
1047     */
1048    drawImageRectWithSrc(pixelmap: image.PixelMap, srcRect: common2D.Rect, dstRect: common2D.Rect,
1049      samplingOptions?: SamplingOptions, constraint?: SrcRectConstraint): void;
1050
1051    /**
1052     * Fills clip with color color. Mode determines how ARGB is combined with destination.
1053     * @param { common2D.Color } color - The range of color channels must be [0, 255].
1054     * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER.
1055     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1056     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1057     * @syscap SystemCapability.Graphics.Drawing
1058     * @since 11
1059     */
1060    drawColor(color: common2D.Color, blendMode?: BlendMode): void;
1061
1062    /**
1063     * Fills the clipped rectangle with the specified ARGB color.
1064     * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255].
1065     * @param { number } red - Red channel of color. The range of red must be [0, 255].
1066     * @param { number } green - Green channel of color. The range of green must be [0, 255].
1067     * @param { number } blue - Blue channel of color. The range of blue must be [0, 255].
1068     * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER.
1069     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1070     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1071     * @syscap SystemCapability.Graphics.Drawing
1072     * @since 12
1073     */
1074    drawColor(alpha: number, red: number, green: number, blue: number, blendMode?: BlendMode): void;
1075
1076    /**
1077     * Draws an oval.
1078     * @param { common2D.Rect } oval - The bounds of the oval is described by a rect.
1079     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1080     * <br>2. Incorrect parameter types.
1081     * @syscap SystemCapability.Graphics.Drawing
1082     * @since 12
1083     */
1084    drawOval(oval: common2D.Rect): void;
1085
1086    /**
1087     * Draws an arc.
1088     * @param { common2D.Rect } arc - The bounds of the arc is described by a rect.
1089     * @param { number } startAngle - Indicates the startAngle of the arc.
1090     * @param { number } sweepAngle - Indicates the sweepAngle of the arc.
1091     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1092     * <br>2. Incorrect parameter types.
1093     * @syscap SystemCapability.Graphics.Drawing
1094     * @since 12
1095     */
1096    drawArc(arc: common2D.Rect, startAngle: number, sweepAngle: number): void;
1097
1098    /**
1099     * Draw a point.
1100     * @param { number } x - X coordinate position of the point.
1101     * @param { number } y - Y coordinate position of the point.
1102     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1103     * <br>2. Incorrect parameter types.
1104     * @syscap SystemCapability.Graphics.Drawing
1105     * @since 11
1106     */
1107    drawPoint(x: number, y: number): void;
1108
1109    /**
1110     * Draws point array as separate point, line segment or open polygon according to given point mode.
1111     * @param { Array<common2D.Point> } points - Points array.
1112     * @param { PointMode } mode - Draws points enum method. The default value is POINTS.
1113     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1114     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1115     * @syscap SystemCapability.Graphics.Drawing
1116     * @since 12
1117     */
1118    drawPoints(points: Array<common2D.Point>, mode?: PointMode): void;
1119
1120    /**
1121     * Draws a path.
1122     * @param { Path } path - Path to draw.
1123     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1124     * <br>2. Incorrect parameter types.
1125     * @syscap SystemCapability.Graphics.Drawing
1126     * @since 11
1127     */
1128    drawPath(path: Path): void;
1129
1130    /**
1131     * Draws line segment from startPt to endPt.
1132     * @param { number } x0 - X coordinate of the start point of the line segment.
1133     * @param { number } y0 - Y coordinate of the start point of the line segment.
1134     * @param { number } x1 - X coordinate of the end point of the line segment.
1135     * @param { number } y1 - Y coordinate of the end point of the line segment.
1136     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1137     * <br>2. Incorrect parameter types.
1138     * @syscap SystemCapability.Graphics.Drawing
1139     * @since 11
1140     */
1141    drawLine(x0: number, y0: number, x1: number, y1: number): void;
1142
1143    /**
1144     * Draws a single character.
1145     * @param { string } text - A string containing only a single character.
1146     * @param { Font } font - Font object.
1147     * @param { number } x - X coordinate of the single character start point.
1148     * @param { number } y - Y coordinate of the single character start point.
1149     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1150     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1151     * @syscap SystemCapability.Graphics.Drawing
1152     * @since 12
1153     */
1154    drawSingleCharacter(text: string, font: Font, x: number, y: number): void;
1155
1156    /**
1157     * Draws a textBlob
1158     * @param { TextBlob } blob - TextBlob to draw.
1159     * @param { number } x - X coordinate of the text start point.
1160     * @param { number } y - Y coordinate of the text start point.
1161     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1162     * <br>2. Incorrect parameter types.
1163     * @syscap SystemCapability.Graphics.Drawing
1164     * @since 11
1165     */
1166    drawTextBlob(blob: TextBlob, x: number, y: number): void;
1167
1168    /**
1169     * Draws the pixelmap base on the mesh which is evenly distributed across the pixelmap.
1170     * @param { image.PixelMap } pixelmap - The pixelmap to draw using the mesh.
1171     * @param { number } meshWidth - The number of columns in the mesh.
1172     * @param { number } meshHeight - The number of rows in the mesh.
1173     * @param { Array<number> } vertices - Array of vertices, specifying where the mesh should be drawn.
1174     * @param { number } vertOffset - Number of vert elements to skip before drawing.
1175     * @param { Array<number> } colors - Array of colors, specifying a color at each vertex.
1176     * @param { number } colorOffset - Number of color elements to skip before drawing.
1177     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1178     * <br>2. Incorrect parameter types.
1179     * @syscap SystemCapability.Graphics.Drawing
1180     * @since 12
1181     */
1182    drawPixelMapMesh(pixelmap: image.PixelMap, meshWidth: number, meshHeight: number,
1183      vertices: Array<number>, vertOffset: number, colors: Array<number>, colorOffset: number): void;
1184
1185    /**
1186     * Draws a region.
1187     * @param { Region } region - Region object.
1188     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1189     * <br>2. Incorrect parameter types.
1190     * @syscap SystemCapability.Graphics.Drawing
1191     * @since 12
1192     */
1193    drawRegion(region: Region): void;
1194
1195    /**
1196     * Set pen to a canvas.
1197     * @param { Pen } pen - object.
1198     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1199     * <br>2. Incorrect parameter types.
1200     * @syscap SystemCapability.Graphics.Drawing
1201     * @since 11
1202     */
1203    attachPen(pen: Pen): void;
1204
1205    /**
1206     * Set brush to a canvas.
1207     * @param { Brush } brush - Object.
1208     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1209     * <br>2. Incorrect parameter types.
1210     * @syscap SystemCapability.Graphics.Drawing
1211     * @since 11
1212     */
1213    attachBrush(brush: Brush): void;
1214
1215    /**
1216     * Unset pen to a canvas.
1217     * @syscap SystemCapability.Graphics.Drawing
1218     * @since 11
1219     */
1220    detachPen(): void;
1221
1222    /**
1223     * Unset brush to a canvas.
1224     * @syscap SystemCapability.Graphics.Drawing
1225     * @since 11
1226     */
1227    detachBrush(): void;
1228
1229    /**
1230     * Saves the current canvas status (canvas matrix) to the top of the stack.
1231     * @returns { number } Return the number of saved states.
1232     * @syscap SystemCapability.Graphics.Drawing
1233     * @since 12
1234     */
1235    save(): number;
1236
1237    /**
1238     * Saves matrix and clip, and allocates a bitmap for subsequent drawing.
1239     * Calling restore discards changes to matrix and clip, and draws the bitmap.
1240     * @param { common2D.Rect | null} rect - Optional layer size. The default value is null.
1241     * @param { Brush | null} brush - Optional brush effect used to draw the layer. The default value is null.
1242     * @returns { number } Return the number of saved states before this call.
1243     * @throws { BusinessError } 401 - Parameter error. Possible causes: Mandatory parameters are left unspecified.
1244     * @syscap SystemCapability.Graphics.Drawing
1245     * @since 12
1246     */
1247    saveLayer(rect?: common2D.Rect | null, brush?: Brush | null): number;
1248
1249    /**
1250     * Clears a canvas by using a specified color.
1251     * @param { common2D.Color } color - Indicates the color, which is a 32-bit (ARGB) variable.
1252     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1253     * <br>2. Incorrect parameter types.
1254     * @syscap SystemCapability.Graphics.Drawing
1255     * @since 12
1256     */
1257    clear(color: common2D.Color): void;
1258
1259    /**
1260     * Restores the canvas status (canvas matrix) saved on the top of the stack.
1261     * @syscap SystemCapability.Graphics.Drawing
1262     * @since 12
1263     */
1264    restore(): void;
1265
1266    /**
1267     * Restores the specific number of the canvas status (canvas matrix) saved in the stack.
1268     * @param { number } count - Depth of state stack to restore.
1269     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1270     * <br>2. Incorrect parameter types.
1271     * @syscap SystemCapability.Graphics.Drawing
1272     * @since 12
1273     */
1274    restoreToCount(count: number): void;
1275
1276    /**
1277     * Gets the number of the canvas status (canvas matrix) saved in the stack.
1278     * @returns { number } Return represent depth of save state stack.
1279     * @syscap SystemCapability.Graphics.Drawing
1280     * @since 12
1281     */
1282    getSaveCount(): number;
1283
1284    /**
1285     * Gets the width of a canvas.
1286     * @returns { number } Return the width of a canvas.
1287     * @syscap SystemCapability.Graphics.Drawing
1288     * @since 12
1289     */
1290    getWidth(): number;
1291
1292    /**
1293     * Gets the height of a canvas.
1294     * @returns { number } Return the height of a canvas.
1295     * @syscap SystemCapability.Graphics.Drawing
1296     * @since 12
1297     */
1298    getHeight(): number;
1299
1300    /**
1301     * Gets the bounds of clip of a canvas.
1302     * @returns { common2D.Rect } Rect object.
1303     * @syscap SystemCapability.Graphics.Drawing
1304     * @since 12
1305     */
1306    getLocalClipBounds(): common2D.Rect;
1307
1308    /**
1309     * Gets a 3x3 matrix of the transform from local coordinates to 'device'.
1310     * @returns { Matrix } Matrix object.
1311     * @syscap SystemCapability.Graphics.Drawing
1312     * @since 12
1313     */
1314    getTotalMatrix(): Matrix;
1315
1316    /**
1317     * Scales by sx on the x-axis and sy on the y-axis.
1318     * @param { number } sx - Indicates the amount to scale on x-axis.
1319     * @param { number } sy - Indicates the amount to scale on y-axis.
1320     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1321     * <br>2. Incorrect parameter types.
1322     * @syscap SystemCapability.Graphics.Drawing
1323     * @since 12
1324     */
1325    scale(sx: number, sy: number): void;
1326
1327    /**
1328     * Skews by sx on the x-axis and sy on the y-axis.
1329     * @param { number } sx - Indicates the value skew transformation on x-axis.
1330     * @param { number } sy - Indicates the value skew transformation on y-axis.
1331     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1332     * <br>2. Incorrect parameter types.
1333     * @syscap SystemCapability.Graphics.Drawing
1334     * @since 12
1335     */
1336    skew(sx: number, sy: number) : void;
1337
1338    /**
1339     * Rotates by degrees, positive degrees rotates clockwise.
1340     * @param { number } degrees - Indicates the amount to rotate, in degrees.
1341     * @param { number } sx - Indicates the x-axis value of the point to rotate about.
1342     * @param { number } sy - Indicates the y-axis value of the point to rotate about.
1343     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1344     * <br>2. Incorrect parameter types.
1345     * @syscap SystemCapability.Graphics.Drawing
1346     * @since 12
1347     */
1348    rotate(degrees: number, sx: number, sy: number) : void;
1349
1350    /**
1351     * Translates by dx along the x-axis and dy along the y-axis.
1352     * @param { number } dx - Indicates the distance to translate on x-axis.
1353     * @param { number } dy - Indicates the distance to translate on y-axis.
1354     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1355     * <br>2. Incorrect parameter types.
1356     * @syscap SystemCapability.Graphics.Drawing
1357     * @since 12
1358     */
1359    translate(dx: number, dy: number): void;
1360
1361    /**
1362     * Replaces the clipping area with the intersection or difference of the current clipping area and path,
1363     * and use a clipping edge that is aliased or anti-aliased.
1364     * @param { Path } path - To combine with clip.
1365     * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
1366     * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false.
1367     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1368     * <br>2. Incorrect parameter types.
1369     * @syscap SystemCapability.Graphics.Drawing
1370     * @since 12
1371     */
1372    clipPath(path: Path, clipOp?: ClipOp, doAntiAlias?: boolean): void;
1373
1374    /**
1375     * Replaces the clipping area with the intersection or difference between the
1376     * current clipping area and Rect, and use a clipping edge that is aliased or anti-aliased.
1377     * @param { common2D.Rect } rect - To combine with clipping area.
1378     * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
1379     * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false.
1380     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1381     * <br>2. Incorrect parameter types.
1382     * @syscap SystemCapability.Graphics.Drawing
1383     * @since 12
1384     */
1385    clipRect(rect: common2D.Rect, clipOp?: ClipOp, doAntiAlias?: boolean): void;
1386
1387    /**
1388     * Uses the passed matrix to transforming the geometry, then use existing matrix.
1389     * @param { Matrix } matrix - Declares functions related to the matrix object in the drawing module.
1390     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1391     * <br>2. Incorrect parameter types.
1392     * @syscap SystemCapability.Graphics.Drawing
1393     * @since 12
1394     */
1395    concatMatrix(matrix: Matrix): void;
1396
1397    /**
1398     * Replace the clipping area with the intersection or difference of the
1399     * current clipping area and Region, and use a clipping edge that is aliased or anti-aliased.
1400     * @param { Region } region - Region object.
1401     * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
1402     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1403     * <br>2. Incorrect parameter types.
1404     * @syscap SystemCapability.Graphics.Drawing
1405     * @since 12
1406     */
1407    clipRegion(region: Region, clipOp?: ClipOp): void;
1408
1409    /**
1410     * Replaces the clipping area with the intersection or difference between the
1411     * current clipping area and RoundRect, and use a clipping edge that is aliased or anti-aliased.
1412     * @param { RoundRect } roundRect - To combine with clipping area.
1413     * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect.
1414     * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false.
1415     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1416     * <br>2. Incorrect parameter types.
1417     * @syscap SystemCapability.Graphics.Drawing
1418     * @since 12
1419     */
1420    clipRoundRect(roundRect: RoundRect, clipOp?: ClipOp, doAntiAlias?: boolean): void;
1421
1422    /**
1423     * Checks whether the drawable area is empty.
1424     * @returns { boolean } Returns true if drawable area is empty.
1425     * @syscap SystemCapability.Graphics.Drawing
1426     * @since 12
1427     */
1428    isClipEmpty(): boolean;
1429
1430    /**
1431     * Sets matrix of canvas.
1432     * @param { Matrix } matrix - Declares functions related to the matrix object in the drawing module.
1433     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1434     * <br>2. Incorrect parameter types.
1435     * @syscap SystemCapability.Graphics.Drawing
1436     * @since 12
1437     */
1438    setMatrix(matrix: Matrix): void;
1439
1440    /**
1441     * Sets matrix of canvas to the identity matrix.
1442     * @syscap SystemCapability.Graphics.Drawing
1443     * @since 12
1444     */
1445    resetMatrix(): void;
1446  }
1447
1448  /**
1449   * Enumerates clip operations.
1450   *
1451   * @enum { number }
1452   * @syscap SystemCapability.Graphics.Drawing
1453   * @since 12
1454   */
1455  enum ClipOp {
1456    /**
1457     * Clips with difference.
1458     * @syscap SystemCapability.Graphics.Drawing
1459     * @since 12
1460     */
1461    DIFFERENCE = 0,
1462    /**
1463     * Clips with intersection.
1464     * @syscap SystemCapability.Graphics.Drawing
1465     * @since 12
1466     */
1467    INTERSECT = 1,
1468  }
1469
1470  /**
1471   * Provide a description of the type and position of the text.
1472   * @typedef TextBlobRunBuffer
1473   * @syscap SystemCapability.Graphics.Drawing
1474   * @since 11
1475   */
1476  interface TextBlobRunBuffer {
1477    /**
1478     * Text model.
1479     * @type { number }
1480     * @syscap SystemCapability.Graphics.Drawing
1481     * @since 11
1482     */
1483    glyph: number;
1484    /**
1485     * X-coordinate of the text start point.
1486     * @type { number }
1487     * @syscap SystemCapability.Graphics.Drawing
1488     * @since 11
1489     */
1490    positionX: number;
1491    /**
1492     * Y-coordinate of the text start point.
1493     * @type { number }
1494     * @syscap SystemCapability.Graphics.Drawing
1495     * @since 11
1496     */
1497    positionY: number;
1498  }
1499
1500  /**
1501   * Encoding type of the description text.
1502   *
1503   * @enum { number }
1504   * @syscap SystemCapability.Graphics.Drawing
1505   * @since 11
1506   */
1507  enum TextEncoding {
1508    /**
1509     * Use 1 byte to represent UTF-8 or ASCII
1510     * @syscap SystemCapability.Graphics.Drawing
1511     * @since 11
1512     */
1513    TEXT_ENCODING_UTF8 = 0,
1514    /**
1515     * Use 2 bytes to represent most of unicode
1516     * @syscap SystemCapability.Graphics.Drawing
1517     * @since 11
1518     */
1519    TEXT_ENCODING_UTF16 = 1,
1520    /**
1521     * Use 4 bytes to represent all unicode.
1522     * @syscap SystemCapability.Graphics.Drawing
1523     * @since 11
1524     */
1525    TEXT_ENCODING_UTF32 = 2,
1526    /**
1527     * Use 2 bytes to represent the glyph index.
1528     * @syscap SystemCapability.Graphics.Drawing
1529     * @since 11
1530     */
1531    TEXT_ENCODING_GLYPH_ID = 3,
1532  }
1533
1534  /**
1535   * Provide a description of the text
1536   *
1537   * class TextBlob
1538   * @syscap SystemCapability.Graphics.Drawing
1539   * @since 11
1540   */
1541  class TextBlob {
1542    /**
1543     * Create a textblob from a string
1544     * @param { string } text - Drawn glyph content.
1545     * @param { Font } font - Specify text size, font, text scale, etc.
1546     * @param { TextEncoding } encoding - The default value is TEXT_ENCODING_UTF8.
1547     * @returns { TextBlob } TextBlob object.
1548     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1549     * <br>2. Incorrect parameter types.
1550     * @static
1551     * @syscap SystemCapability.Graphics.Drawing
1552     * @since 11
1553     */
1554    static makeFromString(text: string, font: Font, encoding?: TextEncoding): TextBlob;
1555
1556    /**
1557     * Create a textblob from a string, each element of which is located at the given positions.
1558     * @param { string } text - Drawn glyph content.
1559     * @param { number } len - string length, value must equal to points length.
1560     * @param { common2D.Point[] } points - Position coordinates of a textblob elements.
1561     * @param { Font } font - Specify text size, font, text scale, etc.
1562     * @returns { TextBlob } TextBlob object.
1563     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1564     * <br>2. Incorrect parameter types.
1565     * @static
1566     * @syscap SystemCapability.Graphics.Drawing
1567     * @since 12
1568     */
1569    static makeFromPosText(text: string, len: number, points: common2D.Point[], font: Font): TextBlob;
1570
1571    /**
1572     * Creating a textblob object based on RunBuffer information
1573     * @param { Array<TextBlobRunBuffer> } pos - The array of TextBlobRunBuffer.
1574     * @param { Font } font - Font used for this run.
1575     * @param { common2D.Rect } bounds - Optional run bounding box. The default value is null;
1576     * @returns { TextBlob } TextBlob object.
1577     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1578     * <br>2. Incorrect parameter types.
1579     * @static
1580     * @syscap SystemCapability.Graphics.Drawing
1581     * @since 11
1582     */
1583    static makeFromRunBuffer(pos: Array<TextBlobRunBuffer>, font: Font, bounds?: common2D.Rect): TextBlob;
1584
1585    /**
1586     * Returns the bounding rectangle shape
1587     * @returns { common2D.Rect } Rect object.
1588     * @syscap SystemCapability.Graphics.Drawing
1589     * @since 11
1590     */
1591    bounds(): common2D.Rect;
1592
1593    /**
1594     * Returns an unique identifier for a textblob.
1595     * @returns { number } Unique ID.
1596     * @syscap SystemCapability.Graphics.Drawing
1597     * @since 12
1598     */
1599    uniqueID(): number;
1600  }
1601
1602  /**
1603   * The Typeface class specifies the typeface and intrinsic style of a font.
1604   *
1605   * @syscap SystemCapability.Graphics.Drawing
1606   * @since 11
1607   */
1608  class Typeface {
1609    /**
1610     * Get the family name for this typeface.
1611     * @returns { string } Family name.
1612     * @syscap SystemCapability.Graphics.Drawing
1613     * @since 11
1614     */
1615    getFamilyName(): string;
1616
1617    /**
1618     * Generate typeface from file.
1619     * @param { string } filePath - file path for typeface.
1620     * @returns { Typeface } Typeface.
1621     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1622     * <br>2. Incorrect parameter types.
1623     * @syscap SystemCapability.Graphics.Drawing
1624     * @since 12
1625     */
1626     static makeFromFile(filePath: string): Typeface;
1627  }
1628
1629  /**
1630   * Enumerates text edging types.
1631   *
1632   * @enum { number }
1633   * @syscap SystemCapability.Graphics.Drawing
1634   * @since 12
1635   */
1636  enum FontEdging {
1637    /**
1638     * Uses anti aliasing, default value.
1639     * @syscap SystemCapability.Graphics.Drawing
1640     * @since 12
1641     */
1642    ALIAS = 0,
1643
1644    /**
1645     * Uses sub-pixel anti aliasing.
1646     * @syscap SystemCapability.Graphics.Drawing
1647     * @since 12
1648     */
1649    ANTI_ALIAS = 1,
1650
1651    /**
1652     * Uses sub-pixel anti aliasing and enable sub-pixel localization.
1653     * @syscap SystemCapability.Graphics.Drawing
1654     * @since 12
1655     */
1656    SUBPIXEL_ANTI_ALIAS = 2,
1657  }
1658
1659  /**
1660   * Enumerates text hinting types.
1661   *
1662   * @enum { number }
1663   * @syscap SystemCapability.Graphics.Drawing
1664   * @since 12
1665   */
1666  enum FontHinting {
1667    /**
1668     * Not use text hinting.
1669     * @syscap SystemCapability.Graphics.Drawing
1670     * @since 12
1671     */
1672    NONE = 0,
1673
1674    /**
1675     * Uses slight text hinting.
1676     * @syscap SystemCapability.Graphics.Drawing
1677     * @since 12
1678     */
1679    SLIGHT = 1,
1680
1681    /**
1682     * Uses normal text hinting.
1683     * @syscap SystemCapability.Graphics.Drawing
1684     * @since 12
1685     */
1686    NORMAL = 2,
1687
1688    /**
1689     * Uses full text hinting.
1690     * @syscap SystemCapability.Graphics.Drawing
1691     * @since 12
1692     */
1693    FULL = 3,
1694  }
1695
1696  /**
1697   * Font controls options applied when drawing and measuring text.
1698   *
1699   * @syscap SystemCapability.Graphics.Drawing
1700   * @since 11
1701   */
1702  class Font {
1703    /**
1704     * Requests, but does not require, that glyphs respect sub-pixel positioning.
1705     * @param { boolean } isSubpixel - Setting for sub-pixel positioning.
1706     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1707     * <br>2. Incorrect parameter types.
1708     * @syscap SystemCapability.Graphics.Drawing
1709     * @since 11
1710     */
1711    enableSubpixel(isSubpixel: boolean): void;
1712
1713    /**
1714     * Increases stroke width when creating glyph bitmaps to approximate a bold typeface.
1715     * @param { boolean } isEmbolden - Setting for bold approximation.
1716     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1717     * <br>2. Incorrect parameter types.
1718     * @syscap SystemCapability.Graphics.Drawing
1719     * @since 11
1720     */
1721    enableEmbolden(isEmbolden: boolean): void;
1722
1723    /**
1724     * Requests linearly scalable font and glyph metrics.
1725     * @param { boolean } isLinearMetrics - Setting for linearly scalable font and glyph metrics.
1726     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1727     * <br>2. Incorrect parameter types.
1728     * @syscap SystemCapability.Graphics.Drawing
1729     * @since 11
1730     */
1731    enableLinearMetrics(isLinearMetrics: boolean): void;
1732
1733    /**
1734     * Sets text size in points. Has no effect if textSize is not greater than or equal to zero.
1735     * @param { number } textSize - Typographic height of text. The height of the text must be greater than 0.
1736     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1737     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1738     * @syscap SystemCapability.Graphics.Drawing
1739     * @since 11
1740     */
1741    setSize(textSize: number): void;
1742
1743    /**
1744     * Obtains the text size.
1745     * @returns { number } Text size.
1746     * @syscap SystemCapability.Graphics.Drawing
1747     * @since 11
1748     */
1749    getSize(): number;
1750
1751    /**
1752     * Sets Typeface to font.
1753     * @param { Typeface } typeface - Font and style used to draw text.
1754     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1755     * <br>2. Incorrect parameter types.
1756     * @syscap SystemCapability.Graphics.Drawing
1757     * @since 11
1758     */
1759    setTypeface(typeface: Typeface): void;
1760
1761    /**
1762     * Get Typeface to font.
1763     * @returns { Typeface } Typeface.
1764     * @syscap SystemCapability.Graphics.Drawing
1765     * @since 11
1766     */
1767    getTypeface(): Typeface;
1768
1769    /**
1770     * Get fontMetrics associated with typeface.
1771     * @returns { FontMetrics } The fontMetrics value returned to the caller.
1772     * @syscap SystemCapability.Graphics.Drawing
1773     * @since 11
1774     */
1775    getMetrics(): FontMetrics;
1776
1777    /**
1778     * Measure a single character.
1779     * @param { string } text - A string containing only a single character.
1780     * @returns { number } The width of the single character.
1781     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1782     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1783     * @syscap SystemCapability.Graphics.Drawing
1784     * @since 12
1785     */
1786    measureSingleCharacter(text: string): number;
1787    /**
1788     * Measure the width of text.
1789     * @param { string } text - Text Symbol Content.
1790     * @param { TextEncoding } encoding - Encoding format.
1791     * @returns { number } The width of text.
1792     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1793     * <br>2. Incorrect parameter types.
1794     * @syscap SystemCapability.Graphics.Drawing
1795     * @since 11
1796     */
1797    measureText(text: string, encoding: TextEncoding): number;
1798
1799    /**
1800     * Sets text scale on x-axis to font.
1801     * @param { number } scaleX - Text scaleX.
1802     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1803     * <br>2. Incorrect parameter types.
1804     * @syscap SystemCapability.Graphics.Drawing
1805     * @since 12
1806     */
1807    setScaleX(scaleX: number): void;
1808
1809    /**
1810     * Sets text skew on x-axis to font.
1811     * @param { number } skewX - Text skewX.
1812     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1813     * <br>2. Incorrect parameter types.
1814     * @syscap SystemCapability.Graphics.Drawing
1815     * @since 12
1816     */
1817    setSkewX(skewX: number): void;
1818
1819    /**
1820     * Sets the edging effect to font.
1821     * @param { FontEdging } edging - Text edging.
1822     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1823     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1824     * @syscap SystemCapability.Graphics.Drawing
1825     * @since 12
1826     */
1827    setEdging(edging: FontEdging): void;
1828
1829    /**
1830     * Sets the hinting pattern to font.
1831     * @param { FontHinting } hinting - Text hinting.
1832     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1833     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
1834     * @syscap SystemCapability.Graphics.Drawing
1835     * @since 12
1836     */
1837    setHinting(hinting: FontHinting): void;
1838
1839    /**
1840     * Calculates number of glyphs represented by text.
1841     * @param { string } text - Indicates the character storage encoded with text encoding.
1842     * @returns { number } Returns the count of text.
1843     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1844     * <br>2. Incorrect parameter types.
1845     * @syscap SystemCapability.Graphics.Drawing
1846     * @since 12
1847     */
1848    countText(text: string): number;
1849
1850    /**
1851     * Sets whether the font baselines and pixels alignment when the transformation matrix is ​​axis aligned.
1852     * @param { boolean } isBaselineSnap - Indicates whether the font baselines and pixels alignment.
1853     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1854     * <br>2. Incorrect parameter types.
1855     * @syscap SystemCapability.Graphics.Drawing
1856     * @since 12
1857     */
1858    setBaselineSnap(isBaselineSnap: boolean): void;
1859
1860    /**
1861     * Gets whether the font baselines and pixels alignment when the transformation matrix is ​​axis aligned.
1862     * @returns { boolean } Returns true if the font baselines and pixels alignment; returns false otherwise.
1863     * @syscap SystemCapability.Graphics.Drawing
1864     * @since 12
1865     */
1866    isBaselineSnap(): boolean;
1867
1868    /**
1869     * Sets whether to use bitmaps instead of outlines in the object.
1870     * @param { boolean } isEmbeddedBitmaps - Indicates whether to use bitmaps instead of outlines.
1871     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1872     * <br>2. Incorrect parameter types.
1873     * @syscap SystemCapability.Graphics.Drawing
1874     * @since 12
1875     */
1876    setEmbeddedBitmaps(isEmbeddedBitmaps: boolean): void;
1877
1878    /**
1879     * Gets whether to use bitmaps instead of outlines in the object.
1880     * @returns { boolean } if using bitmaps instead of outlines; returns false otherwise.
1881     * @syscap SystemCapability.Graphics.Drawing
1882     * @since 12
1883     */
1884    isEmbeddedBitmaps(): boolean;
1885
1886    /**
1887     * Sets whether the font outline is automatically adjusted.
1888     * @param { boolean } isForceAutoHinting - Indicates whether the font outline is automatically adjusted.
1889     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1890     * <br>2. Incorrect parameter types.
1891     * @syscap SystemCapability.Graphics.Drawing
1892     * @since 12
1893     */
1894    setForceAutoHinting(isForceAutoHinting: boolean): void;
1895
1896    /**
1897     * Gets whether the font outline is automatically adjusted.
1898     * @returns { boolean } Returns true if the font outline is automatically adjusted; returns false otherwise.
1899     * @syscap SystemCapability.Graphics.Drawing
1900     * @since 12
1901     */
1902    isForceAutoHinting(): boolean;
1903
1904    /**
1905     * Retrieves the advance for each glyph in glyphs.
1906     * @param { Array<number> } glyphs - Array of glyph indices to be measured.
1907     * @returns { Array<number> } Returns the width of each character in a string.
1908     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1909     * <br>2. Incorrect parameter types.
1910     * @syscap SystemCapability.Graphics.Drawing
1911     * @since 12
1912     */
1913    getWidths(glyphs: Array<number>): Array<number>;
1914
1915    /**
1916     * Gets storage for glyph indexes.
1917     * @param { string } text - Indicates the character storage encoded with text encoding.
1918     * @param { number } glyphCount - The number of glyph. The default value is the result of calling countText.
1919     * @returns { Array<number> } Returns the storage for glyph indices.
1920     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1921     * <br>2. Incorrect parameter types.
1922     * @syscap SystemCapability.Graphics.Drawing
1923     * @since 12
1924     */
1925    textToGlyphs(text: string, glyphCount?: number): Array<number>;
1926
1927    /**
1928     * Returns true if glyphs may be drawn at sub-pixel offsets.
1929     * @returns { boolean } True if glyphs may be drawn at sub-pixel offsets.
1930     * @syscap SystemCapability.Graphics.Drawing
1931     * @since 12
1932     */
1933    isSubpixel(): boolean;
1934    /**
1935     * Returns true if font and glyph metrics are requested to be linearly scalable.
1936     * @returns { boolean } True if font and glyph metrics are requested to be linearly scalable.
1937     * @syscap SystemCapability.Graphics.Drawing
1938     * @since 12
1939     */
1940    isLinearMetrics(): boolean;
1941    /**
1942     * Returns text skew on x-axis.
1943     * @returns { number } Additional shear on x-axis relative to y-axis.
1944     * @syscap SystemCapability.Graphics.Drawing
1945     * @since 12
1946     */
1947    getSkewX(): number;
1948    /**
1949     * Gets whether to increase the stroke width to approximate bold fonts.
1950     * @returns { boolean } Returns true to increase the stroke width to approximate bold fonts;
1951     * returns false otherwise.
1952     * @syscap SystemCapability.Graphics.Drawing
1953     * @since 12
1954     */
1955    isEmbolden(): boolean;
1956    /**
1957     * Returns text scale on x-axis.
1958     * @returns { number } Text horizontal scale.
1959     * @syscap SystemCapability.Graphics.Drawing
1960     * @since 12
1961     */
1962    getScaleX(): number;
1963    /**
1964     * Gets font hinting pattern.
1965     * @returns { FontHinting } Font hinting level.
1966     * @syscap SystemCapability.Graphics.Drawing
1967     * @since 12
1968     */
1969    getHinting(): FontHinting;
1970    /**
1971     * Gets font edge pixels pattern.
1972     * @returns { FontEdging } Edge pixels pattern.
1973     * @syscap SystemCapability.Graphics.Drawing
1974     * @since 12
1975     */
1976    getEdging(): FontEdging;
1977
1978    /**
1979     * Sets whether to follow the theme font. If the value is true, the theme font is used when typeface is not set.
1980     * @param { boolean } followed - Indicates whether to follow the theme font.
1981     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
1982     * <br>2. Incorrect parameter types.
1983     * @syscap SystemCapability.Graphics.Drawing
1984     * @since 15
1985     */
1986    setThemeFontFollowed(followed: boolean): void;
1987
1988    /**
1989     * Gets whether to follow the theme font.
1990     * @returns { boolean } Returns true if font follows theme font; returns false otherwise.
1991     * @syscap SystemCapability.Graphics.Drawing
1992     * @since 15
1993     */
1994    isThemeFontFollowed(): boolean;
1995  }
1996
1997  /**
1998   * Indicate when certain metrics are valid; the underline or strikeout metrics may be valid and zero.
1999   * Fonts with embedded bitmaps may not have valid underline or strikeout metrics.
2000   * @enum { number }
2001   * @syscap SystemCapability.Graphics.Drawing
2002   * @since 12
2003   */
2004  enum FontMetricsFlags {
2005    /**
2006     * Set if underlineThickness of FontMetrics is valid.
2007     * @syscap SystemCapability.Graphics.Drawing
2008     * @since 12
2009     */
2010    UNDERLINE_THICKNESS_VALID = 1 << 0,
2011
2012    /**
2013     * Set if underlinePosition of FontMetrics is valid.
2014     * @syscap SystemCapability.Graphics.Drawing
2015     * @since 12
2016     */
2017    UNDERLINE_POSITION_VALID = 1 << 1,
2018
2019    /**
2020     * Set if strikethroughThickness of FontMetrics is valid.
2021     * @syscap SystemCapability.Graphics.Drawing
2022     * @since 12
2023     */
2024    STRIKETHROUGH_THICKNESS_VALID = 1 << 2,
2025
2026    /**
2027     * Set if strikethroughPosition of FontMetrics is valid.
2028     * @syscap SystemCapability.Graphics.Drawing
2029     * @since 12
2030     */
2031    STRIKETHROUGH_POSITION_VALID = 1 << 3,
2032
2033    /**
2034     * set if top, bottom, xMin, xMax of FontMetrics invalid.
2035     * @syscap SystemCapability.Graphics.Drawing
2036     * @since 12
2037     */
2038    BOUNDS_INVALID = 1 << 4,
2039  }
2040
2041  /**
2042   * The metrics of an Font.
2043   * @typedef FontMetrics
2044   * @syscap SystemCapability.Graphics.Drawing
2045   * @since 11
2046   */
2047  interface FontMetrics {
2048    /**
2049     * Indicating which metrics are valid.
2050     * @type { ?FontMetricsFlags }
2051     * @syscap SystemCapability.Graphics.Drawing
2052     * @since 12
2053     */
2054    flags?: FontMetricsFlags;
2055
2056    /**
2057     * Maximum range above the glyph bounding box.
2058     * @type { number }
2059     * @syscap SystemCapability.Graphics.Drawing
2060     * @since 11
2061     */
2062    top: number;
2063    /**
2064     * Distance Retained Above Baseline.
2065     * @type { number }
2066     * @syscap SystemCapability.Graphics.Drawing
2067     * @since 11
2068     */
2069    ascent: number;
2070    /**
2071     * The distance that remains below the baseline.
2072     * @type { number }
2073     * @syscap SystemCapability.Graphics.Drawing
2074     * @since 11
2075     */
2076    descent: number;
2077    /**
2078     * Maximum range below the glyph bounding box.
2079     * @type { number }
2080     * @syscap SystemCapability.Graphics.Drawing
2081     * @since 11
2082     */
2083    bottom: number;
2084    /**
2085     * Line Spacing.
2086     * @type { number }
2087     * @syscap SystemCapability.Graphics.Drawing
2088     * @since 11
2089     */
2090    leading: number;
2091    /**
2092     * Average character width, zero if unknown.
2093     * @type { ?number }
2094     * @syscap SystemCapability.Graphics.Drawing
2095     * @since 12
2096     */
2097     avgCharWidth?: number;
2098
2099     /**
2100      * Maximum character width, zero if unknown.
2101      * @type { ?number }
2102      * @syscap SystemCapability.Graphics.Drawing
2103      * @since 12
2104      */
2105     maxCharWidth?: number;
2106
2107     /**
2108      * Greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts.
2109      * @type { ?number }
2110      * @syscap SystemCapability.Graphics.Drawing
2111      * @since 12
2112      */
2113     xMin?: number;
2114
2115     /**
2116      * Greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts.
2117      * @type { ?number }
2118      * @syscap SystemCapability.Graphics.Drawing
2119      * @since 12
2120      */
2121     xMax?: number;
2122
2123     /**
2124      * Height of lower-case 'x', zero if unknown, typically negative.
2125      * @type { ?number }
2126      * @syscap SystemCapability.Graphics.Drawing
2127      * @since 12
2128      */
2129     xHeight?: number;
2130
2131     /**
2132      * Height of an upper-case letter, zero if unknown, typically negative.
2133      * @type { ?number }
2134      * @syscap SystemCapability.Graphics.Drawing
2135      * @since 12
2136      */
2137     capHeight?: number;
2138
2139     /**
2140      * Underline thickness.
2141      * @type { ?number }
2142      * @syscap SystemCapability.Graphics.Drawing
2143      * @since 12
2144      */
2145     underlineThickness?: number;
2146
2147     /**
2148      * Distance from baseline to top of stroke, typically positive.
2149      * @type { ?number }
2150      * @syscap SystemCapability.Graphics.Drawing
2151      * @since 12
2152      */
2153     underlinePosition?: number;
2154
2155     /**
2156      * Strikethrough thickness.
2157      * @type { ?number }
2158      * @syscap SystemCapability.Graphics.Drawing
2159      * @since 12
2160      */
2161     strikethroughThickness?: number;
2162
2163     /**
2164      * Distance from baseline to bottom of stroke, typically negative.
2165      * @type { ?number }
2166      * @syscap SystemCapability.Graphics.Drawing
2167      * @since 12
2168      */
2169     strikethroughPosition?: number;
2170  }
2171
2172  /**
2173   * Lattice is the class for dividing an image into grids.
2174   * @syscap SystemCapability.Graphics.Drawing
2175   * @since 12
2176   */
2177  class Lattice {
2178    /**
2179     * Divide an image into a rectangular grid. Grid entries on even columns and even rows are fixed;
2180     * these entries are always drawn at their original size if the destination is large enough. If the destination
2181     * side is too small to hold the fixed entries, all fixed entries are scaled down to fit.
2182     * The grid entries not on even columns and rows are scaled to fit the remaining space, if any.
2183     * @param { Array<number> } xDivs - X coordinate of values used to divide the image.
2184     * @param { Array<number> } yDivs - Y coordinate of values used to divide the image.
2185     * @param { number } fXCount - Number of x coordinates. Must be >= 0.
2186     * @param { number } fYCount - Number of y coordinates. Must be >= 0.
2187     * @param { common2D.Rect | null } fBounds - Source bounds to draw from. The default value is null.
2188     * @param { Array<RectType> | null } fRectTypes - Array of fill types. The default value is null.
2189     * @param { Array<common2D.Color> | null } fColors - Array of colors. The default value is null.
2190     * @returns { Lattice } Lattice object.
2191     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2192     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2193     * @static
2194     * @syscap SystemCapability.Graphics.Drawing
2195     * @since 12
2196     */
2197    static createImageLattice(xDivs: Array<number>, yDivs: Array<number>, fXCount: number, fYCount: number,
2198      fBounds?: common2D.Rect | null, fRectTypes?: Array<RectType> | null, fColors?: Array<common2D.Color> | null): Lattice;
2199  }
2200
2201  /**
2202   * Enumerate rect types. Optional setting per rectangular grid entry to make it transparent,
2203   * or to fill the grid entry with a color. only used in Lattice.
2204   * @enum { number }
2205   * @syscap SystemCapability.Graphics.Drawing
2206   * @since 12
2207   */
2208  enum RectType {
2209    /**
2210     * Draws image into lattice rect.
2211     * @syscap SystemCapability.Graphics.Drawing
2212     * @since 12
2213     */
2214    DEFAULT = 0,
2215
2216    /**
2217     * Skips lattice rect by making it transparent.
2218     * @syscap SystemCapability.Graphics.Drawing
2219     * @since 12
2220     */
2221    TRANSPARENT = 1,
2222
2223    /**
2224     * Draws one of fColors into lattice rect.
2225     * @syscap SystemCapability.Graphics.Drawing
2226     * @since 12
2227     */
2228    FIXEDCOLOR = 2
2229  }
2230
2231  /**
2232   * MaskFilter is the class for object that perform transformations on an alpha-channel mask before drawing it.
2233   * @syscap SystemCapability.Graphics.Drawing
2234   * @since 12
2235   */
2236  class MaskFilter {
2237    /**
2238     * Makes a MaskFilter with a blur effect.
2239     * @param { BlurType } blurType - Indicates the blur type.
2240     * @param { number } sigma - Indicates the standard deviation of the Gaussian blur to apply. Must be > 0.
2241     * @returns { MaskFilter } MaskFilter object.
2242     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2243     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2244     * @static
2245     * @syscap SystemCapability.Graphics.Drawing
2246     * @since 12
2247     */
2248    static createBlurMaskFilter(blurType: BlurType, sigma: number): MaskFilter;
2249  }
2250
2251  /**
2252   * Defines a PathEffect, which is used to affects stroked paths.
2253   * @syscap SystemCapability.Graphics.Drawing
2254   * @since 12
2255   */
2256  class PathEffect {
2257    /**
2258     * Makes a dash PathEffect.
2259     * @param { Array<number> } intervals - Array of ON and OFF distances. Must contain an even number of entries (>=2),
2260     * with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals.
2261     * @param { number } phase - Offset into the intervals array.
2262     * @returns { PathEffect } PathEffect object.
2263     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2264     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2265     * @static
2266     * @syscap SystemCapability.Graphics.Drawing
2267     * @since 12
2268     */
2269    static createDashPathEffect(intervals: Array<number>, phase: number): PathEffect;
2270
2271    /**
2272     * Makes a corner PathEffect.
2273     * @param { number } radius - Indicates the radius of the tangent circle at the corners of the path.
2274     * The radius must be greater than 0.
2275     * @returns { PathEffect } PathEffect object.
2276     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2277     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2278     * @static
2279     * @syscap SystemCapability.Graphics.Drawing
2280     * @since 12
2281     */
2282    static createCornerPathEffect(radius: number): PathEffect;
2283  }
2284
2285  /**
2286   * Describes a shader effect object.
2287   * @syscap SystemCapability.Graphics.Drawing
2288   * @since 12
2289   */
2290  class ShaderEffect {
2291    /**
2292     * Creates an ShaderEffect object that generates a shader with single color.
2293     * @param { number } color - Indicates the color used by the shader.
2294     * @returns { ShaderEffect } Returns the shader with single color ShaderEffect object.
2295     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2296     * <br>2. Incorrect parameter types.
2297     * @syscap SystemCapability.Graphics.Drawing
2298     * @since 12
2299     */
2300    static createColorShader(color: number): ShaderEffect;
2301
2302    /**
2303     * Creates an ShaderEffect object that generates a linear gradient between the two specified points.
2304     * @param { common2D.Point } startPt - Indicates the start point for the gradient.
2305     * @param { common2D.Point } endPt - Indicates the end point for the gradient.
2306     * @param { Array<number> } colors - Indicates the colors to be distributed between the two points.
2307     * @param { TileMode } mode - Indicates the tile mode.
2308     * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color
2309     * <br> in the colors array. The default value is empty for uniform distribution.
2310     * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null.
2311     * @returns { ShaderEffect } Returns a linear gradient ShaderEffect object.
2312     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2313     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2314     * @syscap SystemCapability.Graphics.Drawing
2315     * @since 12
2316     */
2317    static createLinearGradient(startPt: common2D.Point, endPt: common2D.Point, colors: Array<number>,
2318      mode: TileMode, pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect;
2319
2320    /**
2321     * Creates an ShaderEffect object that generates a radial gradient given the center and radius.
2322     * @param { common2D.Point } centerPt - Indicates the center of the circle for the gradient.
2323     * @param { number } radius - Indicates the radius of the circle for this gradient.
2324     * @param { Array<number> } colors - Indicates the colors to be distributed between the two points.
2325     * @param { TileMode } mode - Indicates the tile mode.
2326     * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color
2327     * <br> in the colors array. The default value is empty for uniform distribution.
2328     * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null.
2329     * @returns { ShaderEffect } Returns a radial gradient ShaderEffect object.
2330     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2331     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2332     * @syscap SystemCapability.Graphics.Drawing
2333     * @since 12
2334     */
2335    static createRadialGradient(centerPt: common2D.Point, radius: number, colors: Array<number>,
2336      mode: TileMode, pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect;
2337
2338    /**
2339     * Creates an ShaderEffect object that generates a sweep gradient given a center.
2340     * @param { common2D.Point } centerPt - Indicates the center of the circle for the gradient.
2341     * @param { Array<number> } colors - Indicates the colors to be distributed between the two points.
2342     * @param { TileMode } mode - Indicates the tile mode.
2343     * @param { number } startAngle - The starting angle of the gradient.
2344     * @param { number } endAngle - The ending angle of the gradient.
2345     * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color
2346     * <br> in the colors array. The default value is empty for uniform distribution.
2347     * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null.
2348     * @returns { ShaderEffect } Returns a sweep gradient ShaderEffect object.
2349     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2350     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2351     * @syscap SystemCapability.Graphics.Drawing
2352     * @since 12
2353     */
2354    static createSweepGradient(centerPt: common2D.Point, colors: Array<number>,
2355      mode: TileMode, startAngle: number, endAngle: number, pos?: Array<number> | null,
2356      matrix?: Matrix | null): ShaderEffect;
2357
2358    /**
2359     * Creates an ShaderEffect object that generates a conical gradient given two circles.
2360     * @param { common2D.Point } startPt - Indicates the center of the start circle for the gradient.
2361     * @param { number } startRadius - Indicates the radius of the start circle for this gradient.
2362     * @param { common2D.Point } endPt - Indicates the center of the end circle for the gradient.
2363     * @param { number } endRadius - Indicates the radius of the end circle for this gradient.
2364     * @param { Array<number> } colors - Indicates the colors to be distributed between the two points.
2365     * @param { TileMode } mode - Indicates the tile mode.
2366     * @param { Array<number> | null } pos - Indicates the relative position of each corresponding color
2367     * <br> in the colors array. The default value is empty for uniform distribution.
2368     * @param { Matrix | null } matrix - Indicates the Matrix object. The default value is null.
2369     * @returns { ShaderEffect } Returns a conical gradient ShaderEffect object.
2370     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2371     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2372     * @syscap SystemCapability.Graphics.Drawing
2373     * @since 12
2374     */
2375    static createConicalGradient(startPt: common2D.Point, startRadius: number, endPt: common2D.Point,
2376      endRadius: number, colors: Array<number>, mode: TileMode,
2377      pos?: Array<number> | null, matrix?: Matrix | null): ShaderEffect;
2378  }
2379
2380  /**
2381   * Enumerates tile modes that describe an image or texture.
2382   * @enum { number }
2383   * @syscap SystemCapability.Graphics.Drawing
2384   * @since 12
2385   */
2386  enum TileMode {
2387    /**
2388     * Replicate the edge color if the shader effect draws outside of its original bounds.
2389     * @syscap SystemCapability.Graphics.Drawing
2390     * @since 12
2391     */
2392    CLAMP = 0,
2393
2394    /**
2395     * Repeat the shader effect image horizontally and vertically.
2396     * @syscap SystemCapability.Graphics.Drawing
2397     * @since 12
2398     */
2399    REPEAT = 1,
2400
2401    /**
2402     * Repeat the shader effect image horizontally and vertically, alternating mirror images
2403     * so that adjacent images always seam.
2404     * @syscap SystemCapability.Graphics.Drawing
2405     * @since 12
2406     */
2407    MIRROR = 2,
2408
2409    /**
2410     * Only draw within the original domain, return transparent-black everywhere else.
2411     * @syscap SystemCapability.Graphics.Drawing
2412     * @since 12
2413     */
2414    DECAL = 3,
2415  }
2416
2417  /**
2418   * Defines a ShadowLayer, which is used to specify the color, blur radius, and offset of the shadow.
2419   * @syscap SystemCapability.Graphics.Drawing
2420   * @since 12
2421   */
2422  class ShadowLayer {
2423    /**
2424     * Makes a new ShadowLayer.
2425     *
2426     * @param { number } blurRadius - The blur radius of the shadow. The blur radius must be greater than 0.
2427     * @param { number } x - The offset point on x-axis.
2428     * @param { number } y - The offset point on y-axis.
2429     * @param { common2D.Color } color - The shadow color. The range of color channels must be [0, 255].
2430     * @returns { ShadowLayer } ShadowLayer object.
2431     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2432     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2433     * @static
2434     * @syscap SystemCapability.Graphics.Drawing
2435     * @since 12
2436     */
2437    static create(blurRadius: number, x: number, y: number, color: common2D.Color): ShadowLayer;
2438  }
2439
2440  /**
2441   * ColorFilters are optional objects in the drawing pipeline.
2442   *
2443   * @syscap SystemCapability.Graphics.Drawing
2444   * @since 11
2445   */
2446  class ColorFilter {
2447    /**
2448     * Makes a color filter with the given color and blend mode.
2449     * @param { common2D.Color } color - The range of color channels must be [0, 255].
2450     * @param { BlendMode } mode - BlendMode.
2451     * @returns { ColorFilter } Colorfilter object.
2452     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2453     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2454     * @static
2455     * @syscap SystemCapability.Graphics.Drawing
2456     * @since 11
2457     */
2458    static createBlendModeColorFilter(color: common2D.Color, mode: BlendMode): ColorFilter;
2459
2460    /**
2461     * Create a color filter consisting of two filters.
2462     * @param { ColorFilter } outer - The filter is used next.
2463     * @param { ColorFilter } inner - The filter is used first.
2464     * @returns { ColorFilter } Colorfilter object.
2465     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2466     * <br>2. Incorrect parameter types.
2467     * @static
2468     * @syscap SystemCapability.Graphics.Drawing
2469     * @since 11
2470     */
2471    static createComposeColorFilter(outer: ColorFilter, inner: ColorFilter): ColorFilter;
2472
2473    /**
2474     * Makes a color filter that converts between linear colors and sRGB colors.
2475     * @returns { ColorFilter } Colorfilter object.
2476     * @static
2477     * @syscap SystemCapability.Graphics.Drawing
2478     * @since 11
2479     */
2480    static createLinearToSRGBGamma(): ColorFilter;
2481
2482    /**
2483     * Makes a color filter that converts between sRGB colors and linear colors.
2484     * @returns { ColorFilter } Colorfilter object.
2485     * @static
2486     * @syscap SystemCapability.Graphics.Drawing
2487     * @since 11
2488     */
2489    static createSRGBGammaToLinear(): ColorFilter;
2490
2491    /**
2492     * Makes a color filter that multiplies the luma of its input into the alpha channel,
2493     * and sets the red, green, and blue channels to zero.
2494     * @returns { ColorFilter } Colorfilter.
2495     * @static
2496     * @syscap SystemCapability.Graphics.Drawing
2497     * @since 11
2498     */
2499    static createLumaColorFilter(): ColorFilter;
2500    /**
2501     * Makes a color filter with a 5x4 color matrix
2502     * @param { Array<number> } matrix - Indicates the matrix, which is represented as a number array of length 20.
2503     * @returns { ColorFilter } Colorfilter object.
2504     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2505     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2506     * @static
2507     * @syscap SystemCapability.Graphics.Drawing
2508     * @since 12
2509     */
2510    static createMatrixColorFilter(matrix: Array<number>): ColorFilter;
2511  }
2512
2513  /**
2514   * ImageFilters are optional objects in the drawing pipeline.
2515   *
2516   * @syscap SystemCapability.Graphics.Drawing
2517   * @since 12
2518   */
2519  class ImageFilter {
2520    /**
2521     * Makes an ImageFilter object that blurs its input by the separate X and Y sigmas.
2522     * @param { number } sigmaX - Indicates the Gaussian sigma value for blurring along the X axis. Must be > 0.
2523     * @param { number } sigmaY - Indicates the Gaussian sigma value for blurring along the Y axis. Must be > 0.
2524     * @param { TileMode } tileMode - Indicates the tile mode applied at edges.
2525     * @param { ImageFilter | null } imageFilter - Indicates the input filter that is blurred,
2526     * uses source bitmap if this is null.
2527     * @returns { ImageFilter } ImageFilter object.
2528     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2529     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2530     * @static
2531     * @syscap SystemCapability.Graphics.Drawing
2532     * @since 12
2533     */
2534    static createBlurImageFilter(sigmaX: number, sigmaY: number,
2535      tileMode: TileMode, imageFilter?: ImageFilter | null): ImageFilter;
2536    /**
2537     * Makes an ImageFilter object that applies the color filter to the input.
2538     * @param { ColorFilter } colorFilter - Indicates the color filter that transforms the input image.
2539     * @param { ImageFilter | null } imageFilter - Indicates the input filter, or uses the source bitmap if this is null.
2540     * @returns { ImageFilter } ImageFilter object.
2541     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2542     * <br>2. Incorrect parameter types.
2543     * @static
2544     * @syscap SystemCapability.Graphics.Drawing
2545     * @since 12
2546     */
2547    static createFromColorFilter(colorFilter: ColorFilter, imageFilter?: ImageFilter | null): ImageFilter;
2548  }
2549  /**
2550   * Enumerate join styles. The join style defines the shape of the joins of a
2551   * polyline segment drawn by the pen.
2552   * @enum { number }
2553   * @syscap SystemCapability.Graphics.Drawing
2554   * @since 12
2555   */
2556  enum JoinStyle {
2557    /**
2558     * Miter corner. If the angle of a polyline is small, its miter length may be inappropriate.
2559     * In this case, you need to use the miter limit to limit the miter length.
2560     * @syscap SystemCapability.Graphics.Drawing
2561     * @since 12
2562     */
2563    MITER_JOIN = 0,
2564
2565    /**
2566     * Round corner.
2567     * @syscap SystemCapability.Graphics.Drawing
2568     * @since 12
2569     */
2570    ROUND_JOIN = 1,
2571
2572    /**
2573     * Bevel corner.
2574     * @syscap SystemCapability.Graphics.Drawing
2575     * @since 12
2576     */
2577    BEVEL_JOIN = 2
2578  }
2579
2580  /**
2581   * Enumerates cap styles of a pen. The cap style defines
2582   * the style of both ends of a segment drawn by the pen.
2583   * @enum { number }
2584   * @syscap SystemCapability.Graphics.Drawing
2585   * @since 12
2586   */
2587  enum CapStyle {
2588    /**
2589     * No cap style. Both ends of the segment are cut off square.
2590     * @syscap SystemCapability.Graphics.Drawing
2591     * @since 12
2592     */
2593    FLAT_CAP = 0,
2594
2595    /**
2596     * Square cap style. Both ends have a square, the height of which
2597     * is half of the width of the segment, with the same width.
2598     * @syscap SystemCapability.Graphics.Drawing
2599     * @since 12
2600     */
2601    SQUARE_CAP = 1,
2602
2603    /**
2604     * Round cap style. Both ends have a semicircle centered, the diameter of which
2605     * is the same as the width of the segment.
2606     * @syscap SystemCapability.Graphics.Drawing
2607     * @since 12
2608     */
2609    ROUND_CAP = 2
2610  }
2611
2612  /**
2613   * Enumerates blur type.
2614   * @enum { number }
2615   * @syscap SystemCapability.Graphics.Drawing
2616   * @since 12
2617   */
2618  enum BlurType {
2619    /**
2620     * Fuzzy inside and outside.
2621     * @syscap SystemCapability.Graphics.Drawing
2622     * @since 12
2623     */
2624    NORMAL = 0,
2625
2626    /**
2627     * Solid inside, fuzzy outside.
2628     * @syscap SystemCapability.Graphics.Drawing
2629     * @since 12
2630     */
2631    SOLID = 1,
2632
2633    /**
2634     * Nothing inside, fuzzy outside.
2635     * @syscap SystemCapability.Graphics.Drawing
2636     * @since 12
2637     */
2638    OUTER = 2,
2639
2640    /**
2641     * Fuzzy inside, nothing outside.
2642     * @syscap SystemCapability.Graphics.Drawing
2643     * @since 12
2644     */
2645    INNER = 3
2646  }
2647
2648  /**
2649   * Provides settings for strokes during drawing.
2650   * @syscap SystemCapability.Graphics.Drawing
2651   * @since 11
2652   */
2653  class Pen {
2654    /**
2655     * Constructor for the pen.
2656     * @syscap SystemCapability.Graphics.Drawing
2657     * @since 12
2658     */
2659    constructor();
2660
2661    /**
2662     * Constructor for the pen from an existing pen object pen.
2663     * @param { Pen } pen - Indicates the Pen object.
2664     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2665     * <br>2. Incorrect parameter types.
2666     * @syscap SystemCapability.Graphics.Drawing
2667     * @since 12
2668     */
2669    constructor(pen: Pen);
2670
2671    /**
2672     * Sets the stroke miter limit for a polyline drawn by a pen.
2673     * @param { number } miter - Indicates a variable that describes the miter limit.
2674     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2675     * <br>2. Incorrect parameter types.
2676     * @syscap SystemCapability.Graphics.Drawing
2677     * @since 12
2678     */
2679    setMiterLimit(miter: number): void;
2680
2681    /**
2682     * Obtains the stroke miter limit of a polyline drawn by a pen.
2683     * @returns { number } Returns the miter limit.
2684     * @syscap SystemCapability.Graphics.Drawing
2685     * @since 12
2686     */
2687    getMiterLimit(): number;
2688
2689    /**
2690     * Sets the shaderEffect for a pen.
2691     * @param { ShaderEffect } shaderEffect - Indicates the ShaderEffect object.
2692     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2693     * <br>2. Incorrect parameter types.
2694     * @syscap SystemCapability.Graphics.Drawing
2695     * @since 12
2696     */
2697    setShaderEffect(shaderEffect: ShaderEffect): void;
2698
2699    /**
2700    * Set the color of the pen.
2701    * @param { common2D.Color } color - The range of color channels must be [0, 255].
2702    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2703    * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2704    * @syscap SystemCapability.Graphics.Drawing
2705    * @since 11
2706    */
2707    setColor(color: common2D.Color): void;
2708
2709    /**
2710    * Set the AGRB color of the pen.
2711     * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255].
2712     * @param { number } red - Red channel of color. The range of red must be [0, 255].
2713     * @param { number } green - Green channel of color. The range of green must be [0, 255].
2714     * @param { number } blue - Blue channel of color. The range of blue must be [0, 255].
2715    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2716     * <br>2. Incorrect parameter types.
2717    * @syscap SystemCapability.Graphics.Drawing
2718    * @since 12
2719    */
2720    setColor(alpha: number, red: number, green: number, blue: number): void;
2721
2722    /**
2723     * Obtains the color of a pen. The color is used by the pen to outline a shape.
2724     * @returns { common2D.Color } Returns a 32-bit (ARGB) variable that describes the color.
2725     * @syscap SystemCapability.Graphics.Drawing
2726     * @since 12
2727     */
2728    getColor(): common2D.Color;
2729
2730    /**
2731    * Sets the thickness of the pen used by the paint to outline the shape.
2732    *
2733    * @param { number } width - Zero thickness for hairline; greater than zero for pen thickness.
2734    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2735    * <br>2. Incorrect parameter types.
2736    * @syscap SystemCapability.Graphics.Drawing
2737    * @since 11
2738    */
2739    setStrokeWidth(width: number): void;
2740
2741    /**
2742     * Obtains the thickness of a pen. This thickness determines the width of the outline of a shape.
2743     * @returns { number } Returns the thickness.
2744     * @syscap SystemCapability.Graphics.Drawing
2745     * @since 12
2746     */
2747    getWidth(): number;
2748
2749    /**
2750    * Requests, but does not require, that edge pixels draw opaque or with partial transparency.
2751    *
2752    * @param { boolean } aa - Setting for antialiasing.
2753    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2754    * <br>2. Incorrect parameter types.
2755    * @syscap SystemCapability.Graphics.Drawing
2756    * @since 11
2757    */
2758    setAntiAlias(aa: boolean): void;
2759
2760    /**
2761     * Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled,
2762     * edges will be drawn with partial transparency.
2763     * @returns { boolean } Returns true if the anti-aliasing is enabled; returns false otherwise.
2764     * @syscap SystemCapability.Graphics.Drawing
2765     * @since 12
2766     */
2767    isAntiAlias(): boolean;
2768
2769    /**
2770    * Replaces alpha, leaving RGB
2771    *
2772    * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255].
2773    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2774    * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2775    * @syscap SystemCapability.Graphics.Drawing
2776    * @since 11
2777    */
2778    setAlpha(alpha: number): void;
2779
2780    /**
2781     * Obtains the alpha of a pen. The alpha is used by the pen to outline a shape.
2782     * @returns { number } Returns a 8-bit variable that describes the alpha.
2783     * @syscap SystemCapability.Graphics.Drawing
2784     * @since 12
2785     */
2786    getAlpha(): number;
2787
2788    /**
2789    * Sets ColorFilter to pen
2790    *
2791    * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw.
2792    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2793    * <br>2. Incorrect parameter types.
2794    * @syscap SystemCapability.Graphics.Drawing
2795    * @since 11
2796    */
2797    setColorFilter(filter: ColorFilter): void;
2798    /**
2799     * Gets ColorFilter of pen
2800     * @returns { ColorFilter } ColorFilter.
2801     * @syscap SystemCapability.Graphics.Drawing
2802     * @since 12
2803     */
2804    getColorFilter(): ColorFilter;
2805    /**
2806     * Sets ImageFilter to pen
2807     * @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw.
2808     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2809     * <br>2. Incorrect parameter types.
2810     * @syscap SystemCapability.Graphics.Drawing
2811     * @since 12
2812     */
2813    setImageFilter(filter: ImageFilter | null): void;
2814    /**
2815     * Sets MaskFilter to pen.
2816     *
2817     * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw.
2818     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2819     * <br>2. Incorrect parameter types.
2820     * @syscap SystemCapability.Graphics.Drawing
2821     * @since 12
2822     */
2823    setMaskFilter(filter: MaskFilter): void;
2824
2825    /**
2826     * Sets PathEffect to pen.
2827     *
2828     * @param { PathEffect } effect - PathEffect to apply to subsequent draw.
2829     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2830     * <br>2. Incorrect parameter types.
2831     * @syscap SystemCapability.Graphics.Drawing
2832     * @since 12
2833     */
2834    setPathEffect(effect: PathEffect): void;
2835
2836    /**
2837     * Sets ShadowLayer to pen.
2838     *
2839     * @param { ShadowLayer } shadowLayer - ShadowLayer to apply to subsequent draw.
2840     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2841     * <br>2. Incorrect parameter types.
2842     * @syscap SystemCapability.Graphics.Drawing
2843     * @since 12
2844     */
2845    setShadowLayer(shadowLayer: ShadowLayer): void;
2846
2847    /**
2848    * Sets a blender that implements the specified blendmode enum.
2849    *
2850    * @param { BlendMode } mode - Blendmode.
2851    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2852    * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2853    * @syscap SystemCapability.Graphics.Drawing
2854    * @since 11
2855    */
2856    setBlendMode(mode: BlendMode): void;
2857
2858    /**
2859    * Request color distribution error.
2860    *
2861    * @param { boolean } dither - Whether the color is distributed incorrectly.
2862    * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2863    * <br>2. Incorrect parameter types.
2864    * @syscap SystemCapability.Graphics.Drawing
2865    * @since 11
2866    */
2867    setDither(dither: boolean): void;
2868
2869    /**
2870     * Sets the JoinStyle for a pen.
2871     *
2872     * @param { JoinStyle } style - The JoinStyle.
2873     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2874     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2875     * @syscap SystemCapability.Graphics.Drawing
2876     * @since 12
2877     */
2878    setJoinStyle(style: JoinStyle): void;
2879
2880    /**
2881     * Obtains the JoinStyle of a pen.
2882     *
2883     * @returns { JoinStyle } The JoinStyle.
2884     * @syscap SystemCapability.Graphics.Drawing
2885     * @since 12
2886     */
2887    getJoinStyle(): JoinStyle;
2888
2889    /**
2890     * Sets the CapStyle for a pen.
2891     *
2892     * @param { CapStyle } style - The CapStyle.
2893     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2894     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2895     * @syscap SystemCapability.Graphics.Drawing
2896     * @since 12
2897     */
2898    setCapStyle(style: CapStyle): void;
2899
2900    /**
2901     * Obtains the CapStyle of a pen.
2902     *
2903     * @returns { CapStyle } The CapStyle.
2904     * @syscap SystemCapability.Graphics.Drawing
2905     * @since 12
2906     */
2907    getCapStyle(): CapStyle;
2908
2909    /**
2910     * Resets all pen contents to their initial values.
2911     * @syscap SystemCapability.Graphics.Drawing
2912     * @since 12
2913     */
2914    reset(): void;
2915    /**
2916     * Obtains the filled equivalent of the src path.
2917     *
2918     * @param { Path } src - The path read to create a filled version.
2919     * @param { Path } dst - The resulting path (may be the same as src).
2920     * @returns { boolean } true if the path should be filled, or false if it should be drawn with a hairline (width == 0)
2921     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2922     * <br>2. Incorrect parameter types.
2923     * @syscap SystemCapability.Graphics.Drawing
2924     * @since 12
2925     */
2926    getFillPath(src: Path, dst: Path): boolean;
2927  }
2928
2929  /**
2930   * Provides settings for brush fill when drawing.
2931   * @syscap SystemCapability.Graphics.Drawing
2932   * @since 11
2933   */
2934  class Brush {
2935    /**
2936     * Constructor for the Brush.
2937     * @syscap SystemCapability.Graphics.Drawing
2938     * @since 12
2939     */
2940    constructor();
2941
2942    /**
2943     * Constructor for the Brush from an existing brush object brush.
2944     * @param { Brush } brush - Indicates the Brush object.
2945     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2946     * <br>2. Incorrect parameter types.
2947     * @syscap SystemCapability.Graphics.Drawing
2948     * @since 12
2949     */
2950    constructor(brush: Brush);
2951
2952    /**
2953     * Set the color of the brush.
2954     * @param { common2D.Color } color - The range of color channels must be [0, 255].
2955     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2956     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2957     * @syscap SystemCapability.Graphics.Drawing
2958     * @since 11
2959     */
2960    setColor(color: common2D.Color): void;
2961
2962    /**
2963     * Set the ARGB color of the brush.
2964     * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255].
2965     * @param { number } red - Red channel of color. The range of red must be [0, 255].
2966     * @param { number } green - Green channel of color. The range of green must be [0, 255].
2967     * @param { number } blue - Blue channel of color. The range of blue must be [0, 255].
2968     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2969     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
2970     * @syscap SystemCapability.Graphics.Drawing
2971     * @since 12
2972     */
2973    setColor(alpha: number, red: number, green: number, blue: number): void;
2974
2975    /**
2976     * Obtains the color of a brush. The color is used by the brush to fill in a shape.
2977     * @returns { common2D.Color } Returns a 32-bit (ARGB) variable that describes the color.
2978     * @syscap SystemCapability.Graphics.Drawing
2979     * @since 12
2980     */
2981    getColor(): common2D.Color;
2982
2983    /**
2984     * Requests, but does not require, that edge pixels draw opaque or with partial transparency.
2985     * @param { boolean } aa - Setting for antialiasing.
2986     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
2987     * <br>2. Incorrect parameter types.
2988     * @syscap SystemCapability.Graphics.Drawing
2989     * @since 11
2990     */
2991    setAntiAlias(aa: boolean): void;
2992
2993    /**
2994     * Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled,
2995     * edges will be drawn with partial transparency.
2996     * @returns { boolean } Returns true if anti-aliasing is enabled; returns false otherwise.
2997     * @syscap SystemCapability.Graphics.Drawing
2998     * @since 12
2999     */
3000    isAntiAlias(): boolean;
3001
3002    /**
3003     * Replaces alpha, leaving RGB
3004     * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255].
3005     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3006     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
3007     * @syscap SystemCapability.Graphics.Drawing
3008     * @since 11
3009     */
3010    setAlpha(alpha: number): void;
3011
3012    /**
3013     * Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape.
3014     * @returns { number } Returns a 8-bit variable that describes the alpha.
3015     * @syscap SystemCapability.Graphics.Drawing
3016     * @since 12
3017     */
3018    getAlpha(): number;
3019
3020    /**
3021     * Sets ColorFilter to brush
3022     * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw.
3023     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3024     * <br>2. Incorrect parameter types.
3025     * @syscap SystemCapability.Graphics.Drawing
3026     * @since 11
3027     */
3028    setColorFilter(filter: ColorFilter): void;
3029
3030    /**
3031     * Gets ColorFilter of brush
3032     * @returns { ColorFilter } ColorFilter.
3033     * @syscap SystemCapability.Graphics.Drawing
3034     * @since 12
3035     */
3036    getColorFilter(): ColorFilter;
3037    /**
3038     * Sets ImageFilter to brush
3039     * @param { ImageFilter | null } filter - ImageFilter to apply to subsequent draw.
3040     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3041     * <br>2. Incorrect parameter types.
3042     * @syscap SystemCapability.Graphics.Drawing
3043     * @since 12
3044     */
3045    setImageFilter(filter: ImageFilter | null): void;
3046    /**
3047     * Sets MaskFilter to brush.
3048     * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw.
3049     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3050     * <br>2. Incorrect parameter types.
3051     * @syscap SystemCapability.Graphics.Drawing
3052     * @since 12
3053     */
3054    setMaskFilter(filter: MaskFilter): void;
3055
3056    /**
3057     * Sets ShadowLayer to brush.
3058     *
3059     * @param { ShadowLayer } shadowLayer - ShadowLayer painting.
3060     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3061     * <br>2. Incorrect parameter types.
3062     * @syscap SystemCapability.Graphics.Drawing
3063     * @since 12
3064     */
3065    setShadowLayer(shadowLayer: ShadowLayer): void;
3066
3067    /**
3068     * Sets the shaderEffect for a brush.
3069     * @param { ShaderEffect } shaderEffect - Indicates the ShaderEffect object.
3070     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3071     * <br>2. Incorrect parameter types.
3072     * @syscap SystemCapability.Graphics.Drawing
3073     * @since 12
3074     */
3075    setShaderEffect(shaderEffect: ShaderEffect): void;
3076
3077    /**
3078     * Sets a blender that implements the specified blendmode enum.
3079     * @param { BlendMode } mode - Blendmode.
3080     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3081     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
3082     * @syscap SystemCapability.Graphics.Drawing
3083     * @since 11
3084     */
3085    setBlendMode(mode: BlendMode): void;
3086
3087    /**
3088     * Resets all brush contents to their initial values.
3089     * @syscap SystemCapability.Graphics.Drawing
3090     * @since 12
3091     */
3092    reset(): void;
3093  }
3094
3095  /**
3096   * Declares functions related to the matrix object in the drawing module.
3097   *
3098   * @syscap SystemCapability.Graphics.Drawing
3099   * @since 12
3100   */
3101  class Matrix {
3102    /**
3103     * Creates an identity matrix.
3104     * @syscap SystemCapability.Graphics.Drawing
3105     * @since 12
3106     */
3107    constructor();
3108
3109    /**
3110     * Sets matrix to rotate by degrees about a pivot point at (px, py).
3111     * @param { number } degree - Indicates the angle of axes relative to upright axes.
3112     * @param { number } px - Indicates the pivot on x-axis.
3113     * @param { number } py - Indicates the pivot on y-axis.
3114     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3115     * <br>2. Incorrect parameter types.
3116     * @syscap SystemCapability.Graphics.Drawing
3117     * @since 12
3118     */
3119    setRotation(degree: number, px: number, py: number): void;
3120
3121    /**
3122     * Sets matrix to scale by sx and sy, about a pivot point at (px, py).
3123     * @param { number } sx - Indicates the horizontal scale factor.
3124     * @param { number } sy - Indicates the vertical scale factor.
3125     * @param { number } px - Indicates the pivot on x-axis.
3126     * @param { number } py - Indicates the pivot on y-axis.
3127     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3128     * <br>2. Incorrect parameter types.
3129     * @syscap SystemCapability.Graphics.Drawing
3130     * @since 12
3131     */
3132    setScale(sx: number, sy: number, px: number, py: number): void;
3133
3134    /**
3135     * Sets matrix to translate by (dx, dy).
3136     * @param { number } dx - Indicates the horizontal translation.
3137     * @param { number } dy - Indicates the vertical translation.
3138     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3139     * <br>2. Incorrect parameter types.
3140     * @syscap SystemCapability.Graphics.Drawing
3141     * @since 12
3142     */
3143    setTranslation(dx: number, dy: number): void;
3144
3145    /**
3146     * Sets the params for a matrix.
3147     * @param { Array<number> } values - Each value in the array represents the following parameters:
3148     * values[0] - horizontal scale factor to store.
3149     * values[1] - horizontal skew factor to store.
3150     * values[2] - horizontal translation to store.
3151     * values[3] - vertical skew factor to store.
3152     * values[4] - vertical scale factor to store.
3153     * values[5] - vertical translation to store.
3154     * values[6] - input x-axis values perspective factor to store.
3155     * values[7] - input y-axis values perspective factor to store.
3156     * values[8] - perspective scale factor to store.
3157     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3158     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
3159     * @syscap SystemCapability.Graphics.Drawing
3160     * @since 12
3161     */
3162    setMatrix(values: Array<number>): void;
3163
3164    /**
3165     * Sets matrix total to matrix a multiplied by matrix b.
3166     * @param { Matrix } matrix - Indicates the Matrix object.
3167     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3168     * <br>2. Incorrect parameter types.
3169     * @syscap SystemCapability.Graphics.Drawing
3170     * @since 12
3171     */
3172    preConcat(matrix: Matrix): void;
3173
3174    /**
3175     * Returns true if the first matrix equals the second matrix.
3176     * @param { Matrix } matrix - Indicates the Matrix object.
3177     * @returns { Boolean } Returns true if the two matrices are equal; returns false otherwise.
3178     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3179     * <br>2. Incorrect parameter types.
3180     * @syscap SystemCapability.Graphics.Drawing
3181     * @since 12
3182     */
3183    isEqual(matrix: Matrix): Boolean;
3184
3185    /**
3186     * Sets inverse to reciprocal matrix, returning true if matrix can be inverted.
3187     * @param { Matrix } matrix - Indicates the Matrix object.
3188     * @returns { Boolean } Returns true if matrix can be inverted; returns false otherwise.
3189     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3190     * <br>2. Incorrect parameter types.
3191     * @syscap SystemCapability.Graphics.Drawing
3192     * @since 12
3193     */
3194    invert(matrix: Matrix): Boolean;
3195
3196    /**
3197     * Returns true if matrix is identity.
3198     * @returns { Boolean } Returns true if matrix is identity; returns false otherwise.
3199     * @syscap SystemCapability.Graphics.Drawing
3200     * @since 12
3201     */
3202    isIdentity(): Boolean;
3203
3204    /**
3205     * Get one matrix value. Index is between the range of 0-8.
3206     * @param { number } index - one of 0-8
3207     * @returns { number } Returns value corresponding to index.Returns 0 if out of range.
3208     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3209     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
3210     * @syscap SystemCapability.Graphics.Drawing
3211     * @since 12
3212     */
3213    getValue(index: number): number;
3214    /**
3215     * Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py).
3216     * This can be thought of as rotating around a pivot point after applying matrix.
3217     * @param { number } degree - Indicates the angle of axes relative to upright axes.
3218     * @param { number } px - Indicates the pivot on x-axis.
3219     * @param { number } py - Indicates the pivot on y-axis.
3220     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3221     * <br>2. Incorrect parameter types.
3222     * @syscap SystemCapability.Graphics.Drawing
3223     * @since 12
3224     */
3225    postRotate(degree: number, px: number, py: number): void;
3226    /**
3227     * Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py).
3228     * This can be thought of as scaling relative to a pivot point after applying matrix.
3229     * @param { number } sx - Indicates the horizontal scale factor.
3230     * @param { number } sy - Indicates the vertical scale factor.
3231     * @param { number } px - Indicates the pivot on x-axis.
3232     * @param { number } py - Indicates the pivot on y-axis.
3233     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3234     * <br>2. Incorrect parameter types.
3235     * @syscap SystemCapability.Graphics.Drawing
3236     * @since 12
3237     */
3238    postScale(sx: number, sy: number, px: number, py: number): void;
3239    /**
3240     * Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy).
3241     * This can be thought of as moving the point to be mapped after applying matrix.
3242     * @param { number } dx - Indicates the horizontal translation.
3243     * @param { number } dy - Indicates the vertical translation.
3244     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3245     * <br>2. Incorrect parameter types.
3246     * @syscap SystemCapability.Graphics.Drawing
3247     * @since 12
3248     */
3249    postTranslate(dx: number, dy: number): void;
3250    /**
3251     * Sets matrix to matrix multiplied by matrix constructed from rotating by degrees around pivot point (px, py).
3252     * This can be thought of as rotating around a pivot point before applying matrix.
3253     * @param { number } degree - Indicates the angle of axes relative to upright axes.
3254     * @param { number } px - Indicates the pivot on x-axis.
3255     * @param { number } py - Indicates the pivot on y-axis.
3256     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3257     * <br>2. Incorrect parameter types.
3258     * @syscap SystemCapability.Graphics.Drawing
3259     * @since 12
3260     */
3261    preRotate(degree: number, px: number, py: number): void;
3262    /**
3263     * Sets matrix to matrix multiplied by matrix constructed from scaling by (sx, sy) relative to pivot point (px, py).
3264     * This can be thought of as scaling relative to a pivot point before applying matrix.
3265     * @param { number } sx - Indicates the horizontal scale factor.
3266     * @param { number } sy - Indicates the vertical scale factor.
3267     * @param { number } px - Indicates the pivot on x-axis.
3268     * @param { number } py - Indicates the pivot on y-axis.
3269     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3270     * <br>2. Incorrect parameter types.
3271     * @syscap SystemCapability.Graphics.Drawing
3272     * @since 12
3273     */
3274    preScale(sx: number, sy: number, px: number, py: number): void;
3275    /**
3276     * Sets matrix to matrix multiplied by matrix constructed from translation (dx, dy).
3277     * This can be thought of as moving the point to be mapped before applying matrix.
3278     * @param { number } dx - Indicates the horizontal translation.
3279     * @param { number } dy - Indicates the vertical translation.
3280     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3281     * <br>2. Incorrect parameter types.
3282     * @syscap SystemCapability.Graphics.Drawing
3283     * @since 12
3284     */
3285    preTranslate(dx: number, dy: number): void;
3286    /**
3287     * Reset matrix to identity.
3288     * @syscap SystemCapability.Graphics.Drawing
3289     * @since 12
3290     */
3291    reset(): void;
3292    /**
3293     * Maps src array of length count to dst array of equal or greater length.
3294     * This can be thought of as moving the point to be mapped before applying matrix.
3295     * @param { Array<common2D.Point> } src - points to transform.
3296     * @returns { Array<common2D.Point> } Return mapped points array.
3297     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3298     * <br>2. Incorrect parameter types.
3299     * @syscap SystemCapability.Graphics.Drawing
3300     * @since 12
3301     */
3302    mapPoints(src: Array<common2D.Point>): Array<common2D.Point>;
3303    /**
3304     * Return nine scalar values contained by Matrix.
3305     * @returns { Array<number> } nine scalar values contained by Matrix.
3306     * @syscap SystemCapability.Graphics.Drawing
3307     * @since 12
3308     */
3309    getAll(): Array<number>;
3310    /**
3311     * Sets dst to bounds of src corners mapped by matrix transformation.
3312     * @param { common2D.Rect } dst - Rect to map from.
3313     * @param { common2D.Rect } src - Rect to map to.
3314     * @returns { boolean } Returns true if the mapped src is equal to the dst; returns false is not equal.
3315     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3316     * <br>2. Incorrect parameter types.
3317     * @syscap SystemCapability.Graphics.Drawing
3318     * @since 12
3319     */
3320    mapRect(dst: common2D.Rect, src: common2D.Rect): boolean;
3321    /**
3322     * Sets matrix to scale and translate src rect to dst rect.
3323     * @param { common2D.Rect } src - Rect to map from.
3324     * @param { common2D.Rect } dst - Rect to map to.
3325     * @param { ScaleToFit } scaleToFit - Describes how matrix is constructed to map one rect to another.
3326     * @returns { boolean } Returns true if dst is empty, and sets matrix to:
3327               | 0 0 0 |
3328               | 0 0 0 |
3329               | 0 0 1 |.
3330     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3331     * <br>2. Incorrect parameter types; 3. Parameter verification failed.
3332     * @syscap SystemCapability.Graphics.Drawing
3333     * @since 12
3334     */
3335    setRectToRect(src: common2D.Rect, dst: common2D.Rect, scaleToFit: ScaleToFit): boolean;
3336    /**
3337     * Sets Matrix to map src to dst. Count must be zero or greater, and four or less.
3338     * @param { Array<common2D.Point> } src - Point to map from
3339     * @param { Array<common2D.Point> } dst - Point to map to
3340     * @param { number } count - Number of Point in src and dst
3341     * @returns { boolean } Returns true if Matrix was constructed successfully
3342     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3343     * <br>2. Incorrect parameter types.
3344     * @syscap SystemCapability.Graphics.Drawing
3345     * @since 12
3346     */
3347    setPolyToPoly(src: Array<common2D.Point>, dst: Array<common2D.Point>, count: number): boolean;
3348  }
3349
3350  /**
3351   * Describes a scale-to-fit values.
3352   * @enum { number }
3353   * @syscap SystemCapability.Graphics.Drawing
3354   * @since 12
3355   */
3356  enum ScaleToFit {
3357    /**
3358     * Scales in x and y to fill destination Rect.
3359     * @syscap SystemCapability.Graphics.Drawing
3360     * @since 12
3361     */
3362    FILL_SCALE_TO_FIT = 0,
3363
3364    /**
3365     * Scales and aligns to left and top.
3366     * @syscap SystemCapability.Graphics.Drawing
3367     * @since 12
3368     */
3369    START_SCALE_TO_FIT = 1,
3370
3371    /**
3372     * Scales and aligns to center.
3373     * @syscap SystemCapability.Graphics.Drawing
3374     * @since 12
3375     */
3376    CENTER_SCALE_TO_FIT = 2,
3377
3378    /**
3379     * Scales and aligns to right and bottom.
3380     * @syscap SystemCapability.Graphics.Drawing
3381     * @since 12
3382     */
3383    END_SCALE_TO_FIT = 3
3384  }
3385
3386  /**
3387   * Describes a region object.
3388   * @syscap SystemCapability.Graphics.Drawing
3389   * @since 12
3390   */
3391  class Region {
3392    /**
3393     * Determines whether the test point is in the region.
3394     * @param { number } x - Indicates the x coordinate of the point. The parameter must be an integer.
3395     * @param { number } y - Indicates the y coordinate of the point. The parameter must be an integer.
3396     * @returns { boolean } Returns true if (x, y) is inside region; returns false otherwise.
3397     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3398     * <br>2. Incorrect parameter types.
3399     * @syscap SystemCapability.Graphics.Drawing
3400     * @since 12
3401     */
3402    isPointContained(x: number, y:number): boolean;
3403
3404    /**
3405     * Determines whether other region is in the region.
3406     * @param { Region } other - Other region object.
3407     * @returns { boolean } Returns true if other region is completely inside the region object;
3408     * <br>returns false otherwise.
3409     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3410     * <br>2. Incorrect parameter types.
3411     * @syscap SystemCapability.Graphics.Drawing
3412     * @since 12
3413     */
3414    isRegionContained(other: Region): boolean;
3415
3416    /**
3417     * Replaces region with the result of region op region.
3418     * @param { Region } region - Region object.
3419     * @param { RegionOp } regionOp - Operation type.
3420     * @returns { boolean } Returns true if replaced region is not empty; returns false otherwise.
3421     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3422     * <br>2. Incorrect parameter types.
3423     * @syscap SystemCapability.Graphics.Drawing
3424     * @since 12
3425     */
3426    op(region: Region, regionOp: RegionOp): boolean;
3427
3428    /**
3429     * Determines whether rect and region does not intersect.
3430     * @param { number } left - Left position of rectangle. The parameter must be an integer.
3431     * @param { number } top - Top position of rectangle. The parameter must be an integer.
3432     * @param { number } right - Right position of rectangle. The parameter must be an integer.
3433     * @param { number } bottom - Bottom position of rectangle. The parameter must be an integer.
3434     * @returns { boolean } Returns true if rect and region is not intersect; returns false otherwise.
3435     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3436     * <br>2. Incorrect parameter types.
3437     * @syscap SystemCapability.Graphics.Drawing
3438     * @since 12
3439     */
3440    quickReject(left: number, top: number, right: number, bottom: number): boolean;
3441
3442    /**
3443     * Sets the region to match outline of path within clip.
3444     * @param { Path } path - Providing outline.
3445     * @param { Region } clip - Region object.
3446     * @returns { boolean } Returns true if constructed region is not empty; returns false otherwise.
3447     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3448     * <br>2. Incorrect parameter types.
3449     * @syscap SystemCapability.Graphics.Drawing
3450     * @since 12
3451     */
3452    setPath(path: Path, clip: Region): boolean;
3453
3454    /**
3455     * Sets a rect to region.
3456     * @param { number } left - Left position of rectangle. The parameter must be an integer.
3457     * @param { number } top - Top position of rectangle. The parameter must be an integer.
3458     * @param { number } right - Right position of rectangle. The parameter must be an integer.
3459     * @param { number } bottom - Bottom position of rectangle. The parameter must be an integer.
3460     * @returns { boolean } Returns true if constructed region is not empty; returns false otherwise.
3461     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3462     * <br>2. Incorrect parameter types.
3463     * @syscap SystemCapability.Graphics.Drawing
3464     * @since 12
3465     */
3466    setRect(left: number, top: number, right: number, bottom: number): boolean;
3467  }
3468
3469  /**
3470   * Enumerates of operations when two regions are combined.
3471   * @enum { number }
3472   * @syscap SystemCapability.Graphics.Drawing
3473   * @since 12
3474   */
3475  enum RegionOp {
3476    /**
3477     * Difference operation.
3478     * @syscap SystemCapability.Graphics.Drawing
3479     * @since 12
3480     */
3481    DIFFERENCE = 0,
3482
3483    /**
3484     * Intersect operation.
3485     * @syscap SystemCapability.Graphics.Drawing
3486     * @since 12
3487     */
3488    INTERSECT = 1,
3489
3490    /**
3491     * Union operation.
3492     * @syscap SystemCapability.Graphics.Drawing
3493     * @since 12
3494     */
3495    UNION = 2,
3496
3497    /**
3498     * Xor operation.
3499     * @syscap SystemCapability.Graphics.Drawing
3500     * @since 12
3501     */
3502    XOR = 3,
3503
3504    /**
3505     * Reverse difference operation.
3506     * @syscap SystemCapability.Graphics.Drawing
3507     * @since 12
3508     */
3509    REVERSE_DIFFERENCE = 4,
3510
3511    /**
3512     * Replace operation.
3513     * @syscap SystemCapability.Graphics.Drawing
3514     * @since 12
3515     */
3516    REPLACE = 5
3517  }
3518
3519  /**
3520   * Enumerates of corner radius position.
3521   *
3522   * @enum { number }
3523   * @syscap SystemCapability.Graphics.Drawing
3524   * @since 12
3525   */
3526  enum CornerPos {
3527    /**
3528     * Index of top-left corner radius.
3529     * @syscap SystemCapability.Graphics.Drawing
3530     * @since 12
3531     */
3532    TOP_LEFT_POS = 0,
3533
3534    /**
3535     * Index of top-right corner radius.
3536     * @syscap SystemCapability.Graphics.Drawing
3537     * @since 12
3538     */
3539    TOP_RIGHT_POS = 1,
3540
3541    /**
3542     * Index of bottom-right corner radius.
3543     * @syscap SystemCapability.Graphics.Drawing
3544     * @since 12
3545     */
3546    BOTTOM_RIGHT_POS = 2,
3547
3548    /**
3549     * Index of bottom-left corner radius.
3550     * @syscap SystemCapability.Graphics.Drawing
3551     * @since 12
3552     */
3553    BOTTOM_LEFT_POS = 3
3554  }
3555
3556  /**
3557   * Enumeration defines the constraint type.
3558   *
3559   * @enum { number }
3560   * @syscap SystemCapability.Graphics.Drawing
3561   * @since 12
3562   */
3563  enum SrcRectConstraint {
3564
3565    /**
3566     * Using sampling only inside bounds in a slower manner.
3567     *
3568     * @syscap SystemCapability.Graphics.Drawing
3569     * @since 12
3570     */
3571    STRICT = 0,
3572
3573    /**
3574     * Using sampling outside bounds in a faster manner.
3575     *
3576     * @syscap SystemCapability.Graphics.Drawing
3577     * @since 12
3578     */
3579    FAST = 1
3580  }
3581
3582  /**
3583   * The Tool class for drawing.
3584   *
3585   * @syscap SystemCapability.Graphics.Drawing
3586   * @since 15
3587   */
3588  class Tool {
3589    /**
3590     * Make a common2D.Color variable that describes the color from ResourceColor.
3591     * @param { ResourceColor } resourceColor - ResourceColor.
3592     * @returns { common2D.Color } Returns a 32-bit (ARGB) variable that describes the color.
3593     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
3594     * <br>2. Incorrect parameter types.
3595     * @syscap SystemCapability.Graphics.Drawing
3596     * @since 15
3597     */
3598    static makeColorFromResourceColor(resourceColor: ResourceColor): common2D.Color;
3599  }
3600}
3601
3602export default drawing;
3603