• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkGraphics 2D
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   * Describes a path object.
220   *
221   * @syscap SystemCapability.Graphics.Drawing
222   * @since 11
223   */
224  class Path {
225    /**
226     * Sets the start point of a path
227     * @param { number } x - Indicates the x coordinate of the start point.
228     * @param { number } y - Indicates the y coordinate of the start point.
229     * @throws { BusinessError } 401 - Parameter error.
230     * @syscap SystemCapability.Graphics.Drawing
231     * @since 11
232     */
233    moveTo(x: number, y: number): void;
234
235    /**
236     * Draws a line segment from the last point of a path to the target point.
237     * @param { number } x - Indicates the x coordinate of the target point.
238     * @param { number } y - Indicates the y coordinate of the target point.
239     * @throws { BusinessError } 401 - Parameter error.
240     * @syscap SystemCapability.Graphics.Drawing
241     * @since 11
242     */
243    lineTo(x: number, y: number): void;
244
245    /**
246     * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first,
247     * and then a start angle and a sweep angle are specified.
248     * The arc is a portion of the ellipse defined by the start angle and the sweep angle.
249     * By default, a line segment from the last point of the path to the start point of the arc is also added.
250     * @param { number } x1 - Indicates the x coordinate of the upper left corner of the rectangle.
251     * @param { number } y1 - Indicates the y coordinate of the upper left corner of the rectangle.
252     * @param { number } x2 - Indicates the x coordinate of the lower right corner of the rectangle.
253     * @param { number } y2 - Indicates the y coordinate of the lower right corner of the rectangle.
254     * @param { number } startDeg - Indicates the start angle, in degrees.
255     * @param { number } sweepDeg - Indicates the angle to sweep, in degrees.
256     * @throws { BusinessError } 401 - Parameter error.
257     * @syscap SystemCapability.Graphics.Drawing
258     * @since 11
259     */
260    arcTo(x1: number, y1: number, x2: number, y2: number, startDeg: number, sweepDeg: number): void;
261
262    /**
263     * Draws a quadratic Bezier curve from the last point of a path to the target point.
264     * @param { number } ctrlX - Indicates the x coordinate of the control point.
265     * @param { number } ctrlY - Indicates the y coordinate of the control point.
266     * @param { number } endX - Indicates the x coordinate of the target point.
267     * @param { number } endY - Indicates the y coordinate of the target point.
268     * @throws { BusinessError } 401 - Parameter error.
269     * @syscap SystemCapability.Graphics.Drawing
270     * @since 11
271     */
272    quadTo(ctrlX: number, ctrlY: number, endX: number, endY: number): void;
273
274    /**
275     * Draws a cubic Bezier curve from the last point of a path to the target point.
276     * @param { number } ctrlX1 - Indicates the x coordinate of the first control point.
277     * @param { number } ctrlY1 - Indicates the y coordinate of the first control point.
278     * @param { number } ctrlX2 - Indicates the x coordinate of the second control point.
279     * @param { number } ctrlY2 - Indicates the y coordinate of the second control point.
280     * @param { number } endX - Indicates the x coordinate of the target point.
281     * @param { number } endY - Indicates the y coordinate of the target point.
282     * @throws { BusinessError } 401 - Parameter error.
283     * @syscap SystemCapability.Graphics.Drawing
284     * @since 11
285     */
286    cubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void;
287
288    /**
289     * Closes a path. A line segment from the start point to the last point of the path is added.
290     * @syscap SystemCapability.Graphics.Drawing
291     * @since 11
292     */
293    close(): void;
294
295    /**
296     * Resets path data.
297     * @syscap SystemCapability.Graphics.Drawing
298     * @since 11
299     */
300    reset(): void;
301  }
302
303  /**
304   * Provides an interface to the drawing, and how to clip and transform the drawing.
305   * @syscap SystemCapability.Graphics.Drawing
306   * @since 11
307   */
308  class Canvas {
309    /**
310     * Constructor for the Canvas.
311     * @param { image.PixelMap } pixelmap - PixelMap.
312     * @throws { BusinessError } 401 - Parameter error.
313     * @syscap SystemCapability.Graphics.Drawing
314     * @since 11
315     */
316    constructor(pixelmap: image.PixelMap);
317
318    /**
319     * If rectangle is stroked, use pen to stroke width describes the line thickness,
320     * else use brush to fill the rectangle.
321     * @param { common2D.Rect } rect - Rectangle to draw.
322     * @throws { BusinessError } 401 - Parameter error.
323     * @syscap SystemCapability.Graphics.Drawing
324     * @since 11
325     */
326    drawRect(rect: common2D.Rect): void;
327
328    /**
329     * If radius is zero or less, nothing is drawn. If circle is stroked, use pen to
330     * stroke width describes the line thickness, else use brush to fill the circle.
331     * @param { number } x - X coordinate of the circle center.
332     * @param { number } y - Y coordinate of the circle center.
333     * @param { number } radius - Half the diameter of circle.
334     * @throws { BusinessError } 401 - Parameter error.
335     * @syscap SystemCapability.Graphics.Drawing
336     * @since 11
337     */
338    drawCircle(x: number, y: number, radius: number): void;
339
340    /**
341     * Draw an pixelmap, with the upper left corner at (left, top).
342     * @param { image.PixelMap } pixelmap - PixelMap.
343     * @param { number } left - Left side of image.
344     * @param { number } top - Top side of image.
345     * @throws { BusinessError } 401 - Parameter error.
346     * @syscap SystemCapability.Graphics.Drawing
347     * @since 11
348     */
349    drawImage(pixelmap: image.PixelMap, left: number, top: number): void;
350
351    /**
352     * Fills clip with color color. Mode determines how ARGB is combined with destination.
353     * @param { common2D.Color } color - Color in 32-bit argb format.
354     * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER.
355     * @throws { BusinessError } 401 - Parameter error.
356     * @syscap SystemCapability.Graphics.Drawing
357     * @since 11
358     */
359    drawColor(color: common2D.Color, blendMode?: BlendMode): void;
360
361    /**
362     * Draw a point.
363     * @param { number } x - X coordinate position of the point.
364     * @param { number } y - Y coordinate position of the point.
365     * @throws { BusinessError } 401 - Parameter error.
366     * @syscap SystemCapability.Graphics.Drawing
367     * @since 11
368     */
369    drawPoint(x: number, y: number): void;
370
371    /**
372     * Path contains an array of path contour, each of which may be open or closed.
373     * @param { Path } path - Path to draw.
374     * @throws { BusinessError } 401 - Parameter error.
375     * @syscap SystemCapability.Graphics.Drawing
376     * @since 11
377     */
378    drawPath(path: Path): void;
379
380    /**
381     * Draws line segment from startPt to endPt.
382     * @param { number } x0 - X coordinate of the start point of the line segment.
383     * @param { number } y0 - Y coordinate of the start point of the line segment.
384     * @param { number } x1 - X coordinate of the end point of the line segment.
385     * @param { number } y1 - Y coordinate of the end point of the line segment.
386     * @throws { BusinessError } 401 - Parameter error.
387     * @syscap SystemCapability.Graphics.Drawing
388     * @since 11
389     */
390    drawLine(x0: number, y0: number, x1: number, y1: number): void;
391
392    /**
393     * Draws line segment from startPt to endPt.
394     * @param { TextBlob } blob - X coordinate of the start point of the line segment.
395     * @param { number } x - X coordinate of the text start point.
396     * @param { number } y - Y coordinate of the text start point.
397     * @throws { BusinessError } 401 - Parameter error.
398     * @syscap SystemCapability.Graphics.Drawing
399     * @since 11
400     */
401    drawTextBlob(blob: TextBlob, x: number, y: number): void;
402
403    /**
404     * Set pen to a canvas.
405     * @param { Pen } pen - object.
406     * @throws { BusinessError } 401 - Parameter error.
407     * @syscap SystemCapability.Graphics.Drawing
408     * @since 11
409     */
410    attachPen(pen: Pen): void;
411
412    /**
413     * Set brush to a canvas.
414     * @param { Brush } brush - Object.
415     * @throws { BusinessError } 401 - Parameter error.
416     * @syscap SystemCapability.Graphics.Drawing
417     * @since 11
418     */
419    attachBrush(brush: Brush): void;
420
421    /**
422     * Unset pen to a canvas.
423     * @syscap SystemCapability.Graphics.Drawing
424     * @since 11
425     */
426    detachPen(): void;
427
428    /**
429     * Unset brush to a canvas.
430     * @syscap SystemCapability.Graphics.Drawing
431     * @since 11
432     */
433    detachBrush(): void;
434  }
435
436  /**
437   * Provide a description of the type and position of the text.
438   * @typedef TextBlobRunBuffer
439   * @syscap SystemCapability.Graphics.Drawing
440   * @since 11
441   */
442  interface TextBlobRunBuffer {
443    /**
444     * Text model.
445     * @type { number }
446     * @syscap SystemCapability.Graphics.Drawing
447     * @since 11
448     */
449    glyph: number;
450    /**
451     * X-coordinate of the text start point.
452     * @type { number }
453     * @syscap SystemCapability.Graphics.Drawing
454     * @since 11
455     */
456    positionX: number;
457    /**
458     * Y-coordinate of the text start point.
459     * @type { number }
460     * @syscap SystemCapability.Graphics.Drawing
461     * @since 11
462     */
463    positionY: number;
464  }
465
466  /**
467   * Encoding type of the description text.
468   *
469   * @enum { number }
470   * @syscap SystemCapability.Graphics.Drawing
471   * @since 11
472   */
473  enum TextEncoding {
474    /**
475     * Use 1 byte to represent UTF-8 or ASCII
476     * @syscap SystemCapability.Graphics.Drawing
477     * @since 11
478     */
479    TEXT_ENCODING_UTF8 = 0,
480    /**
481     * Use 2 bytes to represent most of unicode
482     * @syscap SystemCapability.Graphics.Drawing
483     * @since 11
484     */
485    TEXT_ENCODING_UTF16 = 1,
486    /**
487     * Use 4 bytes to represent all unicode.
488     * @syscap SystemCapability.Graphics.Drawing
489     * @since 11
490     */
491    TEXT_ENCODING_UTF32 = 2,
492    /**
493     * Use 2 bytes to represent the glyph index.
494     * @syscap SystemCapability.Graphics.Drawing
495     * @since 11
496     */
497    TEXT_ENCODING_GLYPH_ID = 3,
498  }
499
500  /**
501   * Provide a description of the text
502   *
503   * class TextBlob
504   * @syscap SystemCapability.Graphics.Drawing
505   * @since 11
506   */
507  class TextBlob {
508    /**
509     * Create a textblob from a string
510     * @param { string } text - Drawn glyph content.
511     * @param { Font } font - Specify text size, font, text scale, etc.
512     * @param { TextEncoding } encoding - The default value is TEXT_ENCODING_UTF8.
513     * @returns { TextBlob } TextBlob object.
514     * @throws { BusinessError } 401 - Parameter error.
515     * @static
516     * @syscap SystemCapability.Graphics.Drawing
517     * @since 11
518     */
519    static makeFromString(text: string, font: Font, encoding?: TextEncoding): TextBlob;
520
521    /**
522     * Creating a textblob object based on RunBuffer information
523     * @param { Array<TextBlobRunBuffer> } pos - The array of TextBlobRunBuffer.
524     * @param { Font } font - Font used for this run.
525     * @param { common2D.Rect } bounds - Optional run bounding box.
526     * @returns { TextBlob } TextBlob object.
527     * @throws { BusinessError } 401 - Parameter error.
528     * @static
529     * @syscap SystemCapability.Graphics.Drawing
530     * @since 11
531     */
532    static makeFromRunBuffer(pos: Array<TextBlobRunBuffer>, font: Font, bounds?: common2D.Rect): TextBlob;
533
534    /**
535     * Returns the bounding rectangle shape
536     * @returns { common2D.Rect } Rect object.
537     * @syscap SystemCapability.Graphics.Drawing
538     * @since 11
539     */
540    bounds(): common2D.Rect;
541  }
542
543  /**
544   * The Typeface class specifies the typeface and intrinsic style of a font.
545   *
546   * @syscap SystemCapability.Graphics.Drawing
547   * @since 11
548   */
549  class Typeface {
550    /**
551     * Get the family name for this typeface.
552     * @returns { string } Family name.
553     * @syscap SystemCapability.Graphics.Drawing
554     * @since 11
555     */
556    getFamilyName(): string;
557  }
558
559  /**
560   * Font controls options applied when drawing and measuring text.
561   *
562   * @syscap SystemCapability.Graphics.Drawing
563   * @since 11
564   */
565  class Font {
566    /**
567     * Requests, but does not require, that glyphs respect sub-pixel positioning.
568     * @param { boolean } isSubpixel - Setting for sub-pixel positioning.
569     * @throws { BusinessError } 401 - Parameter error.
570     * @syscap SystemCapability.Graphics.Drawing
571     * @since 11
572     */
573    enableSubpixel(isSubpixel: boolean): void;
574    /**
575     * Increases stroke width when creating glyph bitmaps to approximate a bold typeface.
576     * @param { boolean } isEmbolden - Setting for bold approximation.
577     * @throws { BusinessError } 401 - Parameter error.
578     * @syscap SystemCapability.Graphics.Drawing
579     * @since 11
580     */
581    enableEmbolden(isEmbolden: boolean): void;
582    /**
583     * Requests linearly scalable font and glyph metrics.
584     * @param { boolean } isLinearMetrics - Setting for linearly scalable font and glyph metrics.
585     * @throws { BusinessError } 401 - Parameter error.
586     * @syscap SystemCapability.Graphics.Drawing
587     * @since 11
588     */
589    enableLinearMetrics(isLinearMetrics: boolean): void;
590    /**
591     * Sets text size in points. Has no effect if textSize is not greater than or equal to zero.
592     * @param { number } textSize - Typographic height of text.
593     * @throws { BusinessError } 401 - Parameter error.
594     * @syscap SystemCapability.Graphics.Drawing
595     * @since 11
596     */
597    setSize(textSize: number): void;
598    /**
599     * Obtains the text size.
600     * @returns { number } Text size.
601     * @syscap SystemCapability.Graphics.Drawing
602     * @since 11
603     */
604    getSize(): number;
605    /**
606     * Sets Typeface to font.
607     * @param { Typeface } typeface - Font and style used to draw text.
608     * @throws { BusinessError } 401 - Parameter error.
609     * @syscap SystemCapability.Graphics.Drawing
610     * @since 11
611     */
612    setTypeface(typeface: Typeface): void;
613    /**
614     * Get Typeface to font.
615     * @returns { Typeface } Typeface.
616     * @syscap SystemCapability.Graphics.Drawing
617     * @since 11
618     */
619    getTypeface(): Typeface;
620    /**
621     * Get fontMetrics associated with typeface.
622     * @returns { FontMetrics } The fontMetrics value returned to the caller.
623     * @syscap SystemCapability.Graphics.Drawing
624     * @since 11
625     */
626    getMetrics(): FontMetrics;
627    /**
628     * Measure the width of text.
629     * @param { string } text - Text Symbol Content.
630     * @param { TextEncoding } encoding - Encoding format.
631     * @returns { number } The width of text.
632     * @throws { BusinessError } 401 - Parameter error.
633     * @syscap SystemCapability.Graphics.Drawing
634     * @since 11
635     */
636    measureText(text: string, encoding: TextEncoding): number;
637  }
638
639  /**
640   * The metrics of an Font.
641   * @typedef FontMetrics
642   * @syscap SystemCapability.Graphics.Drawing
643   * @since 11
644   */
645  interface FontMetrics {
646    /**
647     * Maximum range above the glyph bounding box.
648     * @type { number }
649     * @syscap SystemCapability.Graphics.Drawing
650     * @since 11
651     */
652    top: number;
653    /**
654     * Distance Retained Above Baseline.
655     * @type { number }
656     * @syscap SystemCapability.Graphics.Drawing
657     * @since 11
658     */
659    ascent: number;
660    /**
661     * The distance that remains below the baseline.
662     * @type { number }
663     * @syscap SystemCapability.Graphics.Drawing
664     * @since 11
665     */
666    descent: number;
667    /**
668     * Maximum range below the glyph bounding box.
669     * @type { number }
670     * @syscap SystemCapability.Graphics.Drawing
671     * @since 11
672     */
673    bottom: number;
674    /**
675     * Line Spacing.
676     * @type { number }
677     * @syscap SystemCapability.Graphics.Drawing
678     * @since 11
679     */
680    leading: number;
681  }
682  /**
683   * ColorFilters are optional objects in the drawing pipeline.
684   *
685   * @syscap SystemCapability.Graphics.Drawing
686   * @since 11
687   */
688  class ColorFilter {
689    /**
690     * Makes a color filter with the given color and blend mode.
691     * @param { common2D.Color } color - Color.
692     * @param { BlendMode } mode - BlendMode.
693     * @returns { ColorFilter } Colorfilter object.
694     * @throws { BusinessError } 401 - Parameter error.
695     * @static
696     * @syscap SystemCapability.Graphics.Drawing
697     * @since 11
698     */
699    static createBlendModeColorFilter(color: common2D.Color, mode: BlendMode): ColorFilter;
700    /**
701     * Create a color filter consisting of two filters.
702     * @param { ColorFilter } outer - The filter is used next.
703     * @param { ColorFilter } inner - The filter is used first.
704     * @returns { ColorFilter } Colorfilter object.
705     * @throws { BusinessError } 401 - Parameter error.
706     * @static
707     * @syscap SystemCapability.Graphics.Drawing
708     * @since 11
709     */
710    static createComposeColorFilter(outer: ColorFilter, inner: ColorFilter): ColorFilter;
711    /**
712     * Makes a color filter that converts between linear colors and sRGB colors.
713     * @returns { ColorFilter } Colorfilter object.
714     * @static
715     * @syscap SystemCapability.Graphics.Drawing
716     * @since 11
717     */
718    static createLinearToSRGBGamma(): ColorFilter;
719    /**
720     * Makes a color filter that converts between sRGB colors and linear colors.
721     * @returns { ColorFilter } Colorfilter object.
722     * @static
723     * @syscap SystemCapability.Graphics.Drawing
724     * @since 11
725     */
726    static createSRGBGammaToLinear(): ColorFilter;
727    /**
728     * Makes a color filter that multiplies the luma of its input into the alpha channel,
729     * and sets the red, green, and blue channels to zero.
730     * @returns { ColorFilter } Colorfilter.
731     * @static
732     * @syscap SystemCapability.Graphics.Drawing
733     * @since 11
734     */
735    static createLumaColorFilter(): ColorFilter;
736  }
737
738  /**
739   * Provides settings for strokes during drawing.
740   * @syscap SystemCapability.Graphics.Drawing
741   * @since 11
742   */
743  class Pen {
744    /**
745    * Set the color of the pen.
746    * @param { common2D.Color } color - Set colors.
747    * @throws { BusinessError } 401 - Parameter error.
748    * @syscap SystemCapability.Graphics.Drawing
749    * @since 11
750    */
751    setColor(color: common2D.Color): void;
752    /**
753    * Sets the thickness of the pen used by the paint to outline the shape.
754    *
755    * @param { number } width - Zero thickness for hairline; greater than zero for pen thickness.
756    * @throws { BusinessError } 401 - Parameter error.
757    * @syscap SystemCapability.Graphics.Drawing
758    * @since 11
759    */
760    setStrokeWidth(width: number): void;
761    /**
762    * Requests, but does not require, that edge pixels draw opaque or with
763    * partial transparency.
764    *
765    * @param { boolean } aa - Setting for antialiasing.
766    * @throws { BusinessError } 401 - Parameter error.
767    * @syscap SystemCapability.Graphics.Drawing
768    * @since 11
769    */
770    setAntiAlias(aa: boolean): void;
771    /**
772    * Replaces alpha, leaving RGB
773    *
774    * @param { number } alpha - Alpha component of color.
775    * @throws { BusinessError } 401 - Parameter error.
776    * @syscap SystemCapability.Graphics.Drawing
777    * @since 11
778    */
779    setAlpha(alpha: number): void;
780    /**
781    * Sets ColorFilter to pen
782    *
783    * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw.
784    * @throws { BusinessError } 401 - Parameter error.
785    * @syscap SystemCapability.Graphics.Drawing
786    * @since 11
787    */
788    setColorFilter(filter: ColorFilter): void;
789    /**
790    * Sets a blender that implements the specified blendmode enum.
791    *
792    * @param { BlendMode } mode - Blendmode.
793    * @throws { BusinessError } 401 - Parameter error.
794    * @syscap SystemCapability.Graphics.Drawing
795    * @since 11
796    */
797    setBlendMode(mode: BlendMode): void;
798    /**
799    * Request color distribution error.
800    *
801    * @param { boolean } dither - Whether the color is distributed incorrectly.
802    * @throws { BusinessError } 401 - Parameter error.
803    * @syscap SystemCapability.Graphics.Drawing
804    * @since 11
805    */
806    setDither(dither: boolean): void;
807  }
808
809  /**
810   * Provides settings for brush fill when drawing.
811   * @syscap SystemCapability.Graphics.Drawing
812   * @since 11
813   */
814  class Brush {
815    /**
816     * Set the color of the brush.
817     * @param { common2D.Color } color - Set colors.
818     * @throws { BusinessError } 401 - Parameter error.
819     * @syscap SystemCapability.Graphics.Drawing
820     * @since 11
821     */
822    setColor(color: common2D.Color): void;
823    /**
824     * Requests, but does not require, that edge pixels draw opaque or with
825     * partial transparency.
826     * @param { boolean } aa - Setting for antialiasing.
827     * @throws { BusinessError } 401 - Parameter error.
828     * @syscap SystemCapability.Graphics.Drawing
829     * @since 11
830     */
831    setAntiAlias(aa: boolean): void;
832    /**
833     * Replaces alpha, leaving RGB
834     * @param { number } alpha - Alpha component of color, value range: 0–255.
835     * @throws { BusinessError } 401 - Parameter error.
836     * @syscap SystemCapability.Graphics.Drawing
837     * @since 11
838     */
839    setAlpha(alpha: number): void;
840    /**
841     * Sets ColorFilter to brush
842     * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw.
843     * @throws { BusinessError } 401 - Parameter error.
844     * @syscap SystemCapability.Graphics.Drawing
845     * @since 11
846     */
847    setColorFilter(filter: ColorFilter): void;
848    /**
849     * Sets a blender that implements the specified blendmode enum.
850     * @param { BlendMode } mode - Blendmode.
851     * @throws { BusinessError } 401 - Parameter error.
852     * @syscap SystemCapability.Graphics.Drawing
853     * @since 11
854     */
855    setBlendMode(mode: BlendMode): void;
856  }
857}
858
859export default drawing;