• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Drawing
2
3
4## Overview
5
6Provides functions such as 2D graphics rendering, text drawing, and image display.
7
8Provides the 2D drawing capability.
9
10\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
11
12**Since:**
138
14
15
16## Summary
17
18
19### Files
20
21| Name | Description |
22| -------- | -------- |
23| [drawing_bitmap.h](drawing__bitmap_8h.md) | Declares functions related to the **bitmap** object in the drawing module. <br>File to Include: <native_drawing/drawing_bitmap.h> |
24| [drawing_brush.h](drawing__brush_8h.md) | Declares functions related to the **brush** object in the drawing module. <br>File to Include: <native_drawing/drawing_brush.h> |
25| [drawing_canvas.h](drawing__canvas_8h.md) | Declares functions related to the **canvas** object in the drawing module. <br>File to Include: <native_drawing/drawing_canvas.h> |
26| [drawing_color.h](drawing__color_8h.md) | Declares functions related to the **color** object in the drawing module. <br>File to Include: <native_drawing/drawing_color.h> |
27| [drawing_font_collection.h](drawing__font__collection_8h.md) | Declares functions related to **FontCollection** in the drawing module. <br>File to Include: <native_drawing/drawing_font_collection.h> |
28| [drawing_path.h](drawing__path_8h.md) | Declares functions related to the **path** object in the drawing module. <br>File to Include: <native_drawing/drawing_path.h> |
29| [drawing_pen.h](drawing__pen_8h.md) | Declares functions related to the **pen** object in the drawing module. <br>File to Include: <native_drawing/drawing_pen.h> |
30| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | Declares the data structure related to text in 2D drawing. <br>File to Include: <native_drawing/drawing_text_declaration.h> |
31| [drawing_text_typography.h](drawing__text__typography_8h.md) | Declares functions related to **typography** in the drawing module. <br>File to Include: <native_drawing/drawing_text_typography.h> |
32| [drawing_types.h](drawing__types_8h.md) | Declares the data types for drawing 2D graphics, including the canvas, brush, pen, bitmap, and path. <br>File to Include: <native_drawing/drawing_types.h> |
33
34
35### Structs
36
37| Name | Description |
38| -------- | -------- |
39| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Defines the pixel format of a bitmap, including the color type and alpha type.  |
40
41
42### Types
43
44| Name | Description |
45| -------- | -------- |
46| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | Defines an **OH_Drawing_FontCollection**, which is used to load fonts.  |
47| [OH_Drawing_Typography](#oh_drawing_typography) | Defines an **OH_Drawing_Typography**, which is used to manage the typography layout and display.  |
48| [OH_Drawing_TextStyle](#oh_drawing_textstyle) | Defines an **OH_Drawing_TextStyle**, which is used to manage text colors and decorations.  |
49| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | Defines an **OH_Drawing_TypographyStyle**, which is used to manage the typography style, such as the text direction.  |
50| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | Defines an **OH_Drawing_TypographyCreate**, which is used to create an **OH_Drawing_Typography** object.  |
51| [OH_Drawing_Canvas](#oh_drawing_canvas) | Defines a rectangular canvas on which various shapes, images, and texts can be drawn by using the brush and pen.  |
52| [OH_Drawing_Pen](#oh_drawing_pen) | Defines a pen, which is used to describe the style and color to outline a shape.  |
53| [OH_Drawing_Brush](#oh_drawing_brush) | Defines as a brush, which is used to describe the style and color to fill in a shape.  |
54| [OH_Drawing_Path](#oh_drawing_path) | Defines a path, which is used to customize various shapes.  |
55| [OH_Drawing_Bitmap](#oh_drawing_bitmap) | Defines a bitmap, which is a memory that contains the pixel data of a shape.  |
56
57
58### Enums
59
60| Name | Description |
61| -------- | -------- |
62| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | Enumerates line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.  |
63| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | Enumerates pen line join styles. The line join style defines the shape of the joints of a polyline segment drawn by the pen.  |
64| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | Enumerates text directions.  |
65| [OH_Drawing_TextAlign](#oh_drawing_textalign) {<br/>TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY,<br/>TEXT_ALIGN_START, TEXT_ALIGN_END<br/>} | Enumerates text alignment modes.  |
66| [OH_Drawing_FontWeight](#oh_drawing_fontweight) {<br/>FONT_WEIGHT_100, FONT_WEIGHT_200, FONT_WEIGHT_300, FONT_WEIGHT_400,<br/>FONT_WEIGHT_500, FONT_WEIGHT_600, FONT_WEIGHT_700, FONT_WEIGHT_800,<br/>FONT_WEIGHT_900<br/>} | Enumerates font weights.  |
67| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | Enumerates text baselines.  |
68| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | Enumerates text decorations.  |
69| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC } | Enumerates font styles.  |
70| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) {<br/>COLOR_FORMAT_UNKNOWN, COLOR_FORMAT_ALPHA_8, COLOR_FORMAT_RGB_565, COLOR_FORMAT_ARGB_4444,<br/>COLOR_FORMAT_RGBA_8888, COLOR_FORMAT_BGRA_8888<br/>} | Enumerates storage formats of bitmap pixels.  |
71| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | Enumerates alpha formats of bitmap pixels.  |
72
73
74### Functions
75
76| Name | Description |
77| -------- | -------- |
78| [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | Creates an **OH_Drawing_Bitmap** object.  |
79| [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Destroys an **OH_Drawing_Bitmap** object and reclaims the memory occupied by the object.  |
80| [OH_Drawing_BitmapBuild](#oh_drawing_bitmapbuild) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const uint32_t width, const uint32_t height, const [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) \*) | Initializes the width and height of an **OH_Drawing_Bitmap** object and sets the pixel format for the bitmap.  |
81| [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the width of a bitmap.  |
82| [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the height of a bitmap.  |
83| [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap.  |
84| [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | Creates an **OH_Drawing_Brush** object.  |
85| [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | Destroys an **OH_Drawing_Brush** object and reclaims the memory occupied by the object.  |
86| [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.  |
87| [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.  |
88| [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Obtains the color of a brush. The color is used by the brush to fill in a shape.  |
89| [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | Sets the color for a brush. The color will be used by the brush to fill in a shape.  |
90| [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | Creates an **OH_Drawing_Canvas** object.  |
91| [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Destroys an **OH_Drawing_Canvas** object and reclaims the memory occupied by the object.  |
92| [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap (this process is called CPU rendering).  |
93| [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape.  |
94| [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Detaches the pen from a canvas so that the canvas will not use the style and color of the pen to outline a shape.  |
95| [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Attaches a brush to a canvas so that the canvas will use the style and color of the brush to fill in a shape.  |
96| [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Detaches the brush from a canvas so that the canvas will not use the style and color of the brush to fill in a shape.  |
97| [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Saves the current canvas status (canvas matrix) to the top of the stack.  |
98| [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Restores the canvas status (canvas matrix) saved on the top of the stack.  |
99| [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | Draws a line segment.  |
100| [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | Draws a path.  |
101| [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | Clears a canvas by using a specified color.  |
102| [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.  |
103| [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | Creates an **OH_Drawing_FontCollection** object.  |
104| [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | Releases the memory occupied by an **OH_Drawing_FontCollection** object.  |
105| [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | Creates an **OH_Drawing_Path** object.  |
106| [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object.  |
107| [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Sets the start point of a path.  |
108| [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Draws a line segment from the last point of a path to the target point.  |
109| [OH_Drawing_PathArcTo](#oh_drawing_patharcto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first, and then a start angle and a sweep angle are specified. The arc is a portion of the ellipse defined by the start angle and the sweep angle. By default, a line segment from the last point of the path to the start point of the arc is also added.  |
110| [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | Draws a quadratic Bezier curve from the last point of a path to the target point.  |
111| [OH_Drawing_PathCubicTo](#oh_drawing_pathcubicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | Draws a cubic Bezier curve from the last point of a path to the target point.  |
112| [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | Closes a path. A line segment from the start point to the last point of the path is added.  |
113| [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | Resets path data.  |
114| [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | Creates an **OH_Drawing_Pen** object.  |
115| [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | Destroys an **OH_Drawing_Pen** object and reclaims the memory occupied by the object.  |
116| [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.  |
117| [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | Enables or disables anti-aliasing for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.  |
118| [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the color of a pen. The color is used by the pen to outline a shape.  |
119| [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | Sets the color for a pen. The color is used by the pen to outline a shape.  |
120| [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the thickness of a pen. This thickness determines the width of the outline of a shape.  |
121| [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | Sets the thickness for a pen. This thickness determines the width of the outline of a shape.  |
122| [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.  |
123| [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.  |
124| [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the line cap style of a pen.  |
125| [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | Sets the line cap style for a pen.  |
126| [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the line join style of a pen.  |
127| [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | Sets the line join style for a pen.  |
128| [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | Creates an **OH_Drawing_TypographyStyle** object.  |
129| [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Releases the memory occupied by an **OH_Drawing_TypographyStyle** object.  |
130| [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text direction.  |
131| [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text alignment mode.  |
132| [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the maximum number of lines in a text file.  |
133| [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | Creates an **OH_Drawing_TextStyle** object.  |
134| [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Releases the memory occupied by an **OH_Drawing_TextStyle** object.  |
135| [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the text color.  |
136| [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the font size.  |
137| [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font weight.  |
138| [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the text baseline.  |
139| [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the text decoration.  |
140| [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the color for the text decoration.  |
141| [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the font height.  |
142| [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | Sets the font families.  |
143| [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font style.  |
144| [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the locale.  |
145| [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | Creates a pointer to an **OH_Drawing_TypographyCreate** object.  |
146| [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Releases the memory occupied by an **OH_Drawing_TypographyCreate** object.  |
147| [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Sets the text style.  |
148| [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | Sets the text content.  |
149| [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Removes the topmost style in the stack, leaving the remaining styles in effect.  |
150| [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Creates an **OH_Drawing_Typography** object.  |
151| [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Releases the memory occupied by an **OH_Drawing_Typography** object.  |
152| [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | Lays out the typography.  |
153| [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | Paints text on the canvas.  |
154| [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum width.  |
155| [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the height.  |
156| [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the longest line.  |
157| [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the minimum intrinsic width.  |
158| [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum intrinsic width.  |
159| [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the alphabetic baseline.  |
160| [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the ideographic baseline.  |
161
162
163## Type Description
164
165
166### OH_Drawing_Bitmap
167
168
169```
170typedef struct OH_Drawing_BitmapOH_Drawing_Bitmap
171```
172**Description**<br>
173Defines a bitmap, which is a memory that contains the pixel data of a shape.
174
175
176### OH_Drawing_Brush
177
178
179```
180typedef struct OH_Drawing_BrushOH_Drawing_Brush
181```
182**Description**<br>
183Defines as a brush, which is used to describe the style and color to fill in a shape.
184
185
186### OH_Drawing_Canvas
187
188
189```
190typedef struct OH_Drawing_CanvasOH_Drawing_Canvas
191```
192**Description**<br>
193Defines a rectangular canvas on which various shapes, images, and texts can be drawn by using the brush and pen.
194
195
196### OH_Drawing_FontCollection
197
198
199```
200typedef struct OH_Drawing_FontCollectionOH_Drawing_FontCollection
201```
202**Description**<br>
203Defines an **OH_Drawing_FontCollection**, which is used to load fonts.
204
205
206### OH_Drawing_Path
207
208
209```
210typedef struct OH_Drawing_PathOH_Drawing_Path
211```
212**Description**<br>
213Defines a path, which is used to customize various shapes.
214
215
216### OH_Drawing_Pen
217
218
219```
220typedef struct OH_Drawing_PenOH_Drawing_Pen
221```
222**Description**<br>
223Defines a pen, which is used to describe the style and color to outline a shape.
224
225
226### OH_Drawing_TextStyle
227
228
229```
230typedef struct OH_Drawing_TextStyleOH_Drawing_TextStyle
231```
232**Description**<br>
233Defines an **OH_Drawing_TextStyle**, which is used to manage text colors and decorations.
234
235
236### OH_Drawing_Typography
237
238
239```
240typedef struct OH_Drawing_TypographyOH_Drawing_Typography
241```
242**Description**<br>
243Defines an **OH_Drawing_Typography**, which is used to manage the typography layout and display.
244
245
246### OH_Drawing_TypographyCreate
247
248
249```
250typedef struct OH_Drawing_TypographyCreateOH_Drawing_TypographyCreate
251```
252**Description**<br>
253Defines an **OH_Drawing_TypographyCreate**, which is used to create an **OH_Drawing_Typography** object.
254
255
256### OH_Drawing_TypographyStyle
257
258
259```
260typedef struct OH_Drawing_TypographyStyleOH_Drawing_TypographyStyle
261```
262**Description**<br>
263Defines an **OH_Drawing_TypographyStyle**, which is used to manage the typography style, such as the text direction.
264
265
266## Enum Description
267
268
269### OH_Drawing_AlphaFormat
270
271
272```
273enum OH_Drawing_AlphaFormat
274```
275**Description**<br>
276Enumerates alpha formats of bitmap pixels.
277
278| Name | Description |
279| -------- | -------- |
280| ALPHA_FORMAT_UNKNOWN  | Unknown format. |
281| ALPHA_FORMAT_OPAQUE  | The bitmap does not have the alpha component. |
282| ALPHA_FORMAT_PREMUL  | The color component of each pixel is premultiplied by the alpha component. |
283| ALPHA_FORMAT_UNPREMUL  | The color component of each pixel is not premultiplied by the alpha component. |
284
285
286### OH_Drawing_ColorFormat
287
288
289```
290enum OH_Drawing_ColorFormat
291```
292**Description**<br>
293Enumerates storage formats of bitmap pixels.
294
295| Name | Description |
296| -------- | -------- |
297| COLOR_FORMAT_UNKNOWN  | Unknown format. |
298| COLOR_FORMAT_ALPHA_8  | Each pixel is represented by 8 bits, which together indicate alpha. |
299| COLOR_FORMAT_RGB_565  | Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, the first 5 bits indicate red, the subsequent 6 bits indicate green, and the last 5 bits indicate blue. |
300| COLOR_FORMAT_ARGB_4444  | Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, every 4 bits indicate alpha, red, green, and blue, respectively. |
301| COLOR_FORMAT_RGBA_8888  | Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate alpha, red, green, and blue, respectively. |
302| COLOR_FORMAT_BGRA_8888  | Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate blue, green, red, and alpha, respectively. |
303
304
305### OH_Drawing_FontStyle
306
307
308```
309enum OH_Drawing_FontStyle
310```
311**Description**<br>
312Enumerates font styles.
313
314| Name | Description |
315| -------- | -------- |
316| FONT_STYLE_NORMAL  | Normal style |
317| FONT_STYLE_ITALIC  | Italic style |
318
319
320### OH_Drawing_FontWeight
321
322
323```
324enum OH_Drawing_FontWeight
325```
326**Description**<br>
327Enumerates font weights.
328
329| Name | Description |
330| -------- | -------- |
331| FONT_WEIGHT_100  | Thin |
332| FONT_WEIGHT_200  | Extra-light |
333| FONT_WEIGHT_300  | Light |
334| FONT_WEIGHT_400  | Normal/Regular |
335| FONT_WEIGHT_500  | Medium |
336| FONT_WEIGHT_600  | Semi-bold |
337| FONT_WEIGHT_700  | Bold |
338| FONT_WEIGHT_800  | Extra-bold |
339| FONT_WEIGHT_900  | Black |
340
341
342### OH_Drawing_PenLineCapStyle
343
344
345```
346enum OH_Drawing_PenLineCapStyle
347```
348**Description**<br>
349Enumerates line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
350
351| Name | Description |
352| -------- | -------- |
353| LINE_FLAT_CAP  | There is no cap style. Both ends of the line segment are cut off square. |
354| LINE_SQUARE_CAP  | Square cap style. Both ends have a square, the height of which is half of the width of the line segment, with the same width. |
355| LINE_ROUND_CAP  | Round cap style. Both ends have a semicircle centered, the diameter of which is the same as the width of the line segment. |
356
357
358### OH_Drawing_PenLineJoinStyle
359
360
361```
362enum OH_Drawing_PenLineJoinStyle
363```
364**Description**<br>
365Enumerates pen line join styles. The line join style defines the shape of the joints of a polyline segment drawn by the pen.
366
367| Name | Description |
368| -------- | -------- |
369| LINE_MITER_JOIN  | Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case, you need to use the miter limit to limit the miter length. |
370| LINE_ROUND_JOIN  | Round corner. |
371| LINE_BEVEL_JOIN  | Beveled corner. |
372
373
374### OH_Drawing_TextAlign
375
376
377```
378enum OH_Drawing_TextAlign
379```
380**Description**<br>
381Enumerates text alignment modes.
382
383| Name | Description |
384| -------- | -------- |
385| TEXT_ALIGN_LEFT  | Left-aligned |
386| TEXT_ALIGN_RIGHT  | Right-aligned |
387| TEXT_ALIGN_CENTER  | Center-aligned |
388| TEXT_ALIGN_JUSTIFY  | Justified, which means that each line (except the last line) is stretched so that every line has equal width, and the left and right margins are straight. |
389| TEXT_ALIGN_START  | **TEXT_ALIGN_START** achieves the same effect as **TEXT_ALIGN_LEFT** when **OH_Drawing_TextDirection** is **TEXT_DIRECTION_LTR**; it achieves the same effect as **TEXT_ALIGN_RIGHT** when **OH_Drawing_TextDirection** is **TEXT_DIRECTION_RTL**. |
390| TEXT_ALIGN_END  | **TEXT_ALIGN_END** achieves the same effect as **TEXT_ALIGN_RIGHT** when **OH_Drawing_TextDirection** is **TEXT_DIRECTION_LTR**; it achieves the same effect as **TEXT_ALIGN_LEFT** when **OH_Drawing_TextDirection** is **TEXT_DIRECTION_RTL**. |
391
392
393### OH_Drawing_TextBaseline
394
395
396```
397enum OH_Drawing_TextBaseline
398```
399**Description**<br>
400Enumerates text baselines.
401
402| Name | Description |
403| -------- | -------- |
404| TEXT_BASELINE_ALPHABETIC  | Alphabetic, where the letters in alphabets like English sit on. |
405| TEXT_BASELINE_IDEOGRAPHIC  | Ideographic. The baseline is at the bottom of the text area. |
406
407
408### OH_Drawing_TextDecoration
409
410
411```
412enum OH_Drawing_TextDecoration
413```
414**Description**<br>
415Enumerates text decorations.
416
417| Name | Description |
418| -------- | -------- |
419| TEXT_DECORATION_NONE  | No decoration. |
420| TEXT_DECORATION_UNDERLINE  | A underline is used for decoration. |
421| TEXT_DECORATION_OVERLINE  | An overline is used for decoration. |
422| TEXT_DECORATION_LINE_THROUGH  | A strikethrough is used for decoration. |
423
424
425### OH_Drawing_TextDirection
426
427
428```
429enum OH_Drawing_TextDirection
430```
431**Description**<br>
432Enumerates text directions.
433
434| Name | Description |
435| -------- | -------- |
436| TEXT_DIRECTION_RTL  | Right to left (RTL) |
437| TEXT_DIRECTION_LTR  | Left to right (LTR) |
438
439
440## Function Description
441
442
443### OH_Drawing_BitmapBuild()
444
445
446```
447void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap * , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat *  )
448```
449**Description**<br>
450Initializes the width and height of an **OH_Drawing_Bitmap** object and sets the pixel format for the bitmap.
451
452\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
453
454 **Parameters**
455
456| Name | Description |
457| -------- | -------- |
458| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
459| width | Indicates the width of the bitmap to be initialized.  |
460| height | Indicates the height of the bitmap to be initialized.  |
461| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Indicates the pixel format of the bitmap to be initialized, including the pixel color type and alpha type.  |
462
463
464### OH_Drawing_BitmapCreate()
465
466
467```
468OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
469```
470**Description**<br>
471Creates an **OH_Drawing_Bitmap** object.
472
473\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
474
475**Returns**
476
477Returns the pointer to the **OH_Drawing_Bitmap** object created.
478
479
480### OH_Drawing_BitmapDestroy()
481
482
483```
484void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap * )
485```
486**Description**<br>
487Destroys an **OH_Drawing_Bitmap** object and reclaims the memory occupied by the object.
488
489\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
490
491 **Parameters**
492
493| Name | Description |
494| -------- | -------- |
495| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
496
497
498### OH_Drawing_BitmapGetHeight()
499
500
501```
502uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap * )
503```
504**Description**<br>
505Obtains the height of a bitmap.
506
507\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
508
509 **Parameters**
510
511| Name | Description |
512| -------- | -------- |
513| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
514
515**Returns**
516
517Returns the height.
518
519
520### OH_Drawing_BitmapGetPixels()
521
522
523```
524void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap * )
525```
526**Description**<br>
527Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap.
528
529\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
530
531 **Parameters**
532
533| Name | Description |
534| -------- | -------- |
535| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
536
537**Returns**
538
539Returns the pixel address.
540
541
542### OH_Drawing_BitmapGetWidth()
543
544
545```
546uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap * )
547```
548**Description**<br>
549Obtains the width of a bitmap.
550
551\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
552
553 **Parameters**
554
555| Name | Description |
556| -------- | -------- |
557| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
558
559**Returns**
560
561Returns the width.
562
563
564### OH_Drawing_BrushCreate()
565
566
567```
568OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
569```
570**Description**<br>
571Creates an **OH_Drawing_Brush** object.
572
573\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
574
575**Returns**
576
577Returns the pointer to the **OH_Drawing_Brush** object created.
578
579
580### OH_Drawing_BrushDestroy()
581
582
583```
584void OH_Drawing_BrushDestroy (OH_Drawing_Brush * )
585```
586**Description**<br>
587Destroys an **OH_Drawing_Brush** object and reclaims the memory occupied by the object.
588
589\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
590
591 **Parameters**
592
593| Name | Description |
594| -------- | -------- |
595| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
596
597
598### OH_Drawing_BrushGetColor()
599
600
601```
602uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush * )
603```
604**Description**<br>
605Obtains the color of a brush. The color is used by the brush to fill in a shape.
606
607\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
608
609 **Parameters**
610
611| Name | Description |
612| -------- | -------- |
613| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
614
615**Returns**
616
617Returns a 32-bit (ARGB) variable that describes the color.
618
619
620### OH_Drawing_BrushIsAntiAlias()
621
622
623```
624bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush * )
625```
626**Description**<br>
627Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.
628
629\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
630
631 **Parameters**
632
633| Name | Description |
634| -------- | -------- |
635| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
636
637**Returns**
638
639Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
640
641
642### OH_Drawing_BrushSetAntiAlias()
643
644
645```
646void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush * , bool  )
647```
648**Description**<br>
649Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency.
650
651\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
652
653 **Parameters**
654
655| Name | Description |
656| -------- | -------- |
657| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
658| bool | Specifies whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite.  |
659
660
661### OH_Drawing_BrushSetColor()
662
663
664```
665void OH_Drawing_BrushSetColor (OH_Drawing_Brush * , uint32_t color )
666```
667**Description**<br>
668Sets the color for a brush. The color will be used by the brush to fill in a shape.
669
670\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
671
672 **Parameters**
673
674| Name | Description |
675| -------- | -------- |
676| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
677| color | Indicates the color to set, which is a 32-bit (ARGB) variable.  |
678
679
680### OH_Drawing_CanvasAttachBrush()
681
682
683```
684void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas * , const OH_Drawing_Brush *  )
685```
686**Description**<br>
687Attaches a brush to a canvas so that the canvas will use the style and color of the brush to fill in a shape.
688
689\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
690
691 **Parameters**
692
693| Name | Description |
694| -------- | -------- |
695| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
696| OH_Drawing_Brush | Indicates the pointer to an **OH_Drawing_Brush** object.  |
697
698
699### OH_Drawing_CanvasAttachPen()
700
701
702```
703void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas * , const OH_Drawing_Pen *  )
704```
705**Description**<br>
706Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape.
707
708\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
709
710 **Parameters**
711
712| Name | Description |
713| -------- | -------- |
714| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
715| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
716
717
718### OH_Drawing_CanvasBind()
719
720
721```
722void OH_Drawing_CanvasBind (OH_Drawing_Canvas * , OH_Drawing_Bitmap *  )
723```
724**Description**<br>
725Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap (this process is called CPU rendering).
726
727\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
728
729 **Parameters**
730
731| Name | Description |
732| -------- | -------- |
733| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
734| OH_Drawing_Bitmap | Indicates the pointer to an **OH_Drawing_Bitmap** object.  |
735
736
737### OH_Drawing_CanvasClear()
738
739
740```
741void OH_Drawing_CanvasClear (OH_Drawing_Canvas * , uint32_t color )
742```
743**Description**<br>
744Clears a canvas by using a specified color.
745
746\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
747
748 **Parameters**
749
750| Name | Description |
751| -------- | -------- |
752| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
753| color | Indicates the color, which is a 32-bit (ARGB) variable.  |
754
755
756### OH_Drawing_CanvasCreate()
757
758
759```
760OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
761```
762**Description**<br>
763Creates an **OH_Drawing_Canvas** object.
764
765\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
766
767**Returns**
768
769Returns the pointer to the **OH_Drawing_Canvas** object created.
770
771
772### OH_Drawing_CanvasDestroy()
773
774
775```
776void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas * )
777```
778**Description**<br>
779Destroys an **OH_Drawing_Canvas** object and reclaims the memory occupied by the object.
780
781\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
782
783 **Parameters**
784
785| Name | Description |
786| -------- | -------- |
787| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
788
789
790### OH_Drawing_CanvasDetachBrush()
791
792
793```
794void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas * )
795```
796**Description**<br>
797Detaches the brush from a canvas so that the canvas will not use the style and color of the brush to fill in a shape.
798
799\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
800
801 **Parameters**
802
803| Name | Description |
804| -------- | -------- |
805| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
806
807
808### OH_Drawing_CanvasDetachPen()
809
810
811```
812void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas * )
813```
814**Description**<br>
815Detaches the pen from a canvas so that the canvas will not use the style and color of the pen to outline a shape.
816
817\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
818
819 **Parameters**
820
821| Name | Description |
822| -------- | -------- |
823| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
824
825
826### OH_Drawing_CanvasDrawLine()
827
828
829```
830void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas * , float x1, float y1, float x2, float y2 )
831```
832**Description**<br>
833Draws a line segment.
834
835\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
836
837 **Parameters**
838
839| Name | Description |
840| -------- | -------- |
841| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
842| x1 | Indicates the x coordinate of the start point of the line segment.  |
843| y1 | Indicates the y coordinate of the start point of the line segment.  |
844| x2 | Indicates the x coordinate of the end point of the line segment.  |
845| y2 | Indicates the y coordinate of the end point of the line segment.  |
846
847
848### OH_Drawing_CanvasDrawPath()
849
850
851```
852void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas * , const OH_Drawing_Path *  )
853```
854**Description**<br>
855Draws a path.
856
857\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
858
859 **Parameters**
860
861| Name | Description |
862| -------- | -------- |
863| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
864| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
865
866
867### OH_Drawing_CanvasRestore()
868
869
870```
871void OH_Drawing_CanvasRestore (OH_Drawing_Canvas * )
872```
873**Description**<br>
874Restores the canvas status (canvas matrix) saved on the top of the stack.
875
876\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
877
878 **Parameters**
879
880| Name | Description |
881| -------- | -------- |
882| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
883
884
885### OH_Drawing_CanvasSave()
886
887
888```
889void OH_Drawing_CanvasSave (OH_Drawing_Canvas * )
890```
891**Description**<br>
892Saves the current canvas status (canvas matrix) to the top of the stack.
893
894\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
895
896 **Parameters**
897
898| Name | Description |
899| -------- | -------- |
900| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
901
902
903### OH_Drawing_ColorSetArgb()
904
905
906```
907uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
908```
909**Description**<br>
910Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
911
912\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
913
914 **Parameters**
915
916| Name | Description |
917| -------- | -------- |
918| alpha | Indicates a variable that describes alpha. The value ranges from 0x00 to 0xFF.  |
919| red | Indicates a variable that describes red. The value ranges from 0x00 to 0xFF.  |
920| green | Indicates a variable that describes green. The value ranges from 0x00 to 0xFF.  |
921| blue | Indicates a variable that describes blue. The value ranges from 0x00 to 0xFF.  |
922
923**Returns**
924
925Returns a 32-bit (ARGB) variable that describes the color.
926
927
928### OH_Drawing_CreateFontCollection()
929
930
931```
932OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
933```
934**Description**<br>
935Creates an **OH_Drawing_FontCollection** object.
936
937\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
938
939**Returns**
940
941Returns the pointer to the **OH_Drawing_FontCollection** object created.
942
943
944### OH_Drawing_CreateTextStyle()
945
946
947```
948OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
949```
950**Description**<br>
951Creates an **OH_Drawing_TextStyle** object.
952
953\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
954
955**Returns**
956
957Returns the pointer to the **OH_Drawing_TextStyle** object created.
958
959
960### OH_Drawing_CreateTypography()
961
962
963```
964OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate * )
965```
966**Description**<br>
967Creates an **OH_Drawing_Typography** object.
968
969\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
970
971 **Parameters**
972
973| Name | Description |
974| -------- | -------- |
975| OH_Drawing_TypographyCreate | Indicates the pointer to an **OH_Drawing_TypographyCreate** object.  |
976
977**Returns**
978
979Returns the pointer to the **OH_Drawing_Typography** object created.
980
981
982### OH_Drawing_CreateTypographyHandler()
983
984
985```
986OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle * , OH_Drawing_FontCollection *  )
987```
988**Description**<br>
989Creates a pointer to an **OH_Drawing_TypographyCreate** object.
990
991\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
992
993 **Parameters**
994
995| Name | Description |
996| -------- | -------- |
997| OH_Drawing_TypographyStyle | Indicates the pointer to an **OH_Drawing_TypographyStyle** object.  |
998| OH_Drawing_FontCollection | Indicates the pointer to an **OH_Drawing_FontCollection** object.  |
999
1000**Returns**
1001
1002Returns the pointer to the **OH_Drawing_TypographyCreate** object created.
1003
1004
1005### OH_Drawing_CreateTypographyStyle()
1006
1007
1008```
1009OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
1010```
1011**Description**<br>
1012Creates an **OH_Drawing_TypographyStyle** object.
1013
1014\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1015
1016**Returns**
1017
1018Returns the pointer to the **OH_Drawing_TypographyStyle** object created.
1019
1020
1021### OH_Drawing_DestroyFontCollection()
1022
1023
1024```
1025void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection * )
1026```
1027**Description**<br>
1028Releases the memory occupied by an **OH_Drawing_FontCollection** object.
1029
1030\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1031
1032 **Parameters**
1033
1034| Name | Description |
1035| -------- | -------- |
1036| OH_Drawing_FontCollection | Indicates the pointer to an **OH_Drawing_FontCollection** object.  |
1037
1038
1039### OH_Drawing_DestroyTextStyle()
1040
1041
1042```
1043void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle * )
1044```
1045**Description**<br>
1046Releases the memory occupied by an **OH_Drawing_TextStyle** object.
1047
1048\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1049
1050 **Parameters**
1051
1052| Name | Description |
1053| -------- | -------- |
1054| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1055
1056
1057### OH_Drawing_DestroyTypography()
1058
1059
1060```
1061void OH_Drawing_DestroyTypography (OH_Drawing_Typography * )
1062```
1063**Description**<br>
1064Releases the memory occupied by an **OH_Drawing_Typography** object.
1065
1066\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1067
1068 **Parameters**
1069
1070| Name | Description |
1071| -------- | -------- |
1072| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1073
1074
1075### OH_Drawing_DestroyTypographyHandler()
1076
1077
1078```
1079void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate * )
1080```
1081**Description**<br>
1082Releases the memory occupied by an **OH_Drawing_TypographyCreate** object.
1083
1084\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1085
1086 **Parameters**
1087
1088| Name | Description |
1089| -------- | -------- |
1090| OH_Drawing_TypographyCreate | Indicates the pointer to an **OH_Drawing_TypographyCreate** object.  |
1091
1092
1093### OH_Drawing_DestroyTypographyStyle()
1094
1095
1096```
1097void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle * )
1098```
1099**Description**<br>
1100Releases the memory occupied by an **OH_Drawing_TypographyStyle** object.
1101
1102\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1103
1104 **Parameters**
1105
1106| Name | Description |
1107| -------- | -------- |
1108| OH_Drawing_TypographyStyle | Indicates the pointer to an **OH_Drawing_TypographyStyle** object.  |
1109
1110
1111### OH_Drawing_PathArcTo()
1112
1113
1114```
1115void OH_Drawing_PathArcTo (OH_Drawing_Path * , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
1116```
1117**Description**<br>
1118Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first, and then a start angle and a sweep angle are specified. The arc is a portion of the ellipse defined by the start angle and the sweep angle. By default, a line segment from the last point of the path to the start point of the arc is also added.
1119
1120\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1121
1122 **Parameters**
1123
1124| Name | Description |
1125| -------- | -------- |
1126| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1127| x1 | Indicates the x coordinate of the upper left corner of the rectangle.  |
1128| y1 | Indicates the y coordinate of the upper left corner of the rectangle.  |
1129| x2 | Indicates the x coordinate of the lower right corner of the rectangle.  |
1130| y2 | Indicates the y coordinate of the lower right corner of the rectangle.  |
1131| startDeg | Indicates the start angle, in degrees.  |
1132| sweepDeg | Indicates the angle to sweep, in degrees.  |
1133
1134
1135### OH_Drawing_PathClose()
1136
1137
1138```
1139void OH_Drawing_PathClose (OH_Drawing_Path * )
1140```
1141**Description**<br>
1142Closes a path. A line segment from the start point to the last point of the path is added.
1143
1144\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1145
1146 **Parameters**
1147
1148| Name | Description |
1149| -------- | -------- |
1150| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1151
1152
1153### OH_Drawing_PathCreate()
1154
1155
1156```
1157OH_Drawing_Path* OH_Drawing_PathCreate (void )
1158```
1159**Description**<br>
1160Creates an **OH_Drawing_Path** object.
1161
1162\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1163
1164**Returns**
1165
1166Returns the pointer to the **OH_Drawing_Path** object created.
1167
1168
1169### OH_Drawing_PathCubicTo()
1170
1171
1172```
1173void OH_Drawing_PathCubicTo (OH_Drawing_Path * , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
1174```
1175**Description**<br>
1176Draws a cubic Bezier curve from the last point of a path to the target point.
1177
1178\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1179
1180 **Parameters**
1181
1182| Name | Description |
1183| -------- | -------- |
1184| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1185| ctrlX1 | Indicates the x coordinate of the first control point.  |
1186| ctrlY1 | Indicates the y coordinate of the first control point.  |
1187| ctrlX2 | Indicates the x coordinate of the second control point.  |
1188| ctrlY2 | Indicates the y coordinate of the second control point.  |
1189| endX | Indicates the x coordinate of the target point.  |
1190| endY | Indicates the y coordinate of the target point.  |
1191
1192
1193### OH_Drawing_PathDestroy()
1194
1195
1196```
1197void OH_Drawing_PathDestroy (OH_Drawing_Path * )
1198```
1199**Description**<br>
1200Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object.
1201
1202\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1203
1204 **Parameters**
1205
1206| Name | Description |
1207| -------- | -------- |
1208| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1209
1210
1211### OH_Drawing_PathLineTo()
1212
1213
1214```
1215void OH_Drawing_PathLineTo (OH_Drawing_Path * , float x, float y )
1216```
1217**Description**<br>
1218Draws a line segment from the last point of a path to the target point.
1219
1220\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1221
1222 **Parameters**
1223
1224| Name | Description |
1225| -------- | -------- |
1226| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1227| x | Indicates the x coordinate of the target point.  |
1228| y | Indicates the y coordinate of the target point.  |
1229
1230
1231### OH_Drawing_PathMoveTo()
1232
1233
1234```
1235void OH_Drawing_PathMoveTo (OH_Drawing_Path * , float x, float y )
1236```
1237**Description**<br>
1238Sets the start point of a path.
1239
1240\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1241
1242 **Parameters**
1243
1244| Name | Description |
1245| -------- | -------- |
1246| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1247| x | Indicates the x coordinate of the start point.  |
1248| y | Indicates the y coordinate of the start point.  |
1249
1250
1251### OH_Drawing_PathQuadTo()
1252
1253
1254```
1255void OH_Drawing_PathQuadTo (OH_Drawing_Path * , float ctrlX, float ctrlY, float endX, float endY )
1256```
1257**Description**<br>
1258Draws a quadratic Bezier curve from the last point of a path to the target point.
1259
1260\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1261
1262 **Parameters**
1263
1264| Name | Description |
1265| -------- | -------- |
1266| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1267| ctrlX | Indicates the x coordinate of the control point.  |
1268| ctrlY | Indicates the y coordinate of the control point.  |
1269| endX | Indicates the x coordinate of the target point.  |
1270| endY | Indicates the y coordinate of the target point.  |
1271
1272
1273### OH_Drawing_PathReset()
1274
1275
1276```
1277void OH_Drawing_PathReset (OH_Drawing_Path * )
1278```
1279**Description**<br>
1280Resets path data.
1281
1282\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1283
1284 **Parameters**
1285
1286| Name | Description |
1287| -------- | -------- |
1288| OH_Drawing_Path | Indicates the pointer to an **OH_Drawing_Path** object.  |
1289
1290
1291### OH_Drawing_PenCreate()
1292
1293
1294```
1295OH_Drawing_Pen* OH_Drawing_PenCreate (void )
1296```
1297**Description**<br>
1298Creates an **OH_Drawing_Pen** object.
1299
1300\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1301
1302**Returns**
1303
1304Returns the pointer to the **OH_Drawing_Pen** object created.
1305
1306
1307### OH_Drawing_PenDestroy()
1308
1309
1310```
1311void OH_Drawing_PenDestroy (OH_Drawing_Pen * )
1312```
1313**Description**<br>
1314Destroys an **OH_Drawing_Pen** object and reclaims the memory occupied by the object.
1315
1316\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1317
1318 **Parameters**
1319
1320| Name | Description |
1321| -------- | -------- |
1322| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1323
1324
1325### OH_Drawing_PenGetCap()
1326
1327
1328```
1329OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen * )
1330```
1331**Description**<br>
1332Obtains the line cap style of a pen.
1333
1334\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1335
1336 **Parameters**
1337
1338| Name | Description |
1339| -------- | -------- |
1340| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1341
1342**Returns**
1343
1344Returns the line cap style.
1345
1346
1347### OH_Drawing_PenGetColor()
1348
1349
1350```
1351uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen * )
1352```
1353**Description**<br>
1354Obtains the color of a pen. The color is used by the pen to outline a shape.
1355
1356\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1357
1358 **Parameters**
1359
1360| Name | Description |
1361| -------- | -------- |
1362| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1363
1364**Returns**
1365
1366Returns a 32-bit (ARGB) variable that describes the color.
1367
1368
1369### OH_Drawing_PenGetJoin()
1370
1371
1372```
1373OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen * )
1374```
1375**Description**<br>
1376Obtains the line join style of a pen.
1377
1378\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1379
1380 **Parameters**
1381
1382| Name | Description |
1383| -------- | -------- |
1384| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1385
1386**Returns**
1387
1388Returns the line join style.
1389
1390
1391### OH_Drawing_PenGetMiterLimit()
1392
1393
1394```
1395float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen * )
1396```
1397**Description**<br>
1398Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
1399
1400\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1401
1402 **Parameters**
1403
1404| Name | Description |
1405| -------- | -------- |
1406| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1407
1408**Returns**
1409
1410Returns the miter limit.
1411
1412
1413### OH_Drawing_PenGetWidth()
1414
1415
1416```
1417float OH_Drawing_PenGetWidth (const OH_Drawing_Pen * )
1418```
1419**Description**<br>
1420Obtains the thickness of a pen. This thickness determines the width of the outline of a shape.
1421
1422\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1423
1424 **Parameters**
1425
1426| Name | Description |
1427| -------- | -------- |
1428| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1429
1430**Returns**
1431
1432Returns the thickness.
1433
1434
1435### OH_Drawing_PenIsAntiAlias()
1436
1437
1438```
1439bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen * )
1440```
1441**Description**<br>
1442Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.
1443
1444\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1445
1446 **Parameters**
1447
1448| Name | Description |
1449| -------- | -------- |
1450| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1451
1452**Returns**
1453
1454Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
1455
1456
1457### OH_Drawing_PenSetAntiAlias()
1458
1459
1460```
1461void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen * , bool  )
1462```
1463**Description**<br>
1464Enables or disables anti-aliasing for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency.
1465
1466\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1467
1468 **Parameters**
1469
1470| Name | Description |
1471| -------- | -------- |
1472| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1473| bool | Specifies whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite.  |
1474
1475
1476### OH_Drawing_PenSetCap()
1477
1478
1479```
1480void OH_Drawing_PenSetCap (OH_Drawing_Pen * , OH_Drawing_PenLineCapStyle  )
1481```
1482**Description**<br>
1483Sets the line cap style for a pen.
1484
1485\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1486
1487 **Parameters**
1488
1489| Name | Description |
1490| -------- | -------- |
1491| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1492| OH_Drawing_PenLineCapStyle | Indicates a variable that describes the line cap style.  |
1493
1494
1495### OH_Drawing_PenSetColor()
1496
1497
1498```
1499void OH_Drawing_PenSetColor (OH_Drawing_Pen * , uint32_t color )
1500```
1501**Description**<br>
1502Sets the color for a pen. The color is used by the pen to outline a shape.
1503
1504\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1505
1506 **Parameters**
1507
1508| Name | Description |
1509| -------- | -------- |
1510| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1511| color | Indicates the color to set, which is a 32-bit (ARGB) variable.  |
1512
1513
1514### OH_Drawing_PenSetJoin()
1515
1516
1517```
1518void OH_Drawing_PenSetJoin (OH_Drawing_Pen * , OH_Drawing_PenLineJoinStyle  )
1519```
1520**Description**<br>
1521Sets the line join style for a pen.
1522
1523\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1524
1525 **Parameters**
1526
1527| Name | Description |
1528| -------- | -------- |
1529| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1530| OH_Drawing_PenLineJoinStyle | Indicates a variable that describes the line join style.  |
1531
1532
1533### OH_Drawing_PenSetMiterLimit()
1534
1535
1536```
1537void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen * , float miter )
1538```
1539**Description**<br>
1540Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded.
1541
1542\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1543
1544 **Parameters**
1545
1546| Name | Description |
1547| -------- | -------- |
1548| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1549| miter | Indicates a variable that describes the miter limit.  |
1550
1551
1552### OH_Drawing_PenSetWidth()
1553
1554
1555```
1556void OH_Drawing_PenSetWidth (OH_Drawing_Pen * , float width )
1557```
1558**Description**<br>
1559Sets the thickness for a pen. This thickness determines the width of the outline of a shape.
1560
1561\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1562
1563 **Parameters**
1564
1565| Name | Description |
1566| -------- | -------- |
1567| OH_Drawing_Pen | Indicates the pointer to an **OH_Drawing_Pen** object.  |
1568| width | Indicates the thickness to set, which is a variable.  |
1569
1570
1571### OH_Drawing_SetTextStyleBaseLine()
1572
1573
1574```
1575void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle * , int  )
1576```
1577**Description**<br>
1578Sets the text baseline.
1579
1580\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1581
1582 **Parameters**
1583
1584| Name | Description |
1585| -------- | -------- |
1586| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1587| int | Indicates the text baseline to set. For details, see the enum **OH_Drawing_TextBaseline**.  |
1588
1589
1590### OH_Drawing_SetTextStyleColor()
1591
1592
1593```
1594void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle * , uint32_t  )
1595```
1596**Description**<br>
1597Sets the text color.
1598
1599\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1600
1601 **Parameters**
1602
1603| Name | Description |
1604| -------- | -------- |
1605| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1606| uint32_t | Indicates the color to set.  |
1607
1608
1609### OH_Drawing_SetTextStyleDecoration()
1610
1611
1612```
1613void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle * , int  )
1614```
1615**Description**<br>
1616Sets the text decoration.
1617
1618\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1619
1620 **Parameters**
1621
1622| Name | Description |
1623| -------- | -------- |
1624| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1625| int | Indicates the text decoration to set. For details, see the enum **OH_Drawing_TextDecoration**.  |
1626
1627
1628### OH_Drawing_SetTextStyleDecorationColor()
1629
1630
1631```
1632void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle * , uint32_t  )
1633```
1634**Description**<br>
1635Sets the color for the text decoration.
1636
1637\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1638
1639 **Parameters**
1640
1641| Name | Description |
1642| -------- | -------- |
1643| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1644| uint32_t | Indicates the color to set.  |
1645
1646
1647### OH_Drawing_SetTextStyleFontFamilies()
1648
1649
1650```
1651void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle * , int , const char * fontFamilies[] )
1652```
1653**Description**<br>
1654Sets the font families.
1655
1656\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1657
1658 **Parameters**
1659
1660| Name | Description |
1661| -------- | -------- |
1662| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1663| int | Indicates the number of font families to set.  |
1664| char | Indicates the pointer to the font families to set.  |
1665
1666
1667### OH_Drawing_SetTextStyleFontHeight()
1668
1669
1670```
1671void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle * , double  )
1672```
1673**Description**<br>
1674Sets the font height.
1675
1676\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1677
1678 **Parameters**
1679
1680| Name | Description |
1681| -------- | -------- |
1682| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1683| double | Indicates the font height to set.  |
1684
1685
1686### OH_Drawing_SetTextStyleFontSize()
1687
1688
1689```
1690void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle * , double  )
1691```
1692**Description**<br>
1693Sets the font size.
1694
1695\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1696
1697 **Parameters**
1698
1699| Name | Description |
1700| -------- | -------- |
1701| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1702| double | Indicates the font size to set.  |
1703
1704
1705### OH_Drawing_SetTextStyleFontStyle()
1706
1707
1708```
1709void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle * , int  )
1710```
1711**Description**<br>
1712Sets the font style.
1713
1714\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1715
1716 **Parameters**
1717
1718| Name | Description |
1719| -------- | -------- |
1720| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1721| int | Indicates the font style to set. For details, see the enum **OH_Drawing_FontStyle**.  |
1722
1723
1724### OH_Drawing_SetTextStyleFontWeight()
1725
1726
1727```
1728void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle * , int  )
1729```
1730**Description**<br>
1731Sets the font weight.
1732
1733\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1734
1735 **Parameters**
1736
1737| Name | Description |
1738| -------- | -------- |
1739| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1740| int | Indicates the font weight to set. For details, see the enum **OH_Drawing_FontWeight**.  |
1741
1742
1743### OH_Drawing_SetTextStyleLocale()
1744
1745
1746```
1747void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle * , const char *  )
1748```
1749**Description**<br>
1750Sets the locale.
1751
1752\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1753
1754 **Parameters**
1755
1756| Name | Description |
1757| -------- | -------- |
1758| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
1759| char | Indicates the pointer to the locale to set.  |
1760
1761
1762### OH_Drawing_SetTypographyTextAlign()
1763
1764
1765```
1766void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle * , int  )
1767```
1768**Description**<br>
1769Sets the text alignment mode.
1770
1771\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1772
1773 **Parameters**
1774
1775| Name | Description |
1776| -------- | -------- |
1777| OH_Drawing_TypographyStyle | Indicates the pointer to an **OH_Drawing_TypographyStyle** object.  |
1778| int | Indicates the text alignment mode to set. For details, see the enum **OH_Drawing_TextAlign**.  |
1779
1780
1781### OH_Drawing_SetTypographyTextDirection()
1782
1783
1784```
1785void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle * , int  )
1786```
1787**Description**<br>
1788Sets the text direction.
1789
1790\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1791
1792 **Parameters**
1793
1794| Name | Description |
1795| -------- | -------- |
1796| OH_Drawing_TypographyStyle | Indicates the pointer to an **OH_Drawing_TypographyStyle** object.  |
1797| int | Indicates the text direction to set. For details, see the enum **OH_Drawing_TextDirection**.  |
1798
1799
1800### OH_Drawing_SetTypographyTextMaxLines()
1801
1802
1803```
1804void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle * , int  )
1805```
1806**Description**<br>
1807Sets the maximum number of lines in a text file.
1808
1809\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1810
1811 **Parameters**
1812
1813| Name | Description |
1814| -------- | -------- |
1815| OH_Drawing_TypographyStyle | Indicates the pointer to an **OH_Drawing_TypographyStyle** object.  |
1816| int | Indicates the maximum number of lines to set.  |
1817
1818
1819### OH_Drawing_TypographyGetAlphabeticBaseline()
1820
1821
1822```
1823double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography * )
1824```
1825**Description**<br>
1826Obtains the alphabetic baseline.
1827
1828\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1829
1830 **Parameters**
1831
1832| Name | Description |
1833| -------- | -------- |
1834| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1835
1836**Returns**
1837
1838Returns the alphabetic baseline.
1839
1840
1841### OH_Drawing_TypographyGetHeight()
1842
1843
1844```
1845double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography * )
1846```
1847**Description**<br>
1848Obtains the height.
1849
1850\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1851
1852 **Parameters**
1853
1854| Name | Description |
1855| -------- | -------- |
1856| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1857
1858**Returns**
1859
1860Returns the height.
1861
1862
1863### OH_Drawing_TypographyGetIdeographicBaseline()
1864
1865
1866```
1867double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography * )
1868```
1869**Description**<br>
1870Obtains the ideographic baseline.
1871
1872\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1873
1874 **Parameters**
1875
1876| Name | Description |
1877| -------- | -------- |
1878| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1879
1880**Returns**
1881
1882Returns the ideographic baseline.
1883
1884
1885### OH_Drawing_TypographyGetLongestLine()
1886
1887
1888```
1889double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography * )
1890```
1891**Description**<br>
1892Obtains the longest line.
1893
1894\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1895
1896 **Parameters**
1897
1898| Name | Description |
1899| -------- | -------- |
1900| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1901
1902**Returns**
1903
1904Returns the longest line.
1905
1906
1907### OH_Drawing_TypographyGetMaxIntrinsicWidth()
1908
1909
1910```
1911double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography * )
1912```
1913**Description**<br>
1914Obtains the maximum intrinsic width.
1915
1916\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1917
1918 **Parameters**
1919
1920| Name | Description |
1921| -------- | -------- |
1922| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1923
1924**Returns**
1925
1926Returns the maximum intrinsic width.
1927
1928
1929### OH_Drawing_TypographyGetMaxWidth()
1930
1931
1932```
1933double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography * )
1934```
1935**Description**<br>
1936Obtains the maximum width.
1937
1938\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1939
1940 **Parameters**
1941
1942| Name | Description |
1943| -------- | -------- |
1944| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1945
1946**Returns**
1947
1948Returns the maximum width.
1949
1950
1951### OH_Drawing_TypographyGetMinIntrinsicWidth()
1952
1953
1954```
1955double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography * )
1956```
1957**Description**<br>
1958Obtains the minimum intrinsic width.
1959
1960\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1961
1962 **Parameters**
1963
1964| Name | Description |
1965| -------- | -------- |
1966| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
1967
1968**Returns**
1969
1970Returns the minimum intrinsic width.
1971
1972
1973### OH_Drawing_TypographyHandlerAddText()
1974
1975
1976```
1977void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate * , const char *  )
1978```
1979**Description**<br>
1980Sets the text content.
1981
1982\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
1983
1984 **Parameters**
1985
1986| Name | Description |
1987| -------- | -------- |
1988| OH_Drawing_TypographyCreate | Indicates the pointer to an **OH_Drawing_TypographyCreate** object.  |
1989| char | Indicates the pointer to the text content to set.  |
1990
1991
1992### OH_Drawing_TypographyHandlerPopTextStyle()
1993
1994
1995```
1996void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate * )
1997```
1998**Description**<br>
1999Removes the topmost style in the stack, leaving the remaining styles in effect.
2000
2001\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
2002
2003 **Parameters**
2004
2005| Name | Description |
2006| -------- | -------- |
2007| OH_Drawing_TypographyCreate | Indicates the pointer to an **OH_Drawing_TypographyCreate** object.  |
2008
2009
2010### OH_Drawing_TypographyHandlerPushTextStyle()
2011
2012
2013```
2014void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate * , OH_Drawing_TextStyle *  )
2015```
2016**Description**<br>
2017Sets the text style.
2018
2019\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
2020
2021 **Parameters**
2022
2023| Name | Description |
2024| -------- | -------- |
2025| OH_Drawing_TypographyCreate | Indicates the pointer to an **OH_Drawing_TypographyCreate** object.  |
2026| OH_Drawing_TextStyle | Indicates the pointer to an **OH_Drawing_TextStyle** object.  |
2027
2028
2029### OH_Drawing_TypographyLayout()
2030
2031
2032```
2033void OH_Drawing_TypographyLayout (OH_Drawing_Typography * , double  )
2034```
2035**Description**<br>
2036Lays out the typography.
2037
2038\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
2039
2040 **Parameters**
2041
2042| Name | Description |
2043| -------- | -------- |
2044| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
2045| double | Indicates the maximum text width to set.  |
2046
2047
2048### OH_Drawing_TypographyPaint()
2049
2050
2051```
2052void OH_Drawing_TypographyPaint (OH_Drawing_Typography * , OH_Drawing_Canvas * , double , double  )
2053```
2054**Description**<br>
2055Paints text on the canvas.
2056
2057\@syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
2058
2059 **Parameters**
2060
2061| Name | Description |
2062| -------- | -------- |
2063| OH_Drawing_Typography | Indicates the pointer to an **OH_Drawing_Typography** object.  |
2064| OH_Drawing_Canvas | Indicates the pointer to an **OH_Drawing_Canvas** object.  |
2065| double | Indicates the x coordinate.  |
2066| double | Indicates the y coordinate.  |
2067