• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Drawing
2
3
4## Overview
5
6The Drawing module provides the functions for 2D graphics rendering, text drawing, and image display. It uses the physical pixel unit, px. The module operates under a single-threaded model. The caller needs to manage thread safety and context state transitions.
7
8**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9
10**Since**: 8
11
12
13## Summary
14
15
16### Files
17
18| Name| Description|
19| -------- | -------- |
20| [drawing_bitmap.h](drawing__bitmap_8h.md) | Declares the functions related to the bitmap in the drawing module.|
21| [drawing_brush.h](drawing__brush_8h.md) | Declares the functions related to the brush in the drawing module.|
22| [drawing_canvas.h](drawing__canvas_8h.md) | Declares the functions related to the canvas in the drawing module. By default, the canvas has a black brush with anti-aliasing enabled but no any other style. This default brush takes effect only when no brush or pen is proactively set in the canvas. Canvases that are not set for recording will immediately draw the commands onto the bound bitmap, whereas canvases designated for recording will store the drawing commands for future replay.|
23| [drawing_color.h](drawing__color_8h.md) | Declares the functions related to the color in the drawing module.|
24| [drawing_color_filter.h](drawing__color__filter_8h.md) | Declares the functions related to the color filter in the drawing module.|
25| [drawing_error_code.h](drawing__error__code_8h.md) | Declares the functions related to the error code in the drawing module.|
26| [drawing_color_space.h](drawing__color__space_8h.md) | Declares the functions related to the color space in the drawing module.|
27| [drawing_filter.h](drawing__filter_8h.md) | Declares the functions related to the filter in the drawing module.|
28| [drawing_font.h](drawing__font_8h.md) | Declares the functions related to the font in the drawing module.|
29| [drawing_font_collection.h](drawing__font__collection_8h.md) | Declares the functions related to the font collection in the drawing module.|
30| [drawing_font_mgr.h](drawing__font__mgr_8h.md) | Declares the functions related to font management in the drawing module. The functions can be used to load fonts and match available fonts in the system.|
31| [drawing_gpu_context.h](drawing__gpu__context_8h.md) | Declares the functions related to the GPU context in the drawing module.|
32| [drawing_image.h](drawing__image_8h.md) | Declares the functions related to the image in the drawing module.|
33| [drawing_image_filter.h](drawing__image__filter_8h.md) | Declares the functions related to the image filter in the drawing module.|
34| [drawing_mask_filter.h](drawing__mask__filter_8h.md) | Declares the functions related to the mask filter in the drawing module.|
35| [drawing_matrix.h](drawing__matrix_8h.md) | Declares the functions related to the matrix in the drawing module.|
36| [drawing_memory_stream.h](drawing__memory__stream_8h.md) | Declares the functions related to the memory stream in the drawing module.|
37| [drawing_path.h](drawing__path_8h.md) | Declares the functions related to the path in the drawing module.|
38| [drawing_path_effect.h](drawing__path__effect_8h.md) | Declares the functions related to the bitmap in the drawing module.|
39| [drawing_pen.h](drawing__pen_8h.md) | Declares the functions related to the pen in the drawing module.|
40| [drawing_pixel_map.h](drawing__pixel__map_8h.md) | Declares the functions related to the pixel map in the drawing module.|
41| [drawing_point.h](drawing__point_8h.md) | Declares the functions related to the coordinate point in the drawing module.|
42| [drawing_record_cmd.h](drawing__record__cmd_8h.md) | Declares the functions related to a recording command object.|
43| [drawing_rect.h](drawing__rect_8h.md) | Declares the functions related to the rectangle in the drawing module.|
44| [drawing_region.h](drawing__region_8h.md) | Declares the functions related to the region in the drawing module, including creating a region, setting the boundary, and destroying a region.|
45| [drawing_register_font.h](drawing__register__font_8h.md) | Declares the functions related to the font manager in the drawing module.|
46| [drawing_round_rect.h](drawing__round__rect_8h.md) | Declares the functions related to the rounded rectangle in the drawing module.|
47| [drawing_sampling_options.h](drawing__sampling__options_8h.md) | Declares the functions related to the sampling options in the drawing module. It is used for image or texture sampling.|
48| [drawing_shader_effect.h](drawing__shader__effect_8h.md) | Declares the functions related to the shader effect in the drawing module.|
49| [drawing_shadow_layer.h](drawing__shadow__layer_8h.md) | Declares the functions related to the shadow in the drawing module.|
50| [drawing_surface.h](drawing__surface_8h.md) | Declares the functions related to the surface in the drawing module, including creating, destroying, and using the surface.|
51| [drawing_text_blob.h](drawing__text__blob_8h.md) | Declares the functions related to the text blob in the drawing module.|
52| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | Declares the structs related to text in 2D drawing.|
53| [drawing_text_font_descriptor.h](drawing__text__font__descriptor_8h.md) | Declares the capabilities of font information, such as obtaining font information and searching for a font.|
54| [drawing_text_line.h](drawing__text__line_8h.md) | Declares the capabilities for obtaining the character position in a text line, obtaining the run information, and truncating text by line.|
55| [drawing_text_lineTypography.h](drawing__text__line_typography_8h.md) | Declares the functions related to line typography, including functions to determine the number of characters that can be formatted from a given position within the text.|
56| [drawing_text_run.h](drawing__text__run_8h.md) | Declares the capabilities of runs, such as obtaining the typographic boundary and drawing. |
57| [drawing_text_typography.h](drawing__text__typography_8h.md) | Declares the functions related to typography in the drawing module.|
58| [drawing_typeface.h](drawing__typeface_8h.md) | Declares the functions related to the typeface in the drawing module. Different platforms have their own default typefaces. You can also parse the .ttf file to obtain the typefaces specified by the third party, such as SimSun and SimHei.|
59| [drawing_types.h](drawing__types_8h.md) | Declares the data types of the canvas, brush, pen, bitmap, and path used to draw 2D graphics.|
60
61
62### Structs
63
64| Name| Description|
65| -------- | -------- |
66| struct  [OH_Drawing_String](_o_h___drawing___string.md) | Describes a string of characters encoded in UTF-16.|
67| struct  [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Describes the pixel format of a bitmap, including the color type and alpha type.|
68| struct  [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Describes the measurement information about a font.|
69| struct  [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | Describes the options about the GPU context.|
70| struct  [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | Describes a run, which provides storage for glyphs and positions.|
71| struct  [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | Describes the placeholder that acts as a span.|
72| struct  [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Describes the detailed information about a system font.|
73| struct  [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | Describes the measurement information about a line of text.|
74| struct  [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | Describes the information about a font fallback.|
75| struct  [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | Describes the information about a font fallback group.|
76| struct  [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | Describes the information about a font weight mapping.|
77| struct  [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | Describes the information about a font alias.|
78| struct  [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | Describes the information about generic fonts supported by the system.|
79| struct  [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | Describes the information about a system font configuration.|
80| struct  [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Describes a font style.|
81| struct  [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | Describes a font feature.|
82| struct  [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | Describes a strut style. The strut style determines the line spacing, baseline alignment mode, and other properties related to the line height when drawing texts.|
83| struct  [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Describes a two-dimensional coordinate point.|
84| struct  [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | Describes a three-dimensional coordinate point.|
85| struct  [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Describes the image information.|
86| struct  [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | Describes the style of a rectangle.|
87
88
89### Types
90
91| Name| Description|
92| -------- | -------- |
93| typedef enum [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) | Defines an enum for the drawing styles for path effects. |
94| typedef struct [OH_Drawing_String](_o_h___drawing___string.md) [OH_Drawing_String](#oh_drawing_string) | Defines a struct for a string of characters encoded in UTF-16.|
95| typedef enum [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) | Defines an enum for the system font types.|
96| typedef bool(\* [Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback)) (double offset, int32_t index, bool leadingEdge) | Defines a custom callback used to receive the offset and index of each character in a text line object as its parameters.|
97| typedef struct [OH_Drawing_LineTypography](#oh_drawing_linetypography) [OH_Drawing_LineTypography](#oh_drawing_linetypography) | Defines a struct used to extract a single line of data from a piece of text for typography.|
98| typedef struct [OH_Drawing_TextTab](#oh_drawing_texttab) [OH_Drawing_TextTab](#oh_drawing_texttab) | Defines a struct used to manage text tabs.|
99| typedef struct [OH_Drawing_TextLine](#oh_drawing_textline) [OH_Drawing_TextLine](#oh_drawing_textline) | Defines a struct used to manage text lines.|
100| typedef struct [OH_Drawing_Run](#oh_drawing_run) [OH_Drawing_Run](#oh_drawing_run) | Defines a struct used to manage runs.|
101| typedef struct [OH_Drawing_Array](#oh_drawing_array) [OH_Drawing_Array](#oh_drawing_array) | Defines a struct for an array object, which is used to store multiple objects of the same type.|
102| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | Defines a struct for font arguments.|
103| typedef struct [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) | Defines the recording command tool, which is used to generate recording commands.|
104| typedef struct [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) | Defines the recording command class, which is used to store the set of recording commands.|
105| typedef enum [OH_Drawing_ErrorCode](#oh_drawing_errorcode)  [OH_Drawing_ErrorCode](#oh_drawing_errorcode) | Defines an enum for the error codes that may be generated by the module.|
106| typedef enum [OH_Drawing_PathOpMode](#oh_drawing_pathopmode)  [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | Defines an enum for the operation modes available for a path.|
107| typedef enum [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)  [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | Defines an enum for the types of matrix information obtained during path measurement.|
108| typedef enum [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)  [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) | Defines an enum for the operation modes available for a region.|
109| typedef struct [OH_Drawing_ImageFilter](#oh_drawing_imagefilter)  [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) | Defines a struct for an image filter, which is used to operate all color bits that make up image pixels.|
110| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | Defines a struct for a filter, which consists of a color filter, mask filter, and image filter.|
111| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)  [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | Defines a struct for the pixel format of a bitmap, including the color type and alpha type.|
112| typedef enum [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint)  [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) | Defines an enum for the constraint types of the source rectangle.|
113| typedef enum [OH_Drawing_PointMode](#oh_drawing_pointmode)  [OH_Drawing_PointMode](#oh_drawing_pointmode) | Defines an enum for the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.|
114| typedef enum [OH_Drawing_VertexMode](#oh_drawing_vertexmode)  [OH_Drawing_VertexMode](#oh_drawing_vertexmode) | Defines an enum for the modes of interpreting the geometry of a given vertex.|
115| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)  [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | Defines an enum for the canvas clipping modes.|
116| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging)  [OH_Drawing_FontEdging](#oh_drawing_fontedging) | Defines an enum for the font edging types.|
117| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting)  [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | Defines an enum for the font hinting types.|
118| typedef struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)  [OH_Drawing_Font_Metrics](#oh_drawing_font_metrics) | Defines a struct for the measurement information about a font.|
119| typedef struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)  [OH_Drawing_GpuContextOptions](#oh_drawing_gpucontextoptions) | Defines a struct for the options about the GPU context.|
120| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype)  [OH_Drawing_BlurType](#oh_drawing_blurtype) | Defines an enum for the blur types.|
121| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)  [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | Defines an enum for the matrix scaling modes.|
122| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection)  [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | Defines an enum for the directions of a closed contour.|
123| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)  [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | Defines an enum for the fill types of a path.|
124| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)  [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | Defines an enum for the path adding modes.|
125| typedef enum [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)  [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) | Defines an enum for the line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.|
126| typedef enum [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)  [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) | Defines an enum for the line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.|
127| typedef enum [OH_Drawing_CornerPos](#oh_drawing_cornerpos)  [OH_Drawing_CornerPos](#oh_drawing_cornerpos) | Defines an enum for the corner positions of a rounded rectangle.|
128| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode)  [OH_Drawing_FilterMode](#oh_drawing_filtermode) | Defines an enum for the filter modes.|
129| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)  [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | Defines an enum for the mipmap modes.|
130| typedef enum [OH_Drawing_TileMode](#oh_drawing_tilemode)  [OH_Drawing_TileMode](#oh_drawing_tilemode) | Defines an enum for the tile modes of the shader effect.|
131| typedef struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md)  [OH_Drawing_RunBuffer](#oh_drawing_runbuffer) | Defines a struct for a run, which provides storage for glyphs and positions.|
132| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection)  [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | Defines a struct used to load fonts.|
133| typedef struct [OH_Drawing_Typography](#oh_drawing_typography)  [OH_Drawing_Typography](#oh_drawing_typography) | Defines a struct used to manage the typography layout and display.|
134| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle)  [OH_Drawing_TextStyle](#oh_drawing_textstyle) | Defines a struct used to manage text colors and decorations.|
135| typedef struct [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)  [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | Defines a struct used to manage the typography style, such as the text direction.|
136| typedef struct [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)  [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | Defines a struct used to create an [OH_Drawing_Typography](#oh_drawing_typography) object.|
137| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox)  [OH_Drawing_TextBox](#oh_drawing_textbox) | Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity.|
138| typedef struct [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)  [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | Defines a struct used to receive the position and affinity of a glyph.|
139| typedef struct [OH_Drawing_Range](#oh_drawing_range)  [OH_Drawing_Range](#oh_drawing_range) | Defines a struct used to receive the start position and end position of a glyph.|
140| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow)  [OH_Drawing_TextShadow](#oh_drawing_textshadow) | Defines a struct used to manage text shadows.|
141| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser)  [OH_Drawing_FontParser](#oh_drawing_fontparser) | Defines a struct used to parse system font files.|
142| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment)  [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | Defines an enum for the vertical alignment modes of placeholders.|
143| typedef struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md)  [OH_Drawing_PlaceholderSpan](#oh_drawing_placeholderspan) | Defines a struct for the placeholder that acts as a span.|
144| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)  [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | Defines an enum for the text decoration styles.|
145| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)  [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | Defines an enum for the ellipsis styles.|
146| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)  [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | Defines an enum for the text break strategies.|
147| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)  [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | Defines an enum for the word break types.|
148| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)  [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | Defines an enum for the rectangle height styles.|
149| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)  [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | Defines an enum for the rectangle width styles.|
150| typedef struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)  [OH_Drawing_FontDescriptor](#oh_drawing_fontdescriptor) | Defines a struct for the detailed information about a system font.|
151| typedef struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)  [OH_Drawing_LineMetrics](#oh_drawing_linemetrics) | Defines a struct for the measurement information about a line of text.|
152| typedef struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md)  [OH_Drawing_FontFallbackInfo](#oh_drawing_fontfallbackinfo) | Defines a struct for the information about a font fallback.|
153| typedef struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md)  [OH_Drawing_FontFallbackGroup](#oh_drawing_fontfallbackgroup) | Defines a struct for the information about a font fallback group.|
154| typedef struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md)  [OH_Drawing_FontAdjustInfo](#oh_drawing_fontadjustinfo) | Defines a struct for the information about a font weight mapping.|
155| typedef struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md)  [OH_Drawing_FontAliasInfo](#oh_drawing_fontaliasinfo) | Defines a struct for the information about a font alias.|
156| typedef struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md)  [OH_Drawing_FontGenericInfo](#oh_drawing_fontgenericinfo) | Defines a struct for the information about generic fonts supported by the system.|
157| typedef struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)  [OH_Drawing_FontConfigInfo](#oh_drawing_fontconfiginfo) | Defines a struct for the information about a system font configuration.|
158| typedef struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md)  [OH_Drawing_FontStyleStruct](#oh_drawing_fontstylestruct) | Defines a struct for a font style.|
159| typedef struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)  [OH_Drawing_StrutStyle](#oh_drawing_strutstyle) | Defines a struct for a strut style. The strut style determines the line spacing, baseline alignment mode, and other properties related to the line height when drawing texts.|
160| typedef struct [OH_Drawing_Canvas](#oh_drawing_canvas)  [OH_Drawing_Canvas](#oh_drawing_canvas) | Defines a struct for a rectangular canvas, on which various shapes, images, and texts can be drawn by using the brush and pen.|
161| typedef struct [OH_Drawing_Pen](#oh_drawing_pen)  [OH_Drawing_Pen](#oh_drawing_pen) | Defines a struct for a pen, which is used to describe the style and color to outline a shape.|
162| typedef struct [OH_Drawing_Region](#oh_drawing_region)  [OH_Drawing_Region](#oh_drawing_region) | Defines a struct for a region, which represents a closed area on the canvas for more accurate graphic control.|
163| typedef struct [OH_Drawing_Brush](#oh_drawing_brush)  [OH_Drawing_Brush](#oh_drawing_brush) | Defines a struct for a brush, which is used to describe the style and color to fill in a shape.|
164| typedef struct [OH_Drawing_Path](#oh_drawing_path)  [OH_Drawing_Path](#oh_drawing_path) | Defines a struct for a path, which is used to customize various shapes.|
165| typedef struct [OH_Drawing_PixelMap](#oh_drawing_pixelmap)  [OH_Drawing_PixelMap](#oh_drawing_pixelmap) | Defines a struct for a pixel map, which is used to wrap the real pixel map supported by the image framework.|
166| typedef struct [OH_Drawing_Bitmap](#oh_drawing_bitmap)  [OH_Drawing_Bitmap](#oh_drawing_bitmap) | Defines a struct for a bitmap, which is a memory area that contains the pixel data of a shape.|
167| typedef struct [OH_Drawing_Point](#oh_drawing_point)  [OH_Drawing_Point](#oh_drawing_point) | Defines a struct for a coordinate point.|
168| typedef struct [OH_Drawing_ColorSpace](#oh_drawing_colorspace)  [OH_Drawing_ColorSpace](#oh_drawing_colorspace) | Defines a struct for a color space, which is used to describe the color information.|
169| typedef struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Point2D](#oh_drawing_point2d) | Defines a struct for a two-dimensional coordinate point.|
170| typedef [OH_Drawing_Point2D](_o_h___drawing___point2_d.md)  [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) | Defines a struct for the radii of a rounded corner. The radii consist of the radius in the x-axis direction and that in the y-axis direction.|
171| typedef struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md)  [OH_Drawing_Point3D](#oh_drawing_point3d) | Defines a struct for a three-dimensional coordinate point.|
172| typedef struct [OH_Drawing_PathEffect](#oh_drawing_patheffect)  [OH_Drawing_PathEffect](#oh_drawing_patheffect) | Defines a struct for a path effect that affects the stroke.|
173| typedef struct [OH_Drawing_Rect](#oh_drawing_rect)  [OH_Drawing_Rect](#oh_drawing_rect) | Defines a struct for a rectangle.|
174| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect)  [OH_Drawing_RoundRect](#oh_drawing_roundrect) | Defines a struct for a rounded rectangle.|
175| typedef struct [OH_Drawing_Matrix](#oh_drawing_matrix)  [OH_Drawing_Matrix](#oh_drawing_matrix) | Defines a struct for a matrix, which is used to describe coordinate transformation.|
176| typedef struct [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)  [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | Defines a struct for a shader effect, which is used to describe the source color of the drawn content.|
177| typedef struct [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)  [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) | Defines a struct for a shadow, which is used to describe the shadow layer of the drawn content.|
178| typedef struct [OH_Drawing_Filter](#oh_drawing_filter)  [OH_Drawing_Filter](#oh_drawing_filter) | Defines a struct for a filter, which consists of a color filter and mask filter.|
179| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter)  [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | Defines a struct for a mask filter.|
180| typedef struct [OH_Drawing_ColorFilter](#oh_drawing_colorfilter)  [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | Defines a struct for a color filter, which is used to convert a color into a new one.|
181| typedef struct [OH_Drawing_Font](#oh_drawing_font)  [OH_Drawing_Font](#oh_drawing_font) | Defines a struct for a font.|
182| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream)  [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | Defines a struct for a memory stream.|
183| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface)  [OH_Drawing_Typeface](#oh_drawing_typeface) | Defines a struct for a typeface.|
184| typedef struct [OH_Drawing_TextBlob](#oh_drawing_textblob)  [OH_Drawing_TextBlob](#oh_drawing_textblob) | Defines a struct for a text blob, an immutable container that holds multiple texts. Each text blob consists of glyphs and position.|
185| typedef struct [OH_Drawing_Image](#oh_drawing_image)  [OH_Drawing_Image](#oh_drawing_image) | Defines a struct for an image that describes a two-dimensional pixel array.|
186| typedef struct [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)  [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) | Defines a struct for sampling options, which describe the sampling methods for images and bitmaps.|
187| typedef struct [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder)  [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | Defines a struct for a text blob builder, which is used to build a text blob.|
188| typedef struct [OH_Drawing_GpuContext](#oh_drawing_gpucontext)  [OH_Drawing_GpuContext](#oh_drawing_gpucontext) | Defines a struct for the GPU context, which is used to describe the GPU backend context.|
189| typedef struct [OH_Drawing_Surface](#oh_drawing_surface)  [OH_Drawing_Surface](#oh_drawing_surface) | Defines a struct for a surface, which is used to manage the content drawn on the canvas.|
190| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat)  [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | Defines an enum for the storage formats of bitmap pixels.|
191| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)  [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | Defines an enum for the alpha formats of bitmap pixels.|
192| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode)  [OH_Drawing_BlendMode](#oh_drawing_blendmode) | Defines an enum for the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule).|
193| typedef struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md)  [OH_Drawing_Image_Info](#oh_drawing_image_info) | Defines a struct for the image information.|
194| typedef struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)  [OH_Drawing_RectStyle_Info](#oh_drawing_rectstyle_info) | Defines a struct for the style of a rectangle.|
195| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding)  [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | Defines an enum for the text encoding types.|
196| typedef struct [OH_Drawing_FontMgr](#oh_drawing_fontmgr)  [OH_Drawing_FontMgr](#oh_drawing_fontmgr) | Defines a struct for the font manager, which is used for font management.|
197| typedef struct [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)  [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) | Defines a struct for a font style set, which is used for font style family matching.|
198| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | Defines an enum for the shadow flags.|
199
200### Enums
201
202| Name| Description|
203| -------- | -------- |
204| [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle-1) { DRAWING_PATH_DASH_STYLE_TRANSLATE, DRAWING_PATH_DASH_STYLE_ROTATE, DRAWING_PATH_DASH_STYLE_MORPH } | Enumerates the drawing styles for path effects. |
205| [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype-1) { ALL = 1 << 0, GENERIC = 1 << 1, STYLISH = 1 << 2, INSTALLED = 1 << 3, CUSTOMIZED = 1 << 4 } | Enumerates the system font types.|
206| [OH_Drawing_ErrorCode](#oh_drawing_errorcode-1) { OH_DRAWING_SUCCESS = 0, OH_DRAWING_ERROR_NO_PERMISSION = 201, OH_DRAWING_ERROR_INVALID_PARAMETER = 401, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE = 26200001,OH_DRAWING_ERROR_ALLOCATION_FAILED = 26200002 } | Enumerates the error codes that may be generated by the module.|
207| [OH_Drawing_PathOpMode](#oh_drawing_pathopmode-1) {<br>PATH_OP_MODE_DIFFERENCE, PATH_OP_MODE_INTERSECT, PATH_OP_MODE_UNION, PATH_OP_MODE_XOR,<br>PATH_OP_MODE_REVERSE_DIFFERENCE<br>} | Enumerates the operation modes available for a path.|
208| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags-1) { GET_POSITION_MATRIX, GET_TANGENT_MATRIX, GET_POSITION_AND_TANGENT_MATRIX } | Enumerates the types of matrix information obtained during path measurement.|
209| [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode-1) {<br>REGION_OP_MODE_DIFFERENCE, REGION_OP_MODE_INTERSECT, REGION_OP_MODE_UNION, REGION_OP_MODE_XOR,<br>REGION_OP_MODE_REVERSE_DIFFERENCE, REGION_OP_MODE_REPLACE<br>} | Enumerates the operation modes available for a region.|
210| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | Enumerates the constraint types of the source rectangle.|
211| [OH_Drawing_PointMode](#oh_drawing_pointmode-1) { POINT_MODE_POINTS, POINT_MODE_LINES, POINT_MODE_POLYGON } | Enumerates the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.|
212| [OH_Drawing_VertexMode](#oh_drawing_vertexmode-1) { VERTEX_MODE_TRIANGLES, VERTEX_MODE_TRIANGLESSTRIP, VERTEX_MODE_TRIANGLEFAN } | Enumerates the modes of interpreting the geometry of a given vertex.|
213| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | Enumerates the canvas clipping modes.|
214| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | Enumerates the font edging types.|
215| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | Enumerates the font hinting types.|
216| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | Enumerates the blur types.|
217| [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit-1) { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } | Enumerates the matrix scaling modes.|
218| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | Enumerates the directions of a closed contour.|
219| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1) { PATH_FILL_TYPE_WINDING, PATH_FILL_TYPE_EVEN_ODD, PATH_FILL_TYPE_INVERSE_WINDING, PATH_FILL_TYPE_INVERSE_EVEN_ODD } | Enumerates the fill types of a path.|
220| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | Enumerates the path adding modes.|
221| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle-1) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | Enumerates the line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.|
222| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle-1) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | Enumerates the line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.|
223| [OH_Drawing_CornerPos](#oh_drawing_cornerpos-1) { CORNER_POS_TOP_LEFT, CORNER_POS_TOP_RIGHT, CORNER_POS_BOTTOM_RIGHT, CORNER_POS_BOTTOM_LEFT } | Enumerates the corner positions of a rounded rectangle.|
224| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | Enumerates the filter modes.|
225| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | Enumerates the mipmap modes.|
226| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | Enumerates the tile modes of the shader effect.|
227| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | Enumerates the text directions.|
228| [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 the text alignment modes.|
229| [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 the font weights.|
230| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | Enumerates the text baselines.|
231| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | Enumerates the text decorations.|
232| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | Enumerates the font styles.|
233| [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment-1) {<br>ALIGNMENT_OFFSET_AT_BASELINE, ALIGNMENT_ABOVE_BASELINE, ALIGNMENT_BELOW_BASELINE, ALIGNMENT_TOP_OF_ROW_BOX,<br>ALIGNMENT_BOTTOM_OF_ROW_BOX, ALIGNMENT_CENTER_OF_ROW_BOX<br>} | Enumerates the vertical alignment modes of placeholders.|
234| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle-1) {<br>TEXT_DECORATION_STYLE_SOLID, TEXT_DECORATION_STYLE_DOUBLE, TEXT_DECORATION_STYLE_DOTTED, TEXT_DECORATION_STYLE_DASHED,<br>TEXT_DECORATION_STYLE_WAVY<br>} | Enumerates the text decoration styles.|
235| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | Enumerates the ellipsis styles.|
236| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy-1) { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } | Enumerates the text break strategies.|
237| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype-1) { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2, WORD_BREAK_TYPE_BREAK_HYPHEN = 3 } | Enumerates the word break types.|
238| [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle-1) {<br>RECT_HEIGHT_STYLE_TIGHT, RECT_HEIGHT_STYLE_MAX, RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,<br>RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, RECT_HEIGHT_STYLE_STRUCT<br>} | Enumerates the rectangle height styles.|
239| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | Enumerates the rectangle width styles.|
240| [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) {<br>SUCCESS_FONT_CONFIG_INFO = 0, ERROR_FONT_CONFIG_INFO_UNKNOWN = 1, ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2, ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3,<br>ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4<br>} | Enumerates the error codes that may be used during the obtaining of system font configurations.|
241| [OH_Drawing_FontWidth](#oh_drawing_fontwidth) {<br>FONT_WIDTH_ULTRA_CONDENSED = 1, FONT_WIDTH_EXTRA_CONDENSED = 2, FONT_WIDTH_CONDENSED = 3, FONT_WIDTH_SEMI_CONDENSED = 4,<br>FONT_WIDTH_NORMAL = 5, FONT_WIDTH_SEMI_EXPANDED = 6, FONT_WIDTH_EXPANDED = 7, FONT_WIDTH_EXTRA_EXPANDED = 8,<br>FONT_WIDTH_ULTRA_EXPANDED = 9<br>} | Enumerates the font widths. |
242| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) { TEXT_HEIGHT_ALL = 0x0, TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, TEXT_HEIGHT_DISABLE_ALL = 0x1 \| 0x2 } | Enumerates the text height modifier patterns.|
243| [OH_Drawing_TextStyleType](#oh_drawing_textstyletype) {<br>TEXT_STYLE_NONE, TEXT_STYLE_ALL_ATTRIBUTES, TEXT_STYLE_FONT, TEXT_STYLE_FOREGROUND,<br>TEXT_STYLE_BACKGROUND, TEXT_STYLE_SHADOW, TEXT_STYLE_DECORATIONS, TEXT_STYLE_LETTER_SPACING,<br>TEXT_STYLE_WORD_SPACING<br>} | Enumerates the text style types.|
244| [OH_Drawing_ColorFormat](#oh_drawing_colorformat-1) {<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 the storage formats of bitmap pixels.|
245| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat-1) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | Enumerates the alpha formats of bitmap pixels.|
246| [OH_Drawing_BlendMode](#oh_drawing_blendmode-1) {<br>BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST, BLEND_MODE_SRC_OVER,<br>BLEND_MODE_DST_OVER, BLEND_MODE_SRC_IN, BLEND_MODE_DST_IN, BLEND_MODE_SRC_OUT,<br>BLEND_MODE_DST_OUT, BLEND_MODE_SRC_ATOP, BLEND_MODE_DST_ATOP, BLEND_MODE_XOR,<br>BLEND_MODE_PLUS, BLEND_MODE_MODULATE, BLEND_MODE_SCREEN, BLEND_MODE_OVERLAY,<br>BLEND_MODE_DARKEN, BLEND_MODE_LIGHTEN, BLEND_MODE_COLOR_DODGE, BLEND_MODE_COLOR_BURN,<br>BLEND_MODE_HARD_LIGHT, BLEND_MODE_SOFT_LIGHT, BLEND_MODE_DIFFERENCE, BLEND_MODE_EXCLUSION,<br>BLEND_MODE_MULTIPLY, BLEND_MODE_HUE, BLEND_MODE_SATURATION, BLEND_MODE_COLOR,<br>BLEND_MODE_LUMINOSITY<br>} | Enumerates the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule).|
247| [OH_Drawing_TextEncoding](#oh_drawing_textencoding-1) { TEXT_ENCODING_UTF8, TEXT_ENCODING_UTF16, TEXT_ENCODING_UTF32, TEXT_ENCODING_GLYPH_ID } | Enumerates the text encoding types.|
248| [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags-1) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | Enumerates the shadow flags.|
249
250### Functions
251
252| Name| Description|
253| -------- | -------- |
254| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PathGetSegment](#oh_drawing_pathgetsegment) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float start, float stop, bool startWithMoveTo, [OH_Drawing_Path](#oh_drawing_path) \*dst, bool \*result) | Extracts a segment of a path and appends it to a destination path. |
255| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateSumPathEffect](#oh_drawing_createsumpatheffect) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*firstPathEffect, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*secondPathEffect) | Creates an overlay path effect based on two distinct path effects that take effect separately. |
256| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreatePathDashEffect](#oh_drawing_createpathdasheffect) (const [OH_Drawing_Path](#oh_drawing_path) \*path, float advance, float phase, [OH_Drawing_PathDashStyle](#oh_drawing_pathdashstyle) type) | Creates a dashed path effect. |
257| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDiscretePathEffect](#oh_drawing_creatediscretepatheffect) (float segLength, float deviation) | Creates a path effect that segments the path and scatters the segments in an irregular pattern along the path. |
258| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateCornerPathEffect](#oh_drawing_createcornerpatheffect) (float radius) | Creates a path effect that transforms the sharp angle between line segments into a rounded corner with the specified radius. |
259| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateComposePathEffect](#oh_drawing_createcomposepatheffect) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*outer, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*inner) | Creates a path effect by sequentially applying the inner effect and then the outer effect. |
260| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate) (void) | Creates an **OH_Drawing_GpuContext** object, for which the backend type depends on the device. |
261| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawArcWithCenter](#oh_drawing_canvasdrawarcwithcenter) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect, float startAngle, float sweepAngle, bool useCenter) | Draws an arc. It enables you to define the starting angle, sweep angle, and whether the arc's endpoints should connect to its center. |
262| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawNestedRoundRect](#oh_drawing_canvasdrawnestedroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*outer, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*inner) | Draws two nested rounded rectangles. The outer rectangle boundary must contain the inner rectangle boundary. Otherwise, there is no drawing effect.|
263| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasQuickRejectPath](#oh_drawing_canvasquickrejectpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Path](#oh_drawing_path) \*path, bool \*quickReject) | Checks whether the path is not intersecting with the canvas area. The canvas area includes its boundaries. |
264| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasQuickRejectRect](#oh_drawing_canvasquickrejectrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect, bool \*quickReject) | Checks whether the rectangle is not intersecting with the canvas area. The canvas area includes its boundaries. |
265| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawPixelMapNine](#oh_drawing_canvasdrawpixelmapnine) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*pixelMap, const [OH_Drawing_Rect](#oh_drawing_rect) \*center, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_FilterMode](#oh_drawing_filtermode) mode) | Splits a PixelMap into nine sections using two horizontal and two vertical lines: four edge sections, four corner sections, and a central section. If the four corner sections are smaller than the target rectangle, they will be drawn in the target rectangle without scaling. Otherwise, they will be scaled to fit the target rectangle. Any remaining space will be filled by stretching or compressing the other five sections to cover the entire target rectangle. |
266| [OH_Drawing_Surface](#oh_drawing_surface) \* [OH_Drawing_SurfaceCreateOnScreen](#oh_drawing_surfacecreateonscreen) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*gpuContext, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) imageInfo, void \*window) | Creates an **OH_Drawing_Surface** object bound to the window using the GPU context to manage the content drawn on the canvas. |
267| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_SurfaceFlush](#oh_drawing_surfaceflush) ([OH_Drawing_Surface](#oh_drawing_surface) \*surface) | Pushes the drawing content from an **OH_Drawing_Surface** object to the GPU for rendering. |
268| void [OH_Drawing_ErrorCodeReset](#oh_drawing_errorcodereset) (void) | Resets the error code of this module to **OH_DRAWING_SUCCESS**.<br>When a function that does not return an error code fails, the error code obtained through [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) is reset to the corresponding error number. However, it is not reset to **OH_DRAWING_SUCCESS** for a successful operation.<br>By calling this function, you can manually reset the error code to **OH_DRAWING_SUCCESS**, avoiding interference between different functions and simplifying the debugging process.|
269| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontSetThemeFontFollowed](#oh_drawing_fontsetthemefontfollowed) ([OH_Drawing_Font](#oh_drawing_font) \*font, bool followed) | Sets whether to follow the theme font. When **followed** is set to **true**, the theme font is used if it is enabled by the system and no typeface is set.|
270| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontIsThemeFontFollowed](#oh_drawing_fontisthemefontfollowed) (const [OH_Drawing_Font](#oh_drawing_font) \*font, bool \*followed) | Checks whether the font follows the theme font. By default, the theme font is not followed.|
271| OH_Drawing_FontCollection \* [OH_Drawing_GetFontCollectionGlobalInstance](#oh_drawing_getfontcollectionglobalinstance) (void) | Obtains the global **OH_Drawing_FontCollection** object, which can be used to sense the theme font information. Do not release the object. |
272| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | Creates an **OH_Drawing_Bitmap** object.|
273| void [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.|
274| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreateFromPixels](#oh_drawing_bitmapcreatefrompixels) ([OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*, void \*pixels, uint32_t rowBytes) | Creates an **OH_Drawing_Bitmap** object, with the address of the memory for storing the bitmap pixels set to the memory address that you applied for.|
275| void [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 a bitmap and sets the pixel format for the bitmap.|
276| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the width of a bitmap.|
277| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the height of a bitmap.|
278| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_BitmapGetColorFormat](#oh_drawing_bitmapgetcolorformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the pixel format of a bitmap.|
279| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_BitmapGetAlphaFormat](#oh_drawing_bitmapgetalphaformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the alpha component of a bitmap.|
280| void \* [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.|
281| void [OH_Drawing_BitmapGetImageInfo](#oh_drawing_bitmapgetimageinfo) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | Obtains the image information of a bitmap.|
282| bool [OH_Drawing_BitmapReadPixels](#oh_drawing_bitmapreadpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*dstInfo, void \*dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY) | Reads pixels of a rectangle in a bitmap to the specified buffer.|
283| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | Creates an **OH_Drawing_Brush** object.|
284| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCopy](#oh_drawing_brushcopy) ([OH_Drawing_Brush](#oh_drawing_brush) \*brush) | Copies an existing [OH_Drawing_Brush](#oh_drawing_brush) object to create a new one.|
285| void [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.|
286| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Checks whether anti-aliasing is enabled for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.|
287| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | Enables or disables anti-aliasing for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.|
288| uint32_t [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.|
289| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | Sets the color for a brush. The color is used by the brush to fill in a shape.|
290| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape.|
291| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape.|
292| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | Sets the shader effect for a brush.|
293| void [OH_Drawing_BrushSetShadowLayer](#oh_drawing_brushsetshadowlayer) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | Sets the shadow layer for a brush. The shadow layer effect takes effect only when text is drawn.|
294| void [OH_Drawing_BrushSetFilter](#oh_drawing_brushsetfilter) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | Sets a filter for a brush. The filter is a container that holds a mask filter and color filter.|
295| void [OH_Drawing_BrushGetFilter](#oh_drawing_brushgetfilter) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | Obtains the filter of a brush. The filter is a container that holds a mask filter and color filter.|
296| void [OH_Drawing_BrushSetBlendMode](#oh_drawing_brushsetblendmode) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | Sets a blender for a brush. The blender implements the specified blend mode.|
297| void [OH_Drawing_BrushReset](#oh_drawing_brushreset) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | Resets a brush to the initial state. All configured attributes are cleared.|
298| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | Creates an **OH_Drawing_Canvas** object.|
299| void [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.|
300| void [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.)|
301| void [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 can use the style and color of the pen to outline a shape. If the pen effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.|
302| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Detaches the pen from a canvas so that the canvas can no longer use the style and color of the pen to outline a shape.|
303| void [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 can use the style and color of the brush to fill in a shape. If the brush effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.|
304| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Detaches the brush from a canvas so that the canvas can no longer use the previously set brush to fill in a shape.|
305| void [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. This function must be used in pair with [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore).|
306| void [OH_Drawing_CanvasSaveLayer](#oh_drawing_canvassavelayer) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Saves the matrix and cropping region, and allocates a bitmap for subsequent drawing. If you call [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore), the changes made to the matrix and clipping region are discarded, and the bitmap is drawn.|
307| void [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.|
308| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the number of canvas statuses (canvas matrices) saved in the stack.|
309| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | Restores to a given number of canvas statuses (canvas matrices).|
310| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | Draws a line segment.|
311| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | Draws a path.|
312| void [OH_Drawing_CanvasDrawPixelMapRect](#oh_drawing_canvasdrawpixelmaprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | Draws a portion of a pixel map onto a specified area of the canvas.|
313| void [OH_Drawing_CanvasDrawBackground](#oh_drawing_canvasdrawbackground) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Draws a background filled with a brush.|
314| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | Draws a region.|
315| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawPoint](#oh_drawing_canvasdrawpoint) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*point) | Draws a point.|
316| void [OH_Drawing_CanvasDrawPoints](#oh_drawing_canvasdrawpoints) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_PointMode](#oh_drawing_pointmode) mode, uint32_t count, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*) | Draws multiple points. You can draw a single point, a line segment, or an open polygon.|
317| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | Draws a bitmap. A bitmap, also referred to as a dot matrix image, a pixel map image, or a grid image, includes single points called pixels (image elements).|
318| void [OH_Drawing_CanvasDrawBitmapRect](#oh_drawing_canvasdrawbitmaprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | Draws a portion of a bitmap onto a specified area of the canvas.|
319| void [OH_Drawing_CanvasSetMatrix](#oh_drawing_canvassetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Sets the matrix status for a canvas.|
320| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Resets the matrix of a canvas to an identity matrix.|
321| void [OH_Drawing_CanvasDrawImageRectWithSrc](#oh_drawing_canvasdrawimagerectwithsrc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Image](#oh_drawing_image) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*, [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint)) | Draws a portion of an image onto a specified area of the canvas. The area selected by the source rectangle is scaled and translated to the destination rectangle.|
322| void [OH_Drawing_CanvasDrawImageRect](#oh_drawing_canvasdrawimagerect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | Draws an image onto a specified area of the canvas.|
323| void [OH_Drawing_CanvasDrawVertices](#oh_drawing_canvasdrawvertices) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_VertexMode](#oh_drawing_vertexmode) vertexMmode, int32_t vertexCount, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*positions, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*texs, const uint32_t \*colors, int32_t indexCount, const uint16_t \*indices, [OH_Drawing_BlendMode](#oh_drawing_blendmode) mode) | Draws a triangular grid described by a vertex array.|
324| bool [OH_Drawing_CanvasReadPixels](#oh_drawing_canvasreadpixels) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*, void \*dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY) | Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases.|
325| bool [OH_Drawing_CanvasReadPixelsToBitmap](#oh_drawing_canvasreadpixelstobitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, int32_t srcX, int32_t srcY) | Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases.|
326| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasIsClipEmpty](#oh_drawing_canvasisclipempty) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, bool \*isClipEmpty) | Checks whether the region that can be drawn is empty after cropping.|
327| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasGetImageInfo](#oh_drawing_canvasgetimageinfo) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*imageInfo) | Obtains the image information of a canvas.|
328| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws a rectangle.|
329| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | Draws a circle.|
330| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawColor](#oh_drawing_canvasdrawcolor) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode) blendMode) | Fills the entire canvas with the specified color and blend mode.|
331| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws an oval.|
332| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | Draws an arc. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn.|
333| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | Draws a rounded rectangle.|
334| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawSingleCharacter](#oh_drawing_canvasdrawsinglecharacter) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const char \*str, const [OH_Drawing_Font](#oh_drawing_font) \*font, float x, float y) | Draws a single character. If the typeface of the current font does not support the character to draw, the system typeface is used to draw the character.|
335| void [OH_Drawing_CanvasDrawTextBlob](#oh_drawing_canvasdrawtextblob) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*, float x, float y) | Draws a text blob. If the typeface used to construct **OH_Drawing_TextBlob** does not support a character, that character will not be drawn.|
336| uint32_t [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.|
337| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | Creates an **OH_Drawing_ColorFilter** object with a given blend mode.|
338| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateCompose](#oh_drawing_colorfiltercreatecompose) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter1, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter2) | Creates an **OH_Drawing_ColorFilter** object by combining another two color filters.|
339| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | Creates an **OH_Drawing_ColorFilter** object with a given 5x4 color matrix.|
340| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | Creates an **OH_Drawing_ColorFilter** object that applies the sRGB gamma curve to the RGB channels.|
341| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | Creates an **OH_Drawing_ColorFilter** object that applies the RGB channels to the sRGB gamma curve.|
342| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | Creates an **OH_Drawing_ColorFilter** object that multiplies the passed-in luma into the alpha channel and sets the RGB channels to zero.|
343| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | Destroys an **OH_Drawing_ColorFilter** object and reclaims the memory occupied by the object.|
344| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | Creates an sRGB color space.|
345| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | Creates an sRGB linear (Gamma 1.0) color space.|
346| void [OH_Drawing_ColorSpaceDestroy](#oh_drawing_colorspacedestroy) ([OH_Drawing_ColorSpace](#oh_drawing_colorspace) \*) | Destroys an **OH_Drawing_ColorSpace** object and reclaims the memory occupied by the object.|
347| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | Obtains the error code of the module.|
348| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | Creates an **OH_Drawing_Filter** object.|
349| void [OH_Drawing_FilterSetImageFilter](#oh_drawing_filtersetimagefilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | Sets an **OH_Drawing_ImageFilter** object for an **OH_Drawing_Filter** object.|
350| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | Sets an **OH_Drawing_MaskFilter** object for an **OH_Drawing_Filter** object.|
351| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | Sets an **OH_Drawing_ColorFilter** object for an **OH_Drawing_Filter** object.|
352| void [OH_Drawing_FilterGetColorFilter](#oh_drawing_filtergetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | Obtains an **OH_Drawing_ColorFilter** object from an **OH_Drawing_Filter** object.|
353| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | Destroys an **OH_Drawing_Filter** object and reclaims the memory occupied by the object.|
354| void [OH_Drawing_FontSetBaselineSnap](#oh_drawing_fontsetbaselinesnap) ([OH_Drawing_Font](#oh_drawing_font) \*, bool baselineSnap) | Sets whether to request that baselines be snapped to pixels when the current canvas matrix is axis aligned.|
355| bool [OH_Drawing_FontIsBaselineSnap](#oh_drawing_fontisbaselinesnap) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned.|
356| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | Sets a font edging effect.|
357| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font edging effect.|
358| void [OH_Drawing_FontSetForceAutoHinting](#oh_drawing_fontsetforceautohinting) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isForceAutoHinting) | Sets whether to forcibly use auto hinting, that is, whether to always hint glyphs.|
359| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether auto hinting is forcibly used.|
360| void [OH_Drawing_FontSetSubpixel](#oh_drawing_fontsetsubpixel) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isSubpixel) | Sets whether to use sub-pixel rendering for a font.|
361| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether sub-pixel rendering is used for a font.|
362| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | Creates an **OH_Drawing_Font** object.|
363| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | Sets a typeface for a font.|
364| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the typeface of a font.|
365| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | Sets the text size for a font.|
366| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the text size.|
367| int [OH_Drawing_FontCountText](#oh_drawing_fontcounttext) ([OH_Drawing_Font](#oh_drawing_font) \*, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding) | Obtains the number of glyphs represented by text.|
368| uint32_t [OH_Drawing_FontTextToGlyphs](#oh_drawing_fonttexttoglyphs) (const [OH_Drawing_Font](#oh_drawing_font) \*, const void \*text, uint32_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, uint16_t \*glyphs, int maxGlyphCount) | Converts text into glyph indices.|
369| void [OH_Drawing_FontGetWidths](#oh_drawing_fontgetwidths) (const [OH_Drawing_Font](#oh_drawing_font) \*, const uint16_t \*glyphs, int count, float \*widths) | Obtains the width of each glyph in a string of text.|
370| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontMeasureSingleCharacter](#oh_drawing_fontmeasuresinglecharacter) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const char \*str, float \*textWidth) | Measures the width of a single character. If the typeface of the current font does not support the character to measure, the system typeface is used to measure the character width.|
371| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontMeasureText](#oh_drawing_fontmeasuretext) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, [OH_Drawing_Rect](#oh_drawing_rect) \*bounds, float \*textWidth) | Obtains the text width and bounding box.|
372| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | Sets linear scaling for a font.|
373| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether linear scaling is used for a font.|
374| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | Sets a horizontal skew factor for a font.|
375| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal skew factor of a font.|
376| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | Sets fake bold for a font by increasing the stroke width.|
377| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether fake bold is used for a font.|
378| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | Sets a horizontal scale factor for a font.|
379| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal scale factor of a font.|
380| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | Sets a font hinting effect.|
381| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font hinting effect.|
382| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | Sets whether to use bitmaps in a font.|
383| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether bitmaps are used in a font.|
384| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | Destroys an **OH_Drawing_Font** object and reclaims the memory occupied by the object.|
385| float [OH_Drawing_FontGetMetrics](#oh_drawing_fontgetmetrics) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | Obtains the measurement information about a font.|
386| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetBounds](#oh_drawing_fontgetbounds) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const uint16_t \*glyphs, uint32_t count, [OH_Drawing_Array](#oh_drawing_array) \*bounds) | Obtains the rectangular bounding box for each glyph in the glyph array.|
387| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetPathForGlyph](#oh_drawing_fontgetpathforglyph) (const [OH_Drawing_Font](#oh_drawing_font) \*font, uint16_t glyph, [OH_Drawing_Path](#oh_drawing_path) \*path) | Obtains the path of a glyph.|
388| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontGetTextPath](#oh_drawing_fontgettextpath) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, float x, float y, [OH_Drawing_Path](#oh_drawing_path) \*path) | Obtains the text outline path.|
389| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object.|
390| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | Destroys an **OH_Drawing_FontCollection** object and reclaims the memory occupied by the object.|
391| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the system fonts.|
392| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the system fonts.|
393| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (void) | Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object that is shareable.|
394| void [OH_Drawing_ClearFontCaches](#oh_drawing_clearfontcaches) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | Clears the font cache. (The font cache has a memory limit and a clearing mechanism. It occupies limited memory. You are not advised to clear it unless otherwise required.)|
395| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | Creates an **OH_Drawing_FontMgr** object, which can be used only to manage system fonts.|
396| void [OH_Drawing_FontMgrDestroy](#oh_drawing_fontmgrdestroy) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | Destroys an **OH_Drawing_FontMgr** object and reclaims the memory occupied by the object.|
397| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | Obtains the number of font families.|
398| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | Obtains the font family name based on an index.|
399| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | Reclaims the memory occupied by a font family name.|
400| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrCreateFontStyleSet](#oh_drawing_fontmgrcreatefontstyleset) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | Creates a font style set from an **OH_Drawing_FontMgr** object.|
401| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Reclaims the memory occupied by a font style set.|
402| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrMatchFamily](#oh_drawing_fontmgrmatchfamily) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName) | Obtains a font style set based on a font family name.|
403| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontMgrMatchFamilyStyle](#oh_drawing_fontmgrmatchfamilystyle) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md)) | Obtains a typeface based on the font style information and font family name.|
404| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontMgrMatchFamilyStyleCharacter](#oh_drawing_fontmgrmatchfamilystylecharacter) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md), const char \*bcp47[], int bcp47Count, int32_t character) | Obtains a typeface for the specified character. A null pointer is returned only when no typeface corresponding to the input UTF-8 character is found in the **OH_Drawing_FontMgr** object.|
405| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetCreateTypeface](#oh_drawing_fontstylesetcreatetypeface) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int index) | Creates a typeface for the specified index.|
406| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_FontStyleSetGetStyle](#oh_drawing_fontstylesetgetstyle) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int32_t index, char \*\*styleName) | Obtains the font style.|
407| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | Reclaims the memory occupied by a font style.|
408| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetMatchStyle](#oh_drawing_fontstylesetmatchstyle) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyleStruct) | Obtains the typeface closest to the font style.|
409| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Obtains the number of fonts in the font style set.|
410| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreateFromGL](#oh_drawing_gpucontextcreatefromgl) ([OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)) | Creates an **OH_Drawing_GpuContext** object that uses OpenGL as the backend interface.|
411| void [OH_Drawing_GpuContextDestroy](#oh_drawing_gpucontextdestroy) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*) | Destroys an **OH_Drawing_GpuContext** object and reclaims the memory occupied by the object.|
412| [OH_Drawing_Image](#oh_drawing_image) \* [OH_Drawing_ImageCreate](#oh_drawing_imagecreate) (void) | Creates an **OH_Drawing_Image** object that describes an array of two-dimensional pixels to draw.|
413| void [OH_Drawing_ImageDestroy](#oh_drawing_imagedestroy) ([OH_Drawing_Image](#oh_drawing_image) \*) | Destroys an **OH_Drawing_Image** object and reclaims the memory occupied by the object.|
414| bool [OH_Drawing_ImageBuildFromBitmap](#oh_drawing_imagebuildfrombitmap) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Builds an image from a bitmap by sharing or copying bitmap pixels. If the bitmap is marked as immutable, the pixel memory is shared, not copied.|
415| int32_t [OH_Drawing_ImageGetWidth](#oh_drawing_imagegetwidth) ([OH_Drawing_Image](#oh_drawing_image) \*) | Obtains the image width, that is, the number of pixels in each line.|
416| int32_t [OH_Drawing_ImageGetHeight](#oh_drawing_imagegetheight) ([OH_Drawing_Image](#oh_drawing_image) \*) | Obtains the image height, that is, the number of pixel lines.|
417| void [OH_Drawing_ImageGetImageInfo](#oh_drawing_imagegetimageinfo) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | Obtains the image information. After this function is called, the passed-in image information object is filled.|
418| [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \* [OH_Drawing_ImageFilterCreateBlur](#oh_drawing_imagefiltercreateblur) (float sigmaX, float sigmaY, [OH_Drawing_TileMode](#oh_drawing_tilemode), [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*input) | Creates an **OH_Drawing_ImageFilter** object with a given blur type.|
419| [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \* [OH_Drawing_ImageFilterCreateFromColorFilter](#oh_drawing_imagefiltercreatefromcolorfilter) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*input) | Creates an **OH_Drawing_ImageFilter** object with a color filter effect.|
420| void [OH_Drawing_ImageFilterDestroy](#oh_drawing_imagefilterdestroy) ([OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | Destroys an **OH_Drawing_ImageFilter** object and reclaims the memory occupied by the object.|
421| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | Creates an **OH_Drawing_MaskFilter** object with a blur type.|
422| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | Destroys an **OH_Drawing_MaskFilter** object and reclaims the memory occupied by the object.|
423| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | Creates an **OH_Drawing_Matrix** object.|
424| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateRotation](#oh_drawing_matrixcreaterotation) (float deg, float x, float y) | Creates an **OH_Drawing_Matrix** with the rotation attribute. The matrix is obtained by rotating an identity matrix by a given degree around the rotation point (x, y).|
425| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateScale](#oh_drawing_matrixcreatescale) (float sx, float sy, float px, float py) | Creates an **OH_Drawing_Matrix** with the scale attribute. The matrix is obtained by scaling an identity matrix with the factor (sx, sy) at the rotation point (px, py).|
426| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateTranslation](#oh_drawing_matrixcreatetranslation) (float dx, float dy) | Creates an **OH_Drawing_Matrix** with the translation attribute. The matrix is obtained by translating the identity matrix by the distance (dx, dy).|
427| void [OH_Drawing_MatrixSetMatrix](#oh_drawing_matrixsetmatrix) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2) | Sets matrix parameters for an **OH_Drawing_Matrix** object.|
428| bool [OH_Drawing_MatrixSetRectToRect](#oh_drawing_matrixsetrecttorect) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) stf) | Scales a matrix to map a source rectangle to a destination rectangle.|
429| void [OH_Drawing_MatrixPreRotate](#oh_drawing_matrixprerotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | Premultiplies a matrix by an identity matrix that rotates by a given degree around the rotation point (px, py).|
430| void [OH_Drawing_MatrixPreScale](#oh_drawing_matrixprescale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).|
431| void [OH_Drawing_MatrixPreTranslate](#oh_drawing_matrixpretranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy).|
432| void [OH_Drawing_MatrixPostRotate](#oh_drawing_matrixpostrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py).|
433| void [OH_Drawing_MatrixPostScale](#oh_drawing_matrixpostscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).|
434| void [OH_Drawing_MatrixPostTranslate](#oh_drawing_matrixposttranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy).|
435| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Resets a matrix to an identity matrix.|
436| void [OH_Drawing_MatrixConcat](#oh_drawing_matrixconcat) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*total, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*a, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*b) | Multiplies two matrices to produce a new matrix. For example, if a given matrix a and a given matrix b are shown as follows:\| A B C \| \| J K L \| a = \| D E F \|, b = \| M N O \| \| G H I \| \| P Q R \| then the final matrix total is as follows:\| A B C \| \| J K L \| \| AJ+BM+CP AK+BN+CQ AL+BO+CR \| total = a \* b = \| D E F \| \* \| M N O \| = \| DJ+EM+FP DK+EN+FQ DL+EO+FR \| \| G H I \| \| P Q R \| \| GJ+HM+IP GK+HN+IQ GL+HO+IR \| |
437| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_MatrixGetAll](#oh_drawing_matrixgetall) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, float value[9]) | Obtains all element values of a matrix.|
438| float [OH_Drawing_MatrixGetValue](#oh_drawing_matrixgetvalue) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, int index) | Obtains a matrix value of a given index, which ranges from 0 to 8.|
439| void [OH_Drawing_MatrixRotate](#oh_drawing_matrixrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py).|
440| void [OH_Drawing_MatrixTranslate](#oh_drawing_matrixtranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | Sets a matrix as an identity matrix and translates it by a given distance (dx, dy).|
441| void [OH_Drawing_MatrixScale](#oh_drawing_matrixscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py).|
442| bool [OH_Drawing_MatrixInvert](#oh_drawing_matrixinvert) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*inverse) | Inverts a matrix and returns the result.|
443| bool [OH_Drawing_MatrixSetPolyToPoly](#oh_drawing_matrixsetpolytopoly) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*src, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*dst, uint32_t count) | Generates a transformation matrix by setting source points and destination points. Both the number of source points and that of destination points must be in the range [0, 4].|
444| void [OH_Drawing_MatrixMapPoints](#oh_drawing_matrixmappoints) (const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*src, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*dst, int count) | Maps a source point array to a destination point array by means of matrix transformation.|
445| bool [OH_Drawing_MatrixMapRect](#oh_drawing_matrixmaprect) (const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, [OH_Drawing_Rect](#oh_drawing_rect) \*dst) | Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices are mapped by means of matrix transformation.|
446| bool [OH_Drawing_MatrixIsEqual](#oh_drawing_matrixisequal) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*other) | Checks whether two **OH_Drawing_Matrix** objects are equal.|
447| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Checks whether an **OH_Drawing_Matrix** object is an identity matrix.|
448| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Destroys an **OH_Drawing_Matrix** object and reclaims the memory occupied by the object.|
449| [OH_Drawing_MemoryStream](#oh_drawing_memorystream) \* [OH_Drawing_MemoryStreamCreate](#oh_drawing_memorystreamcreate) (const void \*data, size_t length, bool copyData) | Creates an **OH_Drawing_MemoryStream** object.|
450| void [OH_Drawing_MemoryStreamDestroy](#oh_drawing_memorystreamdestroy) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*) | Destroys an **OH_Drawing_MemoryStream** object and reclaims the memory occupied by the object.|
451| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | Creates an **OH_Drawing_Path** object.|
452| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCopy](#oh_drawing_pathcopy) ([OH_Drawing_Path](#oh_drawing_path) \*) | Copies an existing [OH_Drawing_Path](#oh_drawing_path) object to create a new one.|
453| void [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.|
454| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Sets the start point of a path.|
455| void [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. If the path is empty, the start point (0, 0) is used.|
456| void [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 is specified first, and then a start angle and a sweep angle are specified. The inscribed ellipse of the rectangle will be used to intercept the arc. The arc is a portion of the ellipse defined by the start angle and the sweep angle. If the path is empty, a line segment from the last point of the path to the start point of the arc is also added.|
457| void [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. If the path is empty, the start point (0, 0) is used.|
458| void [OH_Drawing_PathConicTo](#oh_drawing_pathconicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY, float weight) | Draws a conic curve from the last point of a path to the target point. If the path is empty, the start point (0, 0) is used.|
459| void [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. If the path is empty, the start point (0, 0) is used.|
460| void [OH_Drawing_PathRMoveTo](#oh_drawing_pathrmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Sets the start position relative to the last point of a path. If the path is empty, the start point (0, 0) is used.|
461| void [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Draws a line segment from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.|
462| void [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto) ([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 a point relative to the last point. If the path is empty, the start point (0, 0) is used.|
463| void [OH_Drawing_PathRConicTo](#oh_drawing_pathrconicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY, float weight) | Draws a conic curve from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.|
464| void [OH_Drawing_PathRCubicTo](#oh_drawing_pathrcubicto) ([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 a point relative to the last point. If the path is empty, the start point (0, 0) is used.|
465| void [OH_Drawing_PathAddRect](#oh_drawing_pathaddrect) ([OH_Drawing_Path](#oh_drawing_path) \*, float left, float top, float right, float bottom, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds a rectangle to a path in the specified direction. The start point is the upper left corner of the rectangle.|
466| void [OH_Drawing_PathAddRectWithInitialCorner](#oh_drawing_pathaddrectwithinitialcorner) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_PathDirection](#oh_drawing_pathdirection), uint32_t start) | Adds a rectangle contour to a path in the specified direction.|
467| void [OH_Drawing_PathAddRoundRect](#oh_drawing_pathaddroundrect) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*roundRect, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds a rounded rectangle to a path in the specified direction. When the path direction is clockwise, the start point is at the intersection of the rounded rectangle's left boundary and its lower left corner. When the path direction is counterclockwise, the start point is at the intersection point between the left boundary and the upper left corner.|
468| void [OH_Drawing_PathAddOvalWithInitialPoint](#oh_drawing_pathaddovalwithinitialpoint) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, uint32_t start, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds an oval to a path. **OH_Drawing_Rect** specifies the outer tangent rectangle of the oval, and **OH_Drawing_PathDirection** specifies whether the drawing is clockwise or anticlockwise.|
469| void [OH_Drawing_PathAddArc](#oh_drawing_pathaddarc) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | Adds an arc to a path as the start of a new contour. The arc added is part of the inscribed ellipse of the rectangle, from the start angle through the sweep angle. If the sweep angle is less than or equal to -360°, or if the sweep angle is greater than or equal to 360°, and start angle modulo 90 is nearly zero, an oval instead of an ellipse is added.|
470| void [OH_Drawing_PathAddPath](#oh_drawing_pathaddpath) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Transforms the points in a **src** path by a matrix and adds the new one to the current path.|
471| void [OH_Drawing_PathAddPathWithMatrixAndMode](#oh_drawing_pathaddpathwithmatrixandmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | Transforms the points in a **src** path by a matrix and adds the new one to the current path with the specified adding mode.|
472| void [OH_Drawing_PathAddPathWithMode](#oh_drawing_pathaddpathwithmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | Adds a **src** path to the current path with the specified adding mode.|
473| void [OH_Drawing_PathAddPathWithOffsetAndMode](#oh_drawing_pathaddpathwithoffsetandmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, float dx, float dy, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | Translates a **src** path by an offset and adds the new one to the current path with the specified adding mode.|
474| void [OH_Drawing_PathAddPolygon](#oh_drawing_pathaddpolygon) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*points, uint32_t count, bool isClosed) | Adds a polygon to a path.|
475| void [OH_Drawing_PathAddCircle](#oh_drawing_pathaddcircle) ([OH_Drawing_Path](#oh_drawing_path) \*path, float x, float y, float radius, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds a circle to a path in the specified direction.|
476| void [OH_Drawing_PathAddOval](#oh_drawing_pathaddoval) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds an oval to a path in the specified direction.|
477| bool [OH_Drawing_PathBuildFromSvgString](#oh_drawing_pathbuildfromsvgstring) ([OH_Drawing_Path](#oh_drawing_path) \*path, const char \*str) | Parses the path represented by an SVG string.|
478| bool [OH_Drawing_PathContains](#oh_drawing_pathcontains) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Checks whether a coordinate point is included in this path. For details, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype).|
479| void [OH_Drawing_PathTransform](#oh_drawing_pathtransform) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Transforms the points in a path by a matrix.|
480| void [OH_Drawing_PathTransformWithPerspectiveClip](#oh_drawing_pathtransformwithperspectiveclip) ([OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Path](#oh_drawing_path) \*dst, bool applyPerspectiveClip) | Transforms the points in a **src** path by a matrix and uses the new one to replace the **dst** path. If **dst** is NULL, the **src** path is replaced.|
481| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | Sets the fill type for a path. The fill type determines how "inside" of the path is drawn.|
482| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | Obtains the length of a path.|
483| void [OH_Drawing_PathGetBounds](#oh_drawing_pathgetbounds) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the minimum bounds that enclose a path.|
484| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | Closes a path by drawing a line segment from the current point to the start point of the path.|
485| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | Checks whether a path is closed.|
486| bool [OH_Drawing_PathGetPositionTangent](#oh_drawing_pathgetpositiontangent) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float distance, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*position, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*tangent) | Obtains the coordinates and tangent at a distance from the start point of a path.|
487| bool [OH_Drawing_PathOp](#oh_drawing_pathop) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*other, [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) op) | Combines two paths based on the specified operation mode.|
488| bool [OH_Drawing_PathGetMatrix](#oh_drawing_pathgetmatrix) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float distance, [OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) flag) | Obtains a transformation matrix at a distance from the start point of a path.|
489| void [OH_Drawing_PathOffset](#oh_drawing_pathoffset) ([OH_Drawing_Path](#oh_drawing_path) \*path, [OH_Drawing_Path](#oh_drawing_path) \*dst, float dx, float dy) | Translates a path by an offset along the X axis and Y axis and adds the new one to the **dst** path.|
490| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | Resets path data.|
491| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDashPathEffect](#oh_drawing_createdashpatheffect) (float \*intervals, int count, float phase) | Creates an **OH_Drawing_PathEffect** object with a dashed line effect. The dashed line effect is determined by a group of "on" and "off" intervals.|
492| void [OH_Drawing_PathEffectDestroy](#oh_drawing_patheffectdestroy) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | Destroys an **OH_Drawing_PathEffect** object and reclaims the memory occupied by the object.|
493| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | Creates an **OH_Drawing_Pen** object.|
494| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCopy](#oh_drawing_pencopy) ([OH_Drawing_Pen](#oh_drawing_pen) \*pen) | Copies an existing [OH_Drawing_Pen](#oh_drawing_pen) object to create a new one.|
495| void [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.|
496| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Checks whether anti-aliasing is enabled for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.|
497| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | Enables or disables anti-aliasing for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.|
498| uint32_t [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.|
499| void [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.|
500| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape.|
501| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape.|
502| float [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.|
503| void [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.|
504| float [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.|
505| void [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.|
506| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the line cap style of a pen.|
507| void [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.|
508| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the line join style of a pen.|
509| void [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.|
510| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | Sets the shader effect for a pen.|
511| void [OH_Drawing_PenSetShadowLayer](#oh_drawing_pensetshadowlayer) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn.|
512| void [OH_Drawing_PenSetPathEffect](#oh_drawing_pensetpatheffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | Sets the path effect for a pen.|
513| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | Sets a filter for a pen.|
514| void [OH_Drawing_PenGetFilter](#oh_drawing_pengetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | Obtains the filter of a pen. The filter is a container that holds a mask filter and color filter.|
515| void [OH_Drawing_PenSetBlendMode](#oh_drawing_pensetblendmode) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | Sets a blender for a pen. The blender implements the specified blend mode.|
516| bool [OH_Drawing_PenGetFillPath](#oh_drawing_pengetfillpath) ([OH_Drawing_Pen](#oh_drawing_pen) \*, const [OH_Drawing_Path](#oh_drawing_path) \*src, [OH_Drawing_Path](#oh_drawing_path) \*dst, const [OH_Drawing_Rect](#oh_drawing_rect) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Obtains the source path outline drawn using a pen and represents it using a destination path.|
517| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | Resets a pen to the initial state.|
518| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) (NativePixelMap_ \*) | Obtains the pixel map defined by this module from a pixel map defined by the image framework.|
519| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative) (OH_PixelmapNative \*) | Obtains the pixel map defined by this module from a pixel map defined by the image framework.|
520| void [OH_Drawing_PixelMapDissolve](#oh_drawing_pixelmapdissolve) ([OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*) | Removes the relationship between a pixel map defined by this module and a pixel map defined by the image framework. The relationship is established by calling [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) or [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative).|
521| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | Creates an **OH_Drawing_Point** object.|
522| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetX](#oh_drawing_pointgetx) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*x) | Obtains the X coordinate of a point.|
523| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetY](#oh_drawing_pointgety) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*y) | Obtains the Y coordinate of a point.|
524| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointSet](#oh_drawing_pointset) ([OH_Drawing_Point](#oh_drawing_point) \*point, float x, float y) | Sets the X and Y coordinates of a point.|
525| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | Destroys an **OH_Drawing_Point** object and reclaims the memory occupied by the object.|
526| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | Creates an **OH_Drawing_RecordCmdUtils** object.|
527| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsDestroy](#oh_drawing_recordcmdutilsdestroy) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils) | Destroys an **OH_Drawing_RecordCmdUtils** object and reclaims the memory occupied by the object.|
528| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils, int32_t width, int32_t height, [OH_Drawing_Canvas](#oh_drawing_canvas) \*\*canvas) | Starts recording. This function must be used in pair with [OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording).<br>The **OH_Drawing_RecordCmdUtils** object generates a canvas object of the recording type and calls the interface of the drawing object to record all drawing commands.|
529| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils, [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*\*recordCmd) | Ends recording. This function must be called after [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording).<br>The **OH_Drawing_RecordCmdUtils** object ends recording and stores the drawing commands recorded by the canvas object of the recording type into the generated [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording) object.|
530| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) ([OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | Destroys an **OH_Drawing_RecordCmd** object and reclaims the memory occupied by the object.|
531| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | Creates an **OH_Drawing_Rect** object, without sorting the coordinates passed in. This means that the coordinates of the upper left corner of the rectangle can be greater than those of the lower right corner.|
532| float [OH_Drawing_RectGetHeight](#oh_drawing_rectgetheight) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the height of a rectangle. The height is calculated by using the Y coordinate of the lower right corner of the rectangle minus the Y coordinate of the upper left corner.|
533| float [OH_Drawing_RectGetWidth](#oh_drawing_rectgetwidth) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the width of a rectangle. The width is calculated by using the X coordinate of the lower right corner of the rectangle minus the X coordinate of the upper left corner.|
534| float [OH_Drawing_RectGetLeft](#oh_drawing_rectgetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the X coordinate of the upper left corner of a rectangle.|
535| float [OH_Drawing_RectGetTop](#oh_drawing_rectgettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the Y coordinate of the upper left corner of a rectangle.|
536| float [OH_Drawing_RectGetRight](#oh_drawing_rectgetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the X coordinate of the lower right corner of a rectangle.|
537| float [OH_Drawing_RectGetBottom](#oh_drawing_rectgetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the Y coordinate of the lower right corner of a rectangle.|
538| bool [OH_Drawing_RectIntersect](#oh_drawing_rectintersect) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | Checks whether two rectangles intersect and if yes, sets **rect** to the area of intersection.|
539| bool [OH_Drawing_RectJoin](#oh_drawing_rectjoin) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | Obtains the union of two rectangles.|
540| void [OH_Drawing_RectSetLeft](#oh_drawing_rectsetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float left) | Sets the horizontal coordinate of the upper left corner of a rectangle.|
541| void [OH_Drawing_RectSetTop](#oh_drawing_rectsettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float top) | Sets the vertical coordinate of the upper left corner of a rectangle.|
542| void [OH_Drawing_RectSetRight](#oh_drawing_rectsetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float right) | Sets the horizontal coordinate of the lower right corner of a rectangle.|
543| void [OH_Drawing_RectSetBottom](#oh_drawing_rectsetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float bottom) | Sets the vertical coordinate of the lower right corner of a rectangle.|
544| void [OH_Drawing_RectCopy](#oh_drawing_rectcopy) ([OH_Drawing_Rect](#oh_drawing_rect) \*sRect, [OH_Drawing_Rect](#oh_drawing_rect) \*dRect) | Copies a source rectangle to create a new one.|
545| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | Destroys an **OH_Drawing_Rect** object and reclaims the memory occupied by the object.|
546| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_RectCreateArray](#oh_drawing_rectcreatearray) (size_t size) | Creates a rectangle array object to store multiple rectangle objects. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray) to release the pointer to the object.|
547| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectGetArraySize](#oh_drawing_rectgetarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray, size_t \*pSize) | Obtains the size of a rectangle array, which is an [OH_Drawing_Array](#oh_drawing_array) object.|
548| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectGetArrayElement](#oh_drawing_rectgetarrayelement) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray, size_t index, [OH_Drawing_Rect](#oh_drawing_rect) \*\*rect) | Obtains the rectangle with the specified index in a rectangle array.|
549| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray) ([OH_Drawing_Array](#oh_drawing_array) \*rectArray) | Destroys an **OH_Drawing_Array** object and reclaims the memory occupied by the object.|
550| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | Creates an **OH_Drawing_Region** object for more accurate graphical control.|
551| bool [OH_Drawing_RegionContains](#oh_drawing_regioncontains) ([OH_Drawing_Region](#oh_drawing_region) \*region, int32_t x, int32_t y) | Checks whether a region contains the specified point.|
552| bool [OH_Drawing_RegionOp](#oh_drawing_regionop) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Region](#oh_drawing_region) \*other, [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) op) | Combines two regions based on the specified operation mode.|
553| bool [OH_Drawing_RegionSetRect](#oh_drawing_regionsetrect) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect) | Sets the boundary for an **OH_Drawing_Region** object.|
554| bool [OH_Drawing_RegionSetPath](#oh_drawing_regionsetpath) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Region](#oh_drawing_region) \*clip) | Sets a region to the area described by the path.|
555| void [OH_Drawing_RegionDestroy](#oh_drawing_regiondestroy) ([OH_Drawing_Region](#oh_drawing_region) \*) | Destroys an **OH_Drawing_Region** object and reclaims the memory occupied by the object.|
556| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | Registers a custom font with the font manager. The supported font file formats are .ttf and .otf.|
557| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | Registers a font buffer with the font manager.|
558| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | Creates an **OH_Drawing_RoundRect** object.|
559| void [OH_Drawing_RoundRectSetCorner](#oh_drawing_roundrectsetcorner) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CornerPos](#oh_drawing_cornerpos) pos, [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii)) | Sets the radii of the specified rounded corner in a rounded rectangle.|
560| [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) [OH_Drawing_RoundRectGetCorner](#oh_drawing_roundrectgetcorner) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CornerPos](#oh_drawing_cornerpos) pos) | Obtains the radii of the specified rounded corner in a rounded rectangle.|
561| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | Destroys an **OH_Drawing_RoundRect** object and reclaims the memory occupied by the object.|
562| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RoundRectOffset](#oh_drawing_roundrectoffset) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*roundRect, float dx, float dy) | Translates a rounded rectangle by an offset along the X axis and Y axis.|
563| [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \* [OH_Drawing_SamplingOptionsCreate](#oh_drawing_samplingoptionscreate) ([OH_Drawing_FilterMode](#oh_drawing_filtermode), [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)) | Creates an **OH_Drawing_SamplingOptions** object.|
564| void [OH_Drawing_SamplingOptionsDestroy](#oh_drawing_samplingoptionsdestroy) ([OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | Destroys an **OH_Drawing_SamplingOptions** object and reclaims the memory occupied by the object.|
565| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateColorShader](#oh_drawing_shadereffectcreatecolorshader) (const uint32_t color) | Creates an **OH_Drawing_ShaderEffect** object with a single color.|
566| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateLinearGradient](#oh_drawing_shadereffectcreatelineargradient) (const [OH_Drawing_Point](#oh_drawing_point) \*startPt, const [OH_Drawing_Point](#oh_drawing_point) \*endPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.|
567| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix](#oh_drawing_shadereffectcreatelineargradientwithlocalmatrix) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*startPt, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*endPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.|
568| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateRadialGradient](#oh_drawing_shadereffectcreateradialgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, float radius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | Creates an **OH_Drawing_ShaderEffect** object that generates a radial gradient based on the center and radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.|
569| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix](#oh_drawing_shadereffectcreateradialgradientwithlocalmatrix) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*centerPt, float radius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Creates an **OH_Drawing_ShaderEffect** object that generates a radial gradient based on the center and radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.|
570| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateSweepGradient](#oh_drawing_shadereffectcreatesweepgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | Creates an **OH_Drawing_ShaderEffect** object that generates a sweep gradient based on the center. A sweep gradient paints a gradient in a sweeping arc ranging from 0° to 360°.|
571| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateImageShader](#oh_drawing_shadereffectcreateimageshader) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_TileMode](#oh_drawing_tilemode) tileX, [OH_Drawing_TileMode](#oh_drawing_tilemode) tileY, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Creates an **OH_Drawing_ShaderEffect** object for an image shader. You are advised not to use the API for the canvas of the capture type because it affects the performance.|
572| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateTwoPointConicalGradient](#oh_drawing_shadereffectcreatetwopointconicalgradient) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*startPt, float startRadius, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*endPt, float endRadius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Creates an **OH_Drawing_ShaderEffect** object that generates a gradient between two given circles.|
573| void [OH_Drawing_ShaderEffectDestroy](#oh_drawing_shadereffectdestroy) ([OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | Destroys an **OH_Drawing_ShaderEffect** object and reclaims the memory occupied by the object.|
574| [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \* [OH_Drawing_ShadowLayerCreate](#oh_drawing_shadowlayercreate) (float blurRadius, float x, float y, uint32_t color) | Creates an **OH_Drawing_ShadowLayer** object.|
575| void [OH_Drawing_ShadowLayerDestroy](#oh_drawing_shadowlayerdestroy) ([OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | Destroys an **OH_Drawing_ShadowLayer** object and reclaims the memory occupied by the object.|
576| [OH_Drawing_Surface](#oh_drawing_surface) \* [OH_Drawing_SurfaceCreateFromGpuContext](#oh_drawing_surfacecreatefromgpucontext) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*, bool budgeted, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md)) | Creates an **OH_Drawing_Surface** object using the GPU context to manage the content drawn on the canvas.|
577| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_SurfaceGetCanvas](#oh_drawing_surfacegetcanvas) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | Obtains a canvas from an **OH_Drawing_Surface** object.|
578| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied.|
579| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | Creates an **OH_Drawing_TextBlobBuilder** object.|
580| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromText](#oh_drawing_textblobcreatefromtext) (const void \*text, size_t byteLength, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | Creates an **OH_Drawing_TextBlob** object from the text.|
581| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromPosText](#oh_drawing_textblobcreatefrompostext) (const void \*text, size_t byteLength, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | Creates an **OH_Drawing_TextBlob** object from the text. The coordinates of each character in the **OH_Drawing_TextBlob** object are determined by the coordinate information in the **OH_Drawing_Point2D** array.|
582| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromString](#oh_drawing_textblobcreatefromstring) (const char \*str, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | Creates an **OH_Drawing_TextBlob** object from a string.|
583| void [OH_Drawing_TextBlobGetBounds](#oh_drawing_textblobgetbounds) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the bounds of an **OH_Drawing_TextBlob** object.|
584| uint32_t [OH_Drawing_TextBlobUniqueID](#oh_drawing_textblobuniqueid) (const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | Obtains the unique identifier of a text blob. The identifier is a non-zero value.|
585| const [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) \* [OH_Drawing_TextBlobBuilderAllocRunPos](#oh_drawing_textblobbuilderallocrunpos) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*, const [OH_Drawing_Font](#oh_drawing_font) \*, int32_t count, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Allocates a run to store glyphs and positions. The pointer returned does not need to be managed by the caller. It can no longer be used after [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) is called.|
586| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | Makes an **OH_Drawing_TextBlob** object from an **OH_Drawing_TextBlobBuilder**.|
587| void [OH_Drawing_TextBlobDestroy](#oh_drawing_textblobdestroy) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | Destroys an **OH_Drawing_TextBlob** object and reclaims the memory occupied by the object.|
588| void [OH_Drawing_TextBlobBuilderDestroy](#oh_drawing_textblobbuilderdestroy) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | Destroys an **OH_Drawing_TextBlobBuilder** object and reclaims the memory occupied by the object.|
589| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_MatchFontDescriptors](#oh_drawing_matchfontdescriptors) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*, size_t \*) | Obtains all system font descriptors that match a font descriptor. In the [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) struct, the **path** field is not used for matching, and other fields are valid only when they are not set to their default values. If all fields in [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) are set to their default values, all system font descriptors are returned. If no matching is found, NULL is returned. When [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) is no longer required, call [OH_Drawing_DestroyFontDescriptors](_drawing.md#oh_drawing_destroyfontdescriptors) to release the pointer to the object.|
590| void [OH_Drawing_DestroyFontDescriptors](#oh_drawing_destroyfontdescriptors) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*, size_t) | Releases an array of [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) objects.|
591| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_GetFontDescriptorByFullName](#oh_drawing_getfontdescriptorbyfullname) (const [OH_Drawing_String](_o_h___drawing___string.md) \*, [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | Obtains a font descriptor based on the font name and type. System fonts, style fonts, and user-installed fonts are supported. A font descriptor is a data structure that describes font features. It contains details of the font appearance and properties.|
592| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetSystemFontFullNamesByType](#oh_drawing_getsystemfontfullnamesbytype) ([OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | Obtains an array of font names by font type.|
593| const [OH_Drawing_String](_o_h___drawing___string.md) \* [OH_Drawing_GetSystemFontFullNameByIndex](#oh_drawing_getsystemfontfullnamebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*, size_t) | Obtains the font name with the specified index in the font name array.|
594| void [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) ([OH_Drawing_Array](#oh_drawing_array) \*) | Releases the memory occupied by the font name array obtained by font type.|
595| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_TypographyGetTextLines](#oh_drawing_typographygettextlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*typography) | Obtains the array of text lines in a typography object. This array contains one or more text line objects. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines) to release the pointer to the object.|
596| void [OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines) ([OH_Drawing_Array](#oh_drawing_array) \*lines) | Releases the memory occupied by a text line array.|
597| void [OH_Drawing_DestroyTextLine](#oh_drawing_destroytextline) (OH_Drawing_TextLine \*line) | Releases the memory occupied by a text line object. This is applicable only to text line objects that have requested memory on their own and not to a particular text line object within a text line array.|
598| OH_Drawing_TextLine \* [OH_Drawing_GetTextLineByIndex](#oh_drawing_gettextlinebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*lines, size_t index) | Obtains the text line object with the specified index in a text line array.|
599| double [OH_Drawing_TextLineGetGlyphCount](#oh_drawing_textlinegetglyphcount) (OH_Drawing_TextLine \*line) | Obtains the number of glyphs in a text line object.|
600| void [OH_Drawing_TextLineGetTextRange](#oh_drawing_textlinegettextrange) (OH_Drawing_TextLine \*line, size_t \*start, size_t \*end) | Obtains the range of the text in a text line object in the entire paragraph.|
601| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_TextLineGetGlyphRuns](#oh_drawing_textlinegetglyphruns) (OH_Drawing_TextLine \*line) | Obtains the array of glyph runs in a text line object.|
602| void [OH_Drawing_DestroyRuns](#oh_drawing_destroyruns) ([OH_Drawing_Array](#oh_drawing_array) \*runs) | Releases the memory occupied by a glyph run array.|
603| OH_Drawing_Run \* [OH_Drawing_GetRunByIndex](#oh_drawing_getrunbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*runs, size_t index) | Obtains the glyph run object with the specified index in a glyph run array.|
604| void [OH_Drawing_TextLinePaint](#oh_drawing_textlinepaint) (OH_Drawing_TextLine \*line, [OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, double x, double y) | Paints a text line on the canvas with the coordinate point (x, y) as the upper left corner.|
605| OH_Drawing_TextLine \* [OH_Drawing_TextLineCreateTruncatedLine](#oh_drawing_textlinecreatetruncatedline) (OH_Drawing_TextLine \*line, double width, int mode, const char \*ellipsis) | Creates a truncated text line object.|
606| double [OH_Drawing_TextLineGetTypographicBounds](#oh_drawing_textlinegettypographicbounds) (OH_Drawing_TextLine \*line, double \*ascent, double \*descent, double \*leading) | Obtains the typographic boundary of a text line object. The typographic boundary is related to the font and font size used for typography, but not the characters within the text. For example, for the string " a b " (which has a space before "a" and a space after "b"), the typographic boundary encompasses the spaces at the beginning and end. For the strings "j" and "E", the typographic boundaries are the same, indicating that they are irrelevant to specific characters.|
607| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_TextLineGetImageBounds](#oh_drawing_textlinegetimagebounds) (OH_Drawing_TextLine \*line) | Obtains the image boundary of a text line object. The image boundary, equivalent to a visual boundary, is related to the font, font size, and characters. For example, for the string " a b " (which has a space before "a" and a space after "b"), only "a b" are visible to users, and therefore the image boundary does not include these spaces at the beginning and end. For the strings "j" and "E", their image boundaries are different. Specifically, the width of the boundary for "j" is narrower than that for "E", and the height of the boundary for "j" is taller than that for "E".|
608| double [OH_Drawing_TextLineGetTrailingSpaceWidth](#oh_drawing_textlinegettrailingspacewidth) (OH_Drawing_TextLine \*line) | Obtains the width of the spaces at the end of a text line object.|
609| int32_t [OH_Drawing_TextLineGetStringIndexForPosition](#oh_drawing_textlinegetstringindexforposition) (OH_Drawing_TextLine \*line, [OH_Drawing_Point](#oh_drawing_point) \*point) | Obtains the index of a string at a specified position in a text line object.|
610| double [OH_Drawing_TextLineGetOffsetForStringIndex](#oh_drawing_textlinegetoffsetforstringindex) (OH_Drawing_TextLine \*line, int32_t index) | Obtains the offset of a string with the specified index in a text line object.|
611| void [OH_Drawing_TextLineEnumerateCaretOffsets](#oh_drawing_textlineenumeratecaretoffsets) (OH_Drawing_TextLine \*line, [Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback) callback) | Enumerates the offset and index of each character in a text line object and passes them to a custom callback function. You can use the offset and index array for other operations.|
612| double [OH_Drawing_TextLineGetAlignmentOffset](#oh_drawing_textlinegetalignmentoffset) (OH_Drawing_TextLine \*line, double alignmentFactor, double alignmentWidth) | Obtains the offset of a text line object after alignment based on the alignment factor and alignment width.|
613| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunStringIndices](#oh_drawing_getrunstringindices) (OH_Drawing_Run \*run, int64_t start, int64_t length) | Obtains an array of character indices of glyphs within a specified range of a run, where the indices are offsets relative to the entire paragraph.|
614| uint64_t [OH_Drawing_GetRunStringIndicesByIndex](#oh_drawing_getrunstringindicesbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*stringIndices, size_t index) | Obtains character indices of glyphs in a run by index.|
615| void [OH_Drawing_DestroyRunStringIndices](#oh_drawing_destroyrunstringindices) ([OH_Drawing_Array](#oh_drawing_array) \*stringIndices) | Releases the pointer to a character index array.|
616| void [OH_Drawing_GetRunStringRange](#oh_drawing_getrunstringrange) (OH_Drawing_Run \*run, uint64_t \*location, uint64_t \*length) | Obtains the range of glyphs generated by a run.|
617| float [OH_Drawing_GetRunTypographicBounds](#oh_drawing_getruntypographicbounds) (OH_Drawing_Run \*run, float \*ascent, float \*descent, float \*leading) | Obtains the typographic boundary of a run. The typographic boundary is related to the font and font size used for typography, but not the characters within the text.|
618| void [OH_Drawing_RunPaint](#oh_drawing_runpaint) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, OH_Drawing_Run \*run, double x, double y) | Paints the text contained in a run on the canvas.|
619| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_GetRunImageBounds](#oh_drawing_getrunimagebounds) (OH_Drawing_Run \*run) | Obtains the image boundary of a run. The image boundary is related to characters and is equivalent to the visual boundary.|
620| void [OH_Drawing_DestroyRunImageBounds](#oh_drawing_destroyrunimagebounds) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect) | Releases the pointer to an image boundary object of a run.|
621| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunGlyphs](#oh_drawing_getrunglyphs) (OH_Drawing_Run \*run, int64_t start, int64_t length) | Obtains an array of glyphs within the specified range of a run.|
622| uint16_t [OH_Drawing_GetRunGlyphsByIndex](#oh_drawing_getrunglyphsbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*glyphs, size_t index) | Obtains individual glyphs in a run by index.|
623| void [OH_Drawing_DestroyRunGlyphs](#oh_drawing_destroyrunglyphs) ([OH_Drawing_Array](#oh_drawing_array) \*glyphs) | Releases the pointer to a glyph array in a run.|
624| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetRunPositions](#oh_drawing_getrunpositions) (OH_Drawing_Run \*run, int64_t start, int64_t length) | Obtains the positions of glyphs within the specified range of a run.|
625| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_GetRunPositionsByIndex](#oh_drawing_getrunpositionsbyindex) ([OH_Drawing_Array](#oh_drawing_array) \*positions, size_t index) | Obtains the positions of individual glyphs in a run by index.|
626| void [OH_Drawing_DestroyRunPositions](#oh_drawing_destroyrunpositions) ([OH_Drawing_Array](#oh_drawing_array) \*positions) | Releases the pointer to a glyph position array in a run.|
627| uint32_t [OH_Drawing_GetRunGlyphCount](#oh_drawing_getrunglyphcount) (OH_Drawing_Run \*run) | Obtains the number of glyphs in a run.|
628| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | Creates an **OH_Drawing_TypographyStyle** object. When [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) is no longer required, call [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) to release the pointer to the object.|
629| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Destroys an **OH_Drawing_TypographyStyle** object and reclaims the memory occupied by the object.|
630| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text direction in a typography style.|
631| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text alignment mode.|
632| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.|
633| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the maximum number of lines in the text.|
634| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | Creates an **OH_Drawing_TextStyle** object.|
635| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the default text style of a typography style.|
636| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Destroys an **OH_Drawing_TextStyle** object and reclaims the memory occupied by the object.|
637| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the color for a text style.|
638| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the font size for a text style.|
639| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font weight for a text style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.|
640| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the baseline for a text style.|
641| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration for a text style. Only one decoration can be set. To add multiple decorations, use [OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration).|
642| void [OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Adds the decoration for a text style. Multiple decoration lines can be displayed.|
643| void [OH_Drawing_RemoveTextStyleDecoration](#oh_drawing_removetextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Removes the decoration for a text style.|
644| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the decoration color for a text style.|
645| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the line height based on the multiple of the font size.|
646| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | Sets the font families for a text style.|
647| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font style for a text style.|
648| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the locale for a text style.|
649| void [OH_Drawing_SetTextStyleForegroundBrush](#oh_drawing_settextstyleforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | Sets the foreground brush for a text style.|
650| void [OH_Drawing_TextStyleGetForegroundBrush](#oh_drawing_textstylegetforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | Obtains the foreground brush of a text style.|
651| void [OH_Drawing_SetTextStyleForegroundPen](#oh_drawing_settextstyleforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | Sets the foreground pen for a text style.|
652| void [OH_Drawing_TextStyleGetForegroundPen](#oh_drawing_textstylegetforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the foreground pen of a text style.|
653| void [OH_Drawing_SetTextStyleBackgroundBrush](#oh_drawing_settextstylebackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | Sets the background brush for a text style.|
654| void [OH_Drawing_TextStyleGetBackgroundBrush](#oh_drawing_textstylegetbackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | Obtains the background brush of a text style.|
655| void [OH_Drawing_SetTextStyleBackgroundPen](#oh_drawing_settextstylebackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | Sets the background pen for a text style.|
656| void [OH_Drawing_TextStyleGetBackgroundPen](#oh_drawing_textstylegetbackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the background pen of a text style.|
657| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \* [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | Creates an **OH_Drawing_TypographyCreate** object. When [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) is no longer required, call [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) to release the pointer to the object.|
658| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Destroys an **OH_Drawing_TypographyCreate** object and reclaims the memory occupied by the object.|
659| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Pushes a text style into the text style stack. Any text added afterward will use the style currently on top of the stack.|
660| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | Adds text.|
661| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Pops the top text style out of the text style stack.|
662| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Creates an **OH_Drawing_Typography** object. When [OH_Drawing_Typography](#oh_drawing_typography) is no longer required, call [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) to release the pointer to the object.|
663| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Destroys an **OH_Drawing_Typography** object and reclaims the memory occupied by the object.|
664| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | Lays out the typography.|
665| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | Draws text from the upper left corner at a specified position. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.|
666| void [OH_Drawing_TypographyPaintOnPath](#oh_drawing_typographypaintonpath) ([OH_Drawing_Typography](#oh_drawing_typography) \* typography, [OH_Drawing_Canvas](#oh_drawing_canvas) \* canvas, [OH_Drawing_Path](#oh_drawing_path) \* path, double hOffset, double vOffset) | Draws text along a path. To prevent text overlap caused by the text width exceeding the layout width, you are advised to use [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) to limit the text to a single line. |
667| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the typography width set by the user. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
668| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the overall height of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
669| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.|
670| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line of a typography object, including its indentation. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.|
671| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the minimum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
672| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
673| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the alphabetic baseline in a typography object.|
674| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the ideographic baseline in a typography object.|
675| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | Adds a placeholder.|
676| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Checks whether the maximum number of lines of a typography object is exceeded. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. If the maximum number of lines is not set by calling [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines), **false** is returned.|
677| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t, size_t, [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle), [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)) | Obtains text boxes in a given range of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.|
678| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains text boxes for placeholders in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.|
679| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the left position of a text box.|
680| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the right position of a text box.|
681| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the top position of a text box.|
682| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the bottom position of a text box.|
683| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the text direction of a text box.|
684| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Obtains the number of text boxes.|
685| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | Obtains the position and affinity of the glyph at the given coordinates.|
686| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | Obtains the position and affinity of the glyph cluster to which the glyph at the given coordinates belongs. The glyph cluster is a container that holds one or more glyphs.|
687| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object.|
688| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | Obtains the affinity attribute of an **OH_Drawing_PositionAndAffinity** object. The affinity determines whether the font is close to the front text or rear text.|
689| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | Obtains the word boundary in a typography object.|
690| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the start position of an **OH_Drawing_Range** object.|
691| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the end position of an **OH_Drawing_Range** object.|
692| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of lines in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
693| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration style for a text style.|
694| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the thickness scale factor for the decoration style of a text style.|
695| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the letter spacing for a text style.|
696| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the word spacing for a text style.|
697| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | Sets whether to enable half leading for a text style.|
698| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the ellipsis content for a text style.|
699| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the ellipsis style for a text style.|
700| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text break strategy.|
701| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the word break type.|
702| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text ellipsis style for a typography style.|
703| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | Sets the ellipsis text for a typography style.|
704| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line height in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
705| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
706| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | Sets the text split ratio.|
707| bool [OH_Drawing_TypographyIsLineUnlimited](#oh_drawing_typographyislineunlimited) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Checks whether the maximum number of lines is limited for text.|
708| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Checks whether an ellipsis is configured for a typography style.|
709| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) | Sets the locale for a typography style.|
710| bool [OH_Drawing_TextStyleGetFontMetrics](#oh_drawing_textstylegetfontmetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | Obtains the font metrics of a text style.|
711| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Sets a text style.|
712| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) (void) | Creates an **OH_Drawing_FontDescriptor** object to describe the detailed information about a system font.|
713| void [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*) | Destroys an **OH_Drawing_FontDescriptor** object and reclaims the memory occupied by the object.|
714| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | Creates an **OH_Drawing_FontParser** object to parse a system font.|
715| void [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*) | Destroys an **OH_Drawing_FontParser** object and reclaims the memory occupied by the object.|
716| char \*\* [OH_Drawing_FontParserGetSystemFontList](#oh_drawing_fontparsergetsystemfontlist) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, size_t \*) | Obtains the list of system fonts. This function can be used only on 2-in-1 devices and phones.|
717| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | Reclaims the memory occupied by the system font list.|
718| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_FontParserGetFontByName](#oh_drawing_fontparsergetfontbyname) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, const char \*) | Obtains the descriptor of a system font based on the font name.|
719| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \* [OH_Drawing_TypographyGetLineMetrics](#oh_drawing_typographygetlinemetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the line metrics in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) is no longer required, call [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) to release the pointer to the object.|
720| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the number of lines.|
721| void [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Destroys an **OH_Drawing_LineMetrics** object and reclaims the memory occupied by the object.|
722| bool [OH_Drawing_TypographyGetLineMetricsAt](#oh_drawing_typographygetlinemetricsat) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the metrics of a given line in a typography object. For details, see [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
723| bool [OH_Drawing_TypographyGetLineInfo](#oh_drawing_typographygetlineinfo) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool, bool, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the metrics of a given line or the metrics of the first character in a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.|
724| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the default font weight for a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.|
725| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the default font style for a typography style.|
726| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | Sets the font family name for text.|
727| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for text.|
728| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for text.|
729| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for text.|
730| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style.|
731| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text font weight of the strut style in a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.|
732| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font style of the strut style in a typography style.|
733| void [OH_Drawing_SetTypographyTextLineStyleFontFamilies](#oh_drawing_settypographytextlinestylefontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int, const char \*fontFamilies[]) | Sets the font families for a text line style.|
734| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for a text line style.|
735| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for a text line style.|
736| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for the strut style in a typography style.|
737| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the spacing scale factor for a text line style.|
738| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style only.|
739| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | Creates an **OH_Drawing_TextShadow** object. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) to release the pointer to the object.|
740| void [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | Destroys an **OH_Drawing_TextShadow** object and reclaims the memory occupied by the object.|
741| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains a text shadow container. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) to release the pointer to the object.|
742| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a text shadow container.|
743| void [OH_Drawing_TextStyleAddShadow](#oh_drawing_textstyleaddshadow) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | Adds a shadow to a text shadow container.|
744| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all shadows in a text shadow container.|
745| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadowWithIndex](#oh_drawing_textstylegetshadowwithindex) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Obtains a shadow with a given index in a text shadow container.|
746| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | Sets indents for typography. If this function is not called, texts will have no indentation applied.|
747| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains indents with a given index in a typography object. The line index starts from 0.|
748| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | Obtains the line bounds in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. This function can only be used to obtain the bounds of existing lines. That is, the line index must start from 0, and the maximum index is [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1. If the line index is invalid, **start** and **end** in the result value are both **0**.|
749| void [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | Reclaims the memory occupied by the vector consisting of the **OH_Drawing_TextShadow** objects.|
750| [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \* [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo) ([OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) \*) | Obtains the system font configuration.|
751| void [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) ([OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \*) | Reclaims the memory occupied by the system font configuration.|
752| void [OH_Drawing_SetTextStyleFontStyleStruct](#oh_drawing_settextstylefontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyle) | Sets the font style, including the font weight, width, and slant, for a text style.|
753| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TextStyleGetFontStyleStruct](#oh_drawing_textstylegetfontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle) | Obtains the font style, including the font weight, width, and slant, of a text style.|
754| void [OH_Drawing_SetTypographyStyleFontStyleStruct](#oh_drawing_settypographystylefontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyle) | Sets the font style, including the font weight, width, and slant, for the default text style of a typography style.|
755| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | Obtains the font style, including the font weight, width, and slant, of the default text style of a typography style.|
756| void [OH_Drawing_TextStyleSetBackgroundRect](#oh_drawing_textstylesetbackgroundrect) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) \*, int styleId) | Sets a background rectangle and style ID for a text style. The style ID is valid only when the background box is a rounded rectangle.|
757| void [OH_Drawing_TypographyHandlerAddSymbol](#oh_drawing_typographyhandleraddsymbol) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, uint32_t symbol) | Adds the symbol to use in the typography creation process.|
758| void [OH_Drawing_TextStyleAddFontFeature](#oh_drawing_textstyleaddfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*tag, int value) | Adds a font feature for a text style.|
759| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*, const float) | Adds a font variation. This function takes effect only when the corresponding font file (.ttf file) supports variable adjustment. Otherwise, calling this function does not take effect.|
760| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains all the contents in a font feature map container of a text style.|
761| void [OH_Drawing_TextStyleDestroyFontFeatures](#oh_drawing_textstyledestroyfontfeatures) ([OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \*, size_t fontFeatureSize) | Reclaims the memory occupied by the struct array that holds all the font features.|
762| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a font feature map container in a text style.|
763| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all the contents in a font feature map container of a text style.|
764| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the baseline drift of a text style.|
765| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | Sets a baseline drift for a text style.|
766| void [OH_Drawing_TypographyTextSetHeightBehavior](#oh_drawing_typographytextsetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) heightMode) | Sets a text height modifier pattern.|
767| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text height modifier pattern.|
768| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \* [OH_Drawing_TypographyGetLineFontMetrics](#oh_drawing_typographygetlinefontmetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t lineNumber, size_t \*fontMetricsSize) | Obtains all font metrics from a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. Otherwise, a null pointer is returned. When [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) is no longer required, call [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) to release the pointer to the object.|
769| void [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) ([OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | Reclaims the memory occupied by the struct array that holds all the font metrics of a given line.|
770| bool [OH_Drawing_TextStyleIsEqual](#oh_drawing_textstyleisequal) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | Checks whether two text styles are equal. The word width property is not involved in the comparison.|
771| bool [OH_Drawing_TextStyleIsEqualByFont](#oh_drawing_textstyleisequalbyfont) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | Checks whether the font style properties of two text styles are equal.|
772| bool [OH_Drawing_TextStyleIsAttributeMatched](#oh_drawing_textstyleisattributematched) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle, [OH_Drawing_TextStyleType](#oh_drawing_textstyletype) textStyleType) | Checks whether two text styles have the same text style type.|
773| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Sets a placeholder for a text style.|
774| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Checks whether a placeholder is set for a text style.|
775| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.|
776| bool [OH_Drawing_TypographyStyleIsHintEnabled](#oh_drawing_typographystyleishintenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Checks whether font hinting is enabled for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.|
777| void [OH_Drawing_SetTypographyStyleTextStrutStyle](#oh_drawing_settypographystyletextstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | Sets the strut style for a typography style.|
778| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \* [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the strut style of a typography style.|
779| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | Reclaims the memory occupied by a strut style.|
780| bool [OH_Drawing_TypographyStyleStrutStyleEquals](#oh_drawing_typographystylestrutstyleequals) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*from, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*to) | Checks whether two strut styles are equal.|
781| void [OH_Drawing_TypographyStyleSetHintsEnabled](#oh_drawing_typographystylesethintsenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, bool hintsEnabled) | Sets whether to enable font hinting for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.|
782| void [OH_Drawing_TypographyMarkDirty](#oh_drawing_typographymarkdirty) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Marks a typography object as dirty data. This function is used to initialize the typography state.|
783| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of unresolved glyphs in a typography object. This function can be called only after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.|
784| void [OH_Drawing_TypographyUpdateFontSize](#oh_drawing_typographyupdatefontsize) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t from, size_t to, float fontSize) | Updates the font size in a typography object.|
785| bool [OH_Drawing_TypographyTextGetLineStyle](#oh_drawing_typographytextgetlinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether the text line style is enabled for a typography style.|
786| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font weight of the strut style in a typography style.|
787| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font style of the strut style in a typography style.|
788| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, size_t \*num) | Obtains the font families of the strut style in a typography style.|
789| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | Reclaims the memory occupied by the font families.|
790| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font size of a text line style.|
791| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the height scale factor of a text line style.|
792| bool [OH_Drawing_TypographyTextlineStyleGetHeightOnly](#oh_drawing_typographytextlinestylegetheightonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether only the font height is used for a text line style.|
793| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether half leading is enabled for a text line style.|
794| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the spacing scale factor of a text line style.|
795| bool [OH_Drawing_TypographyTextlineGetStyleOnly](#oh_drawing_typographytextlinegetstyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether only the text line style is enabled for a typography style.|
796| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text alignment mode.|
797| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text direction of a typography style.|
798| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the maximum number of lines.|
799| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text ellipsis content of a typography style.|
800| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | Reclaims the memory occupied by the text ellipsis names.|
801| bool [OH_Drawing_TypographyStyleEquals](#oh_drawing_typographystyleequals) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*from, [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*to) | Checks whether two typography styles are the same. The text height modifier mode [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) is not involved in the comparison.|
802| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the color of a text style.|
803| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextStyleGetDecorationStyle](#oh_drawing_textstylegetdecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the decoration style of a text style.|
804| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TextStyleGetFontWeight](#oh_drawing_textstylegetfontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font weight of a text style.|
805| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font style of a text style.|
806| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) [OH_Drawing_TextStyleGetBaseline](#oh_drawing_textstylegetbaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the baseline of a text style.|
807| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | Obtains the font families of a text style.|
808| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | Reclaims the memory occupied by the font families, where **num** specifies the number of font families.|
809| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font size of a text style.|
810| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the letter spacing of a text style.|
811| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the word spacing of a text style.|
812| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font height of a text style.|
813| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Checks whether half leading is enabled for a text style.|
814| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the locale of a text style.|
815| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Releases the memory occupied by a text box.|
816| void [OH_Drawing_SetTextShadow](#oh_drawing_settextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*shadow, uint32_t color, [OH_Drawing_Point](#oh_drawing_point) \*offset, double blurRadius) | Sets a text shadow.|
817| [OH_Drawing_LineTypography](#oh_drawing_linetypography) \* [OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*handler) | Creates a pointer to an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object, which stores the text content and style and can be used to compute typography details for individual lines of text.|
818| void [OH_Drawing_DestroyLineTypography](#oh_drawing_destroylinetypography) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography) | Releases the memory occupied by an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object.|
819| size_t [OH_Drawing_LineTypographyGetLineBreak](#oh_drawing_linetypographygetlinebreak) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography, size_t startIndex, double width) | Obtains the number of characters that can fit in the layout from the specified position within a limited layout width.|
820| OH_Drawing_TextLine \* [OH_Drawing_LineTypographyCreateLine](#oh_drawing_linetypographycreateline) ([OH_Drawing_LineTypography](#oh_drawing_linetypography) \*lineTypography, size_t startIndex, size_t count) | Creates a pointer to an **OH_Drawing_TextLine** object based on the text content in a specified range.|
821| [OH_Drawing_TextTab](#oh_drawing_texttab) \* [OH_Drawing_CreateTextTab](#oh_drawing_createtexttab) ([OH_Drawing_TextAlign](#oh_drawing_textalign) alignment, float location) | Creates a text tab object.|
822| void [OH_Drawing_DestroyTextTab](#oh_drawing_destroytexttab) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | Releases the memory occupied by a text tab object.|
823| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_GetTextTabAlignment](#oh_drawing_gettexttabalignment) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | Obtains the alignment mode of a text tab.|
824| float [OH_Drawing_GetTextTabLocation](#oh_drawing_gettexttablocation) ([OH_Drawing_TextTab](#oh_drawing_texttab) \*) | Obtains the location of a text tab.|
825| void [OH_Drawing_SetTypographyTextTab](#oh_drawing_settypographytexttab) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextTab](#oh_drawing_texttab) \*TextTab) | Sets the alignment mode and location of a text tab. When the text alignment mode or ellipsis style is set, the tab does not take effect. When the tab location is less than 1.0, the tab is replaced with a space.|
826| size_t [OH_Drawing_GetDrawingArraySize](#oh_drawing_getdrawingarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*drawingArray) | Obtains the number of objects in an [OH_Drawing_Array](#oh_drawing_array).|
827| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | Creates a default **OH_Drawing_Typeface** object.|
828| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile) (const char \*path, int index) | Creates an **OH_Drawing_Typeface** object through a file.|
829| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFileWithArguments](#oh_drawing_typefacecreatefromfilewitharguments) (const char \*path, const [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | Creates an **OH_Drawing_Typeface** object with font arguments through a file. If the **OH_Drawing_Typeface** object does not support the variation described in the font arguments, this function creates an **OH_Drawing_Typeface** object with the default font arguments. In this case, this function provides the same capability as [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile).|
830| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromCurrent](#oh_drawing_typefacecreatefromcurrent) (const [OH_Drawing_Typeface](#oh_drawing_typeface) \*current, const [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | Creates an **OH_Drawing_Typeface** object with font arguments based on an existing **OH_Drawing_Typeface** object.|
831| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromStream](#oh_drawing_typefacecreatefromstream) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*, int32_t index) | Creates an **OH_Drawing_Typeface** object through a memory stream. If the memory stream is an invalid font file, a null pointer is returned. After the memory stream is passed in, the ownership is transferred and you cannot release it.|
832| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | Destroys an **OH_Drawing_Typeface** object and reclaims the memory occupied by the object.|
833| [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \* [OH_Drawing_FontArgumentsCreate](#oh_drawing_fontargumentscreate) (void) | Creates an **OH_Drawing_FontArguments** object. The font arguments are used to create an **OH_Drawing_Typeface** object with custom attributes.|
834| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsAddVariation](#oh_drawing_fontargumentsaddvariation) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments, const char \*axis, float value) | Adds a variation to an **OH_Drawing_FontArguments** object.|
835| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsDestroy](#oh_drawing_fontargumentsdestroy) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | Destroys an **OH_Drawing_FontArguments** object.|
836| enum&nbsp;&nbsp;[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | Defines an enum for the shadow flags.|
837| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | Defines an enum for the shadow flags.|
838| void [OH_Drawing_CanvasClipRect](#oh_drawing_canvascliprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | Clips a rectangle.|
839| void [OH_Drawing_CanvasClipRoundRect](#oh_drawing_canvascliproundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | Clips a rounded rectangle.|
840| void [OH_Drawing_CanvasClipPath](#oh_drawing_canvasclippath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | Clips a path.|
841| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasClipRegion](#oh_drawing_canvasclipregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Region](#oh_drawing_region) \*region, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp) | Clips a rectangle.|
842| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | Rotates a canvas by a given angle. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation.|
843| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | Translates a canvas by a given distance.|
844| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | Scales a canvas.|
845| void [OH_Drawing_CanvasSkew](#oh_drawing_canvasskew) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | Skews a canvas. This function premultiplies the current canvas matrix by a skew transformation matrix and applies the resulting matrix to the canvas. The skew transformation matrix is as follows: \|1 sx 0\| \|sy 1 0\| \|0 0 1\| |
846| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | Clears a canvas by using a given color.|
847| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas width.|
848| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas height.|
849| void [OH_Drawing_CanvasGetLocalClipBounds](#oh_drawing_canvasgetlocalclipbounds) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases.|
850| void [OH_Drawing_CanvasGetTotalMatrix](#oh_drawing_canvasgettotalmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Obtains the 3x3 matrix of a canvas.|
851| void [OH_Drawing_CanvasConcatMatrix](#oh_drawing_canvasconcatmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Preconcats the existing matrix with the passed-in matrix. The drawing operation triggered before this function is called is not affected.|
852| void [OH_Drawing_CanvasDrawShadow](#oh_drawing_canvasdrawshadow) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) planeParams, [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) flag) | Draws a spot shadow and uses a given path to outline the ambient shadow.|
853| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | Draws a recording command object.|
854
855## Type Description
856
857### OH_Drawing_PathDashStyle
858
859```
860typedef enum OH_Drawing_PathDashStyle OH_Drawing_PathDashStyle
861```
862
863**Description**
864
865Defines an enum for the drawing styles for path effects.
866
867**Since**: 18
868
869### OH_Drawing_Array
870
871```
872typedef struct OH_Drawing_Array OH_Drawing_Array
873```
874
875**Description**
876
877Defines a struct for an array object, which is used to store multiple objects of the same type.
878
879**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
880
881**Since**: 14
882
883### OH_Drawing_LineTypography
884
885```
886typedef struct OH_Drawing_LineTypography OH_Drawing_LineTypography
887```
888
889**Description**
890
891Defines a struct used to extract a single line of data from a piece of text for typography.
892
893**Since**: 18
894
895### OH_Drawing_TextTab
896
897```
898typedef struct OH_Drawing_TextTab OH_Drawing_TextTab
899```
900
901**Description**
902
903Defines a struct used to manage text tabs.
904
905**Since**: 18
906
907### OH_Drawing_TextLine
908
909```
910typedef struct OH_Drawing_TextLine OH_Drawing_TextLine
911```
912
913**Description**
914
915Defines a struct used to manage text lines.
916
917**Since**: 18
918
919### OH_Drawing_Run
920
921```
922typedef struct OH_Drawing_RunOH_Drawing_Run
923```
924
925**Description**
926
927Defines a struct used to manage runs.
928
929**Since**: 18
930
931### Drawing_CaretOffsetsCallback
932
933```
934typedef bool(* Drawing_CaretOffsetsCallback) (double offset, int32_t index, bool leadingEdge)
935```
936
937**Description**
938
939Defines a custom callback used to receive the offset and index of each character in a text line object as its parameters.
940
941**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
942
943**Since**: 18
944
945**Parameters**
946
947| Name| Description|
948| -------- | -------- |
949| offset | Offset of each character in the text line object.|
950| index | Index of each character in the text line object.|
951| leadingEdge | Whether the cursor is located at the front of the character. The value **true** means that the cursor is located at the front of the character, that is, the offset does not contain the character width. The value **false** means that the cursor is located at the rear of the character, that is, the offset contains the character width.|
952
953**Returns**
954
955Returns the result indicating whether to stop calling the callback. The value **true** means to stop calling the callback, and **false** means to continue calling the callback.
956
957### OH_Drawing_String
958
959```
960typedef struct OH_Drawing_String OH_Drawing_String
961```
962
963**Description**
964
965Defines a struct for a string of characters encoded in UTF-16.
966
967**Since**: 14
968
969
970### OH_Drawing_SystemFontType
971
972```
973typedef enum OH_Drawing_SystemFontType OH_Drawing_SystemFontType
974```
975
976**Description**
977
978Defines an enum for the system font types.
979
980**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
981
982**Since**: 14
983
984
985### OH_Drawing_FontArguments
986
987```
988typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments
989```
990
991**Description**
992
993Defines a struct for font arguments.
994
995**Since**: 13
996
997### OH_Drawing_RecordCmd
998
999```
1000typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd
1001```
1002
1003**Description**
1004
1005Defines the recording command class, which is used to store the set of recording commands.
1006
1007**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
1008
1009**Since**: 13
1010
1011
1012### OH_Drawing_RecordCmdUtils
1013
1014```
1015typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils
1016```
1017
1018**Description**
1019
1020Defines the recording command tool, which is used to generate recording commands.
1021
1022**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
1023
1024**Since**: 13
1025
1026
1027### OH_Drawing_ErrorCode
1028
1029```
1030typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode
1031```
1032
1033
1034**Description**
1035
1036Defines an enum for the error codes that may be generated by the module.
1037
1038**Since**: 12
1039
1040
1041### OH_Drawing_PathOpMode
1042
1043```
1044typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode
1045```
1046
1047**Description**
1048
1049Defines an enum for the operation modes available for a path.
1050
1051**Since**: 12
1052
1053
1054### OH_Drawing_PathMeasureMatrixFlags
1055
1056```
1057typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags
1058```
1059
1060**Description**
1061
1062Defines an enum for the types of matrix information obtained during path measurement.
1063
1064**Since**: 12
1065
1066
1067### OH_Drawing_RegionOpMode
1068
1069```
1070typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode
1071```
1072
1073**Description**
1074
1075Defines an enum for the operation modes available for a region.
1076
1077**Since**: 12
1078
1079
1080### OH_Drawing_ImageFilter
1081
1082```
1083typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter
1084```
1085
1086**Description**
1087
1088Defines a struct for an image filter, which is used to operate all color bits that make up image pixels.
1089
1090**Since**: 12
1091
1092
1093### OH_Drawing_Filter
1094
1095```
1096typedef struct OH_Drawing_Filter OH_Drawing_Filter
1097```
1098
1099**Description**
1100
1101Defines a struct for a filter, which consists of a color filter, mask filter, and image filter.
1102
1103**Since**: 11
1104
1105### OH_Drawing_AlphaFormat
1106
1107```
1108typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat
1109```
1110
1111**Description**
1112
1113Defines an enum for the alpha formats of bitmap pixels.
1114
1115**Since**: 8
1116
1117
1118### OH_Drawing_Bitmap
1119
1120```
1121typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap
1122```
1123
1124**Description**
1125
1126Defines a struct for a bitmap, which is a memory area that contains the pixel data of a shape.
1127
1128**Since**: 8
1129
1130
1131### OH_Drawing_BitmapFormat
1132
1133```
1134typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat
1135```
1136
1137**Description**
1138
1139Defines a struct for the pixel format of a bitmap, including the color type and alpha type.
1140
1141**Since**: 8
1142
1143
1144### OH_Drawing_BlendMode
1145
1146```
1147typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode
1148```
1149
1150**Description**
1151
1152Defines an enum for the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule). The operations for the alpha channel are used as examples.
1153
1154For brevity, the following abbreviations are used:
1155
1156**s**: source.
1157
1158**d**: destination.
1159
1160**sa**: source alpha.
1161
1162**da**: destination alpha.
1163
1164The following abbreviations are used in the calculation result:
1165
1166**r**: The calculation methods of the four channels are the same.
1167
1168**ra**: Only the alpha channel is manipulated.
1169
1170**rc**: The other three color channels are manipulated.
1171
1172**Since**: 11
1173
1174
1175### OH_Drawing_BlurType
1176
1177```
1178typedef enum OH_Drawing_BlurType OH_Drawing_BlurType
1179```
1180
1181**Description**
1182
1183Defines an enum for the blur types.
1184
1185**Since**: 11
1186
1187
1188### OH_Drawing_BreakStrategy
1189
1190```
1191typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy
1192```
1193
1194**Description**
1195
1196Defines an enum for the text break strategies.
1197
1198**Since**: 11
1199
1200
1201### OH_Drawing_Brush
1202
1203```
1204typedef struct OH_Drawing_Brush OH_Drawing_Brush
1205```
1206
1207**Description**
1208
1209Defines a struct for a brush, which is used to describe the style and color to fill in a shape.
1210
1211**Since**: 8
1212
1213
1214### OH_Drawing_Canvas
1215
1216```
1217typedef struct OH_Drawing_Canvas OH_Drawing_Canvas
1218```
1219
1220**Description**
1221
1222Defines a struct for a rectangular canvas, on which various shapes, images, and texts can be drawn by using the brush and pen.
1223
1224**Since**: 8
1225
1226
1227### OH_Drawing_CanvasClipOp
1228
1229```
1230typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp
1231```
1232
1233**Description**
1234
1235Defines an enum for the canvas clipping modes.
1236
1237**Since**: 11
1238
1239
1240### OH_Drawing_CanvasShadowFlags
1241
1242```
1243typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags
1244```
1245
1246**Description**
1247
1248Defines an enum for the shadow flags.
1249
1250**Since**: 12
1251
1252
1253### OH_Drawing_ColorFilter
1254
1255```
1256typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter
1257```
1258
1259**Description**
1260
1261Defines a struct for a color filter, which is used to convert a color into a new one.
1262
1263**Since**: 11
1264
1265
1266### OH_Drawing_ColorFormat
1267
1268```
1269typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat
1270```
1271
1272**Description**
1273
1274Defines an enum for the storage formats of bitmap pixels.
1275
1276**Since**: 8
1277
1278
1279### OH_Drawing_ColorSpace
1280
1281```
1282typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace
1283```
1284
1285**Description**
1286
1287Defines a struct for a color space, which is used to describe the color information.
1288
1289**Since**: 12
1290
1291
1292### OH_Drawing_Corner_Radii
1293
1294```
1295typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii
1296```
1297
1298**Description**
1299
1300Defines a struct for the radii of a rounded corner. The radii consist of the radius in the x-axis direction and that in the y-axis direction.
1301
1302**Since**: 12
1303
1304
1305### OH_Drawing_CornerPos
1306
1307```
1308typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos
1309```
1310
1311**Description**
1312
1313Defines an enum for the corner positions of a rounded rectangle.
1314
1315**Since**: 12
1316
1317
1318### OH_Drawing_EllipsisModal
1319
1320```
1321typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal
1322```
1323
1324**Description**
1325
1326Defines an enum for the ellipsis styles.
1327
1328**Since**: 11
1329
1330
1331### OH_Drawing_FilterMode
1332
1333```
1334typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode
1335```
1336
1337**Description**
1338
1339Defines an enum for the filter modes.
1340
1341**Since**: 12
1342
1343
1344### OH_Drawing_Font
1345
1346```
1347typedef struct OH_Drawing_Font OH_Drawing_Font
1348```
1349
1350**Description**
1351
1352Defines a struct for a font.
1353
1354**Since**: 11
1355
1356
1357### OH_Drawing_Font_Metrics
1358
1359```
1360typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics
1361```
1362
1363**Description**
1364
1365Defines a struct for the measurement information about a font.
1366
1367**Since**: 12
1368
1369
1370### OH_Drawing_FontAdjustInfo
1371
1372```
1373typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo
1374```
1375
1376**Description**
1377
1378Defines a struct for the information about a font weight mapping.
1379
1380**Since**: 12
1381
1382
1383### OH_Drawing_FontAliasInfo
1384
1385```
1386typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo
1387```
1388
1389**Description**
1390
1391Defines a struct for the information about a font alias.
1392
1393**Since**: 12
1394
1395
1396### OH_Drawing_FontCollection
1397
1398```
1399typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection
1400```
1401
1402**Description**
1403
1404Defines a struct used to load fonts.
1405
1406**Since**: 8
1407
1408
1409### OH_Drawing_FontConfigInfo
1410
1411```
1412typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo
1413```
1414
1415**Description**
1416
1417Defines a struct for the information about a system font configuration.
1418
1419**Since**: 12
1420
1421
1422### OH_Drawing_FontDescriptor
1423
1424```
1425typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor
1426```
1427
1428**Description**
1429
1430Defines a struct for the detailed information about a system font.
1431
1432**Since**: 12
1433
1434
1435### OH_Drawing_FontEdging
1436
1437```
1438typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging
1439```
1440
1441**Description**
1442
1443Defines an enum for the font edging types.
1444
1445**Since**: 12
1446
1447
1448### OH_Drawing_FontFallbackGroup
1449
1450```
1451typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup
1452```
1453
1454**Description**
1455
1456Defines a struct for the information about a font fallback group.
1457
1458**Since**: 12
1459
1460
1461### OH_Drawing_FontFallbackInfo
1462
1463```
1464typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo
1465```
1466
1467**Description**
1468
1469Defines a struct for the information about a font fallback.
1470
1471**Since**: 12
1472
1473
1474### OH_Drawing_FontGenericInfo
1475
1476```
1477typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo
1478```
1479
1480**Description**
1481
1482Defines a struct for the information about generic fonts supported by the system.
1483
1484**Since**: 12
1485
1486
1487### OH_Drawing_FontHinting
1488
1489```
1490typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting
1491```
1492
1493**Description**
1494
1495Defines an enum for the font hinting types.
1496
1497**Since**: 12
1498
1499
1500### OH_Drawing_FontMgr
1501
1502```
1503typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr
1504```
1505
1506**Description**
1507
1508Defines a struct for the font manager, which is used for font management.
1509
1510**Since**: 12
1511
1512
1513### OH_Drawing_FontParser
1514
1515```
1516typedef struct OH_Drawing_FontParser OH_Drawing_FontParser
1517```
1518
1519**Description**
1520
1521Defines a struct used to parse system font files.
1522
1523**Since**: 12
1524
1525
1526### OH_Drawing_FontStyleSet
1527
1528```
1529typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet
1530```
1531
1532**Description**
1533
1534Defines a struct for a font style set, which is used for font style family matching.
1535
1536**Since**: 12
1537
1538
1539### OH_Drawing_FontStyleStruct
1540
1541```
1542typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct
1543```
1544
1545**Description**
1546
1547Defines a struct for a font style.
1548
1549**Since**: 12
1550
1551
1552### OH_Drawing_GpuContext
1553
1554```
1555typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext
1556```
1557
1558**Description**
1559
1560Defines a struct for the GPU context, which is used to describe the GPU backend context.
1561
1562**Since**: 12
1563
1564
1565### OH_Drawing_GpuContextOptions
1566
1567```
1568typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions
1569```
1570
1571**Description**
1572
1573Defines a struct for the options about the GPU context.
1574
1575**Since**: 12
1576
1577**Deprecated**: from API version 18
1578
1579
1580### OH_Drawing_Image
1581
1582```
1583typedef struct OH_Drawing_Image OH_Drawing_Image
1584```
1585
1586**Description**
1587
1588Defines a struct for an image that describes a two-dimensional pixel array.
1589
1590**Since**: 12
1591
1592
1593### OH_Drawing_Image_Info
1594
1595```
1596typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info
1597```
1598
1599**Description**
1600
1601Defines a struct for the image information.
1602
1603**Since**: 12
1604
1605
1606### OH_Drawing_LineMetrics
1607
1608```
1609typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics
1610```
1611
1612**Description**
1613
1614Defines a struct for the measurement information about a line of text.
1615
1616**Since**: 12
1617
1618
1619### OH_Drawing_MaskFilter
1620
1621```
1622typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter
1623```
1624
1625**Description**
1626
1627Defines a struct for a mask filter.
1628
1629**Since**: 11
1630
1631
1632### OH_Drawing_Matrix
1633
1634```
1635typedef struct OH_Drawing_Matrix OH_Drawing_Matrix
1636```
1637
1638**Description**
1639
1640Defines a struct for a matrix, which is used to describe coordinate transformation.
1641
1642**Since**: 11
1643
1644
1645### OH_Drawing_MemoryStream
1646
1647```
1648typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream
1649```
1650
1651**Description**
1652
1653Defines a struct for a memory stream.
1654
1655**Since**: 12
1656
1657
1658### OH_Drawing_MipmapMode
1659
1660```
1661typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode
1662```
1663
1664**Description**
1665
1666Defines an enum for the mipmap modes.
1667
1668**Since**: 12
1669
1670
1671### OH_Drawing_Path
1672
1673```
1674typedef struct OH_Drawing_Path OH_Drawing_Path
1675```
1676
1677**Description**
1678
1679Defines a struct for a path, which is used to customize various shapes.
1680
1681**Since**: 8
1682
1683
1684### OH_Drawing_PathAddMode
1685
1686```
1687typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode
1688```
1689
1690**Description**
1691
1692Defines an enum for the path adding modes.
1693
1694**Since**: 12
1695
1696
1697### OH_Drawing_PathDirection
1698
1699```
1700typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection
1701```
1702
1703**Description**
1704
1705Defines an enum for the directions of a closed contour.
1706
1707**Since**: 12
1708
1709
1710### OH_Drawing_PathEffect
1711
1712```
1713typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect
1714```
1715
1716**Description**
1717
1718Defines a struct for a path effect that affects the stroke.
1719
1720**Since**: 12
1721
1722
1723### OH_Drawing_PathFillType
1724
1725```
1726typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType
1727```
1728
1729**Description**
1730
1731Defines an enum for the fill types of a path.
1732
1733**Since**: 12
1734
1735
1736### OH_Drawing_Pen
1737
1738```
1739typedef struct OH_Drawing_Pen OH_Drawing_Pen
1740```
1741
1742**Description**
1743
1744Defines a struct for a pen, which is used to describe the style and color to outline a shape.
1745
1746**Since**: 8
1747
1748
1749### OH_Drawing_PenLineCapStyle
1750
1751```
1752typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle
1753```
1754
1755**Description**
1756
1757Defines an enum for the line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
1758
1759**Since**: 8
1760
1761
1762### OH_Drawing_PenLineJoinStyle
1763
1764```
1765typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle
1766```
1767
1768**Description**
1769
1770Defines an enum for the line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.
1771
1772**Since**: 8
1773
1774
1775### OH_Drawing_PixelMap
1776
1777```
1778typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap
1779```
1780
1781**Description**
1782
1783Defines a struct for a pixel map, which is used to wrap the real pixel map supported by the image framework.
1784
1785**Since**: 12
1786
1787
1788### OH_Drawing_PlaceholderSpan
1789
1790```
1791typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan
1792```
1793
1794**Description**
1795
1796Defines a struct for the placeholder that acts as a span.
1797
1798**Since**: 11
1799
1800
1801### OH_Drawing_PlaceholderVerticalAlignment
1802
1803```
1804typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment
1805```
1806
1807**Description**
1808
1809Defines an enum for the vertical alignment modes of placeholders.
1810
1811**Since**: 11
1812
1813
1814### OH_Drawing_Point
1815
1816```
1817typedef struct OH_Drawing_Point OH_Drawing_Point
1818```
1819
1820**Description**
1821
1822Defines a struct for a coordinate point.
1823
1824**Since**: 11
1825
1826
1827### OH_Drawing_Point2D
1828
1829```
1830typedef struct OH_Drawing_Point2D OH_Drawing_Point2D
1831```
1832
1833**Description**
1834
1835Defines a struct for a two-dimensional coordinate point.
1836
1837**Since**: 12
1838
1839
1840### OH_Drawing_Point3D
1841
1842```
1843typedef struct OH_Drawing_Point3D OH_Drawing_Point3D
1844```
1845
1846**Description**
1847
1848Defines a struct for a three-dimensional coordinate point.
1849
1850**Since**: 12
1851
1852
1853### OH_Drawing_PointMode
1854
1855```
1856typedef enum OH_Drawing_PointMode OH_Drawing_PointMode
1857```
1858
1859**Description**
1860
1861Defines an enum for the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.
1862
1863**Since**: 12
1864
1865
1866### OH_Drawing_PositionAndAffinity
1867
1868```
1869typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity
1870```
1871
1872**Description**
1873
1874Defines a struct used to receive the position and affinity of a glyph.
1875
1876**Since**: 11
1877
1878
1879### OH_Drawing_Range
1880
1881```
1882typedef struct OH_Drawing_Range OH_Drawing_Range
1883```
1884
1885**Description**
1886
1887Defines a struct used to receive the start position and end position of a glyph.
1888
1889**Since**: 11
1890
1891
1892### OH_Drawing_Rect
1893
1894```
1895typedef struct OH_Drawing_Rect OH_Drawing_Rect
1896```
1897
1898**Description**
1899
1900Defines a struct for a rectangle.
1901
1902**Since**: 11
1903
1904
1905### OH_Drawing_RectHeightStyle
1906
1907```
1908typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle
1909```
1910
1911**Description**
1912
1913Defines an enum for the rectangle height styles.
1914
1915**Since**: 11
1916
1917
1918### OH_Drawing_RectStyle_Info
1919
1920```
1921typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info
1922```
1923
1924**Description**
1925
1926Defines a struct for the style of a rectangle.
1927
1928**Since**: 12
1929
1930
1931### OH_Drawing_RectWidthStyle
1932
1933```
1934typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle
1935```
1936
1937**Description**
1938
1939Defines an enum for the rectangle width styles.
1940
1941**Since**: 11
1942
1943
1944### OH_Drawing_Region
1945
1946```
1947typedef struct OH_Drawing_Region OH_Drawing_Region
1948```
1949
1950**Description**
1951
1952Defines a struct for a region, which represents a closed area on the canvas for more accurate graphic control.
1953
1954**Since**: 12
1955
1956
1957### OH_Drawing_RoundRect
1958
1959```
1960typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect
1961```
1962
1963**Description**
1964
1965Defines a struct for a rounded rectangle.
1966
1967**Since**: 11
1968
1969
1970### OH_Drawing_RunBuffer
1971
1972```
1973typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer
1974```
1975
1976**Description**
1977
1978Defines a struct for a run, which provides storage for glyphs and positions.
1979
1980**Since**: 11
1981
1982
1983### OH_Drawing_SamplingOptions
1984
1985```
1986typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions
1987```
1988
1989**Description**
1990
1991Defines a struct for sampling options, which describe the sampling methods for images and bitmaps.
1992
1993**Since**: 12
1994
1995
1996### OH_Drawing_ScaleToFit
1997
1998```
1999typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit
2000```
2001
2002**Description**
2003
2004Defines an enum for the matrix scaling modes.
2005
2006**Since**: 12
2007
2008
2009### OH_Drawing_ShaderEffect
2010
2011```
2012typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect
2013```
2014
2015**Description**
2016
2017Defines a struct for a shader effect, which is used to describe the source color of the drawn content.
2018
2019**Since**: 11
2020
2021
2022### OH_Drawing_ShadowLayer
2023
2024```
2025typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer
2026```
2027
2028**Description**
2029
2030Defines a struct for a shadow, which is used to describe the shadow layer of the drawn content.
2031
2032**Since**: 12
2033
2034
2035### OH_Drawing_SrcRectConstraint
2036
2037```
2038typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint
2039```
2040
2041**Description**
2042
2043Defines an enum for the constraint types of the source rectangle.
2044
2045**Since**: 12
2046
2047
2048### OH_Drawing_StrutStyle
2049
2050```
2051typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle
2052```
2053
2054**Description**
2055
2056Defines a struct for a strut style. The strut style determines the line spacing, baseline alignment mode, and other properties related to the line height when drawing texts.
2057
2058**Since**: 12
2059
2060
2061### OH_Drawing_Surface
2062
2063```
2064typedef struct OH_Drawing_Surface OH_Drawing_Surface
2065```
2066
2067**Description**
2068
2069Defines a struct for a surface, which is used to manage the content drawn on the canvas.
2070
2071**Since**: 12
2072
2073
2074### OH_Drawing_TextBlob
2075
2076```
2077typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob
2078```
2079
2080**Description**
2081
2082Defines a struct for a text blob, an immutable container that holds multiple texts. Each text blob consists of glyphs and position.
2083
2084**Since**: 11
2085
2086
2087### OH_Drawing_TextBlobBuilder
2088
2089```
2090typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder
2091```
2092
2093**Description**
2094
2095Defines a struct for a text blob builder, which is used to build a text blob.
2096
2097**Since**: 11
2098
2099
2100### OH_Drawing_TextBox
2101
2102```
2103typedef struct OH_Drawing_TextBox OH_Drawing_TextBox
2104```
2105
2106**Description**
2107
2108Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity.
2109
2110**Since**: 11
2111
2112
2113### OH_Drawing_TextDecorationStyle
2114
2115```
2116typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle
2117```
2118
2119**Description**
2120
2121Defines an enum for the text decoration styles.
2122
2123**Since**: 11
2124
2125
2126### OH_Drawing_TextEncoding
2127
2128```
2129typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding
2130```
2131
2132**Description**
2133
2134Defines an enum for the text encoding types.
2135
2136**Since**: 12
2137
2138
2139### OH_Drawing_TextShadow
2140
2141```
2142typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow
2143```
2144
2145**Description**
2146
2147Defines a struct used to manage text shadows.
2148
2149**Since**: 12
2150
2151
2152### OH_Drawing_TextStyle
2153
2154```
2155typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle
2156```
2157
2158**Description**
2159
2160Defines a struct used to manage text colors and decorations.
2161
2162**Since**: 8
2163
2164
2165### OH_Drawing_TileMode
2166
2167```
2168typedef enum OH_Drawing_TileMode OH_Drawing_TileMode
2169```
2170
2171**Description**
2172
2173Defines an enum for the tile modes of the shader effect.
2174
2175**Since**: 11
2176
2177
2178### OH_Drawing_Typeface
2179
2180```
2181typedef struct OH_Drawing_Typeface OH_Drawing_Typeface
2182```
2183
2184**Description**
2185
2186Defines a struct for a typeface.
2187
2188**Since**: 11
2189
2190
2191### OH_Drawing_Typography
2192
2193```
2194typedef struct OH_Drawing_Typography OH_Drawing_Typography
2195```
2196
2197**Description**
2198
2199Defines a struct used to manage the typography layout and display.
2200
2201**Since**: 8
2202
2203
2204### OH_Drawing_TypographyCreate
2205
2206```
2207typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate
2208```
2209
2210**Description**
2211
2212Defines a struct used to create an [OH_Drawing_Typography](#oh_drawing_typography) object.
2213
2214**Since**: 8
2215
2216
2217### OH_Drawing_TypographyStyle
2218
2219```
2220typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle
2221```
2222
2223**Description**
2224
2225Defines a struct used to manage the typography style, such as the text direction.
2226
2227**Since**: 8
2228
2229
2230### OH_Drawing_VertexMode
2231
2232```
2233typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode
2234```
2235
2236**Description**
2237
2238Defines an enum for the modes of interpreting the geometry of a given vertex.
2239
2240**Since**: 12
2241
2242
2243### OH_Drawing_WordBreakType
2244
2245```
2246typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType
2247```
2248
2249**Description**
2250
2251Defines an enum for the word break types.
2252
2253**Since**: 11
2254
2255
2256## Enum Description
2257
2258### OH_Drawing_PathDashStyle
2259
2260```
2261enum OH_Drawing_PathDashStyle
2262```
2263
2264**Description**
2265
2266Enumerates the drawing styles for path effects.
2267
2268**Since**: 18
2269
2270| Value| Description|
2271| -------- | -------- |
2272| DRAWING_PATH_DASH_STYLE_TRANSLATE  | Translation effect.|
2273| DRAWING_PATH_DASH_STYLE_ROTATE  | Rotation effect.|
2274| DRAWING_PATH_DASH_STYLE_MORPH  | Morphing effect.|
2275
2276### OH_Drawing_SystemFontType
2277
2278```
2279enum OH_Drawing_SystemFontType
2280```
2281
2282**Description**
2283
2284Enumerates the system font types.
2285
2286**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
2287
2288**Since**: 14
2289
2290| Value| Description|
2291| -------- | -------- |
2292| ALL | All font types.|
2293| GENERIC | System font type.|
2294| STYLISH | Style font type.|
2295| INSTALLED | User-installed font type.|
2296| CUSTOMIZED<sup>18+</sup> | Custom font type.|
2297
2298### OH_Drawing_ErrorCode
2299
2300```
2301enum OH_Drawing_ErrorCode
2302```
2303
2304**Description**
2305
2306Enumerates the error codes that may be generated by the module.
2307
2308**Since**: 12
2309
2310| Value| Description|
2311| -------- | -------- |
2312| OH_DRAWING_SUCCESS | Operation successful.|
2313| OH_DRAWING_ERROR_NO_PERMISSION | Permission verification fails.|
2314| OH_DRAWING_ERROR_INVALID_PARAMETER | Invalid input parameter. For example, NULL is passed in.|
2315| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | The input parameter is not in the valid range.|
2316| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | Failed to allocate memory.|
2317
2318### OH_Drawing_PathMeasureMatrixFlags
2319
2320```
2321enum OH_Drawing_PathMeasureMatrixFlags
2322```
2323
2324**Description**
2325
2326Enumerates the types of matrix information obtained during path measurement.
2327
2328**Since**: 12
2329
2330| Value| Description|
2331| -------- | -------- |
2332| GET_POSITION_MATRIX | Obtains the matrix corresponding to the location information.|
2333| GET_TANGENT_MATRIX | Obtains the matrix corresponding to the tangent information.|
2334| GET_POSITION_AND_TANGENT_MATRIX | Obtains the matrix corresponding to the location and tangent information.|
2335
2336
2337### OH_Drawing_PathOpMode
2338
2339```
2340enum OH_Drawing_PathOpMode
2341```
2342
2343**Description**
2344
2345Enumerates the operation modes available for a path.
2346
2347**Since**: 12
2348
2349| Value| Description|
2350| -------- | -------- |
2351| PATH_OP_MODE_DIFFERENCE | Difference operation.|
2352| PATH_OP_MODE_INTERSECT | Intersection operation.|
2353| PATH_OP_MODE_UNION | Union operation.|
2354| PATH_OP_MODE_XOR | XOR operation.|
2355| PATH_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.|
2356
2357
2358### OH_Drawing_RegionOpMode
2359
2360```
2361enum OH_Drawing_RegionOpMode
2362```
2363
2364**Description**
2365
2366Enumerates the operation modes available for a region.
2367
2368**Since**: 12
2369
2370| Value| Description|
2371| -------- | -------- |
2372| REGION_OP_MODE_DIFFERENCE | Difference operation.|
2373| REGION_OP_MODE_INTERSECT | Intersection operation.|
2374| REGION_OP_MODE_UNION | Union operation.|
2375| REGION_OP_MODE_XOR | XOR operation.|
2376| REGION_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.|
2377| REGION_OP_MODE_REPLACE | Replacement operation.|
2378
2379
2380### OH_Drawing_AlphaFormat
2381
2382```
2383enum OH_Drawing_AlphaFormat
2384```
2385
2386**Description**
2387
2388Enumerates the alpha formats of bitmap pixels.
2389
2390**Since**: 8
2391
2392| Value| Description|
2393| -------- | -------- |
2394| ALPHA_FORMAT_UNKNOWN | Unknown format.|
2395| ALPHA_FORMAT_OPAQUE | The bitmap does not have the alpha component.|
2396| ALPHA_FORMAT_PREMUL | The color component of each pixel is premultiplied by the alpha component.|
2397| ALPHA_FORMAT_UNPREMUL | The color component of each pixel is not premultiplied by the alpha component.|
2398
2399
2400### OH_Drawing_BlendMode
2401
2402```
2403enum OH_Drawing_BlendMode
2404```
2405
2406**Description**
2407
2408Enumerates the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule). The operations for the alpha channel are used as examples.
2409
2410For brevity, the following abbreviations are used:
2411
2412**s**: source.
2413
2414**d**: destination.
2415
2416**sa**: source alpha.
2417
2418**da**: destination alpha.
2419
2420The following abbreviations are used in the calculation result:
2421
2422**r**: The calculation methods of the four channels are the same.
2423
2424**ra**: Only the alpha channel is manipulated.
2425
2426**rc**: The other three color channels are manipulated.
2427
2428**Since**: 11
2429
2430| Value| Description|
2431| -------- | -------- |
2432| BLEND_MODE_CLEAR | Clear mode. r = 0.|
2433| BLEND_MODE_SRC | r = s (The four channels of **result** are equal to the four channels of **source**, that is, the result is equal to the source.)|
2434| BLEND_MODE_DST | r = d (The four channels of **result** are equal to the four channels of **destination**, that is, the result is equal to the destination.)|
2435| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. |
2436| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. |
2437| BLEND_MODE_SRC_IN | r = s \* da. |
2438| BLEND_MODE_DST_IN | r = d \* sa. |
2439| BLEND_MODE_SRC_OUT | r = s \* (1 - da). |
2440| BLEND_MODE_DST_OUT | r = d \* (1 - sa). |
2441| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). |
2442| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). |
2443| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). |
2444| BLEND_MODE_PLUS | r = min(s + d, 1). |
2445| BLEND_MODE_MODULATE | r = s \* d. |
2446| BLEND_MODE_SCREEN | Screen mode. r = s + d - s \* d|
2447| BLEND_MODE_OVERLAY | Overlay mode.|
2448| BLEND_MODE_DARKEN | Darken mode. rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d|
2449| BLEND_MODE_LIGHTEN | Lighten mode. rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d|
2450| BLEND_MODE_COLOR_DODGE | Color dodge mode.|
2451| BLEND_MODE_COLOR_BURN | Color burn mode.|
2452| BLEND_MODE_HARD_LIGHT | Hard light mode.|
2453| BLEND_MODE_SOFT_LIGHT | Soft light mode.|
2454| BLEND_MODE_DIFFERENCE | Difference mode. rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d|
2455| BLEND_MODE_EXCLUSION | Exclusion mode. rc = s + d - two(s \* d), ra = s + (1 - sa) \* d|
2456| BLEND_MODE_MULTIPLY | Multiply mode. r = s \* (1 - da) + d \* (1 - sa) + s \* d|
2457| BLEND_MODE_HUE | Hue mode.|
2458| BLEND_MODE_SATURATION | Saturation mode.|
2459| BLEND_MODE_COLOR | Color mode.|
2460| BLEND_MODE_LUMINOSITY | Luminosity mode.|
2461
2462
2463### OH_Drawing_BlurType
2464
2465```
2466enum OH_Drawing_BlurType
2467```
2468
2469**Description**
2470
2471Enumerates the blur types.
2472
2473**Since**: 11
2474
2475| Value| Description|
2476| -------- | -------- |
2477| NORMAL | Blurs both inside and outside the original border.|
2478| SOLID | Draws solid inside the border, and blurs outside.|
2479| OUTER | Draws nothing inside the border, and blurs outside.|
2480| INNER | Blurs inside the border, and draws nothing outside.|
2481
2482
2483### OH_Drawing_BreakStrategy
2484
2485```
2486enum OH_Drawing_BreakStrategy
2487```
2488
2489**Description**
2490
2491Enumerates the text break strategies.
2492
2493**Since**: 11
2494
2495| Value| Description|
2496| -------- | -------- |
2497| BREAK_STRATEGY_GREEDY | Each line is filled as much as possible during line break.|
2498| BREAK_STRATEGY_HIGH_QUALITY | Text continuity is preferentially considered during line break.|
2499| BREAK_STRATEGY_BALANCED | Line breaks are performed at the word boundary.|
2500
2501
2502### OH_Drawing_CanvasClipOp
2503
2504```
2505enum OH_Drawing_CanvasClipOp
2506```
2507
2508**Description**
2509
2510Enumerates the canvas clipping modes.
2511
2512**Since**: 11
2513
2514| Value| Description|
2515| -------- | -------- |
2516| DIFFERENCE | Clips a specified area. That is, the difference set is obtained.|
2517| INTERSECT | Retains a specified area. That is, the intersection is obtained.|
2518
2519
2520### OH_Drawing_CanvasShadowFlags
2521
2522```
2523enum OH_Drawing_CanvasShadowFlags
2524```
2525
2526**Description**
2527
2528Enumerates the shadow flags.
2529
2530**Since**: 12
2531
2532| Value| Description|
2533| -------- | -------- |
2534| SHADOW_FLAGS_NONE | There is no shadow flag.|
2535| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | The occluding object is transparent.|
2536| SHADOW_FLAGS_GEOMETRIC_ONLY | No analysis on the shadows is required.|
2537| SHADOW_FLAGS_ALL | All the preceding shadow flags are used.|
2538
2539
2540### OH_Drawing_ColorFormat
2541
2542```
2543enum OH_Drawing_ColorFormat
2544```
2545
2546**Description**
2547
2548Enumerates the storage formats of bitmap pixels.
2549
2550**Since**: 8
2551
2552| Value| Description|
2553| -------- | -------- |
2554| COLOR_FORMAT_UNKNOWN | Unknown format.|
2555| COLOR_FORMAT_ALPHA_8 | Each pixel is represented by 8 bits, which together indicate alpha.|
2556| 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.|
2557| 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.|
2558| 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.|
2559| 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.|
2560
2561
2562### OH_Drawing_CornerPos
2563
2564```
2565enum OH_Drawing_CornerPos
2566```
2567
2568**Description**
2569
2570Enumerates the corner positions of a rounded rectangle.
2571
2572**Since**: 12
2573
2574| Value| Description|
2575| -------- | -------- |
2576| CORNER_POS_TOP_LEFT | Top left corner of the rounded rectangle.|
2577| CORNER_POS_TOP_RIGHT | Top right corner of the rounded rectangle.|
2578| CORNER_POS_BOTTOM_RIGHT | Bottom right corner of the rounded rectangle.|
2579| CORNER_POS_BOTTOM_LEFT | Bottom left corner of the rounded rectangle.|
2580
2581
2582### OH_Drawing_EllipsisModal
2583
2584```
2585enum OH_Drawing_EllipsisModal
2586```
2587
2588**Description**
2589
2590Enumerates the ellipsis styles.
2591
2592**Since**: 11
2593
2594| Value| Description|
2595| -------- | -------- |
2596| ELLIPSIS_MODAL_HEAD | Places the ellipsis in the text header.|
2597| ELLIPSIS_MODAL_MIDDLE | Places the ellipsis in the middle of the text.|
2598| ELLIPSIS_MODAL_TAIL | Places the ellipsis at the end of the text.|
2599
2600
2601### OH_Drawing_FilterMode
2602
2603```
2604enum OH_Drawing_FilterMode
2605```
2606
2607**Description**
2608
2609Enumerates the filter modes.
2610
2611**Since**: 12
2612
2613| Value| Description|
2614| -------- | -------- |
2615| FILTER_MODE_NEAREST | Nearest filter mode.|
2616| FILTER_MODE_LINEAR | Linear filter mode.|
2617
2618
2619### OH_Drawing_FontConfigInfoErrorCode
2620
2621```
2622enum OH_Drawing_FontConfigInfoErrorCode
2623```
2624
2625**Description**
2626
2627Enumerates the error codes that may be used during the obtaining of system font configurations.
2628
2629**Since**: 12
2630
2631| Value| Description|
2632| -------- | -------- |
2633| SUCCESS_FONT_CONFIG_INFO | Operation successful.|
2634| ERROR_FONT_CONFIG_INFO_UNKNOWN | Unknown error.|
2635| ERROR_FONT_CONFIG_INFO_PARSE_FILE | Failed to parse the system configuration file.|
2636| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | Failed to allocate the memory.|
2637| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | Failed to copy the string data.|
2638
2639
2640### OH_Drawing_FontEdging
2641
2642```
2643enum OH_Drawing_FontEdging
2644```
2645
2646**Description**
2647
2648Enumerates the font edging types.
2649
2650**Since**: 12
2651
2652| Value| Description|
2653| -------- | -------- |
2654| FONT_EDGING_ALIAS | No anti-aliasing processing is used.|
2655| FONT_EDGING_ANTI_ALIAS | Uses anti-aliasing to smooth the jagged edges.|
2656| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | Uses sub-pixel anti-aliasing to provide a smoother effect for jagged edges.|
2657
2658
2659### OH_Drawing_FontHinting
2660
2661```
2662enum OH_Drawing_FontHinting
2663```
2664
2665**Description**
2666
2667Enumerates the font hinting types.
2668
2669**Since**: 12
2670
2671| Value| Description|
2672| -------- | -------- |
2673| FONT_HINTING_NONE | No font hinting is used.|
2674| FONT_HINTING_SLIGHT | Slight font hinting is used to improve contrast.|
2675| FONT_HINTING_NORMAL | Normal font hinting is used to improve contrast.|
2676| FONT_HINTING_FULL | Full font hinting is used to improve contrast.|
2677
2678
2679### OH_Drawing_FontStyle
2680
2681```
2682enum OH_Drawing_FontStyle
2683```
2684
2685**Description**
2686
2687Enumerates the font styles.
2688
2689| Value| Description|
2690| -------- | -------- |
2691| FONT_STYLE_NORMAL | Normal style.|
2692| FONT_STYLE_ITALIC | Italic.|
2693| FONT_STYLE_OBLIQUE<sup>12+</sup> | Oblique.|
2694
2695
2696### OH_Drawing_FontWeight
2697
2698```
2699enum OH_Drawing_FontWeight
2700```
2701
2702**Description**
2703
2704Enumerates the font weights.
2705
2706| Value| Description|
2707| -------- | -------- |
2708| FONT_WEIGHT_100 | Thin.|
2709| FONT_WEIGHT_200 | Extra-light.|
2710| FONT_WEIGHT_300 | Light.|
2711| FONT_WEIGHT_400 | Normal/Regular.|
2712| FONT_WEIGHT_500 | Medium.|
2713| FONT_WEIGHT_600 | Semi-bold.|
2714| FONT_WEIGHT_700 | Bold.|
2715| FONT_WEIGHT_800 | Extra-bold.|
2716| FONT_WEIGHT_900 | Black.|
2717
2718
2719### OH_Drawing_FontWidth
2720
2721```
2722enum OH_Drawing_FontWidth
2723```
2724
2725**Description**
2726
2727Enumerates the font widths.
2728
2729**Since**: 12
2730
2731| Value| Description|
2732| -------- | -------- |
2733| 1 | Ultra condensed font.|
2734| 2 | Extra condensed font.|
2735| 3 | Condensed font.|
2736| 4 | Semi-condensed font.|
2737| 5 | Normal font.|
2738| 6 | Semi-expanded font.|
2739| 7 | Expanded font.|
2740| 8 | Extra expanded font.|
2741| 9 | Ultra expanded font.|
2742
2743### OH_Drawing_MipmapMode
2744
2745```
2746enum OH_Drawing_MipmapMode
2747```
2748
2749**Description**
2750
2751Enumerates the mipmap modes.
2752
2753**Since**: 12
2754
2755| Value| Description|
2756| -------- | -------- |
2757| MIPMAP_MODE_NONE | Mipmap level ignored.|
2758| MIPMAP_MODE_NEAREST | Nearest sampling from two adjacent mipmap levels.|
2759| MIPMAP_MODE_LINEAR | Linear interpolation sampling between two adjacent mipmap levels.|
2760
2761
2762### OH_Drawing_PathAddMode
2763
2764```
2765enum OH_Drawing_PathAddMode
2766```
2767
2768**Description**
2769
2770Enumerates the path adding modes.
2771
2772**Since**: 12
2773
2774| Value| Description|
2775| -------- | -------- |
2776| PATH_ADD_MODE_APPEND | Adds a path in append mode.|
2777| PATH_ADD_MODE_EXTEND | Adds a line segment to close the path if the previous path is not closed.|
2778
2779
2780### OH_Drawing_PathDirection
2781
2782```
2783enum OH_Drawing_PathDirection
2784```
2785
2786**Description**
2787
2788Enumerates the directions of a closed contour.
2789
2790**Since**: 12
2791
2792| Value| Description|
2793| -------- | -------- |
2794| PATH_DIRECTION_CW | Adds a closed contour clockwise.|
2795| PATH_DIRECTION_CCW | Adds a closed contour counterclockwise.|
2796
2797
2798### OH_Drawing_PathFillType
2799
2800```
2801enum OH_Drawing_PathFillType
2802```
2803
2804**Description**
2805
2806Enumerates the fill types of a path.
2807
2808**Since**: 12
2809
2810| Value| Description|
2811| -------- | -------- |
2812| PATH_FILL_TYPE_WINDING | Specifies that "inside" is computed by a non-zero sum of signed edge crossings. Specifically, draws a point and emits a ray in any direction. A count is used to record the number of intersection points of the ray and path, and the initial count is 0. When encountering a clockwise intersection point (the path passes from the left to the right of the ray), the count increases by 1. When encountering a counterclockwise intersection point (the path passes from the right to the left of the ray), the count decreases by 1. If the final count is not 0, the point is inside the path and needs to be colored. If the final count is 0, the point is not colored.|
2813| PATH_FILL_TYPE_EVEN_ODD | Specifies that "inside" is computed by an odd number of edge crossings. Specifically, draws a point and emits a ray in any direction. If the number of intersection points of the ray and path is an odd number, the point is considered to be inside the path and needs to be colored. If the number is an even number, the point is not colored.|
2814| PATH_FILL_TYPE_INVERSE_WINDING | Same as **PATH_FILL_TYPE_WINDING**, but draws outside of the path, rather than inside.|
2815| PATH_FILL_TYPE_INVERSE_EVEN_ODD | Same as **PATH_FILL_TYPE_EVEN_ODD**, but draws outside of the path, rather than inside.|
2816
2817
2818### OH_Drawing_PenLineCapStyle
2819
2820```
2821enum OH_Drawing_PenLineCapStyle
2822```
2823
2824**Description**
2825
2826Enumerates the line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen.
2827
2828**Since**: 8
2829
2830| Value| Description|
2831| -------- | -------- |
2832| LINE_FLAT_CAP | There is no cap style. Both ends of the line segment are cut off square.|
2833| 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.|
2834| 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.|
2835
2836
2837### OH_Drawing_PenLineJoinStyle
2838
2839```
2840enum OH_Drawing_PenLineJoinStyle
2841```
2842
2843**Description**
2844
2845Enumerates the line join styles of a pen. The line join style defines the shape of the joints of a polyline segment drawn by the pen.
2846
2847**Since**: 8
2848
2849| Value| Description|
2850| -------- | -------- |
2851| 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.|
2852| LINE_ROUND_JOIN | Round corner.|
2853| LINE_BEVEL_JOIN | Beveled corner.|
2854
2855
2856### OH_Drawing_PlaceholderVerticalAlignment
2857
2858```
2859enum OH_Drawing_PlaceholderVerticalAlignment
2860```
2861
2862**Description**
2863
2864Enumerates the vertical alignment modes of placeholders.
2865
2866**Since**: 11
2867
2868| Value| Description|
2869| -------- | -------- |
2870| ALIGNMENT_OFFSET_AT_BASELINE | Aligned to the baseline.|
2871| ALIGNMENT_ABOVE_BASELINE | Aligned above the baseline.|
2872| ALIGNMENT_BELOW_BASELINE | Aligned below the baseline.|
2873| ALIGNMENT_TOP_OF_ROW_BOX | Aligned to the top of the row box.|
2874| ALIGNMENT_BOTTOM_OF_ROW_BOX | Aligned to the bottom of the row box.|
2875| ALIGNMENT_CENTER_OF_ROW_BOX | Aligned to the center of the row box.|
2876
2877
2878### OH_Drawing_PointMode
2879
2880```
2881enum OH_Drawing_PointMode
2882```
2883
2884**Description**
2885
2886Enumerates the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.
2887
2888**Since**: 12
2889
2890| Value| Description|
2891| -------- | -------- |
2892| POINT_MODE_POINTS | Draws each point separately.|
2893| POINT_MODE_LINES | Draws every two points as a line segment.|
2894| POINT_MODE_POLYGON | Draws an array of points as an open polygon.|
2895
2896
2897### OH_Drawing_RectHeightStyle
2898
2899```
2900enum OH_Drawing_RectHeightStyle
2901```
2902
2903**Description**
2904
2905Enumerates the rectangle height styles.
2906
2907**Since**: 11
2908
2909| Value| Description|
2910| -------- | -------- |
2911| RECT_HEIGHT_STYLE_TIGHT | Tight style.|
2912| RECT_HEIGHT_STYLE_MAX | Maximum style.|
2913| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | Middle style that includes the line spacing.|
2914| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | Top style that includes the line spacing.|
2915| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | Bottom style that includes the line spacing.|
2916| RECT_HEIGHT_STYLE_STRUCT | Structure style.|
2917
2918
2919### OH_Drawing_RectWidthStyle
2920
2921```
2922enum OH_Drawing_RectWidthStyle
2923```
2924
2925**Description**
2926
2927Enumerates the rectangle width styles.
2928
2929**Since**: 11
2930
2931| Value| Description|
2932| -------- | -------- |
2933| RECT_WIDTH_STYLE_TIGHT | Tight style.|
2934| RECT_WIDTH_STYLE_MAX | Maximum style.|
2935
2936
2937### OH_Drawing_ScaleToFit
2938
2939```
2940enum OH_Drawing_ScaleToFit
2941```
2942
2943**Description**
2944
2945Enumerates the matrix scaling modes.
2946
2947**Since**: 12
2948
2949| Value| Description|
2950| -------- | -------- |
2951| SCALE_TO_FIT_FILL | Scales the source rectangle both horizontally and vertically to exactly match the destination rectangle.|
2952| SCALE_TO_FIT_START | Scales the source rectangle and aligns it to the left and top edges of the destination rectangle.|
2953| SCALE_TO_FIT_CENTER | Scales the source rectangle and aligns it to the center of the destination rectangle.|
2954| SCALE_TO_FIT_END | Scales the source rectangle and aligns it to the right and bottom edges of the destination rectangle.|
2955
2956
2957### OH_Drawing_SrcRectConstraint
2958
2959```
2960enum OH_Drawing_SrcRectConstraint
2961```
2962
2963**Description**
2964
2965Enumerates the constraint types of the source rectangle.
2966
2967**Since**: 12
2968
2969| Value| Description|
2970| -------- | -------- |
2971| STRICT_SRC_RECT_CONSTRAINT | The source rectangle must be completely contained in the image.|
2972| FAST_SRC_RECT_CONSTRAINT | The source rectangle can be partly outside the image.|
2973
2974
2975### OH_Drawing_TextAlign
2976
2977```
2978enum OH_Drawing_TextAlign
2979```
2980
2981**Description**
2982
2983Enumerates the text alignment modes.
2984
2985| Value| Description|
2986| -------- | -------- |
2987| TEXT_ALIGN_LEFT | Left-aligned.|
2988| TEXT_ALIGN_RIGHT | Right-aligned.|
2989| TEXT_ALIGN_CENTER | Center-aligned.|
2990| 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.|
2991| 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**.|
2992| 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**.|
2993
2994
2995### OH_Drawing_TextBaseline
2996
2997```
2998enum OH_Drawing_TextBaseline
2999```
3000
3001**Description**
3002
3003Enumerates the text baselines.
3004
3005| Value| Description|
3006| -------- | -------- |
3007| TEXT_BASELINE_ALPHABETIC | Alphabetic, where the letters in alphabets like English sit on.|
3008| TEXT_BASELINE_IDEOGRAPHIC | Ideographic, where the baseline is at the bottom of the text area.|
3009
3010
3011### OH_Drawing_TextDecoration
3012
3013```
3014enum OH_Drawing_TextDecoration
3015```
3016
3017**Description**
3018
3019Enumerates the text decorations.
3020
3021| Value| Description|
3022| -------- | -------- |
3023| TEXT_DECORATION_NONE | No decoration.|
3024| TEXT_DECORATION_UNDERLINE | An underline is used for decoration.|
3025| TEXT_DECORATION_OVERLINE | An overline is used for decoration.|
3026| TEXT_DECORATION_LINE_THROUGH | A strikethrough is used for decoration.|
3027
3028
3029### OH_Drawing_TextDecorationStyle
3030
3031```
3032enum OH_Drawing_TextDecorationStyle
3033```
3034
3035**Description**
3036
3037Enumerates the text decoration styles.
3038
3039**Since**: 11
3040
3041| Value| Description|
3042| -------- | -------- |
3043| TEXT_DECORATION_STYLE_SOLID | Solid style.|
3044| TEXT_DECORATION_STYLE_DOUBLE | Double style.|
3045| TEXT_DECORATION_STYLE_DOTTED | Dotted style.|
3046| TEXT_DECORATION_STYLE_DASHED | Dashed style.|
3047| TEXT_DECORATION_STYLE_WAVY | Wavy style.|
3048
3049
3050### OH_Drawing_TextDirection
3051
3052```
3053enum OH_Drawing_TextDirection
3054```
3055
3056**Description**
3057
3058Enumerates the text directions.
3059
3060| Value| Description|
3061| -------- | -------- |
3062| TEXT_DIRECTION_RTL | Right to left (RTL).|
3063| TEXT_DIRECTION_LTR | Left to right (LTR).|
3064
3065
3066### OH_Drawing_TextEncoding
3067
3068```
3069enum OH_Drawing_TextEncoding
3070```
3071
3072**Description**
3073
3074Enumerates the text encoding types.
3075
3076**Since**: 12
3077
3078| Value| Description|
3079| -------- | -------- |
3080| TEXT_ENCODING_UTF8 | One byte used to indicate UTF-8 or ASCII characters.|
3081| TEXT_ENCODING_UTF16 | Two bytes used to indicate most Unicode characters.|
3082| TEXT_ENCODING_UTF32 | Four bytes used to indicate all Unicode characters.|
3083| TEXT_ENCODING_GLYPH_ID | Two bytes used to indicate the glyph index.|
3084
3085
3086### OH_Drawing_TextHeightBehavior
3087
3088```
3089enum OH_Drawing_TextHeightBehavior
3090```
3091
3092**Description**
3093
3094Enumerates the text height modifier patterns.
3095
3096**Since**: 12
3097
3098| Value| Description|
3099| -------- | -------- |
3100| TEXT_HEIGHT_ALL | Enables the height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the top of the first line and the bottom of the last line in a paragraph.|
3101| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | Disables the height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the top of the first line in a paragraph.|
3102| TEXT_HEIGHT_DISABLE_LAST_ASCENT | Disables the height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the bottom of the last line in a paragraph.|
3103| TEXT_HEIGHT_DISABLE_ALL | Disables the height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for both the top of the first line and the bottom of the last line in a paragraph.|
3104
3105
3106### OH_Drawing_TextStyleType
3107
3108```
3109enum OH_Drawing_TextStyleType
3110```
3111
3112**Description**
3113
3114Enumerates the text style types.
3115
3116**Since**: 12
3117
3118| Value| Description|
3119| -------- | -------- |
3120| TEXT_STYLE_NONE | No text style.|
3121| TEXT_STYLE_ALL_ATTRIBUTES | All text styles.|
3122| TEXT_STYLE_FONT | Font style.|
3123| TEXT_STYLE_FOREGROUND | Text foreground style.|
3124| TEXT_STYLE_BACKGROUND | Text background style.|
3125| TEXT_STYLE_SHADOW | Text shadow style.|
3126| TEXT_STYLE_DECORATIONS | Text decoration style.|
3127| TEXT_STYLE_LETTER_SPACING | Text letter spacing style.|
3128| TEXT_STYLE_WORD_SPACING | Text word spacing style.|
3129
3130
3131### OH_Drawing_TileMode
3132
3133```
3134enum OH_Drawing_TileMode
3135```
3136
3137**Description**
3138
3139Enumerates the tile modes of the shader effect.
3140
3141**Since**: 11
3142
3143| Value| Description|
3144| -------- | -------- |
3145| CLAMP | Replicates the edge color if the shader effect draws outside of its original boundary.|
3146| REPEAT | Repeats the shader effect's image in both horizontal and vertical directions.|
3147| MIRROR | Repeats the shader effect's image in both horizontal and vertical directions, alternating mirror images.|
3148| DECAL | Renders the shader effect's image only within the original boundary, and returns transparent black elsewhere.|
3149
3150
3151### OH_Drawing_VertexMode
3152
3153```
3154enum OH_Drawing_VertexMode
3155```
3156
3157**Description**
3158
3159Enumerates the modes of interpreting the geometry of a given vertex.
3160
3161**Since**: 12
3162
3163| Value| Description|
3164| -------- | -------- |
3165| VERTEX_MODE_TRIANGLES | Draws a triangle list. Specifically, a list of isolated triangles are drawn using every three vertices. If the number of vertices is not a multiple of 3, the extra vertices will be ignored. |
3166| VERTEX_MODE_TRIANGLESSTRIP | Draws a triangle strip. Specifically, the first triangle is drawn between the first 3 vertices, and all subsequent triangles use the previous 2 vertices plus the next additional vertex.|
3167| VERTEX_MODE_TRIANGLEFAN | Draws a triangle fan. A triangle fan is similar to a triangle strip, except that all the triangles share one vertex (the first vertex).|
3168
3169
3170### OH_Drawing_WordBreakType
3171
3172```
3173enum OH_Drawing_WordBreakType
3174```
3175
3176**Description**
3177
3178Enumerates the word break types.
3179
3180**Since**: 11
3181
3182| Value| Description|
3183| -------- | -------- |
3184| WORD_BREAK_TYPE_NORMAL | Normal mode.|
3185| WORD_BREAK_TYPE_BREAK_ALL | Breaks the words at any character to prevent overflow.|
3186| WORD_BREAK_TYPE_BREAK_WORD | Breaks the words at arbitrary points to prevent overflow.|
3187| WORD_BREAK_TYPE_BREAK_HYPHEN<sup>18+</sup>  | Uses a hyphen (-) to break a word at the end of each line. If adding a hyphen is not possible, it will behave the same as **WORD_BREAK_TYPE_BREAK_WORD**.|
3188
3189
3190
3191## Function Description
3192
3193### OH_Drawing_PathGetSegment()
3194
3195```
3196OH_Drawing_ErrorCode OH_Drawing_PathGetSegment (OH_Drawing_Path* path, bool forceClosed, float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result)
3197```
3198
3199**Description**
3200
3201Extracts a segment of a path and appends it to a destination path.
3202
3203**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3204
3205**Since**: 18
3206
3207**Parameters**
3208
3209| Name| Description|
3210| -------- | -------- |
3211| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
3212| forceClosed | Whether the path is measured as a closed path. The value **true** means that the path is considered closed during measurement, and **false** means that the path is measured based on the actual closed status. |
3213| start | Distance from the start point of the path to the start point of the segment. If it is less than 0, it defaults to 0. If it is greater than or equal to **stop**, the extraction fails. |
3214| stop | Distance from the start point of the path to the end point of the segment. If it is less than or equal to **start**, the extraction fails. If it is greater than the path length, it defaults to the path length. |
3215| startWithMoveTo | Whether to execute [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) in the destination path to move to its start point. The value **true** means to move to the start point, and **false** means the opposite. |
3216| dst | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object. If the extraction succeeds, the segment is appended to the path. If the extraction fails, nothing changes. |
3217| result | Pointer to the extraction result. The value **true** means that the extraction is successful, and **false** means the opposite.   |
3218
3219**Returns**
3220
3221Returns one of the following result codes:
3222
3223- **OH_DRAWING_SUCCESS** if the operation is successful.
3224
3225- **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the **path**, **dst**, and **result** parameters is a null pointer.
3226
3227### OH_Drawing_CreateSumPathEffect()
3228
3229```
3230OH_Drawing_PathEffect* OH_Drawing_CreateSumPathEffect (OH_Drawing_PathEffect* firstPathEffect, OH_Drawing_PathEffect* secondPathEffect )
3231```
3232
3233**Description**
3234
3235Creates an overlay path effect based on two distinct path effects that take effect separately.
3236
3237**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3238
3239**Since**: 18
3240
3241**Parameters**
3242
3243| Name| Description|
3244| -------- | -------- |
3245| firstPathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
3246| secondPathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
3247
3248**Returns**
3249
3250Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
3251
3252If a null pointer is returned, the creation fails. The possible failure cause is that **firstPathEffect** or **secondPathEffect** is a null pointer.
3253
3254### OH_Drawing_CreatePathDashEffect()
3255
3256```
3257OH_Drawing_PathEffect* OH_Drawing_CreatePathDashEffect (const OH_Drawing_Path* path, float advance, float phase, OH_Drawing_PathDashStyle type )
3258```
3259
3260**Description**
3261
3262Creates an **OH_Drawing_PathEffect** object with a dashed line effect.
3263
3264**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3265
3266**Since**: 18
3267
3268**Parameters**
3269
3270| Name| Description|
3271| -------- | -------- |
3272| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
3273| advance | Length of each dashed line segment. |
3274| phase | Offset of the pattern within the dash segment length. |
3275| type | Style of the dashed path effect. |
3276
3277**Returns**
3278
3279Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
3280
3281If a null pointer is returned, the creation fails. The possible failure cause is that **path** is a null pointer or **advance** is less than or equal to **0**.
3282
3283### OH_Drawing_CreateDiscretePathEffect()
3284
3285```
3286OH_Drawing_PathEffect* OH_Drawing_CreateDiscretePathEffect (float segLength, float deviation )
3287```
3288
3289**Description**
3290
3291Creates a path effect that segments the path and scatters the segments in an irregular pattern along the path.
3292
3293**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3294
3295**Since**: 18
3296
3297**Parameters**
3298
3299| Name| Description|
3300| -------- | -------- |
3301| segLength | Distance along the path at which each segment is fragmented. An effect is created when it is greater than 0. |
3302| deviation | Maximum amount by which the end points of the segments can be randomly displaced during rendering. |
3303
3304**Returns**
3305
3306Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
3307
3308
3309### OH_Drawing_CreateCornerPathEffect()
3310
3311```
3312OH_Drawing_PathEffect* OH_Drawing_CreateCornerPathEffect (float radius)
3313```
3314
3315**Description**
3316
3317Creates a path effect that transforms the sharp angle between line segments into a rounded corner with the specified radius.
3318
3319**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3320
3321**Since**: 18
3322
3323**Parameters**
3324
3325| Name| Description|
3326| -------- | -------- |
3327| radius | Radius of the rounded corner. The value is valid only when it is greater than 0. |
3328
3329**Returns**
3330
3331Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
3332
3333If a null pointer is returned, the creation fails. The possible failure cause is that **radius** is less than or equal to **0**.
3334
3335
3336
3337### OH_Drawing_CreateComposePathEffect()
3338
3339```
3340OH_Drawing_PathEffect* OH_Drawing_CreateComposePathEffect (OH_Drawing_PathEffect* outer, OH_Drawing_PathEffect* inner )
3341```
3342
3343**Description**
3344
3345Creates a path effect by sequentially applying the inner effect and then the outer effect.
3346
3347**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3348
3349**Since**: 18
3350
3351**Parameters**
3352
3353| Name| Description|
3354| -------- | -------- |
3355| outer | Pointer to an outer effect, which is an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
3356| inner | Pointer to an inner effect, which is an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
3357
3358**Returns**
3359
3360Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
3361
3362If a null pointer is returned, the creation fails. The possible failure cause is that **inner** or **inner** is a null pointer.
3363
3364### OH_Drawing_GpuContextCreate()
3365
3366```
3367OH_Drawing_GpuContext* OH_Drawing_GpuContextCreate (void)
3368```
3369
3370**Description**
3371
3372Creates an **OH_Drawing_GpuContext** object, for which the backend type depends on the device.
3373
3374**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3375
3376**Since**: 16
3377
3378**Returns**
3379
3380Returns the pointer to the [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object created.
3381
3382
3383### OH_Drawing_CanvasDrawArcWithCenter()
3384
3385```
3386OH_Drawing_ErrorCode OH_Drawing_CanvasDrawArcWithCenter (OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, float startAngle, float sweepAngle, bool useCenter )
3387```
3388
3389**Description**
3390
3391Draws an arc. It enables you to define the starting angle, sweep angle, and whether the arc's endpoints should connect to its center.
3392
3393**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3394
3395**Since**: 18
3396
3397**Parameters**
3398
3399| Name| Description|
3400| -------- | -------- |
3401| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
3402| rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. |
3403| startAngle | Start angle, in degrees. The value is a floating point number. When the degree is 0, the start point is located at the right end of the oval. A positive number indicates that the start point is placed clockwise, and a negative number indicates that the start point is placed counterclockwise. |
3404| sweepAngle | Angle to sweep, in degrees. The value is a floating point number. A positive number indicates a clockwise sweep, and a negative value indicates a counterclockwise swipe. The swipe angle can exceed 360 degrees, and a complete ellipse is drawn. |
3405| useCenter | Whether the start point and end point of the arc are connected to its center. The value **true** means that they are connected to the center; the value **false** means the opposite. |
3406
3407**Returns**
3408
3409Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **inner** is NULL.
3410
3411### OH_Drawing_CanvasDrawNestedRoundRect()
3412
3413```
3414OH_Drawing_ErrorCode OH_Drawing_CanvasDrawNestedRoundRect (OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* outer, const OH_Drawing_RoundRect* inner )
3415```
3416
3417**Description**
3418
3419Draws two nested rounded rectangles. The outer rectangle boundary must contain the inner rectangle boundary. Otherwise, there is no drawing effect.
3420
3421**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3422
3423**Since**: 18
3424
3425**Parameters**
3426
3427| Name| Description|
3428| -------- | -------- |
3429| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
3430| outer | Pointer to the outer rectangle boundary, which is an [OH_Drawing_RoundRect](#oh_drawing_roundrect) object. |
3431| inner | Pointer to the inner rectangle boundary, which is an [OH_Drawing_RoundRect](#oh_drawing_roundrect) object. |
3432
3433**Returns**
3434
3435Returns one of the following result codes:
3436
3437- **OH_DRAWING_SUCCESS** if the operation is successful.
3438
3439- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas**, **outer**, or **inner** is NULL.
3440
3441### OH_Drawing_CanvasQuickRejectPath()
3442
3443```
3444OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectPath (OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, bool* quickReject )
3445```
3446
3447**Description**
3448
3449
3450Checks whether the path is not intersecting with the canvas area. The canvas area includes its boundaries.
3451
3452**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3453
3454**Since**: 18
3455
3456**Parameters**
3457
3458| Name| Description|
3459| -------- | -------- |
3460| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
3461| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
3462| quickReject | Pointer to the check result. The value **true** means that the path is not intersecting with the canvas area, and **false** means the opposite. |
3463
3464**Returns**
3465
3466Returns one of the following result codes:
3467
3468**OH_DRAWING_SUCCESS** if the operation is successful.
3469
3470**OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas**, **path**, or **quickReject** is NULL.
3471
3472### OH_Drawing_CanvasQuickRejectRect()
3473
3474```
3475OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectRect (OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, bool* quickReject )
3476```
3477
3478**Description**
3479
3480Checks whether the rectangle is not intersecting with the canvas area. The canvas area includes its boundaries.
3481
3482**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3483
3484**Since**: 18
3485
3486**Parameters**
3487
3488| Name| Description|
3489| -------- | -------- |
3490| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
3491| rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. |
3492| quickReject | Pointer to the check result. The value **true** means that the rectangle is not intersecting with the canvas area, and **false** means the opposite. |
3493
3494**Returns**
3495
3496Returns one of the following result codes:
3497
3498- **OH_DRAWING_SUCCESS** if the operation is successful.
3499
3500- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas**, **rect**, or **quickReject** is NULL.
3501
3502### OH_Drawing_CanvasDrawPixelMapNine()
3503
3504```
3505OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapNine (OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, const OH_Drawing_Rect* center, const OH_Drawing_Rect* dst, OH_Drawing_FilterMode mode )
3506```
3507
3508**Description**
3509
3510Splits a PixelMap into nine sections using two horizontal and two vertical lines: four edge sections, four corner sections, and a central section. If the four corner sections are smaller than the target rectangle, they will be drawn in the target rectangle without scaling. Otherwise, they will be scaled to fit the target rectangle. Any remaining space will be filled by stretching or compressing the other five sections to cover the entire target rectangle.
3511
3512**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3513
3514**Since**: 18
3515
3516**Parameters**
3517
3518| Name| Description|
3519| -------- | -------- |
3520| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
3521| pixelMap | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object. |
3522| center | Pointer to the central rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. It divides the image into nine sections by extending its four edges. |
3523| dst | Pointer to the target rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
3524| mode | Filter mode. For details about available options, see [OH_Drawing_FilterMode](#oh_drawing_filtermode-1). |
3525
3526**Returns**
3527
3528Returns one of the following result codes:
3529
3530- **OH_DRAWING_SUCCESS** if the operation is successful.
3531
3532- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas**, **pixelMap**, or **dst** is NULL.
3533
3534### OH_Drawing_SurfaceCreateOnScreen()
3535
3536```
3537OH_Drawing_Surface* OH_Drawing_SurfaceCreateOnScreen (OH_Drawing_GpuContext* gpuContext, OH_Drawing_Image_Info imageInfo, void* window )
3538```
3539**Description**
3540
3541Creates an **OH_Drawing_Surface** object bound to the window using the GPU context to manage the content drawn on the canvas.
3542
3543Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). **OH_DRAWING_ERROR_INVALID_PARAMETER** if **gpuContext** or **window** is NULL.
3544
3545**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3546
3547**Since**: 16
3548
3549**Parameters**
3550
3551| Name| Description|
3552| -------- | -------- |
3553| gpuContext | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. This object must be created by [OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate). Otherwise, the **OH_Drawing_Surface** object fails to be created. |
3554| imageInfo | [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. |
3555| window | Pointer to the window object. |
3556
3557**Returns**
3558
3559Returns the pointer to the [OH_Drawing_Surface](#oh_drawing_surface) object created.
3560
3561### OH_Drawing_SurfaceFlush()
3562
3563```
3564OH_Drawing_ErrorCode OH_Drawing_SurfaceFlush (OH_Drawing_Surface* surface)
3565```
3566
3567**Description**
3568
3569Pushes the drawing content from an **OH_Drawing_Surface** object to the GPU for rendering.
3570
3571**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3572
3573**Since**: 16
3574
3575**Parameters**
3576
3577| Name| Description|
3578| -------- | -------- |
3579| surface | Pointer to the [OH_Drawing_Surface](#oh_drawing_surface) object created. This object must be created by calling [OH_Drawing_SurfaceCreateOnScreen](#oh_drawing_surfacecreateonscreen). Otherwise, calling the current API has no effect. |
3580
3581**Returns**
3582
3583Returns one of the following result codes:
3584
3585- **OH_DRAWING_SUCCESS** if the operation is successful.
3586
3587- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **surface** is NULL.
3588
3589### OH_Drawing_ErrorCodeReset()
3590
3591```
3592void OH_Drawing_ErrorCodeReset (void )
3593```
3594
3595**Description**
3596
3597Resets the error code of this module to **OH_DRAWING_SUCCESS**.
3598
3599When a function that does not return an error code fails, the error code obtained through [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) is reset to the corresponding error number. However, it is not reset to **OH_DRAWING_SUCCESS** for a successful operation.
3600
3601By calling this function, you can manually reset the error code to **OH_DRAWING_SUCCESS**, avoiding interference between different functions and simplifying the debugging process.
3602
3603**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3604
3605**Since**: 18
3606
3607### OH_Drawing_FontSetThemeFontFollowed()
3608
3609```
3610OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed (OH_Drawing_Font* font, bool followed )
3611```
3612
3613**Description**
3614
3615Sets whether to follow the theme font. When **followed** is set to **true**, the theme font is used if it is enabled by the system and no typeface is set.
3616
3617**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3618
3619**Since**: 15
3620
3621**Parameters**
3622
3623| Name| Description|
3624| -------- | -------- |
3625| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3626| followed | Whether to follow the theme font. The value **true** means to follow the theme font, and **false** means the opposite.|
3627
3628**Returns**
3629
3630Returns one of the following result codes:
3631- **OH_DRAWING_SUCCESS** if the operation is successful.
3632- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **font** is NULL.
3633
3634### OH_Drawing_FontIsThemeFontFollowed()
3635
3636```
3637OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed (const OH_Drawing_Font* font, bool* followed )
3638```
3639
3640**Description**
3641
3642Checks whether the font follows the theme font. By default, the theme font is not followed.
3643
3644**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3645
3646**Since**: 15
3647
3648**Parameters**
3649
3650| Name| Description|
3651| -------- | -------- |
3652| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3653| followed | Check result. The value **true** means that the theme font is followed, and **false** means the opposite.  |
3654
3655**Returns**
3656
3657Returns one of the following result codes:
3658- **OH_DRAWING_SUCCESS** if the operation is successful.
3659- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **font** or **followed** is NULL.
3660
3661### OH_Drawing_GetFontCollectionGlobalInstance()
3662
3663```
3664OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance (void )
3665```
3666**Description**
3667
3668Obtains the global **OH_Drawing_FontCollection** object, which can be used to sense the theme font information. Do not release the object.
3669
3670**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3671
3672**Since**: 14
3673
3674**Returns**
3675
3676Returns the pointer to the global {@link OH_Drawing_FontCollection} object obtained.
3677
3678### OH_Drawing_CreateLineTypography()
3679
3680```
3681OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography (OH_Drawing_TypographyCreate* handler)
3682```
3683
3684**Description**
3685
3686Creates a pointer to an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object, which stores the text content and style and can be used to compute typography details for individual lines of text.
3687
3688**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3689
3690**Since**: 18
3691
3692**Parameters**
3693
3694| Name| Description|
3695| -------- | -------- |
3696| handler | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler).|
3697
3698**Returns**
3699
3700Returns the pointer to the [OH_Drawing_LineTypography](#oh_drawing_linetypography) object created.
3701
3702### OH_Drawing_DestroyLineTypography()
3703
3704```
3705void OH_Drawing_DestroyLineTypography (OH_Drawing_LineTypography* lineTypography)
3706```
3707
3708**Description**
3709
3710Releases the memory occupied by an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object.
3711
3712**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3713
3714**Since**: 18
3715
3716**Parameters**
3717
3718| Name| Description|
3719| -------- | -------- |
3720| lineTypography | Pointer to an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object, which is obtained by calling [OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography).|
3721
3722### OH_Drawing_LineTypographyGetLineBreak()
3723
3724```
3725size_t OH_Drawing_LineTypographyGetLineBreak (OH_Drawing_LineTypography* lineTypography, size_t startIndex, double width )
3726```
3727
3728**Description**
3729
3730Obtains the number of characters that can fit in the layout from the specified position within a limited layout width.
3731
3732**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3733
3734**Since**: 18
3735
3736**Parameters**
3737
3738| Name| Description|
3739| -------- | -------- |
3740| lineTypography | Pointer to an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object, which is obtained by calling [OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography).|
3741| startIndex | Start position (inclusive) for layout calculation. The value must be an integer in the range [0, total number of text characters].|
3742| width | Layout width. The value is a floating point number greater than 0, in px.|
3743
3744**Returns**
3745
3746Returns the number of characters.
3747
3748### OH_Drawing_LineTypographyCreateLine()
3749
3750```
3751OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine (OH_Drawing_LineTypography* lineTypography, size_t startIndex, size_t count )
3752```
3753
3754**Description**
3755
3756Creates a pointer to an **OH_Drawing_TextLine** object based on the text content in a specified range.
3757
3758**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3759
3760**Since**: 18
3761
3762**Parameters**
3763
3764| Name| Description|
3765| -------- | -------- |
3766| lineTypography | Pointer to an [OH_Drawing_LineTypography](#oh_drawing_linetypography) object, which is obtained by calling [OH_Drawing_CreateLineTypography](#oh_drawing_createlinetypography).|
3767| startIndex | Start position for layout calculation. The value is an integer in the range [0, total number of text characters).|
3768| count | Number of characters from the specified start position. The value is an integer in the range [0, total number of text characters). The sum of **startIndex** and **count** cannot be greater than the total number of text characters. You can use [OH_Drawing_LineTypographyGetLineBreak](#oh_drawing_linetypographygetlinebreak) to obtain the number of characters that can fit in the layout. If **count** is set to 0, a null pointer is returned.|
3769
3770**Returns**
3771
3772Returns the pointer to the **OH_Drawing_TextLine** object created.
3773
3774### OH_Drawing_CreateTextTab()
3775
3776```
3777OH_Drawing_TextTab* OH_Drawing_CreateTextTab (OH_Drawing_TextAlign alignment, float location )
3778```
3779
3780**Description**
3781
3782Creates a text tab object.
3783
3784**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3785
3786**Since**: 18
3787
3788**Parameters**
3789
3790| Name| Description|
3791| -------- | -------- |
3792| alignment | Alignment mode of the text following the tab character. The value 1 means right alignment, 2 means center alignment, and 0 or other values mean left alignment.|
3793| float | Alignment position of the text following the tab character. The unit is px. The minimum value is 1.0.|
3794
3795**Returns**
3796
3797Returns the pointer to the **OH_Drawing_TextTab** object created. If a null pointer is returned, the creation fails. A possible cause is that no memory is available.
3798
3799### OH_Drawing_DestroyTextTab()
3800
3801```
3802void OH_Drawing_DestroyTextTab (OH_Drawing_TextTab* )
3803```
3804
3805**Description**
3806
3807Releases the memory occupied by a text tab object.
3808
3809**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3810
3811**Since**: 18
3812
3813**Parameters**
3814
3815| Name| Description|
3816| -------- | -------- |
3817| OH_Drawing_TextTab | Pointer to an **OH_Drawing_TextTab** object.|
3818
3819### OH_Drawing_GetTextTabAlignment()
3820
3821```
3822OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment (OH_Drawing_TextTab* )
3823```
3824
3825**Description**
3826
3827Obtains the alignment mode of a text tab.
3828
3829**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3830
3831**Since**: 18
3832
3833**Parameters**
3834
3835| Name| Description|
3836| -------- | -------- |
3837| OH_Drawing_TextTab | Pointer to an **OH_Drawing_TextTab** object.|
3838
3839**Returns**
3840
3841Returns the text alignment mode. The value 1 means right alignment, 2 means center alignment, and 0 or other values mean left alignment.
3842
3843### OH_Drawing_GetTextTabLocation()
3844
3845```
3846float OH_Drawing_GetTextTabLocation (OH_Drawing_TextTab* )
3847```
3848
3849**Description**
3850
3851Obtains the location of a text tab.
3852
3853**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3854
3855**Since**: 18
3856
3857**Parameters**
3858
3859| Name| Description|
3860| -------- | -------- |
3861| OH_Drawing_TextTab | Pointer to an **OH_Drawing_TextTab** object.|
3862
3863**Returns**
3864
3865Returns the position of the text tab.
3866
3867### OH_Drawing_SetTypographyTextTab()
3868
3869```
3870void OH_Drawing_SetTypographyTextTab (OH_Drawing_TypographyStyle* , OH_Drawing_TextTab* TextTab )
3871```
3872
3873**Description**
3874
3875Sets the alignment mode and location of a text tab. When the text alignment mode or ellipsis style is set, the tab does not take effect. When the tab location is less than 1.0, the tab is replaced with a space.
3876
3877**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3878
3879**Since**: 18
3880
3881**Parameters**
3882
3883| Name| Description|
3884| -------- | -------- |
3885| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object.|
3886| OH_Drawing_TextTab | Pointer to an **OH_Drawing_TextTab** object.|
3887
3888### OH_Drawing_FontGetBounds()
3889
3890```
3891OH_Drawing_ErrorCode OH_Drawing_FontGetBounds (const OH_Drawing_Font* font, const uint16_t* glyphs, uint32_t count, OH_Drawing_Array* bounds )
3892```
3893
3894**Description**
3895
3896Obtains the rectangular bounding box for each glyph in the glyph array.
3897
3898**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3899
3900**Since**: 18
3901
3902**Parameters**
3903
3904| Name| Description|
3905| -------- | -------- |
3906| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3907| glyphs | Pointer to a glyph array.|
3908| count | Length of the glyph array.|
3909| bounds | Pointer to a rectangular bounding box array.|
3910
3911**Returns**
3912
3913Returns one of the following result codes:
3914- **OH_DRAWING_SUCCESS** if the operation is successful.
3915- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **font**, **glyphs**, or **bounds** is NULL or **count** is **0**.
3916
3917### OH_Drawing_FontGetPathForGlyph()
3918
3919```
3920OH_Drawing_ErrorCode OH_Drawing_FontGetPathForGlyph (const OH_Drawing_Font* font, uint16_t glyph, OH_Drawing_Path* path )
3921```
3922
3923**Description**
3924
3925Obtains the path of a glyph.
3926
3927**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3928
3929**Since**: 18
3930
3931**Parameters**
3932
3933| Name| Description|
3934| -------- | -------- |
3935| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3936| glyph | Glyph index.|
3937| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, which is used to store the glyph path.|
3938
3939**Returns**
3940
3941Returns one of the following result codes:
3942- **OH_DRAWING_SUCCESS** if the operation is successful.
3943- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **font** or **path** is NULL or the specified glyph does not exist.
3944
3945### OH_Drawing_RectCreateArray()
3946
3947```
3948OH_Drawing_Array* OH_Drawing_RectCreateArray (size_t size)
3949```
3950
3951**Description**
3952
3953Creates a rectangle array object to store multiple rectangle objects. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_RectDestroyArray](#oh_drawing_rectdestroyarray) to release the pointer to the object.
3954
3955**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3956
3957**Since**: 18
3958
3959**Parameters**
3960
3961| Name| Description|
3962| -------- | -------- |
3963| size | Size of the rectangle array. The value cannot exceed 65536, which is the maximum number of glyph indices.|
3964
3965**Returns**
3966
3967Returns the pointer to the [OH_Drawing_Array](#oh_drawing_array) object created. If the returned object pointer is null, the creation fails. Possible causes are that no memory is available or an input parameter is incorrect.
3968
3969### OH_Drawing_RectGetArraySize()
3970
3971```
3972OH_Drawing_ErrorCode OH_Drawing_RectGetArraySize (OH_Drawing_Array* rectArray, size_t* pSize )
3973```
3974
3975**Description**
3976
3977Obtains the size of a rectangle array, which is an [OH_Drawing_Array](#oh_drawing_array) object.
3978
3979**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3980
3981**Since**: 18
3982
3983**Parameters**
3984
3985| Name| Description|
3986| -------- | -------- |
3987| rectArray | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
3988| pSize | Pointer to the size_t type, which is used as an output parameter to store the size of the rectangle array.|
3989
3990**Returns**
3991
3992Returns one of the following result codes:
3993- **OH_DRAWING_SUCCESS** if the operation is successful.
3994- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **rectArray** or **pSize** is NULL.
3995
3996### OH_Drawing_RectGetArrayElement()
3997
3998```
3999OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement (OH_Drawing_Array* rectArray, size_t index, OH_Drawing_Rect** rect )
4000```
4001
4002**Description**
4003
4004Obtains the rectangle with the specified index in a rectangle array.
4005
4006**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4007
4008**Since**: 18
4009
4010**Parameters**
4011
4012| Name| Description|
4013| -------- | -------- |
4014| rectArray | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
4015| index | Index of the rectangle array.|
4016| rect | Double pointer to [OH_Drawing_Rect](#oh_drawing_rect), which is returned to the caller as an output parameter.|
4017
4018**Returns**
4019
4020Returns one of the following result codes:
4021- **OH_DRAWING_SUCCESS** if the operation is successful.
4022- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **rectArray** or **rect** is null or **index** is out of range.
4023
4024### OH_Drawing_RectDestroyArray()
4025
4026```
4027OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray (OH_Drawing_Array* rectArray)
4028```
4029
4030**Description**
4031
4032Destroys an **OH_Drawing_Array** object and reclaims the memory occupied by the object.
4033
4034**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4035
4036**Since**: 18
4037
4038**Parameters**
4039
4040| Name| Description|
4041| -------- | -------- |
4042| rectArray | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
4043
4044**Returns**
4045
4046Returns one of the following result codes:
4047- **OH_DRAWING_SUCCESS** if the operation is successful.
4048- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **rectArray** is NULL.
4049
4050### OH_Drawing_TypographyGetTextLines()
4051
4052```
4053OH_Drawing_Array* OH_Drawing_TypographyGetTextLines (OH_Drawing_Typography* typography)
4054```
4055
4056**Description**
4057
4058Obtains the array of text lines in a typography object. This array contains one or more text line objects. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyTextLines](#oh_drawing_destroytextlines) to release the pointer to the object.
4059
4060**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4061
4062**Since**: 18
4063
4064**Parameters**
4065
4066| Name| Description|
4067| -------- | -------- |
4068| typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object.|
4069
4070**Returns**
4071
4072Returns the pointer to the [OH_Drawing_Array](#oh_drawing_array) object obtained.
4073
4074### OH_Drawing_DestroyTextLines()
4075
4076```
4077void OH_Drawing_DestroyTextLines (OH_Drawing_Array* lines)
4078```
4079
4080**Description**
4081
4082Releases the memory occupied by a text line array.
4083
4084**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4085
4086**Since**: 18
4087
4088**Parameters**
4089
4090| Name| Description|
4091| -------- | -------- |
4092| lines | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
4093
4094### OH_Drawing_DestroyTextLine()
4095
4096```
4097void OH_Drawing_DestroyTextLine (OH_Drawing_TextLine* line)
4098```
4099
4100**Description**
4101
4102Releases the memory occupied by a text line object. This is applicable only to text line objects that have requested memory on their own and not to a particular text line object within a text line array.
4103
4104**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4105
4106**Since**: 18
4107
4108**Parameters**
4109
4110| Name| Description|
4111| -------- | -------- |
4112| line | Pointer to an **OH_Drawing_TextLine** object.|
4113
4114### OH_Drawing_GetTextLineByIndex()
4115
4116```
4117OH_Drawing_TextLine* OH_Drawing_GetTextLineByIndex (OH_Drawing_Array* lines, size_t index )
4118```
4119
4120**Description**
4121
4122Obtains the text line object with the specified index in a text line array.
4123
4124**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4125
4126**Since**: 18
4127
4128**Parameters**
4129
4130| Name| Description|
4131| -------- | -------- |
4132| lines | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
4133| index | Index of the text line array.|
4134
4135**Returns**
4136
4137Returns the pointer to the **OH_Drawing_TextLine** object obtained.
4138
4139### OH_Drawing_TextLineGetGlyphCount()
4140
4141```
4142double OH_Drawing_TextLineGetGlyphCount (OH_Drawing_TextLine* line)
4143```
4144
4145**Description**
4146
4147Obtains the number of glyphs in a text line object.
4148
4149**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4150
4151**Since**: 18
4152
4153**Parameters**
4154
4155| Name| Description|
4156| -------- | -------- |
4157| line | Pointer to an **OH_Drawing_TextLine** object.|
4158
4159**Returns**
4160
4161Returns the number of glyphs in the text line object.
4162
4163### OH_Drawing_TextLineGetTextRange()
4164
4165```
4166void OH_Drawing_TextLineGetTextRange (OH_Drawing_TextLine* line, size_t* start, size_t* end )
4167```
4168
4169**Description**
4170
4171Obtains the range of the text in a text line object in the entire paragraph.
4172
4173**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4174
4175**Since**: 18
4176
4177**Parameters**
4178
4179| Name| Description|
4180| -------- | -------- |
4181| line | Pointer to an **OH_Drawing_TextLine** object.|
4182| start | Pointer to the start of the range.|
4183| end | Pointer to the end of the range.|
4184
4185### OH_Drawing_TextLineGetGlyphRuns()
4186
4187```
4188OH_Drawing_Array* OH_Drawing_TextLineGetGlyphRuns (OH_Drawing_TextLine* line)
4189```
4190
4191**Description**
4192
4193Obtains the array of glyph runs in a text line object.
4194
4195**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4196
4197**Since**: 18
4198
4199**Parameters**
4200
4201| Name| Description|
4202| -------- | -------- |
4203| line | Pointer to an **OH_Drawing_TextLine** object.|
4204
4205**Returns**
4206
4207Returns the pointer to the [OH_Drawing_Array](#oh_drawing_array), which holds multiple **OH_Drawing_Run** objects. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyRuns](#oh_drawing_destroyruns) to release the pointer to the object.
4208
4209### OH_Drawing_DestroyRuns()
4210
4211```
4212void OH_Drawing_DestroyRuns (OH_Drawing_Array* runs)
4213```
4214
4215**Description**
4216
4217Releases the memory occupied by a glyph run array.
4218
4219**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4220
4221**Since**: 18
4222
4223**Parameters**
4224
4225| Name| Description|
4226| -------- | -------- |
4227| runs | Pointer to an [OH_Drawing_Array](#oh_drawing_array), which holds multiple **OH_Drawing_Run** objects.|
4228
4229### OH_Drawing_GetRunByIndex()
4230
4231```
4232OH_Drawing_Run* OH_Drawing_GetRunByIndex (OH_Drawing_Array* runs, size_t index )
4233```
4234
4235**Description**
4236
4237Obtains the glyph run object with the specified index in a glyph run array.
4238
4239**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4240
4241**Since**: 18
4242
4243**Parameters**
4244
4245| Name| Description|
4246| -------- | -------- |
4247| runs | Pointer to an [OH_Drawing_Array](#oh_drawing_array), which holds multiple **OH_Drawing_Run** objects.|
4248| index | Index of the glyph run array.|
4249
4250**Returns**
4251
4252Returns the pointer to the **OH_Drawing_Run** object obtained.
4253
4254### OH_Drawing_TextLinePaint()
4255
4256```
4257void OH_Drawing_TextLinePaint (OH_Drawing_TextLine* line, OH_Drawing_Canvas* canvas, double x, double y )
4258```
4259
4260**Description**
4261
4262Paints a text line on the canvas with the coordinate point (x, y) as the upper left corner.
4263
4264**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4265
4266**Since**: 18
4267
4268**Parameters**
4269
4270| Name| Description|
4271| -------- | -------- |
4272| line | Pointer to an **OH_Drawing_TextLine** object.|
4273| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
4274| x | Horizontal coordinate of the upper left corner, in px.|
4275| y | Vertical coordinate of the upper left corner, in px.|
4276
4277### OH_Drawing_TextLineCreateTruncatedLine()
4278
4279```
4280OH_Drawing_TextLine* OH_Drawing_TextLineCreateTruncatedLine (OH_Drawing_TextLine* line, double width, int mode, const char* ellipsis )
4281```
4282
4283**Description**
4284
4285Creates a truncated text line object.
4286
4287**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4288
4289**Since**: 18
4290
4291**Parameters**
4292
4293| Name| Description|
4294| -------- | -------- |
4295| line | Pointer to an **OH_Drawing_TextLine** object.|
4296| width | Line width after truncation.|
4297| mode | Truncation type. The value is an enumerated value of [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). Currently, only **ELLIPSIS_MODAL_HEAD** and **ELLIPSIS_MODAL_TAIL** are supported.|
4298| ellipsis | Pointer to the string used to mark a truncation.|
4299
4300**Returns**
4301
4302Returns the pointer to the **OH_Drawing_TextLine** object created.
4303
4304### OH_Drawing_TextLineGetTypographicBounds()
4305
4306```
4307double OH_Drawing_TextLineGetTypographicBounds (OH_Drawing_TextLine* line, double* ascent, double* descent, double* leading )
4308```
4309
4310**Description**
4311
4312Obtains the typographic boundary of a text line object. The typographic boundary is related to the font and font size used for typography, but not the characters within the text. For example, for the string " a b " (which has a space before "a" and a space after "b"), the typographic boundary encompasses the spaces at the beginning and end. For the strings "j" and "E", the typographic boundaries are the same, indicating that they are irrelevant to specific characters.
4313
4314**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4315
4316**Since**: 18
4317
4318**Parameters**
4319
4320| Name| Description|
4321| -------- | -------- |
4322| line | Pointer to an **OH_Drawing_TextLine** object. height = ascent + descent + leading.|
4323| ascent | Pointer to the ascent of the text line object.|
4324| descent | Pointer to the descent of the text line object.|
4325| leading | Pointer to the leading of the text line object.|
4326
4327**Returns**
4328
4329Returns the total width of the layout boundary.
4330
4331### OH_Drawing_TextLineGetImageBounds()
4332
4333```
4334OH_Drawing_Rect* OH_Drawing_TextLineGetImageBounds (OH_Drawing_TextLine* line)
4335```
4336
4337**Description**
4338
4339Obtains the image boundary of a text line object.
4340
4341The image boundary, equivalent to a visual boundary, is related to the font, font size, and characters. For example, for the string " a b " (which has a space before "a" and a space after "b"), only "a b" are visible to users, and therefore the image boundary does not include these spaces at the beginning and end. For the strings "j" and "E", their image boundaries are different. Specifically, the width of the boundary for "j" is narrower than that for "E", and the height of the boundary for "j" is taller than that for "E".
4342
4343**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4344
4345**Since**: 18
4346
4347**Parameters**
4348
4349| Name| Description|
4350| -------- | -------- |
4351| line | Pointer to an **OH_Drawing_TextLine** object.|
4352
4353**Returns**
4354
4355Returns the pointer to [OH_Drawing_Rect](#oh_drawing_rect) of the text line object. When [OH_Drawing_Rect](#oh_drawing_rect) is no loner required, call [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) to release the pointer to the object.
4356
4357### OH_Drawing_TextLineGetTrailingSpaceWidth()
4358
4359```
4360double OH_Drawing_TextLineGetTrailingSpaceWidth (OH_Drawing_TextLine* line)
4361```
4362
4363**Description**
4364
4365Obtains the width of the spaces at the end of a text line object.
4366
4367**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4368
4369**Since**: 18
4370
4371**Parameters**
4372
4373| Name| Description|
4374| -------- | -------- |
4375| line | Pointer to an **OH_Drawing_TextLine** object.|
4376
4377**Returns**
4378
4379Returns the pointer to the width of the spaces.
4380
4381### OH_Drawing_TextLineGetStringIndexForPosition()
4382
4383```
4384int32_t OH_Drawing_TextLineGetStringIndexForPosition (OH_Drawing_TextLine* line, OH_Drawing_Point* point )
4385```
4386
4387**Description**
4388
4389Obtains the index of a character at the specified position in a text line object.
4390
4391**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4392
4393**Since**: 18
4394
4395**Parameters**
4396
4397| Name| Description|
4398| -------- | -------- |
4399| line | Pointer to an **OH_Drawing_TextLine** object.|
4400| point | Pointer to the position, which is an [OH_Drawing_Point](#oh_drawing_point) object.|
4401
4402**Returns**
4403
4404Returns the index of the character. For example, for the string "abc", the index of "a" is 0, the index of "b" is 1, and the index of "c" is 2. If the specified position is at "a", then **0** is returned.
4405
4406### OH_Drawing_TextLineGetOffsetForStringIndex()
4407
4408```
4409double OH_Drawing_TextLineGetOffsetForStringIndex (OH_Drawing_TextLine* line, int32_t index )
4410```
4411
4412**Description**
4413
4414Obtains the offset of a character with the specified index in a text line object.
4415
4416**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4417
4418**Since**: 18
4419
4420**Parameters**
4421
4422| Name| Description|
4423| -------- | -------- |
4424| line | Pointer to an **OH_Drawing_TextLine** object.|
4425| index | Index of the character.|
4426
4427**Returns**
4428
4429Returns the offset.
4430
4431### OH_Drawing_TextLineEnumerateCaretOffsets()
4432
4433```
4434void OH_Drawing_TextLineEnumerateCaretOffsets (OH_Drawing_TextLine* line, Drawing_CaretOffsetsCallback callback )
4435```
4436
4437**Description**
4438
4439Enumerates the offset and index of each character in a text line object and passes them to a custom callback function. You can use the offset and index array for other operations.
4440
4441**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4442
4443**Since**: 18
4444
4445**Parameters**
4446
4447| Name| Description|
4448| -------- | -------- |
4449| line | Pointer to an **OH_Drawing_TextLine** object.|
4450| callback | User-defined function, which is [Drawing_CaretOffsetsCallback](#drawing_caretoffsetscallback).|
4451
4452### OH_Drawing_TextLineGetAlignmentOffset()
4453
4454```
4455double OH_Drawing_TextLineGetAlignmentOffset (OH_Drawing_TextLine* line, double alignmentFactor, double alignmentWidth )
4456```
4457
4458**Description**
4459
4460Obtains the offset of a text line object after alignment based on the alignment factor and alignment width.
4461
4462**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4463
4464**Since**: 18
4465
4466**Parameters**
4467
4468| Name| Description|
4469| -------- | -------- |
4470| line | Pointer to an **OH_Drawing_TextLine** object.|
4471| alignmentFactor | Alignment factor, which determines how text is aligned. A value less than or equal to 0.0 means that the text is left-aligned; a value between 0.0 and 0.5 means that the text is slightly left-aligned; the value 0.5 means that is text is centered; a value between 0.5 and 1 means that the text is slightly right-aligned; a value greater than or equal to 1.0 means that the text is right-aligned.|
4472| alignmentWidth | Alignment width, that is, the offset of the lower right corner of the text line object relative to the start position. If the specified alignment width is less than the actual width of the text line object, **0** is returned.|
4473
4474**Returns**
4475
4476Returns the offset obtained.
4477
4478### OH_Drawing_AddTextStyleDecoration()
4479
4480```
4481void OH_Drawing_AddTextStyleDecoration (OH_Drawing_TextStyle* , int  )
4482```
4483
4484**Description**
4485
4486Adds the decoration for a text style. Multiple decoration lines can be displayed.
4487
4488**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4489
4490**Since**: 18
4491
4492**Parameters**
4493
4494| Name| Description|
4495| -------- | -------- |
4496| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle).|
4497| int | Decoration to add. The value **1** means to add an underline, **2** means to add an overline, and 4 means to add a strikethrough. You can add various text decorations in a single operation using bitwise OR. If you set decoration styles that are not defined in [OH_Drawing_TextDecoration](#oh_drawing_textdecoration), the existing decorations remain unchanged.|
4498
4499### OH_Drawing_RemoveTextStyleDecoration()
4500
4501```
4502void OH_Drawing_RemoveTextStyleDecoration (OH_Drawing_TextStyle* , int  )
4503```
4504
4505**Description**
4506
4507Removes the decoration for a text style.
4508
4509**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4510
4511**Since**: 18
4512
4513**Parameters**
4514
4515| Name| Description|
4516| -------- | -------- |
4517| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle).|
4518| int | Decoration to remove. The value **1** means to remove an underline, **2** means to remove an overline, and 4 means to remove a strikethrough. You can remove various text decorations in a single operation using bitwise OR.  If you set decoration styles that are not defined in [OH_Drawing_TextDecoration](#oh_drawing_textdecoration), the existing decorations remain unchanged.|
4519
4520### OH_Drawing_FontGetTextPath()
4521
4522```
4523OH_Drawing_ErrorCode OH_Drawing_FontGetTextPath (const OH_Drawing_Font* font, const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding, float x, float y, OH_Drawing_Path* path )
4524```
4525
4526**Description**
4527
4528Obtains the text outline path.
4529
4530**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4531
4532**Since**: 18
4533
4534**Parameters**
4535
4536| Name| Description|
4537| -------- | -------- |
4538| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4539| text | Pointer to the text string.|
4540| byteLength | Length of the text path. If the length is greater than the length of the text string, undefined behavior occurs.|
4541| encoding | Text encoding format. UTF-8, UTF-16, UTF-32, and glyph indices are supported. For details about the format, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding).|
4542| x | X coordinate of the text in the drawing area, with the origin as the start point.|
4543| y | Y coordinate of the text in the drawing area, with the origin as the start point.|
4544| path | Pointer to the text outline path.|
4545
4546**Returns**
4547
4548Returns one of the following error codes: **IMAGE_RESULT_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if any of **font**, **text**, and **path** is a null pointer.
4549
4550### OH_Drawing_GetDrawingArraySize()
4551
4552```
4553size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array* drawingArray)
4554```
4555
4556**Description**
4557
4558Obtains the number of objects in an [OH_Drawing_Array](#oh_drawing_array).
4559
4560**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4561
4562**Since**: 14
4563
4564**Parameters**
4565
4566| Name| Description|
4567| -------- | -------- |
4568| drawingArray | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.|
4569
4570**Returns**
4571
4572Returns the number of objects in the array.
4573
4574
4575### OH_Drawing_GetRunStringIndices()
4576
4577```
4578OH_Drawing_Array* OH_Drawing_GetRunStringIndices (OH_Drawing_Run* run, int64_t start, int64_t length )
4579```
4580
4581**Description**
4582
4583Obtains an array of character indices of glyphs within a specified range of a run, where the indices are offsets relative to the entire paragraph.
4584
4585**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4586
4587**Since**: 18
4588
4589**Parameters**
4590
4591| Name| Description|
4592| -------- | -------- |
4593| run | Pointer to an **OH_Drawing_Run** object.|
4594| start | Start position in the run. If a negative number is passed, a null pointer is returned.|
4595| length | Length of the range in the run. If the length is 0, all character indices of the run are obtained. If the length is less than 0, a null pointer is returned.|
4596
4597**Returns**
4598
4599Returns the pointer to a character index array, which is an [OH_Drawing_Array](#oh_drawing_array) object. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyRunStringIndices](#oh_drawing_destroyrunstringindices) to release the pointer to the object.
4600
4601
4602### OH_Drawing_GetRunStringIndicesByIndex()
4603
4604```
4605uint64_t OH_Drawing_GetRunStringIndicesByIndex (OH_Drawing_Array* stringIndices, size_t index )
4606```
4607
4608**Description**
4609
4610Obtains character indices of glyphs in a run by index.
4611
4612**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4613
4614**Since**: 18
4615
4616**Parameters**
4617
4618| Name| Description|
4619| -------- | -------- |
4620| stringIndices | Pointer to a character index array.|
4621| index | Index of the character index array.|
4622
4623**Returns**
4624
4625Returns the character indices.
4626
4627
4628### OH_Drawing_DestroyRunStringIndices()
4629
4630```
4631void OH_Drawing_DestroyRunStringIndices (OH_Drawing_Array* stringIndices)
4632```
4633
4634**Description**
4635
4636Releases the pointer to a character index array object.
4637
4638**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4639
4640**Since**: 18
4641
4642**Parameters**
4643
4644| Name| Description|
4645| -------- | -------- |
4646| stringIndices | Pointer to a character index array.|
4647
4648
4649### OH_Drawing_GetRunStringRange()
4650
4651```
4652void OH_Drawing_GetRunStringRange (OH_Drawing_Run* run, uint64_t* location, uint64_t* length )
4653```
4654
4655**Description**
4656
4657Obtains the range of glyphs generated by a run.
4658
4659**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4660
4661**Since**: 18
4662
4663**Parameters**
4664
4665| Name| Description|
4666| -------- | -------- |
4667| run | Pointer to an **OH_Drawing_Run** object.|
4668| location | Start position of the range in the run, which is an offset relative to the entire paragraph.|
4669| length | Length of the range.|
4670
4671
4672### OH_Drawing_GetRunTypographicBounds()
4673
4674```
4675float OH_Drawing_GetRunTypographicBounds (OH_Drawing_Run* run, float* ascent, float* descent, float* leading )
4676```
4677
4678**Description**
4679
4680Obtains the typographic boundary of a run.
4681
4682The typographic boundary is related to the font and font size used for typography, but not the characters within the text.
4683
4684**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4685
4686**Since**: 18
4687
4688**Parameters**
4689
4690| Name| Description|
4691| -------- | -------- |
4692| run | Pointer to an **OH_Drawing_Run** object.|
4693| ascent | Distance from the top of the tallest character to the baseline in the run.|
4694| descent | Distance from the bottom of the lowest character to the baseline in the run.|
4695| leading | Vertical space between lines in the run.|
4696
4697**Returns**
4698
4699Returns the layout width of the run.
4700
4701
4702### OH_Drawing_RunPaint()
4703
4704```
4705void OH_Drawing_RunPaint (OH_Drawing_Canvas* canvas, OH_Drawing_Run* run, double x, double y )
4706```
4707
4708**Description**
4709
4710Paints the text contained in a run on the canvas.
4711
4712**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4713
4714**Since**: 18
4715
4716**Parameters**
4717
4718| Name| Description|
4719| -------- | -------- |
4720| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
4721| run | Pointer to an **OH_Drawing_Run** object.|
4722| x | X coordinate of the run.|
4723| y | Y coordinate of the run.|
4724
4725
4726### OH_Drawing_GetRunImageBounds()
4727
4728```
4729OH_Drawing_Rect* OH_Drawing_GetRunImageBounds (OH_Drawing_Run* run)
4730```
4731
4732**Description**
4733
4734Obtains the image boundary of a run.
4735
4736The image boundary is related to characters and is equivalent to the visual boundary.
4737
4738**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4739
4740**Since**: 18
4741
4742**Parameters**
4743
4744| Name| Description|
4745| -------- | -------- |
4746| run | Pointer to an **OH_Drawing_Run** object.|
4747
4748**Returns**
4749
4750Returns the pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which describes the image boundary of the run. When [OH_Drawing_Rect](#oh_drawing_rect) is no longer required, call [OH_Drawing_DestroyRunImageBounds](#oh_drawing_destroyrunimagebounds) to release the pointer to the object.
4751
4752
4753### OH_Drawing_DestroyRunImageBounds()
4754
4755```
4756void OH_Drawing_DestroyRunImageBounds (OH_Drawing_Rect* rect)
4757```
4758
4759**Description**
4760
4761Releases the pointer to an image boundary object of a run.
4762
4763**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4764
4765**Since**: 18
4766
4767**Parameters**
4768
4769| Name| Description|
4770| -------- | -------- |
4771| rect | Pointer to the image boundary, which is an [OH_Drawing_Rect](#oh_drawing_rect) object.|
4772
4773
4774### OH_Drawing_GetRunGlyphs()
4775
4776```
4777OH_Drawing_Array* OH_Drawing_GetRunGlyphs (OH_Drawing_Run* run, int64_t start, int64_t length )
4778```
4779
4780**Description**
4781
4782Obtains an array of glyphs within the specified range of a run.
4783
4784**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4785
4786**Since**: 18
4787
4788**Parameters**
4789
4790| Name| Description|
4791| -------- | -------- |
4792| run | Pointer to an **OH_Drawing_Run** object.|
4793| start | Start position in the run. If a negative number is passed, a null pointer is returned.|
4794| length | Length of the range in the run. If the length is 0, all character indices of the run are obtained. If the length is less than 0, a null pointer is returned.|
4795
4796**Returns**
4797
4798Returns the pointer to an [OH_Drawing_Array](#oh_drawing_array) object, which holds the glyphs. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyRunGlyphs](#oh_drawing_destroyrunglyphs) to release the pointer to the object.
4799
4800
4801### OH_Drawing_GetRunGlyphsByIndex()
4802
4803```
4804uint16_t OH_Drawing_GetRunGlyphsByIndex (OH_Drawing_Array* glyphs, size_t index )
4805```
4806
4807**Description**
4808
4809Obtains individual glyphs in a run by index.
4810
4811**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4812
4813**Since**: 18
4814
4815**Parameters**
4816
4817| Name| Description|
4818| -------- | -------- |
4819| glyphs | Pointer to the glyph array, which is an [OH_Drawing_Array](#oh_drawing_array) object.|
4820| index | Index of the glyph array.|
4821
4822**Returns**
4823
4824Returns the individual glyphs.
4825
4826
4827### OH_Drawing_DestroyRunGlyphs()
4828
4829```
4830void OH_Drawing_DestroyRunGlyphs (OH_Drawing_Array* glyphs)
4831```
4832
4833**Description**
4834
4835Releases the pointer to a glyph array in a run.
4836
4837**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4838
4839**Since**: 18
4840
4841**Parameters**
4842
4843| Name| Description|
4844| -------- | -------- |
4845| glyphs | Pointer to the glyph array, which is an [OH_Drawing_Array](#oh_drawing_array) object.|
4846
4847### OH_Drawing_GetRunPositions()
4848
4849```
4850OH_Drawing_Array* OH_Drawing_GetRunPositions (OH_Drawing_Run* run, int64_t start, int64_t length )
4851```
4852
4853**Description**
4854
4855Obtains the positions of glyphs within the specified range of a run.
4856
4857**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4858
4859**Since**: 18
4860
4861**Parameters**
4862
4863| Name| Description|
4864| -------- | -------- |
4865| run | Pointer to an **OH_Drawing_Run** object.|
4866| start | Start position in the run. If a negative number is passed, a null pointer is returned.|
4867| length | Length of the range in the run. If the length is 0, all character indices of the run are obtained. If the length is less than 0, a null pointer is returned.|
4868
4869**Returns**
4870
4871Returns the pointer to an [OH_Drawing_Array](#oh_drawing_array) object, which holds the glyph positions. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroyRunPositions](#oh_drawing_destroyrunpositions) to release the pointer to the object.
4872
4873### OH_Drawing_GetRunPositionsByIndex()
4874
4875```
4876OH_Drawing_Point* OH_Drawing_GetRunPositionsByIndex (OH_Drawing_Array* positions, size_t index )
4877```
4878
4879**Description**
4880
4881Obtains the positions of individual glyphs in a run by index.
4882
4883**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4884
4885**Since**: 18
4886
4887**Parameters**
4888
4889| Name| Description|
4890| -------- | -------- |
4891| positions | Pointer to the glyph position array, which is an [OH_Drawing_Array](#oh_drawing_array) object.|
4892| index | Index of the glyph position array in the run.|
4893
4894**Returns**
4895
4896Returns the pointer to an [OH_Drawing_Point](#oh_drawing_point) object, which holds the positions of individual glyphs in the run.
4897
4898
4899### OH_Drawing_DestroyRunPositions()
4900
4901```
4902void OH_Drawing_DestroyRunPositions (OH_Drawing_Array* positions)
4903```
4904
4905**Description**
4906
4907Releases the pointer to a glyph position array in a run.
4908
4909**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4910
4911**Since**: 18
4912
4913**Parameters**
4914
4915| Name| Description|
4916| -------- | -------- |
4917| positions | Pointer to the glyph position array, which is an [OH_Drawing_Array](#oh_drawing_array) object.|
4918
4919### OH_Drawing_GetRunGlyphCount()
4920
4921```
4922uint32_t OH_Drawing_GetRunGlyphCount (OH_Drawing_Run* run)
4923```
4924
4925**Description**
4926
4927Obtains the number of glyphs in a run.
4928
4929**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4930
4931**Since**: 18
4932
4933**Parameters**
4934
4935| Name| Description|
4936| -------- | -------- |
4937| run | Pointer to an **OH_Drawing_Run** object.|
4938
4939**Returns**
4940
4941Returns the number of glyphs.
4942
4943### OH_Drawing_MatchFontDescriptors()
4944
4945```
4946OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors (OH_Drawing_FontDescriptor* , size_t*  )
4947```
4948
4949**Description**
4950
4951Obtains all system font descriptors that match a font descriptor. In the [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) struct, the **path** field is not used for matching, and other fields are valid only when they are not set to their default values. If all fields in [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) are set to their default values, all system font descriptors are returned. If no matching is found, NULL is returned. When [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) is no longer required, call [OH_Drawing_DestroyFontDescriptors](_drawing.md#oh_drawing_destroyfontdescriptors) to release the pointer to the object.
4952
4953**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4954
4955**Since**: 18
4956
4957**Parameters**
4958
4959| Name                                                        | Description                                                        |
4960| ------------------------------------------------------------ | ------------------------------------------------------------ |
4961| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Pointer to [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md). You are advised to use [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) to obtain a valid [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) instance. If you want to create an [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) instance, maintain the default values for the fields that are not used for matching|
4962| size_t                                                       | Pointer to the number of elements in the array.                                  |
4963
4964**Returns**
4965
4966Returns an [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) array, which must be released by calling [OH_Drawing_DestroyFontDescriptors](#oh_drawing_destroyfontdescriptors).
4967
4968### OH_Drawing_DestroyFontDescriptors()
4969
4970```
4971void OH_Drawing_DestroyFontDescriptors (OH_Drawing_FontDescriptor* , size_t  )
4972```
4973
4974**Description**
4975
4976Releases an array of [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) objects.
4977
4978**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4979
4980**Since**: 18
4981
4982**Parameters**
4983
4984| Name| Description|
4985| -------- | -------- |
4986| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Pointer to an array of [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) objects.|
4987| size_t | Number of [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) objects in the array.|
4988
4989### OH_Drawing_DestroySystemFontFullNames()
4990
4991```
4992void OH_Drawing_DestroySystemFontFullNames (OH_Drawing_Array* )
4993```
4994
4995**Description**
4996
4997Releases the memory occupied by the font name array obtained by font type.
4998
4999**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5000
5001**Since**: 14
5002
5003**Parameters**
5004
5005| Name| Description|
5006| -------- | -------- |
5007| OH_Drawing_Array | Pointer to an [OH_Drawing_Array](#oh_drawing_array) that holds the font names.|
5008
5009### OH_Drawing_GetSystemFontFullNameByIndex()
5010
5011```
5012const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex (OH_Drawing_Array* , size_t  )
5013```
5014
5015**Description**
5016
5017Obtains the font name with the specified index in the font name array.
5018
5019**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5020
5021**Since**: 14
5022
5023**Parameters**
5024
5025| Name| Description|
5026| -------- | -------- |
5027| OH_Drawing_Array | Pointer to an [OH_Drawing_Array](#oh_drawing_array) that holds the font names.|
5028| size_t | Index of the font in the array.|
5029
5030**Returns**
5031
5032Returns the pointer to the font name, which is an [OH_Drawing_String](_o_h___drawing___string.md) object.
5033
5034### OH_Drawing_GetSystemFontFullNamesByType()
5035
5036```
5037OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType (OH_Drawing_SystemFontType )
5038```
5039
5040**Description**
5041
5042Obtains an array of font names by font type.
5043
5044**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5045
5046**Since**: 14
5047
5048**Parameters**
5049
5050| Name| Description|
5051| -------- | -------- |
5052| OH_Drawing_SystemFontType | Font type, which is defined in [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype).|
5053
5054**Returns**
5055
5056Returns the pointer to an [OH_Drawing_Array](#oh_drawing_array), which holds the font names. When [OH_Drawing_Array](#oh_drawing_array) is no longer required, call [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) to release the pointer to the object.
5057
5058### OH_Drawing_GetFontDescriptorByFullName()
5059
5060```
5061OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName (const OH_Drawing_String* , OH_Drawing_SystemFontType  )
5062```
5063
5064**Description**
5065
5066Obtains a font descriptor based on the font name and type. System fonts, style fonts, and user-installed fonts are supported. A font descriptor is a data structure that describes font features. It contains details of the font appearance and properties.
5067
5068**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5069
5070**Since**: 14
5071
5072**Parameters**
5073
5074| Name| Description|
5075| -------- | -------- |
5076| [OH_Drawing_String](_o_h___drawing___string.md) | Pointer to the font name, which is [OH_Drawing_String](_o_h___drawing___string.md).|
5077| OH_Drawing_SystemFontType | Font type, which is defined in [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype).|
5078
5079**Returns**
5080
5081Returns the pointer to an [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object. When [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) is no longer required, call [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) to release the pointer to the object.
5082
5083### OH_Drawing_TypefaceCreateFromFileWithArguments()
5084
5085```
5086OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments )
5087```
5088
5089**Description**
5090
5091Creates an **OH_Drawing_Typeface** object with font arguments through a file. If the **OH_Drawing_Typeface** object does not support the variation described in the font arguments, this function creates an **OH_Drawing_Typeface** object with the default font arguments. In this case, this function provides the same capability as [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile).
5092
5093**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5094
5095**Since**: 13
5096
5097**Parameters**
5098
5099| Name| Description|
5100| -------- | -------- |
5101| path | Pointer to the file path.|
5102| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
5103
5104**Returns**
5105
5106Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created. If a null pointer is returned, the creation fails. Possible causes are that no memory is available, the passed-in **path** or **fontArguments** is NULL, or the path is invalid.
5107
5108
5109### OH_Drawing_TypefaceCreateFromCurrent()
5110
5111```
5112OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments )
5113```
5114
5115**Description**
5116
5117Creates an **OH_Drawing_Typeface** object with font arguments based on an existing **OH_Drawing_Typeface** object.
5118
5119**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5120
5121**Since**: 13
5122
5123**Parameters**
5124
5125| Name| Description|
5126| -------- | -------- |
5127| current | Pointer to an [OH_Drawing_Typeface](#oh_drawing_typeface) object.|
5128| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
5129
5130**Returns**
5131
5132Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created. If a null pointer is returned, the creation fails. Possible causes are that no memory is available, the passed-in **path** or **fontArguments** is NULL, or the existing **OH_Drawing_FontArguments** object does not support the variation described in the font arguments.
5133
5134
5135### OH_Drawing_FontArgumentsAddVariation()
5136
5137```
5138OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value )
5139```
5140
5141**Description**
5142
5143Adds a variation to an **OH_Drawing_FontArguments** object.
5144
5145**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5146
5147**Since**: 13
5148
5149**Parameters**
5150
5151| Name| Description|
5152| -------- | -------- |
5153| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
5154| axis | Pointer to the label of the variation. The value must contain four ASCII characters. The supported labels depend on the loaded font file. For example, **'wght'** is the font weight label.|
5155| value | Value of the variation label.|
5156
5157**Returns**
5158
5159Returns one of the following result codes:
5160- **OH_DRAWING_SUCCESS** if the operation is successful.
5161- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **fontArguments** or **axis** is NULL or the length of **axis** is not 4.
5162
5163
5164### OH_Drawing_FontArgumentsCreate()
5165
5166```
5167OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void)
5168```
5169
5170**Description**
5171
5172Creates an **OH_Drawing_FontArguments** object. The font arguments are used to create an **OH_Drawing_Typeface** object with custom attributes.
5173
5174**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5175
5176**Since**: 13
5177
5178**Returns**
5179
5180Returns the pointer to the **OH_Drawing_FontArguments** object created.
5181
5182
5183### OH_Drawing_FontArgumentsDestroy()
5184
5185```
5186OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments)
5187```
5188
5189**Description**
5190
5191Destroys an **OH_Drawing_FontArguments** object.
5192
5193**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5194
5195**Since**: 13
5196
5197**Parameters**
5198
5199| Name| Description|
5200| -------- | -------- |
5201| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
5202
5203**Returns**
5204
5205Returns one of the following result codes:
5206- **OH_DRAWING_SUCCESS** if the operation is successful.
5207- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **fontArguments** is NULL.
5208
5209
5210### OH_Drawing_TypographyGetLongestLineWithIndent()
5211
5212```
5213double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* )
5214```
5215
5216**Description**
5217
5218Obtains the width of the longest line of a typography object, including its indentation. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.
5219
5220**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5221
5222**Since**: 13
5223
5224**Parameters**
5225
5226| Name| Description|
5227| -------- | -------- |
5228| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).|
5229
5230**Returns**
5231
5232Returns the width of the longest line, including its indentation, in px.
5233
5234
5235
5236### OH_Drawing_RecordCmdDestroy()
5237
5238```
5239OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd)
5240```
5241
5242**Description**
5243
5244Destroys an **OH_Drawing_RecordCmd** object and reclaims the memory occupied by the object.
5245
5246**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5247
5248**Since**: 13
5249
5250**Parameters**
5251
5252| Name| Description|
5253| -------- | -------- |
5254| recordCmd | Pointer to an [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.|
5255
5256**Returns**
5257
5258Returns one of the following result codes:
5259- **OH_DRAWING_SUCCESS** if the operation is successful.
5260- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmd** is NULL.
5261
5262
5263### OH_Drawing_RecordCmdUtilsBeginRecording()
5264
5265```
5266OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas )
5267```
5268
5269**Description**
5270
5271Starts recording. This function must be used in pair with [OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording).
5272
5273The **OH_Drawing_RecordCmdUtils** object generates a canvas object of the recording type and calls the interface of the drawing object to record all drawing commands.
5274
5275**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5276
5277**Since**: 13
5278
5279**Parameters**
5280
5281| Name| Description|
5282| -------- | -------- |
5283| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
5284| width | Width of the canvas.|
5285| height | Height of the canvas.|
5286| canvas | Double pointer to the [OH_Drawing_Canvas](#oh_drawing_canvas) object. You do not need to release this pointer. This object does not support nested calling of [OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd).|
5287
5288**Returns**
5289
5290Returns one of the following result codes:
5291- **OH_DRAWING_SUCCESS** if the operation is successful.
5292- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **recordCmdUtils** or **canvas** is NULL.
5293- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **width** or **height** is less than 0.
5294- **OH_DRAWING_ERROR_ALLOCATION_FAILED** if the system memory is insufficient.
5295
5296
5297### OH_Drawing_RecordCmdUtilsCreate()
5298
5299```
5300OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void )
5301```
5302
5303**Description**
5304
5305Creates an **OH_Drawing_RecordCmdUtils** object.
5306
5307**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5308
5309**Since**: 13
5310
5311**Returns**
5312
5313Returns the pointer to the **OH_Drawing_RecordCmdUtils** object created.
5314
5315
5316### OH_Drawing_RecordCmdUtilsDestroy()
5317
5318```
5319OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils)
5320```
5321
5322**Description**
5323
5324Destroys an **OH_Drawing_RecordCmdUtils** object and reclaims the memory occupied by the object.
5325
5326**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5327
5328**Since**: 13
5329
5330**Parameters**
5331
5332| Name| Description|
5333| -------- | -------- |
5334| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
5335
5336**Returns**
5337
5338Returns one of the following result codes:
5339- **OH_DRAWING_SUCCESS** if the operation is successful.
5340- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmdUtils** is NULL.
5341
5342
5343### OH_Drawing_RecordCmdUtilsFinishRecording()
5344
5345```
5346OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd )
5347```
5348
5349**Description**
5350
5351Ends recording. This function must be called after [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording).
5352
5353The **OH_Drawing_RecordCmdUtils** object ends recording and stores the drawing commands recorded by the canvas object of the recording type into the generated [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording) object.
5354
5355**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5356
5357**Since**: 13
5358
5359**Parameters**
5360
5361| Name| Description|
5362| -------- | -------- |
5363| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
5364| recordCmd | Double pointer to the [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object. You need to call [OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd) to draw the object, and call [OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) to release it.|
5365
5366**Returns**
5367
5368Returns one of the following result codes:
5369- **OH_DRAWING_SUCCESS** if the operation is successful.
5370- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **recordCmdUtils** or **recordCmd** is NULL.
5371- **OH_DRAWING_ERROR_ALLOCATION_FAILED** if the system memory is insufficient.
5372
5373
5374### OH_Drawing_CanvasDrawRecordCmd()
5375
5376```
5377OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd )
5378```
5379
5380**Description**
5381
5382Draws an **OH_Drawing_RecordCmd** object.
5383
5384**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5385
5386**Since**: 13
5387
5388**Parameters**
5389
5390| Name| Description|
5391| -------- | -------- |
5392| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. Only a canvas of the recording type is supported.|
5393| recordCmd | Pointer to the [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.|
5394
5395**Returns**
5396
5397Returns one of the following result codes:
5398- **OH_DRAWING_SUCCESS** if the operation is successful.
5399- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **recordCmd** is NULL.
5400
5401
5402
5403### OH_Drawing_TypographyDestroyTextBox()
5404
5405```
5406void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* )
5407```
5408
5409**Description**
5410
5411Releases the memory occupied by a text box.
5412
5413**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5414
5415**Since**: 12
5416
5417**Parameters**
5418
5419| Name| Description|
5420| -------- | -------- |
5421| OH_Drawing_TextBox | Pointer to an [OH_Drawing_TextBox](#oh_drawing_textbox) object.|
5422
5423
5424### OH_Drawing_SetTextShadow()
5425
5426```
5427void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius )
5428```
5429
5430**Description**
5431
5432Sets a text shadow.
5433
5434**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5435
5436**Since**: 12
5437
5438**Parameters**
5439
5440| Name| Description|
5441| -------- | -------- |
5442| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow).|
5443| color | Color of the text shadow. For example, if the input parameter is 0xAABBCCDD, AA indicates opacity, BB indicates the value of the red component, CC indicates the value of the green component, and DD indicates the value of the blue component.|
5444| OH_Drawing_Point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object, which is the position of the text shadow relative to the text.|
5445| blurRadius | Blur radius. The value is a floating point number and has no unit. The value **0.0** means that there is no blur effect.|
5446
5447
5448
5449### OH_Drawing_CanvasDrawSingleCharacter()
5450
5451```
5452OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y )
5453```
5454
5455**Description**
5456
5457Draws a single character. If the typeface of the current font does not support the character to draw, the system typeface is used to draw the character.
5458
5459**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5460
5461**Since**: 12
5462
5463**Parameters**
5464
5465| Name| Description|
5466| -------- | -------- |
5467| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5468| str | Pointer to the single character to draw. A string can be passed in, but only the first character in the string is parsed and drawn in UTF-8 encoding.|
5469| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5470| x | X coordinate of the left point of the character baseline.|
5471| y | Y coordinate of the left point of the character baseline.|
5472
5473**Returns**
5474
5475Returns one of the following result codes:
5476- **OH_DRAWING_SUCCESS** if the operation is successful.
5477- **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the parameters **canvas**, **str**, or **font** is NULL, or the length of **str** is **0**.
5478
5479
5480
5481### OH_Drawing_FontMeasureSingleCharacter()
5482
5483```
5484OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth )
5485```
5486
5487**Description**
5488
5489Measures the width of a single character. If the typeface of the current font does not support the character to measure, the system typeface is used to measure the character width.
5490
5491**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5492
5493**Since**: 12
5494
5495**Parameters**
5496
5497| Name| Description|
5498| -------- | -------- |
5499| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5500| str | Pointer to the single character to measure. A string can be passed in, but only the first character in the string is parsed and measured in UTF-8 encoding.|
5501| textWidth | Pointer to the character width obtained.|
5502
5503**Returns**
5504
5505Returns one of the following result codes:
5506- **OH_DRAWING_SUCCESS** if the operation is successful.
5507- **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the parameters **font**, **str**, or **textWidth** is NULL, or the length of **str** is **0**.
5508
5509
5510
5511### OH_Drawing_TypographyPaintOnPath()
5512
5513```
5514void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, OH_Drawing_Path* path, double hOffset, double vOffset)
5515```
5516
5517**Description**
5518
5519Draws text along a path.
5520
5521To prevent text overlap caused by the text width exceeding the layout width, you are advised to use [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) to limit the text to a single line.
5522
5523**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5524
5525**Since**: 12
5526
5527**Parameters**
5528
5529| Name| Description|
5530| -------- | -------- |
5531| typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).|
5532| canvas | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate).|
5533| path | Pointer to an **OH_Drawing_Path** object, which is obtained by calling [OH_Drawing_PathCreate](#oh_drawing_pathcreate).|
5534| hOffset | Horizontal offset of the text along the path (X axis). A positive number indicates that the text is moved forward, and a negative number indicates that the text is moved backward.|
5535| vOffset | Vertical offset of the text along the path (Y axis). A positive number indicates that the text is moved downward, and a negative number indicates that the text is moved upward.|
5536
5537
5538### OH_Drawing_RoundRectOffset()
5539
5540```
5541OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy )
5542```
5543
5544**Description**
5545
5546Translates a rounded rectangle by an offset along the X axis and Y axis.
5547
5548**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5549
5550**Since**: 12
5551
5552**Parameters**
5553
5554| Name| Description|
5555| -------- | -------- |
5556| roundRect | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.|
5557| dx | X offset.|
5558| dy | Y offset.|
5559
5560**Returns**
5561
5562Returns one of the following result codes:
5563- **OH_DRAWING_SUCCESS** if the operation is successful.
5564- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **roundRect** is NULL.
5565
5566
5567### OH_Drawing_PointGetX()
5568
5569```
5570OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x )
5571```
5572
5573**Description**
5574
5575Obtains the X coordinate of a point.
5576
5577**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5578
5579**Since**: 12
5580
5581**Parameters**
5582
5583| Name| Description|
5584| -------- | -------- |
5585| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
5586| x | Pointer to the X coordinate.|
5587
5588**Returns**
5589
5590Returns one of the following result codes:
5591- **OH_DRAWING_SUCCESS** if the operation is successful.
5592- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **x** is NULL.
5593
5594
5595### OH_Drawing_PointGetY()
5596
5597```
5598OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y )
5599```
5600
5601**Description**
5602
5603Obtains the Y coordinate of a point.
5604
5605**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5606
5607**Since**: 12
5608
5609**Parameters**
5610
5611| Name| Description|
5612| -------- | -------- |
5613| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
5614| y | Pointer to the Y coordinate.|
5615
5616**Returns**
5617
5618Returns one of the following result codes:
5619- **OH_DRAWING_SUCCESS** if the operation is successful.
5620- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **y** is NULL.
5621
5622
5623### OH_Drawing_PointSet()
5624
5625```
5626OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y )
5627```
5628
5629**Description**
5630
5631Sets the X and Y coordinates of a point.
5632
5633**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5634
5635**Since**: 12
5636
5637**Parameters**
5638
5639| Name| Description|
5640| -------- | -------- |
5641| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
5642| x | Pointer to the X coordinate.|
5643| y | Pointer to the Y coordinate.|
5644
5645**Returns**
5646
5647Returns one of the following result codes:
5648- **OH_DRAWING_SUCCESS** if the operation is successful.
5649- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **point** is NULL.
5650
5651
5652### OH_Drawing_FontMeasureText()
5653
5654```
5655OH_Drawing_ErrorCode OH_Drawing_FontMeasureText (const OH_Drawing_Font* font, const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding, OH_Drawing_Rect* bounds, float* textWidth )
5656```
5657
5658**Description**
5659
5660Obtains the text width and bounding box.
5661
5662**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5663
5664**Since**: 12
5665
5666**Parameters**
5667
5668| Name| Description|
5669| -------- | -------- |
5670| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5671| text | Pointer to the text.|
5672| byteLength | Length of the text, in bytes.|
5673| encoding | Encoding type of the text.|
5674| bounds | Pointer to the bounding box. The value can be NULL.|
5675| textWidth | Pointer to the text width.|
5676
5677**Returns**
5678
5679Returns one of the following result codes:
5680- **OH_DRAWING_SUCCESS** if the operation is successful.
5681- **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the parameters **font**, **text**, and **textWidth** is NULL, or **byteLength** is **0**.
5682
5683
5684### OH_Drawing_CanvasClipRegion()
5685
5686```
5687OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp )
5688```
5689
5690**Description**
5691
5692Clips a rectangle.
5693
5694**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5695
5696**Since**: 12
5697
5698**Parameters**
5699
5700| Name| Description|
5701| -------- | -------- |
5702| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5703| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
5704| clipOp | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop).|
5705
5706**Returns**
5707
5708Returns one of the following result codes:
5709- **OH_DRAWING_SUCCESS** if the operation is successful.
5710- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **region** is NULL.
5711- **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **clipOp** is not set to one of the enumerated values.
5712
5713
5714### OH_Drawing_CanvasDrawColor()
5715
5716```
5717OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode )
5718```
5719
5720**Description**
5721
5722Fills the entire canvas with the specified color and blend mode.
5723
5724**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5725
5726**Since**: 12
5727
5728**Parameters**
5729
5730| Name| Description|
5731| -------- | -------- |
5732| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5733| color | Color, represented by a 32-bit (ARGB) variable.|
5734| blendMode | Blend mode.|
5735
5736**Returns**
5737
5738Returns one of the following result codes:
5739- **OH_DRAWING_SUCCESS** if the operation is successful.
5740- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas** is NULL.
5741- **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **blendMode** is not set to one of the enumerated values.
5742
5743
5744### OH_Drawing_CanvasGetImageInfo()
5745
5746```
5747OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo )
5748```
5749
5750**Description**
5751
5752Obtains the image information of a canvas.
5753
5754**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5755
5756**Since**: 12
5757
5758**Parameters**
5759
5760| Name| Description|
5761| -------- | -------- |
5762| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5763| imageInfo | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
5764
5765**Returns**
5766
5767Returns one of the following result codes:
5768- **OH_DRAWING_SUCCESS** if the operation is successful.
5769- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **imageInfo** is NULL.
5770
5771
5772### OH_Drawing_CanvasIsClipEmpty()
5773
5774```
5775OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty )
5776```
5777
5778**Description**
5779
5780Checks whether the region that can be drawn is empty after cropping.
5781
5782**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5783
5784**Since**: 12
5785
5786**Parameters**
5787
5788| Name| Description|
5789| -------- | -------- |
5790| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5791| isClipEmpty | Pointer to the variable that specifies whether the region is empty. The value **true** means that the region is empty, and **false** means the opposite.|
5792
5793**Returns**
5794
5795Returns one of the following result codes:
5796- **OH_DRAWING_SUCCESS** if the operation is successful.
5797- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **isClipEmpty** is NULL.
5798
5799
5800### OH_Drawing_CanvasDrawPoint()
5801
5802```
5803OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point )
5804```
5805
5806**Description**
5807
5808Draws a point.
5809
5810**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5811
5812**Since**: 12
5813
5814**Parameters**
5815
5816| Name| Description|
5817| -------- | -------- |
5818| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
5819| point | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.|
5820
5821**Returns**
5822
5823Returns one of the following result codes:
5824- **OH_DRAWING_SUCCESS** if the operation is successful.
5825- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **point** is NULL.
5826
5827
5828### OH_Drawing_MatrixGetAll()
5829
5830```
5831OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] )
5832```
5833
5834**Description**
5835
5836Obtains all element values of a matrix.
5837
5838**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5839
5840**Since**: 12
5841
5842**Parameters**
5843
5844| Name| Description|
5845| -------- | -------- |
5846| matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
5847| value | Array used to store the obtained element values.|
5848
5849**Returns**
5850
5851Returns one of the following result codes:
5852- **OH_DRAWING_SUCCESS** if all element values of the matrix are successfully obtained.
5853- **OH_DRAWING_ERROR_INVALID_PARAMETER** if the matrix element values fail to be obtained. The failure cause is that **matrix** or **value** is NULL.
5854
5855
5856
5857### OH_Drawing_ErrorCodeGet()
5858
5859```
5860OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet ()
5861```
5862
5863**Description**
5864
5865Obtains the latest error code of the module. After the function is successfully executed, the error code returned by this function will not be modified.
5866
5867**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5868
5869**Since**: 12
5870
5871**Returns**
5872
5873Returns the enumerated values of the error code.
5874
5875### OH_Drawing_BrushCopy()
5876
5877```
5878OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush)
5879```
5880
5881**Description**
5882
5883Copies an existing [OH_Drawing_Brush](#oh_drawing_brush) object to create a new one.
5884
5885Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5886
5887If **brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5888
5889**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5890
5891**Since**: 12
5892
5893**Parameters**
5894
5895| Name| Description|
5896| -------- | -------- |
5897| brush | Pointer to an **OH_Drawing_Brush** object.|
5898
5899**Returns**
5900
5901Returns the pointer to the [OH_Drawing_Brush](#oh_drawing_brush) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or **brush** is NULL.
5902
5903
5904
5905### OH_Drawing_FilterSetImageFilter()
5906
5907```
5908void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* )
5909```
5910
5911**Description**
5912
5913Sets an **OH_Drawing_ImageFilter** object for an **OH_Drawing_Filter** object.
5914
5915Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5916
5917If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5918
5919**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5920
5921**Since**: 12
5922
5923**Parameters**
5924
5925| Name| Description|
5926| -------- | -------- |
5927| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object.|
5928| OH_Drawing_ImageFilter | Pointer to an [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object. If NULL is passed in, the image filter effect of the object will be cleared.|
5929
5930
5931### OH_Drawing_ImageFilterCreateBlur()
5932
5933```
5934OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input )
5935```
5936
5937**Description**
5938
5939Creates an **OH_Drawing_ImageFilter** object with a given blur type.
5940
5941**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5942
5943**Since**: 12
5944
5945**Parameters**
5946
5947| Name| Description|
5948| -------- | -------- |
5949| sigmaX | Standard deviation of the Gaussian blur to apply along the X axis. The value must be greater than 0.|
5950| sigmaY | Standard deviation of the Gaussian blur to apply along the Y axis. The value must be greater than 0.|
5951| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
5952| input | Pointer to the filter to which the image filter will be applied. If NULL is passed in, the image filter is directly applied to the original image.|
5953
5954**Returns**
5955
5956Returns the pointer to the [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available.
5957
5958
5959### OH_Drawing_ImageFilterCreateFromColorFilter()
5960
5961```
5962OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input )
5963```
5964
5965**Description**
5966
5967Creates an **OH_Drawing_ImageFilter** object with a color filter effect.
5968
5969Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5970
5971If **colorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5972
5973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5974
5975**Since**: 12
5976
5977**Parameters**
5978
5979| Name| Description|
5980| -------- | -------- |
5981| colorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object.|
5982| input | Pointer to the filter to which the image filter will be applied. If NULL is passed in, the image filter is directly applied to the original image.|
5983
5984**Returns**
5985
5986Returns the pointer to the [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or **colorFilter** is NULL.
5987
5988
5989### OH_Drawing_ImageFilterDestroy()
5990
5991```
5992void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* )
5993```
5994
5995**Description**
5996
5997Destroys an **OH_Drawing_ImageFilter** object and reclaims the memory occupied by the object.
5998
5999**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6000
6001**Since**: 12
6002
6003**Parameters**
6004
6005| Name| Description|
6006| -------- | -------- |
6007| OH_Drawing_ImageFilter | Pointer to an [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object.|
6008
6009
6010### OH_Drawing_MatrixMapPoints()
6011
6012```
6013void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count )
6014```
6015
6016**Description**
6017
6018Maps a source point array to a destination point array by means of matrix transformation.
6019
6020Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6021
6022If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6023
6024**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6025
6026**Since**: 12
6027
6028**Parameters**
6029
6030| Name| Description|
6031| -------- | -------- |
6032| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
6033| src | Array of source points.|
6034| dst | Array of destination points. The number of destination points must be the same as that of source points.|
6035| count | Number of source points or destination points.|
6036
6037
6038### OH_Drawing_MatrixMapRect()
6039
6040```
6041bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst )
6042```
6043
6044**Description**
6045
6046Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices are mapped by means of matrix transformation.
6047
6048Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6049
6050If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
6051
6052**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6053
6054**Since**: 12
6055
6056**Parameters**
6057
6058| Name| Description|
6059| -------- | -------- |
6060| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
6061| src | Pointer to the source rectangle.|
6062| dst | Pointer to the destination rectangle.|
6063
6064**Returns**
6065
6066Returns **true** if the source rectangle is equal to the destination rectangle; returns **false** otherwise.
6067
6068
6069### OH_Drawing_PathAddPolygon()
6070
6071```
6072void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed )
6073```
6074
6075**Description**
6076
6077Adds a polygon to a path.
6078
6079Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6080
6081If either **path** or **points** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6082
6083**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6084
6085**Since**: 12
6086
6087**Parameters**
6088
6089| Name| Description|
6090| -------- | -------- |
6091| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
6092| points | Pointer to an array that holds the vertex coordinates of the polygon.|
6093| count | Size of the array.|
6094| isClosed | Whether the path is closed. The value **true** means that the path is closed, and **false** means the opposite.|
6095
6096
6097### OH_Drawing_PathAddCircle()
6098
6099```
6100void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection  )
6101```
6102
6103**Description**
6104
6105Adds a circle to a path in the specified direction.
6106
6107Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6108
6109If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6110
6111If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6112
6113If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6114
6115**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6116
6117**Since**: 12
6118
6119**Parameters**
6120
6121| Name| Description|
6122| -------- | -------- |
6123| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6124| x | X coordinate of the circle center.|
6125| y | Y coordinate of the circle center.|
6126| radius | Radius of the circle.|
6127| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection).|
6128
6129
6130### OH_Drawing_PathBuildFromSvgString()
6131
6132```
6133bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str )
6134```
6135
6136**Description**
6137
6138Parses the path represented by an SVG string.
6139
6140Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6141
6142If either **path** or **str** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6143
6144**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6145
6146**Since**: 12
6147
6148**Parameters**
6149
6150| Name| Description|
6151| -------- | -------- |
6152| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6153| str | Pointer to the SVG string.|
6154
6155**Returns**
6156
6157Returns **true** if the SVG string is parsed successfully; returns **false** otherwise.
6158
6159
6160### OH_Drawing_PathGetBounds()
6161
6162```
6163void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect*  )
6164```
6165
6166**Description**
6167
6168Obtains the minimum bounds that enclose a path.
6169
6170Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6171
6172If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6173
6174**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6175
6176**Since**: 12
6177
6178**Parameters**
6179
6180| Name| Description|
6181| -------- | -------- |
6182| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6183| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.|
6184
6185
6186### OH_Drawing_PathIsClosed()
6187
6188```
6189bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed )
6190```
6191
6192**Description**
6193
6194Checks whether a path is closed.
6195
6196Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6197
6198If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6199
6200**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6201
6202**Since**: 12
6203
6204**Parameters**
6205
6206| Name| Description|
6207| -------- | -------- |
6208| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6209| forceClosed | Whether the path is measured as a closed path. The value **true** means that the path is considered closed during measurement, and **false** means that the path is measured based on the actual closed status.|
6210
6211**Returns**
6212
6213Returns **true** if the path is closed; returns **false** otherwise.
6214
6215
6216### OH_Drawing_PathGetPositionTangent()
6217
6218```
6219bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent )
6220```
6221
6222**Description**
6223
6224Obtains the coordinates and tangent at a distance from the start point of a path.
6225
6226Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6227
6228If any of **path**, **position**, or **tangent** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6229
6230**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6231
6232**Since**: 12
6233
6234**Parameters**
6235
6236| Name| Description|
6237| -------- | -------- |
6238| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6239| forceClosed | Whether the path is measured as a closed path. The value **true** means that the path is considered closed during measurement, and **false** means that the path is measured based on the actual closed status.|
6240| distance | Distance from the start point. If a negative number is passed in, the value **0** is used. If a value greater than the path length is passed in, the path length is used.|
6241| position | Pointer to the coordinates.|
6242| tangent | Pointer to the tangent, where **tangent.x** and **tangent.y** represent the cosine and sine of the tangent of the point, respectively.|
6243
6244**Returns**
6245
6246Returns **true** if the operation is successful; returns **false** otherwise.
6247
6248
6249### OH_Drawing_PathOp()
6250
6251```
6252bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op )
6253```
6254
6255**Description**
6256
6257Combines two paths based on the specified operation mode.
6258
6259Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6260
6261If either **path** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6262
6263If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6264
6265**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6266
6267**Since**: 12
6268
6269**Parameters**
6270
6271| Name| Description|
6272| -------- | -------- |
6273| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, in which the resulting path is saved.|
6274| other | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6275| op | Operation mode of the path. For details about the available options, see [OH_Drawing_PathOpMode](#oh_drawing_pathopmode).|
6276
6277**Returns**
6278
6279Returns **true** if the resulting path is not empty; returns **false** otherwise.
6280
6281
6282### OH_Drawing_PathGetMatrix()
6283
6284```
6285bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag )
6286```
6287
6288**Description**
6289
6290Obtains a transformation matrix at a distance from the start point of a path.
6291
6292Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6293
6294If either **path** or **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6295
6296If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6297
6298**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6299
6300**Since**: 12
6301
6302**Parameters**
6303
6304| Name| Description|
6305| -------- | -------- |
6306| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6307| forceClosed | Whether the path is measured as a closed path. The value **true** means that the path is considered closed during measurement, and **false** means that the path is measured based on the actual closed status.|
6308| distance | Distance from the start point. If a negative number is passed in, the value **0** is used. If a value greater than the path length is passed in, the path length is used.|
6309| matrix | Pointer to the transformation matrix.|
6310| flag | Type of the matrix information. For details about the available options, see [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags).|
6311
6312**Returns**
6313
6314Returns **true** if the transformation matrix is obtained successfully; returns **false** otherwise. The possible failure cause is that **path** is NULL or the path length is 0.
6315
6316
6317### OH_Drawing_PenGetFillPath()
6318
6319```
6320bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix*  )
6321```
6322
6323**Description**
6324
6325Obtains the source path outline drawn using a pen and represents it using a destination path.
6326
6327Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6328
6329If any of **OH_Drawing_Pen**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6330
6331**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6332
6333**Since**: 12
6334
6335**Parameters**
6336
6337| Name| Description|
6338| -------- | -------- |
6339| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.|
6340| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
6341| dst | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
6342| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. NULL is recommended.|
6343| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. NULL is recommended. The default value is an identity matrix.|
6344
6345**Returns**
6346
6347Returns **true** if the destination path is obtained; returns **false** otherwise.
6348
6349
6350### OH_Drawing_PenCopy()
6351
6352```
6353OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen)
6354```
6355
6356**Description**
6357
6358Copies an existing [OH_Drawing_Pen](#oh_drawing_pen) object to create a new one.
6359
6360Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6361
6362If **pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6363
6364**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6365
6366**Since**: 12
6367
6368**Parameters**
6369
6370| Name| Description|
6371| -------- | -------- |
6372| pen | Pointer to an **OH_Drawing_Pen** object.|
6373
6374**Returns**
6375
6376Returns the pointer to the [OH_Drawing_Pen](#oh_drawing_pen) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or **pen** is NULL.
6377
6378
6379### OH_Drawing_PixelMapGetFromNativePixelMap()
6380
6381```
6382OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* )
6383```
6384
6385**Description**
6386
6387Obtains the pixel map defined by this module from a pixel map defined by the image framework.
6388
6389**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6390
6391**Since**: 12
6392
6393**Parameters**
6394
6395| Name| Description|
6396| -------- | -------- |
6397| NativePixelMap_ | Pointer to a **NativePixelMap_** object, which is the pixel map defined by the image framework.|
6398
6399**Returns**
6400
6401Returns the pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object, which is the pixel map defined by this module. If NULL is returned, the creation fails. The possible failure cause is that **NativePixelMap_** is NULL.
6402
6403
6404### OH_Drawing_PixelMapGetFromOhPixelMapNative()
6405
6406```
6407OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* )
6408```
6409
6410**Description**
6411
6412Obtains the pixel map defined by this module from a pixel map defined by the image framework.
6413
6414**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6415
6416**Since**: 12
6417
6418**Parameters**
6419
6420| Name| Description|
6421| -------- | -------- |
6422| OH_PixelmapNative | Pointer to an **OH_PixelmapNative** object, which is the pixel map defined by the image framework.|
6423
6424**Returns**
6425
6426Returns the pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object, which is the pixel map defined by this module. If NULL is returned, the creation fails. The possible failure cause is that **OH_PixelmapNative** is NULL.
6427
6428
6429### OH_Drawing_PixelMapDissolve()
6430
6431```
6432void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* )
6433```
6434
6435**Description**
6436
6437Removes the relationship between a pixel map defined by this module and a pixel map defined by the image framework. The relationship is established by calling [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) or [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative).
6438
6439**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6440
6441**Since**: 12
6442
6443**Parameters**
6444
6445| Name| Description|
6446| -------- | -------- |
6447| OH_Drawing_PixelMap | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object.|
6448
6449
6450### OH_Drawing_RectJoin()
6451
6452```
6453bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
6454```
6455
6456**Description**
6457
6458Obtains the union of two rectangles.
6459
6460Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6461
6462If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6463
6464**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6465
6466**Since**: 12
6467
6468**Parameters**
6469
6470| Name| Description|
6471| -------- | -------- |
6472| rect | Pointer to the first rectangle, which is an **OH_Drawing_Rect** object.|
6473| other | Pointer to the second rectangle, which is an **OH_Drawing_Rect** object.|
6474
6475**Returns**
6476
6477Returns **true** if the union is obtained; returns **false** otherwise. The possible failure cause is that at least one of the parameters **rect** and **other** is NULL or the size of the rectangle specified by **other** is empty.
6478
6479
6480### OH_Drawing_RegionContains()
6481
6482```
6483bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y )
6484```
6485
6486**Description**
6487
6488Checks whether a region contains the specified point.
6489
6490Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6491
6492If **region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6493
6494**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6495
6496**Since**: 12
6497
6498**Parameters**
6499
6500| Name| Description|
6501| -------- | -------- |
6502| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
6503| int32_t | X coordinate of the point.|
6504| int32_t | Y coordinate of the point.|
6505
6506**Returns**
6507
6508Returns **true** if the region contains the specified point; returns **false** otherwise.
6509
6510
6511### OH_Drawing_RegionOp()
6512
6513```
6514bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op )
6515```
6516
6517**Description**
6518
6519Combines two regions based on the specified operation mode.
6520
6521Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6522
6523If either **region** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6524
6525If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6526
6527**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6528
6529**Since**: 12
6530
6531**Parameters**
6532
6533| Name| Description|
6534| -------- | -------- |
6535| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object, in which the resulting region is saved.|
6536| other | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
6537| op | Operation mode of the region. For details about the available options, see [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode).|
6538
6539**Returns**
6540
6541Returns **true** if the resulting region is not empty; returns false otherwise.
6542
6543
6544### OH_Drawing_RegionSetPath()
6545
6546```
6547bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip )
6548```
6549
6550**Description**
6551
6552Sets a region to the area described by the path.
6553
6554Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6555
6556If **region**, **path**, or **clip** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6557
6558**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6559
6560**Since**: 12
6561
6562**Parameters**
6563
6564| Name| Description|
6565| -------- | -------- |
6566| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
6567| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
6568| clip | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
6569
6570**Returns**
6571
6572Returns **true** if the resulting region is not empty; returns false otherwise.
6573
6574
6575### OH_Drawing_ShaderEffectCreateColorShader()
6576
6577```
6578OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color)
6579```
6580
6581**Description**
6582
6583Creates an **OH_Drawing_ShaderEffect** object with a single color.
6584
6585**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6586
6587**Since**: 12
6588
6589**Parameters**
6590
6591| Name| Description|
6592| -------- | -------- |
6593| color | Color in the ARGB format. The value is a 32-bit unsigned integer.|
6594
6595**Returns**
6596
6597Returns the pointer to the [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available.
6598
6599
6600### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix()
6601
6602```
6603OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix (const OH_Drawing_Point2D* startPt, const OH_Drawing_Point2D* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode , const OH_Drawing_Matrix*  )
6604```
6605
6606**Description**
6607
6608Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.
6609
6610Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6611
6612If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6613
6614If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6615
6616**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6617
6618**Since**: 12
6619
6620**Parameters**
6621
6622| Name| Description|
6623| -------- | -------- |
6624| startPt | Start point.|
6625| endPt | End point.|
6626| colors | Colors to distribute.|
6627| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the start point and end point.|
6628| size | Number of colors and positions (if **pos** is not NULL).|
6629| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
6630| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
6631
6632**Returns**
6633
6634Returns the pointer to the [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or at least one of the parameters **startPt**, **endPt**, and **colors** is NULL.
6635
6636
6637### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix()
6638
6639```
6640OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix (const OH_Drawing_Point2D* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode , const OH_Drawing_Matrix*  )
6641```
6642
6643**Description**
6644
6645Creates an **OH_Drawing_ShaderEffect** object that generates a radial gradient based on the center and radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.
6646
6647Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6648
6649If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6650
6651If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6652
6653**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6654
6655**Since**: 12
6656
6657**Parameters**
6658
6659| Name| Description|
6660| -------- | -------- |
6661| centerPt | Center of the circle.|
6662| radius | Radius of the gradient.|
6663| colors | Colors to distribute in the radial direction.|
6664| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction.|
6665| size | Number of colors and positions (if **pos** is not NULL).|
6666| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
6667| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
6668
6669**Returns**
6670
6671Returns the pointer to the [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or at least one of the parameters **centerPt** and **colors** is NULL.
6672
6673
6674### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient()
6675
6676```
6677OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateTwoPointConicalGradient (const OH_Drawing_Point2D* startPt, float startRadius, const OH_Drawing_Point2D* endPt, float endRadius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode , const OH_Drawing_Matrix*  )
6678```
6679
6680**Description**
6681
6682Creates an **OH_Drawing_ShaderEffect** object that generates a gradient between two given circles.
6683
6684Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6685
6686If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6687
6688If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6689
6690**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6691
6692**Since**: 12
6693
6694**Parameters**
6695
6696| Name| Description|
6697| -------- | -------- |
6698| startPt | Pointer to the center of the start circle.|
6699| startRadius | Start radius of the gradient. The value should be a non-negative number.|
6700| endPt | Pointer to the center of the end circle.|
6701| endRadius | End radius of the gradient. The value should be a non-negative number.|
6702| colors | Colors to distribute between the two circles.|
6703| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the two circles.|
6704| size | Number of colors and positions (if **pos** is not NULL).|
6705| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1).|
6706| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
6707
6708**Returns**
6709
6710Returns the pointer to the [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object created. If NULL is returned, the creation fails. The possible failure cause is that no memory is available or at least one of the parameters **startPt**, **endPt**, and **colors** is NULL.
6711
6712
6713
6714### OH_Drawing_TextBlobUniqueID()
6715
6716```
6717uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* )
6718```
6719
6720**Description**
6721
6722Obtains the unique identifier of a text blob. The identifier is a non-zero value.
6723
6724Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6725
6726If **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6727
6728**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6729
6730**Since**: 12
6731
6732**Parameters**
6733
6734| Name| Description|
6735| -------- | -------- |
6736| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object.|
6737
6738**Returns**
6739
6740Returns the unique identifier of the text blob.
6741
6742
6743### OH_Drawing_PenSetShadowLayer()
6744
6745```
6746void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* )
6747```
6748
6749**Description**
6750
6751Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn.
6752
6753Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6754
6755If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6756
6757**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6758
6759**Since**: 12
6760
6761**Parameters**
6762
6763| Name| Description|
6764| -------- | -------- |
6765| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.|
6766| OH_Drawing_ShadowLayer | Pointer to an [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) object. If NULL is passed in, the shadow layer effect will be cleared.|
6767
6768
6769### OH_Drawing_BrushSetShadowLayer()
6770
6771```
6772void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* )
6773```
6774
6775**Description**
6776
6777Sets the shadow layer for a brush. The shadow layer effect takes effect only when text is drawn.
6778
6779Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6780
6781If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6782
6783**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6784
6785**Since**: 12
6786
6787**Parameters**
6788
6789| Name| Description|
6790| -------- | -------- |
6791| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object.|
6792| OH_Drawing_ShadowLayer | Pointer to an **OH_Drawing_ShadowLayer** object. If NULL is passed in, the shadow layer effect of the brush will be cleared.|
6793
6794
6795### OH_Drawing_ShadowLayerCreate()
6796
6797```
6798OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color )
6799```
6800
6801**Description**
6802
6803Creates an **OH_Drawing_ShadowLayer** object.
6804
6805Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6806
6807If **blurRadius** is less than or equal to **0**, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6808
6809**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6810
6811**Since**: 12
6812
6813**Parameters**
6814
6815| Name| Description|
6816| -------- | -------- |
6817| blurRadius | Radius of the shadow layer. The value must be greater than 0.|
6818| x | Offset on the X axis.|
6819| y | Offset on the Y axis.|
6820| color | Color of the shadow.|
6821
6822**Returns**
6823
6824Returns the pointer to the **OH_Drawing_ShadowLayer** object created.
6825
6826
6827### OH_Drawing_ShadowLayerDestroy()
6828
6829```
6830void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* )
6831```
6832
6833**Description**
6834
6835Destroys an **OH_Drawing_ShadowLayer** object and reclaims the memory occupied by the object.
6836
6837**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6838
6839**Since**: 12
6840
6841**Parameters**
6842
6843| Name| Description|
6844| -------- | -------- |
6845| OH_Drawing_ShadowLayer | Pointer to the shadow layer.|
6846
6847
6848### OH_Drawing_FontSetBaselineSnap()
6849
6850```
6851void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap )
6852```
6853
6854**Description**
6855
6856Sets whether to request that baselines be snapped to pixels when the current canvas matrix is axis aligned.
6857
6858Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6859
6860If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6861
6862**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6863
6864**Since**: 12
6865
6866**Parameters**
6867
6868| Name| Description|
6869| -------- | -------- |
6870| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
6871| baselineSnap | Check result. The value **true** means to request that baselines be snapped to pixels, and **false** means the opposite.|
6872
6873
6874### OH_Drawing_FontIsBaselineSnap()
6875
6876```
6877bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* )
6878```
6879
6880**Description**
6881
6882Checks whether baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned.
6883
6884Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6885
6886If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6887
6888**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6889
6890**Since**: 12
6891
6892**Parameters**
6893
6894| Name| Description|
6895| -------- | -------- |
6896| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
6897
6898**Returns**
6899
6900Returns **true** if the baselines are requested to be snapped to pixels; returns **false** otherwise.
6901
6902
6903### OH_Drawing_FontSetEdging()
6904
6905```
6906void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging  )
6907```
6908
6909**Description**
6910
6911Sets a font edging effect.
6912
6913Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6914
6915If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6916
6917If **OH_Drawing_FontEdging** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6918
6919**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6920
6921**Since**: 12
6922
6923**Parameters**
6924
6925| Name| Description|
6926| -------- | -------- |
6927| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
6928| OH_Drawing_FontEdging | Font edging effect.|
6929
6930
6931### OH_Drawing_FontGetEdging()
6932
6933```
6934OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* )
6935```
6936
6937**Description**
6938
6939Obtains the font edging effect.
6940
6941Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6942
6943If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6944
6945**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6946
6947**Since**: 12
6948
6949**Parameters**
6950
6951| Name| Description|
6952| -------- | -------- |
6953| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
6954
6955**Returns**
6956
6957Returns the font edging effect.
6958
6959
6960
6961### OH_Drawing_FontSetForceAutoHinting()
6962
6963```
6964void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting )
6965```
6966
6967**Description**
6968
6969Sets whether to forcibly use auto hinting, that is, whether to always hint glyphs.
6970
6971Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6972
6973If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6974
6975**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6976
6977**Since**: 12
6978
6979**Parameters**
6980
6981| Name| Description|
6982| -------- | -------- |
6983| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
6984| isForceAutoHinting | Check result. The value **true** means to forcibly use auto hinting, and **false** means the opposite.|
6985
6986
6987### OH_Drawing_FontIsForceAutoHinting()
6988
6989```
6990bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* )
6991```
6992
6993**Description**
6994
6995Checks whether auto hinting is forcibly used.
6996
6997Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6998
6999If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7000
7001**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7002
7003**Since**: 12
7004
7005**Parameters**
7006
7007| Name| Description|
7008| -------- | -------- |
7009| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7010
7011**Returns**
7012
7013Returns **true** if auto hinting is forcibly used; returns **false** otherwise.
7014
7015
7016### OH_Drawing_FontSetSubpixel()
7017
7018```
7019void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel )
7020```
7021
7022**Description**
7023
7024Sets whether to use sub-pixel rendering for a font.
7025
7026Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7027
7028If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7029
7030**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7031
7032**Since**: 12
7033
7034**Parameters**
7035
7036| Name| Description|
7037| -------- | -------- |
7038| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7039| isSubpixel | Check result. The value **true** means to use sub-pixel rendering for the font, and **false** means the opposite.|
7040
7041
7042### OH_Drawing_FontIsSubpixel()
7043
7044```
7045bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* )
7046```
7047
7048**Description**
7049
7050Checks whether sub-pixel rendering is used for a font.
7051
7052Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7053
7054If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7055
7056**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7057
7058**Since**: 12
7059
7060**Parameters**
7061
7062| Name| Description|
7063| -------- | -------- |
7064| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7065
7066**Returns**
7067
7068Returns **true** if sub-pixel rendering is used for the font; returns **false** otherwise.
7069
7070
7071### OH_Drawing_FontGetTextSize()
7072
7073```
7074float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* )
7075```
7076
7077**Description**
7078
7079Obtains the text size.
7080
7081Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7082
7083If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7084
7085**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7086
7087**Since**: 12
7088
7089**Parameters**
7090
7091| Name| Description|
7092| -------- | -------- |
7093| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7094
7095**Returns**
7096
7097Returns a floating point number representing the text size.
7098
7099
7100### OH_Drawing_FontTextToGlyphs()
7101
7102```
7103uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount )
7104```
7105
7106**Description**
7107
7108Converts text into glyph indices.
7109
7110Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7111
7112If any of **OH_Drawing_Font**, **text**, and **glyphs** is NULL, **byteLength** is **0**, or **maxGlyphCount** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7113
7114**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7115
7116**Since**: 12
7117
7118**Parameters**
7119
7120| Name| Description|
7121| -------- | -------- |
7122| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7123| text | Pointer to the start address of the storage.|
7124| byteLength | Text length, in bytes.|
7125| encoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding).|
7126| glyphs | Pointer to the start address for storing the glyph indices.|
7127| maxGlyphCount | Maximum number of glyphs.|
7128
7129**Returns**
7130
7131Returns the number of glyph indices.
7132
7133
7134### OH_Drawing_FontGetWidths()
7135
7136```
7137void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths )
7138```
7139
7140**Description**
7141
7142Obtains the width of each glyph in a string of text.
7143
7144Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7145
7146If any of **OH_Drawing_Font**, **glyphs**, and **widths** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7147
7148**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7149
7150**Since**: 12
7151
7152**Parameters**
7153
7154| Name| Description|
7155| -------- | -------- |
7156| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7157| glyphs | Pointer to the start address for storing the glyph indices.|
7158| count | Number of glyph indices.|
7159| widths | Pointer to the start address for storing the glyph widths.|
7160
7161
7162### OH_Drawing_FontIsLinearText()
7163
7164```
7165bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* )
7166```
7167
7168**Description**
7169
7170Checks whether linear scaling is used for a font.
7171
7172Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7173
7174If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7175
7176**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7177
7178**Since**: 12
7179
7180**Parameters**
7181
7182| Name| Description|
7183| -------- | -------- |
7184| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7185
7186**Returns**
7187
7188Returns **true** if linear scaling is used; returns **false** otherwise.
7189
7190
7191### OH_Drawing_FontGetTextSkewX()
7192
7193```
7194float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* )
7195```
7196
7197**Description**
7198
7199Obtains the horizontal skew factor of a font.
7200
7201Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7202
7203If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7204
7205**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7206
7207**Since**: 12
7208
7209**Parameters**
7210
7211| Name| Description|
7212| -------- | -------- |
7213| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7214
7215**Returns**
7216
7217Returns a floating point number representing the horizontal skew factor.
7218
7219
7220### OH_Drawing_FontIsFakeBoldText()
7221
7222```
7223bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* )
7224```
7225
7226**Description**
7227
7228Checks whether fake bold is used for a font.
7229
7230Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7231
7232If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7233
7234**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7235
7236**Since**: 12
7237
7238**Parameters**
7239
7240| Name| Description|
7241| -------- | -------- |
7242| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7243
7244**Returns**
7245
7246Returns **true** if fake bold is used; returns **false** otherwise.
7247
7248
7249### OH_Drawing_FontSetScaleX()
7250
7251```
7252void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX )
7253```
7254
7255**Description**
7256
7257Sets a horizontal scale factor for a font.
7258
7259Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7260
7261If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7262
7263**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7264
7265**Since**: 12
7266
7267**Parameters**
7268
7269| Name| Description|
7270| -------- | -------- |
7271| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7272| scaleX | Horizontal scale factor.|
7273
7274
7275### OH_Drawing_FontGetScaleX()
7276
7277```
7278float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* )
7279```
7280
7281**Description**
7282
7283Obtains the horizontal scale factor of a font.
7284
7285Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7286
7287If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7288
7289**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7290
7291**Since**: 12
7292
7293**Parameters**
7294
7295| Name| Description|
7296| -------- | -------- |
7297| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7298
7299**Returns**
7300
7301Returns the horizontal scale factor.
7302
7303
7304### OH_Drawing_FontSetHinting()
7305
7306```
7307void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting  )
7308```
7309
7310**Description**
7311
7312Sets a font hinting effect.
7313
7314Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7315
7316If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7317
7318If **OH_Drawing_FontHinting** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
7319
7320**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7321
7322**Since**: 12
7323
7324**Parameters**
7325
7326| Name| Description|
7327| -------- | -------- |
7328| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7329| OH_Drawing_FontHinting | Font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting).|
7330
7331
7332### OH_Drawing_FontGetHinting()
7333
7334```
7335OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* )
7336```
7337
7338**Description**
7339
7340Obtains the font hinting effect.
7341
7342Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7343
7344If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7345
7346**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7347
7348**Since**: 12
7349
7350**Parameters**
7351
7352| Name| Description|
7353| -------- | -------- |
7354| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7355
7356**Returns**
7357
7358Returns the font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting).
7359
7360
7361### OH_Drawing_FontSetEmbeddedBitmaps()
7362
7363```
7364void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps )
7365```
7366
7367**Description**
7368
7369Sets whether to use bitmaps in a font.
7370
7371Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7372
7373If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7374
7375**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7376
7377**Since**: 12
7378
7379**Parameters**
7380
7381| Name| Description|
7382| -------- | -------- |
7383| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7384| isEmbeddedBitmaps | Whether to use bitmaps in the font. The value **true** means to use bitmaps in the font, and **false** means the opposite.|
7385
7386
7387### OH_Drawing_FontIsEmbeddedBitmaps()
7388
7389```
7390bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* )
7391```
7392
7393**Description**
7394
7395Checks whether bitmaps are used in a font.
7396
7397Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7398
7399If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7400
7401**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7402
7403**Since**: 12
7404
7405**Parameters**
7406
7407| Name| Description|
7408| -------- | -------- |
7409| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
7410
7411**Returns**
7412
7413Returns **true** if bitmaps are used; returns **false** otherwise.
7414
7415
7416### OH_Drawing_BitmapBuild()
7417
7418```
7419void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*  )
7420```
7421
7422**Description**
7423
7424Initializes the width and height of a bitmap and sets the pixel format for the bitmap.
7425
7426Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7427
7428If either **OH_Drawing_Bitmap** or **OH_Drawing_BitmapFormat** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7429
7430**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7431
7432**Since**: 8
7433
7434**Parameters**
7435
7436| Name| Description|
7437| -------- | -------- |
7438| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7439| width | Width of the bitmap to be initialized.|
7440| height | Height of the bitmap to be initialized.|
7441| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Pointer to the pixel format of the bitmap to be initialized, including the pixel color type and alpha type.|
7442
7443
7444### OH_Drawing_BitmapCreate()
7445
7446```
7447OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
7448```
7449
7450**Description**
7451
7452Creates an **OH_Drawing_Bitmap** object.
7453
7454**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7455
7456**Since**: 8
7457
7458**Returns**
7459
7460Returns the pointer to the **OH_Drawing_Bitmap** object created.
7461
7462
7463### OH_Drawing_BitmapCreateFromPixels()
7464
7465```
7466OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes )
7467```
7468
7469**Description**
7470
7471Creates an **OH_Drawing_Bitmap** object, with the address of the memory for storing the bitmap pixels set to the memory address that you applied for.
7472
7473Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7474
7475If either **OH_Drawing_Image_Info** or **pixels** is NULL or **rowBytes** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7476
7477**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7478
7479**Since**: 12
7480
7481**Parameters**
7482
7483| Name| Description|
7484| -------- | -------- |
7485| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
7486| pixels | Pointer to the start address of the memory for storing the bitmap pixels. You need to apply for the memory and ensure its validity.|
7487| rowBytes | Number of bytes in each row of pixels. The value is invalid if it is less than or equal to 0.|
7488
7489**Returns**
7490
7491Returns the pointer to the [OH_Drawing_Bitmap](#oh_drawing_bitmap) object created.
7492
7493
7494### OH_Drawing_BitmapDestroy()
7495
7496```
7497void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* )
7498```
7499
7500**Description**
7501
7502Destroys an **OH_Drawing_Bitmap** object and reclaims the memory occupied by the object.
7503
7504**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7505
7506**Since**: 8
7507
7508**Parameters**
7509
7510| Name| Description|
7511| -------- | -------- |
7512| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7513
7514
7515### OH_Drawing_BitmapGetAlphaFormat()
7516
7517```
7518OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* )
7519```
7520
7521**Description**
7522
7523Obtains the alpha component of a bitmap.
7524
7525Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7526
7527If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7528
7529**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7530
7531**Since**: 12
7532
7533**Parameters**
7534
7535| Name| Description|
7536| -------- | -------- |
7537| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7538
7539**Returns**
7540
7541Returns the alpha component. For details about the supported formats, see [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat).
7542
7543
7544### OH_Drawing_BitmapGetColorFormat()
7545
7546```
7547OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* )
7548```
7549
7550**Description**
7551
7552Obtains the pixel format of a bitmap.
7553
7554Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7555
7556If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7557
7558**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7559
7560**Since**: 12
7561
7562**Parameters**
7563
7564| Name| Description|
7565| -------- | -------- |
7566| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7567
7568**Returns**
7569
7570Returns the pixel format. For details about the supported formats, see [OH_Drawing_ColorFormat](#oh_drawing_colorformat).
7571
7572
7573### OH_Drawing_BitmapGetHeight()
7574
7575```
7576uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* )
7577```
7578
7579**Description**
7580
7581Obtains the height of a bitmap.
7582
7583Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7584
7585If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7586
7587**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7588
7589**Since**: 8
7590
7591**Parameters**
7592
7593| Name| Description|
7594| -------- | -------- |
7595| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7596
7597**Returns**
7598
7599Returns the height.
7600
7601
7602### OH_Drawing_BitmapGetImageInfo()
7603
7604```
7605void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info*  )
7606```
7607
7608**Description**
7609
7610Obtains the image information of a bitmap.
7611
7612Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7613
7614If either **OH_Drawing_Bitmap** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7615
7616**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7617
7618**Since**: 12
7619
7620**Parameters**
7621
7622| Name| Description|
7623| -------- | -------- |
7624| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.|
7625| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
7626
7627
7628### OH_Drawing_BitmapGetPixels()
7629
7630```
7631void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* )
7632```
7633
7634**Description**
7635
7636Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap.
7637
7638Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7639
7640If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7641
7642**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7643
7644**Since**: 8
7645
7646**Parameters**
7647
7648| Name| Description|
7649| -------- | -------- |
7650| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7651
7652**Returns**
7653
7654Returns the pixel address.
7655
7656
7657### OH_Drawing_BitmapGetWidth()
7658
7659```
7660uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* )
7661```
7662
7663**Description**
7664
7665Obtains the width of a bitmap.
7666
7667Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7668
7669If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7670
7671**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7672
7673**Since**: 8
7674
7675**Parameters**
7676
7677| Name| Description|
7678| -------- | -------- |
7679| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
7680
7681**Returns**
7682
7683Returns the width.
7684
7685### OH_Drawing_BitmapReadPixels()
7686
7687```
7688bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY )
7689```
7690
7691**Description**
7692
7693Reads pixels of a rectangle in a bitmap to the specified buffer.
7694
7695Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7696
7697If any of **OH_Drawing_Bitmap**, **dstInfo**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7698
7699**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7700
7701**Since**: 12
7702
7703**Parameters**
7704
7705| Name| Description|
7706| -------- | -------- |
7707| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.|
7708| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
7709| dstPixels | Pointer to the buffer for storing the pixels read.|
7710| dstRowBytes | Number of bytes in each row of the pixel data read. The value must be greater than or equal to the minimum number of bytes in each row in the [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
7711| srcX | Start X coordinate of the pixel data to read from the bitmap. The value must be less than the width of the bitmap.|
7712| srcY | Start Y coordinate of the pixel data to read from the bitmap. The value must be less than the height of the bitmap.|
7713
7714**Returns**
7715
7716Returns **true** if the pixels are read; returns **false** otherwise.
7717
7718### OH_Drawing_BrushCreate()
7719
7720```
7721OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
7722```
7723
7724**Description**
7725
7726Creates an **OH_Drawing_Brush** object.
7727
7728**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7729
7730**Since**: 8
7731
7732**Returns**
7733
7734Returns the pointer to the **OH_Drawing_Brush** object created.
7735
7736
7737### OH_Drawing_BrushDestroy()
7738
7739```
7740void OH_Drawing_BrushDestroy (OH_Drawing_Brush* )
7741```
7742
7743**Description**
7744
7745Destroys an **OH_Drawing_Brush** object and reclaims the memory occupied by the object.
7746
7747**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7748
7749**Since**: 8
7750
7751**Parameters**
7752
7753| Name             | Description                                |
7754| ---------------- | ------------------------------------------ |
7755| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7756
7757
7758### OH_Drawing_BrushGetAlpha()
7759
7760```
7761uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* )
7762```
7763
7764**Description**
7765
7766Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape.
7767
7768Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7769
7770If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7771
7772**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7773
7774**Since**: 11
7775
7776**Parameters**
7777
7778| Name             | Description                                |
7779| ---------------- | ------------------------------------------ |
7780| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7781
7782**Returns**
7783
7784Returns an 8-bit variable that describes the alpha value.
7785
7786
7787### OH_Drawing_BrushGetColor()
7788
7789```
7790uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* )
7791```
7792
7793**Description**
7794
7795Obtains the color of a brush. The color is used by the brush to fill in a shape.
7796
7797Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7798
7799If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7800
7801**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7802
7803**Since**: 8
7804
7805**Parameters**
7806
7807| Name             | Description                                |
7808| ---------------- | ------------------------------------------ |
7809| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7810
7811**Returns**
7812
7813Returns a 32-bit (ARGB) variable that describes the color.
7814
7815
7816### OH_Drawing_BrushGetFilter()
7817
7818```
7819void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
7820```
7821
7822**Description**
7823
7824Obtains the filter of a brush. The filter is a container that holds a mask filter and color filter.
7825
7826Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7827
7828If either **OH_Drawing_Brush** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7829
7830**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7831
7832**Since**: 12
7833
7834**Parameters**
7835
7836| Name              | Description                                                  |
7837| ----------------- | ------------------------------------------------------------ |
7838| OH_Drawing_Brush  | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object.  |
7839| OH_Drawing_Filter | Pointer to the [OH_Drawing_Filter](#oh_drawing_filter) object obtained. |
7840
7841
7842### OH_Drawing_BrushIsAntiAlias()
7843
7844```
7845bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* )
7846```
7847
7848**Description**
7849
7850Checks whether anti-aliasing is enabled for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.
7851
7852Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7853
7854If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7855
7856**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7857
7858**Since**: 8
7859
7860**Parameters**
7861
7862| Name             | Description                                |
7863| ---------------- | ------------------------------------------ |
7864| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7865
7866**Returns**
7867
7868Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
7869
7870
7871### OH_Drawing_BrushReset()
7872
7873```
7874void OH_Drawing_BrushReset (OH_Drawing_Brush* )
7875```
7876
7877**Description**
7878
7879Resets a brush to the initial state. All configured attributes are cleared.
7880
7881Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7882
7883If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7884
7885**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7886
7887**Since**: 12
7888
7889**Parameters**
7890
7891| Name             | Description                                                 |
7892| ---------------- | ----------------------------------------------------------- |
7893| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. |
7894
7895
7896### OH_Drawing_BrushSetAlpha()
7897
7898```
7899void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha )
7900```
7901
7902**Description**
7903
7904Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape.
7905
7906Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7907
7908If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7909
7910**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7911
7912**Since**: 11
7913
7914**Parameters**
7915
7916| Name             | Description                                |
7917| ---------------- | ------------------------------------------ |
7918| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7919| alpha            | Alpha value, which is an 8-bit variable.   |
7920
7921
7922### OH_Drawing_BrushSetAntiAlias()
7923
7924```
7925void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool  )
7926```
7927
7928**Description**
7929
7930Enables or disables anti-aliasing for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.
7931
7932Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7933
7934If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7935
7936**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7937
7938**Since**: 8
7939
7940**Parameters**
7941
7942| Name             | Description                                                  |
7943| ---------------- | ------------------------------------------------------------ |
7944| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object.                   |
7945| bool             | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
7946
7947
7948### OH_Drawing_BrushSetBlendMode()
7949
7950```
7951void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode  )
7952```
7953
7954**Description**
7955
7956Sets a blender for a brush. The blender implements the specified blend mode.
7957
7958Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7959
7960If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7961
7962If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
7963
7964**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7965
7966**Since**: 12
7967
7968**Parameters**
7969
7970| Name                 | Description                                                  |
7971| -------------------- | ------------------------------------------------------------ |
7972| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object.  |
7973| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
7974
7975
7976### OH_Drawing_BrushSetColor()
7977
7978```
7979void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color )
7980```
7981
7982**Description**
7983
7984Sets the color for a brush. The color is used by the brush to fill in a shape.
7985
7986Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7987
7988If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7989
7990**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7991
7992**Since**: 8
7993
7994**Parameters**
7995
7996| Name             | Description                                |
7997| ---------------- | ------------------------------------------ |
7998| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
7999| color            | Color, which is a 32-bit (ARGB) variable.  |
8000
8001
8002### OH_Drawing_BrushSetFilter()
8003
8004```
8005void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
8006```
8007
8008**Description**
8009
8010Sets a filter for a brush. The filter is a container that holds a mask filter and color filter.
8011
8012Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8013
8014If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8015
8016**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8017
8018**Since**: 11
8019
8020**Parameters**
8021
8022| Name              | Description                                                  |
8023| ----------------- | ------------------------------------------------------------ |
8024| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.                   |
8025| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. If null is passed in, the filter will be cleared. |
8026
8027
8028### OH_Drawing_BrushSetShaderEffect()
8029
8030```
8031void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect*  )
8032```
8033
8034**Description**
8035
8036Sets the shader effect for a brush.
8037
8038Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8039
8040If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8041
8042**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8043
8044**Since**: 11
8045
8046**Parameters**
8047
8048| Name                    | Description                                                  |
8049| ----------------------- | ------------------------------------------------------------ |
8050| OH_Drawing_Brush        | Pointer to an **OH_Drawing_Brush** object.                   |
8051| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. If NULL is passed in, the shader effect of the brush will be cleared. |
8052
8053
8054### OH_Drawing_CanvasAttachBrush()
8055
8056```
8057void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
8058```
8059
8060**Description**
8061
8062Attaches a brush to a canvas so that the canvas can use the style and color of the brush to fill in a shape. If the brush effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.
8063
8064Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8065
8066If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8067
8068**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8069
8070**Since**: 8
8071
8072**Parameters**
8073
8074| Name              | Description                                 |
8075| ----------------- | ------------------------------------------- |
8076| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8077| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.  |
8078
8079
8080### OH_Drawing_CanvasAttachPen()
8081
8082```
8083void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen*  )
8084```
8085
8086**Description**
8087
8088Attaches a pen to a canvas so that the canvas can use the style and color of the pen to outline a shape. If the pen effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.
8089
8090Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8091
8092If either **OH_Drawing_Canvas** or **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8093
8094**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8095
8096**Since**: 8
8097
8098**Parameters**
8099
8100| Name              | Description                                 |
8101| ----------------- | ------------------------------------------- |
8102| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8103| OH_Drawing_Pen    | Pointer to an **OH_Drawing_Pen** object.    |
8104
8105
8106### OH_Drawing_CanvasBind()
8107
8108```
8109void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap*  )
8110```
8111
8112**Description**
8113
8114Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap. (This process is called CPU rendering.) A canvas bound to a bitmap is a non-recording canvas.
8115
8116Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8117
8118If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8119
8120**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8121
8122**Since**: 8
8123
8124**Parameters**
8125
8126| Name              | Description                                 |
8127| ----------------- | ------------------------------------------- |
8128| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8129| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object. |
8130
8131
8132### OH_Drawing_CanvasClear()
8133
8134```
8135void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color )
8136```
8137
8138**Description**
8139
8140Clears a canvas by using a given color.
8141
8142Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8143
8144If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8145
8146**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8147
8148**Since**: 8
8149
8150**Parameters**
8151
8152| Name              | Description                                 |
8153| ----------------- | ------------------------------------------- |
8154| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8155| color             | Color, which is a 32-bit (ARGB) variable.   |
8156
8157
8158### OH_Drawing_CanvasClipPath()
8159
8160```
8161void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8162```
8163
8164**Description**
8165
8166Clips a path.
8167
8168Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8169
8170If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8171
8172If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8173
8174**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8175
8176**Since**: 11
8177
8178**Parameters**
8179
8180| Name              | Description                                                  |
8181| ----------------- | ------------------------------------------------------------ |
8182| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
8183| OH_Drawing_Path   | Pointer to an **OH_Drawing_Path** object.                    |
8184| clipOp            | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
8185| doAntiAlias       | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
8186
8187
8188### OH_Drawing_CanvasClipRect()
8189
8190```
8191void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8192```
8193
8194**Description**
8195
8196Clips a rectangle.
8197
8198Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8199
8200If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8201
8202If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8203
8204**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8205
8206**Since**: 11
8207
8208**Parameters**
8209
8210| Name              | Description                                                  |
8211| ----------------- | ------------------------------------------------------------ |
8212| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
8213| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.                    |
8214| clipOp            | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
8215| doAntiAlias       | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
8216
8217### OH_Drawing_CanvasClipRoundRect()
8218
8219```
8220void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
8221```
8222
8223**Description**
8224
8225Clips a rounded rectangle.
8226
8227Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8228
8229If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8230
8231If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8232
8233**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8234
8235**Since**: 12
8236
8237**Parameters**
8238
8239| Name                 | Description                                                  |
8240| -------------------- | ------------------------------------------------------------ |
8241| OH_Drawing_Canvas    | Pointer to an **OH_Drawing_Canvas** object.                  |
8242| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object.               |
8243| clipOp               | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
8244| doAntiAlias          | Whether to perform anti-aliasing. The value **true** means to perform anti-aliasing, and **false** means the opposite. |
8245
8246### OH_Drawing_CanvasConcatMatrix()
8247
8248```
8249void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
8250```
8251
8252**Description**
8253
8254Preconcats the existing matrix with the passed-in matrix. The drawing operation triggered before this function is called is not affected.
8255
8256Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8257
8258If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8259
8260**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8261
8262**Since**: 12
8263
8264**Parameters**
8265
8266| Name              | Description                                                  |
8267| ----------------- | ------------------------------------------------------------ |
8268| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8269| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
8270
8271
8272### OH_Drawing_CanvasCreate()
8273
8274```
8275OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
8276```
8277
8278**Description**
8279
8280Creates an **OH_Drawing_Canvas** object.
8281
8282**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8283
8284**Since**: 8
8285
8286**Returns**
8287
8288Returns the pointer to the **OH_Drawing_Canvas** object created.
8289
8290
8291### OH_Drawing_CanvasDestroy()
8292
8293```
8294void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* )
8295```
8296
8297**Description**
8298
8299Destroys an **OH_Drawing_Canvas** object and reclaims the memory occupied by the object.
8300
8301**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8302
8303**Since**: 8
8304
8305**Parameters**
8306
8307| Name              | Description                                 |
8308| ----------------- | ------------------------------------------- |
8309| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8310
8311
8312### OH_Drawing_CanvasDetachBrush()
8313
8314```
8315void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* )
8316```
8317
8318**Description**
8319
8320Detaches the brush from a canvas so that the canvas can no longer use the previously set brush to fill in a shape.
8321
8322Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8323
8324If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8325
8326**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8327
8328**Since**: 8
8329
8330**Parameters**
8331
8332| Name              | Description                                 |
8333| ----------------- | ------------------------------------------- |
8334| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8335
8336
8337### OH_Drawing_CanvasDetachPen()
8338
8339```
8340void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* )
8341```
8342
8343**Description**
8344
8345Detaches the pen from a canvas so that the canvas can no longer use the style and color of the pen to outline a shape.
8346
8347Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8348
8349If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8350
8351**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8352
8353**Since**: 8
8354
8355**Parameters**
8356
8357| Name              | Description                                 |
8358| ----------------- | ------------------------------------------- |
8359| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8360
8361
8362### OH_Drawing_CanvasDrawArc()
8363
8364```
8365void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
8366```
8367
8368**Description**
8369
8370Draws an arc. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn.
8371
8372Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8373
8374If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8375
8376**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8377
8378**Since**: 11
8379
8380**Parameters**
8381
8382| Name              | Description                                                  |
8383| ----------------- | ------------------------------------------------------------ |
8384| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
8385| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.                    |
8386| startAngle        | Start angle. When the degree is 0, the start point is located at the right end of the oval. A positive number indicates that the start point is placed clockwise, and a negative number indicates that the start point is placed counterclockwise. |
8387| sweepAngle        | Angle to sweep, in degrees. A positive number indicates a clockwise sweep, and a negative value indicates a counterclockwise swipe. The valid range is from -360 degrees to 360 degrees. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn. |
8388
8389
8390### OH_Drawing_CanvasDrawBackground()
8391
8392```
8393void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
8394```
8395
8396**Description**
8397
8398Draws a background filled with a brush.
8399
8400Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8401
8402If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8403
8404**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8405
8406**Since**: 12
8407
8408**Parameters**
8409
8410| Name              | Description                                 |
8411| ----------------- | ------------------------------------------- |
8412| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8413| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.  |
8414
8415
8416### OH_Drawing_CanvasDrawBitmap()
8417
8418```
8419void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top )
8420```
8421
8422**Description**
8423
8424Draws a bitmap. A bitmap, also referred to as a dot matrix image, a pixel map image, or a grid image, includes single points called pixels (image elements).
8425
8426Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8427
8428If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8429
8430**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8431
8432**Since**: 11
8433
8434**Parameters**
8435
8436| Name              | Description                                          |
8437| ----------------- | ---------------------------------------------------- |
8438| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.          |
8439| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.          |
8440| left              | X coordinate of the upper left corner of the bitmap. |
8441| top               | Y coordinate of the upper left corner of the bitmap. |
8442
8443
8444### OH_Drawing_CanvasDrawBitmapRect()
8445
8446```
8447void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
8448```
8449
8450**Description**
8451
8452Draws a portion of a bitmap onto a specified area of the canvas.
8453
8454Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8455
8456If any of **OH_Drawing_Canvas**, **OH_Drawing_Bitmap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8457
8458**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8459
8460**Since**: 12
8461
8462**Parameters**
8463
8464| Name                       | Description                                                  |
8465| -------------------------- | ------------------------------------------------------------ |
8466| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8467| OH_Drawing_Bitmap          | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
8468| src                        | Pointer to a rectangle on the bitmap. If NULL is passed in, it refers to the entire bitmap. |
8469| dst                        | Pointer to a rectangle on the canvas.                        |
8470| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
8471
8472
8473### OH_Drawing_CanvasDrawCircle()
8474
8475```
8476void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius )
8477```
8478
8479**Description**
8480
8481Draws a circle.
8482
8483Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8484
8485If either **OH_Drawing_Canvas** or **OH_Drawing_Point** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8486
8487If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8488
8489**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8490
8491**Since**: 11
8492
8493**Parameters**
8494
8495| Name              | Description                                                  |
8496| ----------------- | ------------------------------------------------------------ |
8497| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
8498| OH_Drawing_Point  | Pointer to an **OH_Drawing_Point** object, which indicates the center of the circle. |
8499| radius            | Radius of the circle. The value is invalid if it is less than or equal to 0. |
8500
8501
8502### OH_Drawing_CanvasDrawImageRect()
8503
8504```
8505void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*  )
8506```
8507
8508**Description**
8509
8510Draws an image onto a specified area of the canvas.
8511
8512Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8513
8514If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8515
8516**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8517
8518**Since**: 12
8519
8520**Parameters**
8521
8522| Name                       | Description                                                  |
8523| -------------------------- | ------------------------------------------------------------ |
8524| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8525| OH_Drawing_Image           | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
8526| dst                        | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
8527| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
8528
8529
8530### OH_Drawing_CanvasDrawImageRectWithSrc()
8531
8532```
8533void OH_Drawing_CanvasDrawImageRectWithSrc (OH_Drawing_Canvas* , const OH_Drawing_Image* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* , OH_Drawing_SrcRectConstraint  )
8534```
8535
8536**Description**
8537
8538Draws a portion of an image onto a specified area of the canvas. The area selected by the source rectangle is scaled and translated to the destination rectangle.
8539
8540Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8541
8542If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8543
8544**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8545
8546**Since**: 12
8547
8548**Parameters**
8549
8550| Name                         | Description                                                  |
8551| ---------------------------- | ------------------------------------------------------------ |
8552| OH_Drawing_Canvas            | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8553| OH_Drawing_Image             | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
8554| src                          | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
8555| dst                          | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
8556| OH_Drawing_SamplingOptions   | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
8557| OH_Drawing_SrcRectConstraint | Constraint type. For details about the available options, see [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1). |
8558
8559
8560### OH_Drawing_CanvasDrawLine()
8561
8562```
8563void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 )
8564```
8565
8566**Description**
8567
8568Draws a line segment.
8569
8570Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8571
8572If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8573
8574**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8575
8576**Since**: 8
8577
8578**Parameters**
8579
8580| Name              | Description                                          |
8581| ----------------- | ---------------------------------------------------- |
8582| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.          |
8583| x1                | X coordinate of the start point of the line segment. |
8584| y1                | Y coordinate of the start point of the line segment. |
8585| x2                | X coordinate of the end point of the line segment.   |
8586| y2                | Y coordinate of the end point of the line segment.   |
8587
8588
8589### OH_Drawing_CanvasDrawOval()
8590
8591```
8592void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
8593```
8594
8595**Description**
8596
8597Draws an oval.
8598
8599Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8600
8601If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8602
8603**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8604
8605**Since**: 11
8606
8607**Parameters**
8608
8609| Name              | Description                                 |
8610| ----------------- | ------------------------------------------- |
8611| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8612| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.   |
8613
8614
8615### OH_Drawing_CanvasDrawPath()
8616
8617```
8618void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path*  )
8619```
8620
8621**Description**
8622
8623Draws a path.
8624
8625Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8626
8627If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8628
8629**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8630
8631**Since**: 8
8632
8633**Parameters**
8634
8635| Name              | Description                                 |
8636| ----------------- | ------------------------------------------- |
8637| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8638| OH_Drawing_Path   | Pointer to an **OH_Drawing_Path** object.   |
8639
8640
8641### OH_Drawing_CanvasDrawPixelMapRect()
8642
8643```
8644void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
8645```
8646
8647**Description**
8648
8649Draws a portion of a pixel map onto a specified area of the canvas.
8650
8651Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8652
8653If any of **OH_Drawing_Canvas**, **OH_Drawing_PixelMap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8654
8655**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8656
8657**Since**: 12
8658
8659**Parameters**
8660
8661| Name                       | Description                                                  |
8662| -------------------------- | ------------------------------------------------------------ |
8663| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8664| OH_Drawing_PixelMap        | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object. |
8665| src                        | Pointer to a rectangle on the pixel map. If NULL is passed in, it refers to the entire pixel map. |
8666| dst                        | Pointer to a rectangle on the canvas.                        |
8667| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
8668
8669
8670### OH_Drawing_CanvasDrawPoints()
8671
8672```
8673void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D*  )
8674```
8675
8676**Description**
8677
8678Draws multiple points. You can draw a single point, a line segment, or an open polygon.
8679
8680Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8681
8682If either **OH_Drawing_Canvas** or **OH_Drawing_Point2D** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8683
8684If **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8685
8686**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8687
8688**Since**: 12
8689
8690**Parameters**
8691
8692| Name                                               | Description                                                  |
8693| -------------------------------------------------- | ------------------------------------------------------------ |
8694| OH_Drawing_Canvas                                  | Pointer to an **OH_Drawing_Canvas** object.                  |
8695| mode                                               | Mode of drawing multiple points. For details about the available options, see [OH_Drawing_PointMode](#oh_drawing_pointmode). |
8696| count                                              | Number of vertices, that is, the number of vertices in the vertex array. |
8697| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Pointer to an array holding the vertices.                    |
8698
8699
8700### OH_Drawing_CanvasDrawRect()
8701
8702```
8703void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
8704```
8705
8706**Description**
8707
8708Draws a rectangle.
8709
8710Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8711
8712If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8713
8714**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8715
8716**Since**: 11
8717
8718**Parameters**
8719
8720| Name              | Description                                 |
8721| ----------------- | ------------------------------------------- |
8722| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8723| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.   |
8724
8725
8726### OH_Drawing_CanvasDrawRegion()
8727
8728```
8729void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region*  )
8730```
8731
8732**Description**
8733
8734Draws a region.
8735
8736Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8737
8738If either **OH_Drawing_Canvas** or **OH_Drawing_Region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8739
8740**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8741
8742**Since**: 12
8743
8744**Parameters**
8745
8746| Name              | Description                                 |
8747| ----------------- | ------------------------------------------- |
8748| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8749| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. |
8750
8751
8752### OH_Drawing_CanvasDrawRoundRect()
8753
8754```
8755void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect*  )
8756```
8757
8758**Description**
8759
8760Draws a rounded rectangle.
8761
8762Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8763
8764If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8765
8766**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8767
8768**Since**: 11
8769
8770**Parameters**
8771
8772| Name                 | Description                                    |
8773| -------------------- | ---------------------------------------------- |
8774| OH_Drawing_Canvas    | Pointer to an **OH_Drawing_Canvas** object.    |
8775| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. |
8776
8777
8778### OH_Drawing_CanvasDrawShadow()
8779
8780```
8781void OH_Drawing_CanvasDrawShadow (OH_Drawing_Canvas* , OH_Drawing_Path* , OH_Drawing_Point3D planeParams, OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, OH_Drawing_CanvasShadowFlags flag )
8782```
8783
8784**Description**
8785
8786Draws a spot shadow and uses a given path to outline the ambient shadow.
8787
8788Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8789
8790If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8791
8792If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8793
8794**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8795
8796**Since**: 12
8797
8798**Parameters**
8799
8800| Name              | Description                                                  |
8801| ----------------- | ------------------------------------------------------------ |
8802| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8803| OH_Drawing_Path   | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, which is used to generate the shadow. |
8804| planeParams       | Z-axis offset of an occluder relative to the canvas, based on its x and y coordinates. |
8805| devLightPos       | Position of the light relative to the canvas.                |
8806| lightRadius       | Radius of the light source. The value must be greater than or equal to 0. |
8807| ambientColor      | Ambient shadow color, which is a 32-bit (ARGB) variable.     |
8808| spotColor         | Point shadow color, which is a 32-bit (ARGB) variable.       |
8809| flag              | Shadow flag. For details about the available options, see [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags). |
8810
8811
8812### OH_Drawing_CanvasDrawTextBlob()
8813
8814```
8815void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y )
8816```
8817
8818**Description**
8819
8820Draws a text blob. If the typeface used to construct **OH_Drawing_TextBlob** does not support a character, that character will not be drawn.
8821
8822Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8823
8824If either **OH_Drawing_Canvas** or **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8825
8826**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8827
8828**Since**: 11
8829
8830**Parameters**
8831
8832| Name                | Description                                             |
8833| ------------------- | ------------------------------------------------------- |
8834| OH_Drawing_Canvas   | Pointer to an **OH_Drawing_Canvas** object.             |
8835| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object.           |
8836| x                   | X coordinate of the lower left corner of the text blob. |
8837| y                   | Y coordinate of the lower left corner of the text blob. |
8838
8839
8840### OH_Drawing_CanvasDrawVertices()
8841
8842```
8843void OH_Drawing_CanvasDrawVertices (OH_Drawing_Canvas* , OH_Drawing_VertexMode vertexMmode, int32_t vertexCount, const OH_Drawing_Point2D* positions, const OH_Drawing_Point2D* texs, const uint32_t* colors, int32_t indexCount, const uint16_t* indices, OH_Drawing_BlendMode mode )
8844```
8845
8846**Description**
8847
8848Draws a triangular grid described by a vertex array.
8849
8850Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8851
8852If either **OH_Drawing_Canvas** or **positions** is NULL, **vertexCount** is less than 3, or **indexCount** is less than 3 but not 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8853
8854If either **vertexMmode** or **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
8855
8856**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8857
8858**Since**: 12
8859
8860**Parameters**
8861
8862| Name              | Description                                                  |
8863| ----------------- | ------------------------------------------------------------ |
8864| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
8865| vertexMmode       | Vertex drawing mode. For details about the available options, see [OH_Drawing_VertexMode](#oh_drawing_vertexmode). |
8866| vertexCount       | Number of elements in the vertex array. The value must be greater than or equal to 3. |
8867| positions         | Pointer to the array that holds the position of every vertex. The array cannot be null and its length must be equal to the value of **vertexCount**. |
8868| texs              | Pointer to the array that holds the texture space coordinate corresponding to each vertex. The array can be null. If the array is not null, its length must be equal to the value of **vertexCount**. |
8869| colors            | Pointer to the array that holds the color corresponding to each vertex. It is used for interpolation in a triangle. The array can be null. If the array is not null, its length must be equal to the value of **vertexCount**. |
8870| indexCount        | Number of indices. The value can be 0 or a value greater than or equal to 3. |
8871| indices           | Pointer to the array that holds the index of each vertex. The array can be null. If the array is not null, its length must be equal to the value of **indexCount**. |
8872| mode              | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
8873
8874
8875### OH_Drawing_CanvasGetHeight()
8876
8877```
8878int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* )
8879```
8880
8881**Description**
8882
8883Obtains the canvas height.
8884
8885Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8886
8887If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8888
8889**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8890
8891**Since**: 12
8892
8893**Parameters**
8894
8895| Name              | Description                                                  |
8896| ----------------- | ------------------------------------------------------------ |
8897| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8898
8899**Returns**
8900
8901Returns the canvas height, in pixels.
8902
8903
8904### OH_Drawing_CanvasGetLocalClipBounds()
8905
8906```
8907void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect*  )
8908```
8909
8910**Description**
8911
8912Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases.
8913
8914Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8915
8916If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8917
8918**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8919
8920**Since**: 12
8921
8922**Parameters**
8923
8924| Name              | Description                                                  |
8925| ----------------- | ------------------------------------------------------------ |
8926| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8927| OH_Drawing_Rect   | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). |
8928
8929
8930### OH_Drawing_CanvasGetSaveCount()
8931
8932```
8933uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* )
8934```
8935
8936**Description**
8937
8938Obtains the number of canvas statuses (canvas matrices) saved in the stack.
8939
8940Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8941
8942If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8943
8944**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8945
8946**Since**: 11
8947
8948**Parameters**
8949
8950| Name              | Description                                 |
8951| ----------------- | ------------------------------------------- |
8952| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
8953
8954**Returns**
8955
8956Returns a 32-bit value that describes the number of canvas statuses (canvas matrices). The initial number is **1**.
8957
8958
8959### OH_Drawing_CanvasGetTotalMatrix()
8960
8961```
8962void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
8963```
8964
8965**Description**
8966
8967Obtains the 3x3 matrix of a canvas.
8968
8969Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8970
8971If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8972
8973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8974
8975**Since**: 12
8976
8977**Parameters**
8978
8979| Name              | Description                                                  |
8980| ----------------- | ------------------------------------------------------------ |
8981| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
8982| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). |
8983
8984
8985### OH_Drawing_CanvasGetWidth()
8986
8987```
8988int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* )
8989```
8990
8991**Description**
8992
8993Obtains the canvas width.
8994
8995Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8996
8997If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8998
8999**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9000
9001**Since**: 12
9002
9003**Parameters**
9004
9005| Name              | Description                                                  |
9006| ----------------- | ------------------------------------------------------------ |
9007| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9008
9009**Returns**
9010
9011Returns the canvas width, in px.
9012
9013
9014### OH_Drawing_CanvasReadPixels()
9015
9016```
9017bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY )
9018```
9019
9020**Description**
9021
9022Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases.
9023
9024Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9025
9026If any of **OH_Drawing_Canvas**, **OH_Drawing_Image_Info**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9027
9028**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9029
9030**Since**: 12
9031
9032**Parameters**
9033
9034| Name                                                      | Description                                                  |
9035| --------------------------------------------------------- | ------------------------------------------------------------ |
9036| OH_Drawing_Canvas                                         | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9037| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. |
9038| dstPixels                                                 | Pointer to the start address for storing the pixel data.     |
9039| dstRowBytes                                               | Number of bytes in each row of pixels. The value is invalid if it is less than or equal to 0. |
9040| srcX                                                      | X offset of the pixels on the canvas, in px.                 |
9041| srcY                                                      | Y offset of the pixels on the canvas, in px.                 |
9042
9043**Returns**
9044
9045Returns **true** if the pixel data is copied to the start address of the storage; returns **false** otherwise.
9046
9047
9048### OH_Drawing_CanvasReadPixelsToBitmap()
9049
9050```
9051bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY )
9052```
9053
9054**Description**
9055
9056Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases.
9057
9058Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9059
9060If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9061
9062**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9063
9064**Since**: 12
9065
9066**Parameters**
9067
9068| Name              | Description                                                  |
9069| ----------------- | ------------------------------------------------------------ |
9070| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9071| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
9072| srcX              | X offset of the pixels on the canvas, in px.                 |
9073| srcY              | Y offset of the pixels on the canvas, in px.                 |
9074
9075**Returns**
9076
9077Returns **true** if the pixel data is copied to the image; returns **false** otherwise.
9078
9079
9080### OH_Drawing_CanvasResetMatrix()
9081
9082```
9083void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* )
9084```
9085
9086**Description**
9087
9088Resets the matrix of a canvas to an identity matrix.
9089
9090Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9091
9092If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9093
9094**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9095
9096**Since**: 12
9097
9098**Parameters**
9099
9100| Name              | Description                                                  |
9101| ----------------- | ------------------------------------------------------------ |
9102| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9103
9104
9105### OH_Drawing_CanvasRestore()
9106
9107```
9108void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* )
9109```
9110
9111**Description**
9112
9113Restores the canvas status (canvas matrix) saved on the top of the stack.
9114
9115Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9116
9117If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9118
9119**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9120
9121**Since**: 8
9122
9123**Parameters**
9124
9125| Name              | Description                                 |
9126| ----------------- | ------------------------------------------- |
9127| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
9128
9129
9130### OH_Drawing_CanvasRestoreToCount()
9131
9132```
9133void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount )
9134```
9135
9136**Description**
9137
9138Restores to a given number of canvas statuses (canvas matrices).
9139
9140Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9141
9142If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9143
9144**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9145
9146**Since**: 11
9147
9148**Parameters**
9149
9150| Name              | Description                                                  |
9151| ----------------- | ------------------------------------------------------------ |
9152| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
9153| saveCount         | Number of canvas statuses (canvas matrices). If the value is less than or equal to 1, the canvas is restored to the initial state. If the value is greater than the number of canvas statuses that have been saved, no operation is performed. |
9154
9155
9156### OH_Drawing_CanvasRotate()
9157
9158```
9159void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py )
9160```
9161
9162**Description**
9163
9164Rotates a canvas by a given angle. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation.
9165
9166Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9167
9168If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9169
9170**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9171
9172**Since**: 11
9173
9174**Parameters**
9175
9176| Name              | Description                                 |
9177| ----------------- | ------------------------------------------- |
9178| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
9179| degrees           | Angle to rotate.                            |
9180| px                | X coordinate of the rotation center.        |
9181| py                | Y coordinate of the rotation center.        |
9182
9183
9184### OH_Drawing_CanvasSave()
9185
9186```
9187void OH_Drawing_CanvasSave (OH_Drawing_Canvas* )
9188```
9189
9190**Description**
9191
9192Saves the current canvas status (canvas matrix) to the top of the stack. This function must be used in pair with [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore).
9193
9194Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9195
9196If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9197
9198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9199
9200**Since**: 8
9201
9202**Parameters**
9203
9204| Name              | Description                                 |
9205| ----------------- | ------------------------------------------- |
9206| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
9207
9208
9209### OH_Drawing_CanvasSaveLayer()
9210
9211```
9212void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush*  )
9213```
9214
9215**Description**
9216
9217Saves the matrix and cropping region, and allocates a bitmap for subsequent drawing. If you call [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore), the changes made to the matrix and clipping region are discarded, and the bitmap is drawn.
9218
9219Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9220
9221If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9222
9223**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9224
9225**Since**: 12
9226
9227**Parameters**
9228
9229| Name              | Description                                                  |
9230| ----------------- | ------------------------------------------------------------ |
9231| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9232| OH_Drawing_Rect   | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is used to limit the size of the graphics layer. If NULL is passed in, the size is not limited. |
9233| OH_Drawing_Brush  | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. The alpha value, filter effect, and blend mode of the brush are applied when the bitmap is drawn. If NULL is passed in, no effect is applied. |
9234
9235
9236### OH_Drawing_CanvasScale()
9237
9238```
9239void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy )
9240```
9241
9242**Description**
9243
9244Scales a canvas.
9245
9246Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9247
9248If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9249
9250**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9251
9252**Since**: 11
9253
9254**Parameters**
9255
9256| Name              | Description                                 |
9257| ----------------- | ------------------------------------------- |
9258| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
9259| sx                | Scale ratio on the X axis.                  |
9260| sy                | Scale ratio on the Y axis.                  |
9261
9262
9263### OH_Drawing_CanvasSetMatrix()
9264
9265```
9266void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
9267```
9268
9269**Description**
9270
9271Sets the matrix status for a canvas.
9272
9273Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9274
9275If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9276
9277**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9278
9279**Since**: 12
9280
9281**Parameters**
9282
9283| Name              | Description                                                  |
9284| ----------------- | ------------------------------------------------------------ |
9285| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
9286| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). |
9287
9288
9289### OH_Drawing_CanvasSkew()
9290
9291```
9292void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy )
9293```
9294
9295**Description**
9296
9297Skews a canvas. This function premultiplies the current canvas matrix by a skew transformation matrix and applies the resulting matrix to the canvas. The skew transformation matrix is as follows: \|1 sx 0\| \|sy 1 0\| \|0 0 1\|
9298
9299Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9300
9301If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9302
9303**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9304
9305**Since**: 12
9306
9307**Parameters**
9308
9309| Name              | Description                                                  |
9310| ----------------- | ------------------------------------------------------------ |
9311| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
9312| sx                | Amount of tilt on the X axis. A positive number tilts the drawing rightwards along the positive direction of the Y axis, and a negative number tilts the drawing leftwards along the positive direction of the Y axis. |
9313| sy                | Amount of tilt on the Y axis. A positive number tilts the drawing downwards along the positive direction of the X axis, and a negative number tilts the drawing upwards along the positive direction of the X axis. |
9314
9315
9316### OH_Drawing_CanvasTranslate()
9317
9318```
9319void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy )
9320```
9321
9322**Description**
9323
9324Translates a canvas by a given distance.
9325
9326Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9327
9328If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9329
9330**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9331
9332**Since**: 11
9333
9334**Parameters**
9335
9336| Name              | Description                                 |
9337| ----------------- | ------------------------------------------- |
9338| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
9339| dx                | Distance to translate on the X axis.        |
9340| dy                | Distance to translate on the Y axis.        |
9341
9342
9343### OH_Drawing_ColorFilterCreateBlendMode()
9344
9345```
9346OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode  )
9347```
9348
9349**Description**
9350
9351Creates an **OH_Drawing_ColorFilter** object with a given blend mode.
9352
9353**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9354
9355**Since**: 11
9356
9357**Parameters**
9358
9359| Name                 | Description                                                  |
9360| -------------------- | ------------------------------------------------------------ |
9361| color                | Color, which is a 32-bit (ARGB) variable.                    |
9362| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
9363
9364**Returns**
9365
9366Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9367
9368
9369### OH_Drawing_ColorFilterCreateCompose()
9370
9371```
9372OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 )
9373```
9374
9375**Description**
9376
9377Creates an **OH_Drawing_ColorFilter** object by combining another two color filters.
9378
9379Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9380
9381If either **colorFilter1** or **colorFilter2** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9382
9383**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9384
9385**Since**: 11
9386
9387**Parameters**
9388
9389| Name         | Description                         |
9390| ------------ | ----------------------------------- |
9391| colorFilter1 | Pointer to the first color filter.  |
9392| colorFilter2 | Pointer to the second color filter. |
9393
9394**Returns**
9395
9396Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9397
9398
9399### OH_Drawing_ColorFilterCreateLinearToSrgbGamma()
9400
9401```
9402OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void )
9403```
9404
9405**Description**
9406
9407Creates an **OH_Drawing_ColorFilter** object that applies the sRGB gamma curve to the RGB channels.
9408
9409**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9410
9411**Since**: 11
9412
9413**Returns**
9414
9415Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9416
9417
9418### OH_Drawing_ColorFilterCreateLuma()
9419
9420```
9421OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void )
9422```
9423
9424**Description**
9425
9426Creates an **OH_Drawing_ColorFilter** object that multiplies the passed-in luma into the alpha channel and sets the RGB channels to zero.
9427
9428**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9429
9430**Since**: 11
9431
9432**Returns**
9433
9434Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9435
9436
9437### OH_Drawing_ColorFilterCreateMatrix()
9438
9439```
9440OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20])
9441```
9442
9443**Description**
9444
9445Creates an **OH_Drawing_ColorFilter** object with a given 5x4 color matrix.
9446
9447Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9448
9449If **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9450
9451**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9452
9453**Since**: 11
9454
9455**Parameters**
9456
9457| Name   | Description                                                  |
9458| ------ | ------------------------------------------------------------ |
9459| matrix | Matrix, which is represented by a floating-point array with a length of 20. |
9460
9461**Returns**
9462
9463Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9464
9465
9466### OH_Drawing_ColorFilterCreateSrgbGammaToLinear()
9467
9468```
9469OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void )
9470```
9471
9472**Description**
9473
9474Creates an **OH_Drawing_ColorFilter** object that applies the RGB channels to the sRGB gamma curve.
9475
9476**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9477
9478**Since**: 11
9479
9480**Returns**
9481
9482Returns the pointer to the **OH_Drawing_ColorFilter** object created.
9483
9484
9485### OH_Drawing_ColorFilterDestroy()
9486
9487```
9488void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* )
9489```
9490
9491**Description**
9492
9493Destroys an **OH_Drawing_ColorFilter** object and reclaims the memory occupied by the object.
9494
9495**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9496
9497**Since**: 11
9498
9499**Parameters**
9500
9501| Name                   | Description                                      |
9502| ---------------------- | ------------------------------------------------ |
9503| OH_Drawing_ColorFilter | Pointer to an **OH_Drawing_ColorFilter** object. |
9504
9505
9506### OH_Drawing_ColorSetArgb()
9507
9508```
9509uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
9510```
9511
9512**Description**
9513
9514Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
9515
9516**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9517
9518**Since**: 8
9519
9520**Parameters**
9521
9522| Name  | Description                                           |
9523| ----- | ----------------------------------------------------- |
9524| alpha | Alpha, which is a variable ranging from 0x00 to 0xFF. |
9525| red   | Read, which is a variable ranging from 0x00 to 0xFF.  |
9526| green | Green, which is a variable ranging from 0x00 to 0xFF. |
9527| blue  | Blue, which is a variable ranging from 0x00 to 0xFF.  |
9528
9529**Returns**
9530
9531Returns a 32-bit (ARGB) variable that describes the color.
9532
9533
9534### OH_Drawing_ColorSpaceCreateSrgb()
9535
9536```
9537OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void )
9538```
9539
9540**Description**
9541
9542Creates an sRGB color space.
9543
9544**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9545
9546**Since**: 12
9547
9548**Returns**
9549
9550Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created.
9551
9552
9553### OH_Drawing_ColorSpaceCreateSrgbLinear()
9554
9555```
9556OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void )
9557```
9558
9559**Description**
9560
9561Creates an sRGB linear (Gamma 1.0) color space.
9562
9563**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9564
9565**Since**: 12
9566
9567**Returns**
9568
9569Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created.
9570
9571
9572### OH_Drawing_ColorSpaceDestroy()
9573
9574```
9575void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* )
9576```
9577
9578**Description**
9579
9580Destroys an **OH_Drawing_ColorSpace** object and reclaims the memory occupied by the object.
9581
9582**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9583
9584**Since**: 12
9585
9586**Parameters**
9587
9588| Name                  | Description                                                  |
9589| --------------------- | ------------------------------------------------------------ |
9590| OH_Drawing_ColorSpace | Pointer to an [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object. |
9591
9592
9593### OH_Drawing_CreateDashPathEffect()
9594
9595```
9596OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase )
9597```
9598
9599**Description**
9600
9601Creates an **OH_Drawing_PathEffect** object with a dashed line effect. The dashed line effect is determined by a group of "on" and "off" intervals.
9602
9603Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9604
9605If **intervals** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9606
9607**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9608
9609**Since**: 12
9610
9611**Parameters**
9612
9613| Name      | Description                                                  |
9614| --------- | ------------------------------------------------------------ |
9615| intervals | Pointer to the start address of the dashed line interval array. In the array, an even entry indicates an "on" interval and an odd entry indicates an "off" interval. The unit is px. |
9616| count     | Number of entries in the dashed line interval array. The value must be an even number greater than 0. |
9617| phase     | Offset in the dashed line interval array.                    |
9618
9619**Returns**
9620
9621Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
9622
9623
9624### OH_Drawing_CreateFontCollection()
9625
9626```
9627OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
9628```
9629
9630**Description**
9631
9632Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. The [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object created by this function can be used by only one [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. To share an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object among multiple [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) objects, use [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) to create it.
9633
9634**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9635
9636**Since**: 8
9637
9638**Returns**
9639
9640Returns the pointer to the **OH_Drawing_FontCollection** object created.
9641
9642
9643### OH_Drawing_CreateFontDescriptor()
9644
9645```
9646OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void )
9647```
9648
9649**Description**
9650
9651Creates an **OH_Drawing_FontDescriptor** object to describe the detailed information about a system font.
9652
9653**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9654
9655**Since**: 12
9656
9657**Returns**
9658
9659Returns the pointer to the [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object created.
9660
9661
9662### OH_Drawing_CreateFontParser()
9663
9664```
9665OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void )
9666```
9667
9668**Description**
9669
9670Creates an **OH_Drawing_FontParser** object to parse a system font.
9671
9672**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9673
9674**Since**: 12
9675
9676**Returns**
9677
9678Returns the pointer to the [OH_Drawing_FontParser](#oh_drawing_fontparser) object created.
9679
9680
9681### OH_Drawing_CreateSharedFontCollection()
9682
9683```
9684OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void )
9685```
9686
9687**Description**
9688
9689Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object.
9690
9691**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9692
9693**Since**: 12
9694
9695**Returns**
9696
9697Returns the pointer to the **OH_Drawing_FontCollection** object created.
9698
9699### OH_Drawing_ClearFontCaches()
9700
9701```
9702void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* )
9703```
9704
9705**Description**
9706
9707Clears the font cache. (The font cache has a memory limit and a clearing mechanism. It occupies limited memory. You are not advised to clear it unless otherwise required.)
9708
9709**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9710
9711**Since**: 12
9712
9713**Parameters**
9714
9715| Name                      | Description                                                  |
9716| ------------------------- | ------------------------------------------------------------ |
9717| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
9718
9719### OH_Drawing_CreateTextShadow()
9720
9721```
9722OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void )
9723```
9724
9725**Description**
9726
9727Creates an **OH_Drawing_TextShadow** object. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) to release the pointer to the object.
9728
9729**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9730
9731**Since**: 12
9732
9733**Returns**
9734
9735Returns the pointer to the **OH_Drawing_TextShadow** object created.
9736
9737
9738### OH_Drawing_CreateTextStyle()
9739
9740```
9741OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
9742```
9743
9744**Description**
9745
9746Creates an **OH_Drawing_TextStyle** object.
9747
9748**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9749
9750**Since**: 8
9751
9752**Returns**
9753
9754Returns the pointer to the **OH_Drawing_TextStyle** object created.
9755
9756
9757### OH_Drawing_CreateTypography()
9758
9759```
9760OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* )
9761```
9762
9763**Description**
9764
9765Creates an **OH_Drawing_Typography** object. When [OH_Drawing_Typography](#oh_drawing_typography) is no longer required, call [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) to release the pointer to the object.
9766
9767**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9768
9769**Since**: 8
9770
9771**Parameters**
9772
9773| Name                        | Description                                                  |
9774| --------------------------- | ------------------------------------------------------------ |
9775| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
9776
9777**Returns**
9778
9779Returns the pointer to the **OH_Drawing_Typography** object created.
9780
9781
9782### OH_Drawing_CreateTypographyHandler()
9783
9784```
9785OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection*  )
9786```
9787
9788**Description**
9789
9790Creates an **OH_Drawing_TypographyCreate** object. When [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) is no longer required, call [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) to release the pointer to the object.
9791
9792**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9793
9794**Since**: 8
9795
9796**Parameters**
9797
9798| Name                       | Description                                                  |
9799| -------------------------- | ------------------------------------------------------------ |
9800| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
9801| OH_Drawing_FontCollection  | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object, which is obtained by calling [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) or [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (recommended). |
9802
9803**Returns**
9804
9805Returns the pointer to the **OH_Drawing_TypographyCreate** object created.
9806
9807
9808### OH_Drawing_CreateTypographyStyle()
9809
9810```
9811OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
9812```
9813
9814**Description**
9815
9816Creates an **OH_Drawing_TypographyStyle** object. When [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) is no longer required, call [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) to release the pointer to the object.
9817
9818**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9819
9820**Since**: 8
9821
9822**Returns**
9823
9824Returns the pointer to the **OH_Drawing_TypographyStyle** object created.
9825
9826
9827### OH_Drawing_DestroyFontCollection()
9828
9829```
9830void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* )
9831```
9832
9833**Description**
9834
9835Destroys an **OH_Drawing_FontCollection** object and reclaims the memory occupied by the object.
9836
9837**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9838
9839**Since**: 8
9840
9841**Parameters**
9842
9843| Name                      | Description                                         |
9844| ------------------------- | --------------------------------------------------- |
9845| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
9846
9847
9848### OH_Drawing_DestroyFontDescriptor()
9849
9850```
9851void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* )
9852```
9853
9854**Description**
9855
9856Destroys an **OH_Drawing_FontDescriptor** object and reclaims the memory occupied by the object.
9857
9858**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9859
9860**Since**: 12
9861
9862**Parameters**
9863
9864| Name                                                         | Description                                                  |
9865| ------------------------------------------------------------ | ------------------------------------------------------------ |
9866| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Pointer to a [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object, which is obtained by calling [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor). |
9867
9868
9869### OH_Drawing_DestroyFontParser()
9870
9871```
9872void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* )
9873```
9874
9875**Description**
9876
9877Destroys an **OH_Drawing_FontParser** object and reclaims the memory occupied by the object.
9878
9879**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9880
9881**Since**: 12
9882
9883**Parameters**
9884
9885| Name                  | Description                                                  |
9886| --------------------- | ------------------------------------------------------------ |
9887| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
9888
9889
9890### OH_Drawing_DestroyLineMetrics()
9891
9892```
9893void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* )
9894```
9895
9896**Description**
9897
9898Destroys an **OH_Drawing_LineMetrics** object and reclaims the memory occupied by the object.
9899
9900**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9901
9902**Since**: 12
9903
9904**Parameters**
9905
9906| Name                   | Description                                                  |
9907| ---------------------- | ------------------------------------------------------------ |
9908| OH_Drawing_LineMetrics | Pointer to an [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object, which is obtained by calling [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). |
9909
9910
9911### OH_Drawing_DestroySystemFontConfigInfo()
9912
9913```
9914void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* )
9915```
9916
9917**Description**
9918
9919Reclaims the memory occupied by the system font configuration.
9920
9921**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9922
9923**Since**: 12
9924
9925**Parameters**
9926
9927| Name                      | Description                                                  |
9928| ------------------------- | ------------------------------------------------------------ |
9929| OH_Drawing_FontConfigInfo | Pointer to an [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) object, which is obtained by calling [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo). |
9930
9931
9932### OH_Drawing_DestroySystemFontList()
9933
9934```
9935void OH_Drawing_DestroySystemFontList (char** , size_t  )
9936```
9937
9938**Description**
9939
9940Reclaims the memory occupied by the system font list.
9941
9942**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9943
9944**Since**: 12
9945
9946**Parameters**
9947
9948| Name     | Description                                      |
9949| -------- | ------------------------------------------------ |
9950| char\*\* | Double pointer to the list of system font names. |
9951| size_t\* | Number of system font names.                     |
9952
9953
9954### OH_Drawing_DestroyTextShadow()
9955
9956```
9957void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* )
9958```
9959
9960**Description**
9961
9962Destroys an **OH_Drawing_TextShadow** object and reclaims the memory occupied by the object.
9963
9964**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9965
9966**Since**: 12
9967
9968**Parameters**
9969
9970| Name                  | Description                                                  |
9971| --------------------- | ------------------------------------------------------------ |
9972| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
9973
9974
9975### OH_Drawing_DestroyTextShadows()
9976
9977```
9978void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* )
9979```
9980
9981**Description**
9982
9983Reclaims the memory occupied by the vector consisting of the **OH_Drawing_TextShadow** objects.
9984
9985**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9986
9987**Since**: 12
9988
9989**Parameters**
9990
9991| Name                  | Description                                                  |
9992| --------------------- | ------------------------------------------------------------ |
9993| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
9994
9995
9996### OH_Drawing_DestroyTextStyle()
9997
9998```
9999void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* )
10000```
10001
10002**Description**
10003
10004Destroys an **OH_Drawing_TextStyle** object and reclaims the memory occupied by the object.
10005
10006**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10007
10008**Since**: 8
10009
10010**Parameters**
10011
10012| Name                 | Description                                                  |
10013| -------------------- | ------------------------------------------------------------ |
10014| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
10015
10016
10017### OH_Drawing_DestroyTypography()
10018
10019```
10020void OH_Drawing_DestroyTypography (OH_Drawing_Typography* )
10021```
10022
10023**Description**
10024
10025Destroys an **OH_Drawing_Typography** object and reclaims the memory occupied by the object.
10026
10027**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10028
10029**Since**: 8
10030
10031**Parameters**
10032
10033| Name                  | Description                                                  |
10034| --------------------- | ------------------------------------------------------------ |
10035| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
10036
10037
10038### OH_Drawing_DestroyTypographyHandler()
10039
10040```
10041void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* )
10042```
10043
10044**Description**
10045
10046Destroys an **OH_Drawing_TypographyCreate** object and reclaims the memory occupied by the object.
10047
10048**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10049
10050**Since**: 8
10051
10052**Parameters**
10053
10054| Name                        | Description                                                  |
10055| --------------------------- | ------------------------------------------------------------ |
10056| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
10057
10058
10059### OH_Drawing_DestroyTypographyStyle()
10060
10061```
10062void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* )
10063```
10064
10065**Description**
10066
10067Destroys an **OH_Drawing_TypographyStyle** object and reclaims the memory occupied by the object.
10068
10069**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10070
10071**Since**: 8
10072
10073**Parameters**
10074
10075| Name                       | Description                                                  |
10076| -------------------------- | ------------------------------------------------------------ |
10077| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
10078
10079
10080### OH_Drawing_DisableFontCollectionFallback()
10081
10082```
10083void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection)
10084```
10085
10086**Description**
10087
10088Disables the system fonts.
10089
10090**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10091
10092**Since**: 12
10093
10094**Parameters**
10095
10096| Name                      | Description                                                  |
10097| ------------------------- | ------------------------------------------------------------ |
10098| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
10099
10100
10101### OH_Drawing_DisableFontCollectionSystemFont()
10102
10103```
10104void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection)
10105```
10106
10107**Description**
10108
10109Disables the system fonts.
10110
10111**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10112
10113**Since**: 12
10114
10115**Parameters**
10116
10117| Name                      | Description                                                  |
10118| ------------------------- | ------------------------------------------------------------ |
10119| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
10120
10121
10122### OH_Drawing_FilterCreate()
10123
10124```
10125OH_Drawing_Filter* OH_Drawing_FilterCreate (void )
10126```
10127
10128**Description**
10129
10130Creates an **OH_Drawing_Filter** object.
10131
10132**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10133
10134**Since**: 11
10135
10136**Returns**
10137
10138Returns the pointer to the **OH_Drawing_Filter** object created.
10139
10140
10141### OH_Drawing_FilterDestroy()
10142
10143```
10144void OH_Drawing_FilterDestroy (OH_Drawing_Filter* )
10145```
10146
10147**Description**
10148
10149Destroys an **OH_Drawing_Filter** object and reclaims the memory occupied by the object.
10150
10151**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10152
10153**Since**: 11
10154
10155**Parameters**
10156
10157| Name              | Description                                 |
10158| ----------------- | ------------------------------------------- |
10159| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. |
10160
10161
10162### OH_Drawing_FilterGetColorFilter()
10163
10164```
10165void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
10166```
10167
10168**Description**
10169
10170Obtains an **OH_Drawing_ColorFilter** object from an **OH_Drawing_Filter** object.
10171
10172Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10173
10174If either **OH_Drawing_Filter** or **OH_Drawing_ColorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10175
10176**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10177
10178**Since**: 12
10179
10180**Parameters**
10181
10182| Name                   | Description                                                  |
10183| ---------------------- | ------------------------------------------------------------ |
10184| OH_Drawing_Filter      | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. |
10185| OH_Drawing_ColorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object. |
10186
10187
10188### OH_Drawing_FilterSetColorFilter()
10189
10190```
10191void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
10192```
10193
10194**Description**
10195
10196Sets an **OH_Drawing_ColorFilter** object for an **OH_Drawing_Filter** object.
10197
10198Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10199
10200If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10201
10202**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10203
10204**Since**: 11
10205
10206**Parameters**
10207
10208| Name                   | Description                                                  |
10209| ---------------------- | ------------------------------------------------------------ |
10210| OH_Drawing_Filter      | Pointer to an **OH_Drawing_Filter** object.                  |
10211| OH_Drawing_ColorFilter | Pointer to an **OH_Drawing_ColorFilter** object. If NULL is passed in, the color filter effect of the object will be cleared. |
10212
10213
10214### OH_Drawing_FilterSetMaskFilter()
10215
10216```
10217void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter*  )
10218```
10219
10220**Description**
10221
10222Sets an **OH_Drawing_MaskFilter** object for an **OH_Drawing_Filter** object.
10223
10224Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10225
10226If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10227
10228**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10229
10230**Since**: 11
10231
10232**Parameters**
10233
10234| Name                  | Description                                                  |
10235| --------------------- | ------------------------------------------------------------ |
10236| OH_Drawing_Filter     | Pointer to an **OH_Drawing_Filter** object.                  |
10237| OH_Drawing_MaskFilter | Pointer to an **OH_Drawing_MaskFilter** object. If NULL is passed in, the mask filter effect of the object will be cleared. |
10238
10239
10240### OH_Drawing_FontCountText()
10241
10242```
10243int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding )
10244```
10245
10246**Description**
10247
10248Obtains the number of glyphs represented by text.
10249
10250Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10251
10252If either **OH_Drawing_Font** or **text** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10253
10254**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10255
10256**Since**: 12
10257
10258**Parameters**
10259
10260| Name            | Description                                                  |
10261| --------------- | ------------------------------------------------------------ |
10262| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
10263| text            | Pointer to the start address of the storage.                 |
10264| byteLength      | Text length, in bytes.                                       |
10265| encoding        | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
10266
10267
10268### OH_Drawing_FontCreate()
10269
10270```
10271OH_Drawing_Font* OH_Drawing_FontCreate (void )
10272```
10273
10274**Description**
10275
10276Creates an **OH_Drawing_Font** object.
10277
10278**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10279
10280**Since**: 11
10281
10282**Returns**
10283
10284Returns the pointer to the **OH_Drawing_Font** object created.
10285
10286
10287### OH_Drawing_FontDestroy()
10288
10289```
10290void OH_Drawing_FontDestroy (OH_Drawing_Font* )
10291```
10292
10293**Description**
10294
10295Destroys an **OH_Drawing_Font** object and reclaims the memory occupied by the object.
10296
10297**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10298
10299**Since**: 11
10300
10301**Parameters**
10302
10303| Name            | Description                               |
10304| --------------- | ----------------------------------------- |
10305| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. |
10306
10307
10308### OH_Drawing_FontGetMetrics()
10309
10310```
10311float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics*  )
10312```
10313
10314**Description**
10315
10316Obtains the measurement information about a font.
10317
10318Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10319
10320If either **OH_Drawing_Font** or **OH_Drawing_Font_Metrics** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10321
10322**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10323
10324**Since**: 12
10325
10326**Parameters**
10327
10328| Name                    | Description                                                  |
10329| ----------------------- | ------------------------------------------------------------ |
10330| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
10331| OH_Drawing_Font_Metrics | Pointer to an [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) object. |
10332
10333**Returns**
10334
10335Returns a floating-point variable that indicates the recommended interline spacing.
10336
10337
10338### OH_Drawing_FontGetTypeface()
10339
10340```
10341OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* )
10342```
10343
10344**Description**
10345
10346Obtains the typeface of a font.
10347
10348Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10349
10350If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10351
10352**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10353
10354**Since**: 12
10355
10356**Parameters**
10357
10358| Name            | Description                                               |
10359| --------------- | --------------------------------------------------------- |
10360| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. |
10361
10362**Returns**
10363
10364Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object.
10365
10366
10367### OH_Drawing_FontMgrCreate()
10368
10369```
10370OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void )
10371```
10372
10373**Description**
10374
10375Creates an **OH_Drawing_FontMgr** object, which can be used only to manage system fonts.
10376
10377**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10378
10379**Since**: 12
10380
10381**Returns**
10382
10383Returns the pointer to the [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object created.
10384
10385
10386### OH_Drawing_FontMgrCreateFontStyleSet()
10387
10388```
10389OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index )
10390```
10391
10392**Description**
10393
10394Creates a font style set from an **OH_Drawing_FontMgr** object.
10395
10396**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10397
10398**Since**: 12
10399
10400**Parameters**
10401
10402| Name               | Description                                                  |
10403| ------------------ | ------------------------------------------------------------ |
10404| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10405| index              | Index of the font style set.                                 |
10406
10407**Returns**
10408
10409Returns the pointer to the [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object created.
10410
10411
10412### OH_Drawing_FontMgrDestroy()
10413
10414```
10415void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* )
10416```
10417
10418**Description**
10419
10420Destroys an **OH_Drawing_FontMgr** object and reclaims the memory occupied by the object.
10421
10422**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10423
10424**Since**: 12
10425
10426**Parameters**
10427
10428| Name               | Description                                                  |
10429| ------------------ | ------------------------------------------------------------ |
10430| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10431
10432
10433### OH_Drawing_FontMgrDestroyFamilyName()
10434
10435```
10436void OH_Drawing_FontMgrDestroyFamilyName (char* familyName)
10437```
10438
10439**Description**
10440
10441Reclaims the memory occupied by a font family name.
10442
10443**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10444
10445**Since**: 12
10446
10447**Parameters**
10448
10449| Name       | Description                    |
10450| ---------- | ------------------------------ |
10451| familyName | Pointer to a font family name. |
10452
10453
10454### OH_Drawing_FontMgrDestroyFontStyleSet()
10455
10456```
10457void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* )
10458```
10459
10460**Description**
10461
10462Reclaims the memory occupied by a font style set.
10463
10464**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10465
10466**Since**: 12
10467
10468**Parameters**
10469
10470| Name                    | Description                                                  |
10471| ----------------------- | ------------------------------------------------------------ |
10472| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
10473
10474
10475### OH_Drawing_FontMgrGetFamilyCount()
10476
10477```
10478int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* )
10479```
10480
10481**Description**
10482
10483Obtains the number of font families.
10484
10485**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10486
10487**Since**: 12
10488
10489**Parameters**
10490
10491| Name               | Description                                                  |
10492| ------------------ | ------------------------------------------------------------ |
10493| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10494
10495**Returns**
10496
10497Returns the number of font families.
10498
10499
10500### OH_Drawing_FontMgrGetFamilyName()
10501
10502```
10503char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index )
10504```
10505
10506**Description**
10507
10508Obtains the font family name based on an index.
10509
10510**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10511
10512**Since**: 12
10513
10514**Parameters**
10515
10516| Name               | Description                                                  |
10517| ------------------ | ------------------------------------------------------------ |
10518| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10519| index              | Index of the font family name.                               |
10520
10521**Returns**
10522
10523Returns the font family name. When the font family name is no longer required, call [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) to release the pointer to the object.
10524
10525
10526### OH_Drawing_FontMgrMatchFamily()
10527
10528```
10529OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName )
10530```
10531
10532**Description**
10533
10534Obtains a font style set based on a font family name.
10535
10536**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10537
10538**Since**: 12
10539
10540**Parameters**
10541
10542| Name               | Description                                                  |
10543| ------------------ | ------------------------------------------------------------ |
10544| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10545| familyName         | Pointer to a font family name.                               |
10546
10547**Returns**
10548
10549Returns the pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. When the object is no longer required, call [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) to release the pointer to the object.
10550
10551
10552### OH_Drawing_FontMgrMatchFamilyStyle()
10553
10554```
10555OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct  )
10556```
10557
10558**Description**
10559
10560Obtains a typeface based on the font style information and font family name.
10561
10562**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10563
10564**Since**: 12
10565
10566**Parameters**
10567
10568| Name                                                         | Description                                                  |
10569| ------------------------------------------------------------ | ------------------------------------------------------------ |
10570| OH_Drawing_FontMgr                                           | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10571| familyName                                                   | Pointer to a font family name.                               |
10572| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
10573
10574**Returns**
10575
10576Returns the pointer to an [OH_Drawing_Typeface](#oh_drawing_typeface) object. When the object is no longer required, call [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) to release the pointer to the object.
10577
10578
10579### OH_Drawing_FontMgrMatchFamilyStyleCharacter()
10580
10581```
10582OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character )
10583```
10584
10585**Description**
10586
10587Obtains a typeface for the specified character. A null pointer is returned only when no typeface corresponding to the input UTF-8 character is found in the **OH_Drawing_FontMgr** object.
10588
10589**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10590
10591**Since**: 12
10592
10593**Parameters**
10594
10595| Name                                                         | Description                                                  |
10596| ------------------------------------------------------------ | ------------------------------------------------------------ |
10597| OH_Drawing_FontMgr                                           | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
10598| familyName                                                   | Pointer to a font family name.                               |
10599| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
10600| bcp47                                                        | Pointer to the character language code array, which is a combination of ISO 639, 15924, and 3166-1 language codes. |
10601| bcp47Count                                                   | Size of the character language code array.                   |
10602| character                                                    | UTF8 character used for matching.                            |
10603
10604**Returns**
10605
10606Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained.
10607
10608
10609### OH_Drawing_FontParserGetFontByName()
10610
10611```
10612OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char*  )
10613```
10614
10615**Description**
10616
10617Obtains the descriptor of a system font based on the font name.
10618
10619**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10620
10621**Since**: 12
10622
10623**Parameters**
10624
10625| Name                  | Description                                                  |
10626| --------------------- | ------------------------------------------------------------ |
10627| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
10628| char\*                | Pointer to the system font name.                             |
10629
10630**Returns**
10631
10632Returns the system font description object. When the object is no longer required, call [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) to release the pointer to the object.
10633
10634
10635### OH_Drawing_FontParserGetSystemFontList()
10636
10637```
10638char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t*  )
10639```
10640
10641**Description**
10642
10643Obtains the list of system fonts. This function can be used only on 2-in-1 devices and phones.
10644
10645**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10646
10647**Since**: 12
10648
10649**Parameters**
10650
10651| Name                  | Description                                                  |
10652| --------------------- | ------------------------------------------------------------ |
10653| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
10654| size_t                | Pointer to the number of system font names.                  |
10655
10656**Returns**
10657
10658Returns the system font list.
10659
10660
10661### OH_Drawing_FontSetFakeBoldText()
10662
10663```
10664void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText )
10665```
10666
10667**Description**
10668
10669Sets fake bold for a font by increasing the stroke width.
10670
10671Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10672
10673If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10674
10675**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10676
10677**Since**: 11
10678
10679**Parameters**
10680
10681| Name            | Description                                                  |
10682| --------------- | ------------------------------------------------------------ |
10683| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.                    |
10684| isFakeBoldText  | Whether to set fake bold. The value **true** means to set fake bold, and **false** means the opposite. |
10685
10686
10687### OH_Drawing_FontSetLinearText()
10688
10689```
10690void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText )
10691```
10692
10693**Description**
10694
10695Sets linear scaling for a font.
10696
10697Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10698
10699If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10700
10701**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10702
10703**Since**: 11
10704
10705**Parameters**
10706
10707| Name            | Description                                                  |
10708| --------------- | ------------------------------------------------------------ |
10709| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.                    |
10710| isLinearText    | Whether to set linear scaling. The value **true** means to set linear scaling, and **false** means the opposite. |
10711
10712
10713### OH_Drawing_FontSetTextSize()
10714
10715```
10716void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize )
10717```
10718
10719**Description**
10720
10721Sets the font size.
10722
10723Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10724
10725If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10726
10727**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10728
10729**Since**: 11
10730
10731**Parameters**
10732
10733| Name            | Description                                                  |
10734| --------------- | ------------------------------------------------------------ |
10735| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.                    |
10736| textSize        | Text size. The value is a floating point number. If a negative number is passed in, the size is set to 0. If the size is 0, the text drawn will not be displayed. |
10737
10738
10739### OH_Drawing_FontSetTextSkewX()
10740
10741```
10742void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX )
10743```
10744
10745**Description**
10746
10747Sets a horizontal skew factor for a font.
10748
10749Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10750
10751If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10752
10753**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10754
10755**Since**: 11
10756
10757**Parameters**
10758
10759| Name            | Description                                |
10760| --------------- | ------------------------------------------ |
10761| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.  |
10762| skewX           | Skew of the X axis relative to the Y axis. |
10763
10764
10765### OH_Drawing_FontSetTypeface()
10766
10767```
10768void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface*  )
10769```
10770
10771**Description**
10772
10773Sets a typeface for a font.
10774
10775Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10776
10777If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10778
10779**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10780
10781**Since**: 11
10782
10783**Parameters**
10784
10785| Name                | Description                                                  |
10786| ------------------- | ------------------------------------------------------------ |
10787| OH_Drawing_Font     | Pointer to an **OH_Drawing_Font** object.                    |
10788| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. If NULL is passed in, the default **OH_Drawing_Typeface** object is used. |
10789
10790
10791### OH_Drawing_FontStyleSetCount()
10792
10793```
10794int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* )
10795```
10796
10797**Description**
10798
10799Obtains the number of fonts in the font style set.
10800
10801**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10802
10803**Since**: 12
10804
10805**Parameters**
10806
10807| Name                    | Description                                                  |
10808| ----------------------- | ------------------------------------------------------------ |
10809| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
10810
10811**Returns**
10812
10813Returns the number of fonts.
10814
10815
10816### OH_Drawing_FontStyleSetCreateTypeface()
10817
10818```
10819OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index )
10820```
10821
10822**Description**
10823
10824Creates a typeface for the specified index.
10825
10826**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10827
10828**Since**: 12
10829
10830**Parameters**
10831
10832| Name                    | Description                                                  |
10833| ----------------------- | ------------------------------------------------------------ |
10834| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
10835| index                   | Index of the typeface.                                       |
10836
10837**Returns**
10838
10839Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created if the operation is successful; returns a null pointer otherwise.
10840
10841
10842### OH_Drawing_FontStyleSetFreeStyleName()
10843
10844```
10845void OH_Drawing_FontStyleSetFreeStyleName (char** styleName)
10846```
10847
10848**Description**
10849
10850Reclaims the memory occupied by a font style.
10851
10852**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10853
10854**Since**: 12
10855
10856**Parameters**
10857
10858| Name      | Description                                                  |
10859| --------- | ------------------------------------------------------------ |
10860| styleName | Double pointer to the string that specifies the font style name. |
10861
10862
10863### OH_Drawing_FontStyleSetGetStyle()
10864
10865```
10866OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName )
10867```
10868
10869**Description**
10870
10871Obtains the font style.
10872
10873**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10874
10875**Since**: 12
10876
10877**Parameters**
10878
10879| Name                    | Description                                                  |
10880| ----------------------- | ------------------------------------------------------------ |
10881| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
10882| index                   | Index of the font style.                                     |
10883| styleName               | Double pointer to the string that specifies the font style name. |
10884
10885**Returns**
10886
10887Returns the font style.
10888
10889
10890### OH_Drawing_FontStyleSetMatchStyle()
10891
10892```
10893OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct )
10894```
10895
10896**Description**
10897
10898Obtains the typeface closest to the font style.
10899
10900**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10901
10902**Since**: 12
10903
10904**Parameters**
10905
10906| Name                    | Description                                                  |
10907| ----------------------- | ------------------------------------------------------------ |
10908| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
10909| fontStyleStruct         | Font style, including the font weight, width, and slant.     |
10910
10911**Returns**
10912
10913Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained.
10914
10915
10916### OH_Drawing_GetAffinityFromPositionAndAffinity()
10917
10918```
10919int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
10920```
10921
10922**Description**
10923
10924Obtains the affinity attribute of an **OH_Drawing_PositionAndAffinity** object. The affinity determines whether the font is close to the front text or rear text.
10925
10926**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10927
10928**Since**: 11
10929
10930**Parameters**
10931
10932| Name                           | Description                                                  |
10933| ------------------------------ | ------------------------------------------------------------ |
10934| OH_Drawing_PositionAndAffinity | Pointer to an **OH_Drawing_PositionAndAffinity** object, which is obtained by calling [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) or [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster). |
10935
10936**Returns**
10937
10938Returns the affinity attribute.
10939
10940
10941### OH_Drawing_GetBottomFromTextBox()
10942
10943```
10944float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int  )
10945```
10946
10947**Description**
10948
10949Obtains the bottom position of a text box.
10950
10951**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10952
10953**Since**: 11
10954
10955**Parameters**
10956
10957| Name               | Description                                                  |
10958| ------------------ | ------------------------------------------------------------ |
10959| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
10960| int                | Index of the text box.                                       |
10961
10962**Returns**
10963
10964Returns the bottom position.
10965
10966
10967### OH_Drawing_GetEndFromRange()
10968
10969```
10970size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* )
10971```
10972
10973**Description**
10974
10975Obtains the end position of an **OH_Drawing_Range** object.
10976
10977**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10978
10979**Since**: 11
10980
10981**Parameters**
10982
10983| Name             | Description                                                  |
10984| ---------------- | ------------------------------------------------------------ |
10985| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by calling [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). |
10986
10987**Returns**
10988
10989Returns the end position.
10990
10991
10992### OH_Drawing_GetLeftFromTextBox()
10993
10994```
10995float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int  )
10996```
10997
10998**Description**
10999
11000Obtains the left position of a text box.
11001
11002**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11003
11004**Since**: 11
11005
11006**Parameters**
11007
11008| Name               | Description                                                  |
11009| ------------------ | ------------------------------------------------------------ |
11010| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
11011| int                | Index of the text box.                                       |
11012
11013**Returns**
11014
11015Returns the left position.
11016
11017
11018### OH_Drawing_GetPositionFromPositionAndAffinity()
11019
11020```
11021size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
11022```
11023
11024**Description**
11025
11026Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object.
11027
11028**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11029
11030**Since**: 11
11031
11032**Parameters**
11033
11034| Name                           | Description                                                  |
11035| ------------------------------ | ------------------------------------------------------------ |
11036| OH_Drawing_PositionAndAffinity | Pointer to an **OH_Drawing_PositionAndAffinity** object, which is obtained by calling [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) or [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster). |
11037
11038**Returns**
11039
11040Returns the position attribute.
11041
11042
11043### OH_Drawing_GetRightFromTextBox()
11044
11045```
11046float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int  )
11047```
11048
11049**Description**
11050
11051Obtains the right position of a text box.
11052
11053**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11054
11055**Since**: 11
11056
11057**Parameters**
11058
11059| Name               | Description                                                  |
11060| ------------------ | ------------------------------------------------------------ |
11061| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
11062| int                | Index of the text box.                                       |
11063
11064**Returns**
11065
11066Returns the right position.
11067
11068
11069### OH_Drawing_GetSizeOfTextBox()
11070
11071```
11072size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* )
11073```
11074
11075**Description**
11076
11077Obtains the number of text boxes.
11078
11079**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11080
11081**Since**: 11
11082
11083**Parameters**
11084
11085| Name               | Description                                                  |
11086| ------------------ | ------------------------------------------------------------ |
11087| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
11088
11089**Returns**
11090
11091Returns the number of text boxes.
11092
11093
11094### OH_Drawing_GetStartFromRange()
11095
11096```
11097size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* )
11098```
11099
11100**Description**
11101
11102Obtains the start position of an **OH_Drawing_Range** object.
11103
11104**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11105
11106**Since**: 11
11107
11108**Parameters**
11109
11110| Name             | Description                                                  |
11111| ---------------- | ------------------------------------------------------------ |
11112| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by calling [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). |
11113
11114**Returns**
11115
11116Returns the start position.
11117
11118
11119### OH_Drawing_GetSystemFontConfigInfo()
11120
11121```
11122OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* )
11123```
11124
11125**Description**
11126
11127Obtains the system font configuration.
11128
11129**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11130
11131**Since**: 12
11132
11133**Parameters**
11134
11135| Name                              | Description                                                  |
11136| --------------------------------- | ------------------------------------------------------------ |
11137| OH_Drawing_FontConfigJsonInfoCode | Pointer to the error code. For details about the available options, see [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode). |
11138
11139**Returns**
11140
11141Returns the pointer to the system font configuration. When it is no longer required, call [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) to release the pointer to the object.
11142
11143
11144### OH_Drawing_GetTextDirectionFromTextBox()
11145
11146```
11147int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int  )
11148```
11149
11150**Description**
11151
11152Obtains the text direction of a text box.
11153
11154**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11155
11156**Since**: 11
11157
11158**Parameters**
11159
11160| Name               | Description                                                  |
11161| ------------------ | ------------------------------------------------------------ |
11162| OH_Drawing_TextBox | Pointer to an [OH_Drawing_TextBox](#oh_drawing_textbox) object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
11163| int                | Index of the text box.                                       |
11164
11165**Returns**
11166
11167Returns the text direction.
11168
11169
11170### OH_Drawing_GetTopFromTextBox()
11171
11172```
11173float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int  )
11174```
11175
11176**Description**
11177
11178Obtains the top position of a text box.
11179
11180**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11181
11182**Since**: 11
11183
11184**Parameters**
11185
11186| Name               | Description                                                  |
11187| ------------------ | ------------------------------------------------------------ |
11188| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). |
11189| int                | Index of the text box.                                       |
11190
11191**Returns**
11192
11193Returns the top position.
11194
11195
11196### OH_Drawing_GpuContextCreateFromGL()
11197
11198```
11199OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions )
11200```
11201
11202**Description**
11203
11204Creates an **OH_Drawing_GpuContext** object that uses OpenGL as the backend interface.
11205
11206**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11207
11208**Since**: 12
11209
11210**Deprecated**: This function is deprecated since API version 18. Use [OH_Drawing_GpuContextCreate](#oh_drawing_gpucontextcreate) instead.
11211
11212**Parameters**
11213
11214| Name                         | Description                                                  |
11215| ---------------------------- | ------------------------------------------------------------ |
11216| OH_Drawing_GpuContextOptions | GPU context option, which is an [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) object. |
11217
11218**Returns**
11219
11220Returns the pointer to the [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object created.
11221
11222
11223### OH_Drawing_GpuContextDestroy()
11224
11225```
11226void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* )
11227```
11228
11229**Description**
11230
11231Destroys an **OH_Drawing_GpuContext** object and reclaims the memory occupied by the object.
11232
11233**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11234
11235**Since**: 12
11236
11237**Parameters**
11238
11239| Name                  | Description                                                  |
11240| --------------------- | ------------------------------------------------------------ |
11241| OH_Drawing_GpuContext | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. |
11242
11243
11244### OH_Drawing_ImageBuildFromBitmap()
11245
11246```
11247bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap*  )
11248```
11249
11250**Description**
11251
11252Builds an image from a bitmap by sharing or copying bitmap pixels. If the bitmap is marked as immutable, the pixel memory is shared, not copied.
11253
11254Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11255
11256If either **OH_Drawing_Image** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11257
11258**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11259
11260**Since**: 12
11261
11262**Parameters**
11263
11264| Name              | Description                                                  |
11265| ----------------- | ------------------------------------------------------------ |
11266| OH_Drawing_Image  | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
11267| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
11268
11269**Returns**
11270
11271Returns **true** if the image is built; returns **false** otherwise.
11272
11273
11274### OH_Drawing_ImageCreate()
11275
11276```
11277OH_Drawing_Image* OH_Drawing_ImageCreate (void )
11278```
11279
11280**Description**
11281
11282Creates an **OH_Drawing_Image** object that describes an array of two-dimensional pixels to draw.
11283
11284**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11285
11286**Since**: 12
11287
11288**Returns**
11289
11290Returns the pointer to the [OH_Drawing_Image](#oh_drawing_image) object created.
11291
11292
11293### OH_Drawing_ImageDestroy()
11294
11295```
11296void OH_Drawing_ImageDestroy (OH_Drawing_Image* )
11297```
11298
11299**Description**
11300
11301Destroys an **OH_Drawing_Image** object and reclaims the memory occupied by the object.
11302
11303**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11304
11305**Since**: 12
11306
11307**Parameters**
11308
11309| Name             | Description                                                 |
11310| ---------------- | ----------------------------------------------------------- |
11311| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
11312
11313
11314### OH_Drawing_ImageGetHeight()
11315
11316```
11317int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* )
11318```
11319
11320**Description**
11321
11322Obtains the image height, that is, the number of pixel lines.
11323
11324Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11325
11326If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11327
11328**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11329
11330**Since**: 12
11331
11332**Parameters**
11333
11334| Name             | Description                                                 |
11335| ---------------- | ----------------------------------------------------------- |
11336| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
11337
11338**Returns**
11339
11340Returns the height.
11341
11342
11343### OH_Drawing_ImageGetImageInfo()
11344
11345```
11346void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info*  )
11347```
11348
11349**Description**
11350
11351Obtains the image information. After this function is called, the passed-in image information object is filled.
11352
11353Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11354
11355If either **OH_Drawing_Image** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11356
11357**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11358
11359**Since**: 12
11360
11361**Parameters**
11362
11363| Name                  | Description                                                  |
11364| --------------------- | ------------------------------------------------------------ |
11365| OH_Drawing_Image      | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
11366| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object, which is created by calling [OH_Drawing_Image_Info](_o_h___drawing___image___info.md). |
11367
11368
11369### OH_Drawing_ImageGetWidth()
11370
11371```
11372int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* )
11373```
11374
11375**Description**
11376
11377Obtains the image width, that is, the number of pixels in each line.
11378
11379Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11380
11381If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11382
11383**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11384
11385**Since**: 12
11386
11387**Parameters**
11388
11389| Name             | Description                                                 |
11390| ---------------- | ----------------------------------------------------------- |
11391| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
11392
11393**Returns**
11394
11395Returns the width.
11396
11397
11398### OH_Drawing_LineMetricsGetSize()
11399
11400```
11401size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* )
11402```
11403
11404**Description**
11405
11406Obtains the number of lines.
11407
11408**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11409
11410**Since**: 12
11411
11412**Parameters**
11413
11414| Name                                                       | Description                                                  |
11415| ---------------------------------------------------------- | ------------------------------------------------------------ |
11416| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | Pointer to an [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object, which is obtained by calling [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). |
11417
11418**Returns**
11419
11420Returns the number of lines.
11421
11422
11423### OH_Drawing_MaskFilterCreateBlur()
11424
11425```
11426OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM )
11427```
11428
11429**Description**
11430
11431Creates an **OH_Drawing_MaskFilter** object with a blur type.
11432
11433**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11434
11435**Since**: 11
11436
11437**Parameters**
11438
11439| Name       | Description                                                  |
11440| ---------- | ------------------------------------------------------------ |
11441| blurType   | Blur type.                                                   |
11442| sigma      | Standard deviation of the Gaussian blur to apply. The value must be greater than 0. |
11443| respectCTM | Whether the blur's sigma is modified by the CTM. The default value is **true**. |
11444
11445**Returns**
11446
11447Returns the pointer to the **OH_Drawing_MaskFilter** object created.
11448
11449
11450### OH_Drawing_MaskFilterDestroy()
11451
11452```
11453void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* )
11454```
11455
11456**Description**
11457
11458Destroys an **OH_Drawing_MaskFilter** object and reclaims the memory occupied by the object.
11459
11460**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11461
11462**Since**: 11
11463
11464**Parameters**
11465
11466| Name                  | Description                                     |
11467| --------------------- | ----------------------------------------------- |
11468| OH_Drawing_MaskFilter | Pointer to an **OH_Drawing_MaskFilter** object. |
11469
11470
11471### OH_Drawing_MatrixConcat()
11472
11473```
11474void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b )
11475```
11476
11477**Description**
11478
11479Multiplies two matrices to produce a new matrix.
11480
11481Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11482
11483If any of **total**, **a**, and **b** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11484
11485**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11486
11487**Since**: 12
11488
11489**Parameters**
11490
11491| Name  | Description                                                  |
11492| ----- | ------------------------------------------------------------ |
11493| total | Pointer to the new matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11494| a     | Pointer to the first matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11495| b     | Pointer to the second matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11496
11497
11498### OH_Drawing_MatrixCreate()
11499
11500```
11501OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void )
11502```
11503
11504**Description**
11505
11506Creates an **OH_Drawing_Matrix** object.
11507
11508**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11509
11510**Since**: 11
11511
11512**Returns**
11513
11514Returns the pointer to the **OH_Drawing_Matrix** object created.
11515
11516
11517### OH_Drawing_MatrixCreateRotation()
11518
11519```
11520OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y )
11521```
11522
11523**Description**
11524
11525Creates an **OH_Drawing_Matrix** with the rotation attribute. The matrix is obtained by rotating an identity matrix by a given degree around the rotation point (x, y).
11526
11527**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11528
11529**Since**: 12
11530
11531**Parameters**
11532
11533| Name | Description                                                  |
11534| ---- | ------------------------------------------------------------ |
11535| deg  | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. |
11536| x    | Coordinate point on the X axis.                              |
11537| y    | Coordinate point on the Y axis.                              |
11538
11539**Returns**
11540
11541Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
11542
11543
11544### OH_Drawing_MatrixCreateScale()
11545
11546```
11547OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py )
11548```
11549
11550**Description**
11551
11552Creates an **OH_Drawing_Matrix** with the scale attribute. The matrix is obtained by scaling an identity matrix with the factor (sx, sy) at the rotation point (px, py).
11553
11554**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11555
11556**Since**: 12
11557
11558**Parameters**
11559
11560| Name | Description                                                  |
11561| ---- | ------------------------------------------------------------ |
11562| sx   | Scale coefficient along the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. |
11563| sy   | Scale coefficient along the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. |
11564| px   | Coordinate point on the X axis.                              |
11565| py   | Coordinate point on the Y axis.                              |
11566
11567**Returns**
11568
11569Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
11570
11571
11572### OH_Drawing_MatrixCreateTranslation()
11573
11574```
11575OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy )
11576```
11577
11578**Description**
11579
11580Creates an **OH_Drawing_Matrix** with the translation attribute. The matrix is obtained by translating the identity matrix by the distance (dx, dy).
11581
11582**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11583
11584**Since**: 12
11585
11586**Parameters**
11587
11588| Name | Description                                                  |
11589| ---- | ------------------------------------------------------------ |
11590| dx   | Distance to translate on the X axis. A positive number indicates a translation towards the positive direction of the X axis, and a negative number indicates a translation towards the negative direction of the X axis. The value is a floating point number. |
11591| dy   | Distance to translate on the Y axis. A positive number indicates a translation towards the positive direction of the Y axis, and a negative number indicates a translation towards the negative direction of the Y axis. The value is a floating point number. |
11592
11593**Returns**
11594
11595Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
11596
11597
11598### OH_Drawing_MatrixDestroy()
11599
11600```
11601void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* )
11602```
11603
11604**Description**
11605
11606Destroys an **OH_Drawing_Matrix** object and reclaims the memory occupied by the object.
11607
11608**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11609
11610**Since**: 11
11611
11612**Parameters**
11613
11614| Name              | Description                               |
11615| ----------------- | ----------------------------------------- |
11616| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Font** object. |
11617
11618
11619### OH_Drawing_MatrixGetValue()
11620
11621```
11622float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index )
11623```
11624
11625**Description**
11626
11627Obtains a matrix value of a given index, which ranges from 0 to 8.
11628
11629Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11630
11631If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11632
11633If **index** is less than 0 or greater than 8, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
11634
11635**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11636
11637**Since**: 12
11638
11639**Parameters**
11640
11641| Name              | Description                                                  |
11642| ----------------- | ------------------------------------------------------------ |
11643| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11644| index             | Index, which ranges from 0 to 8.                             |
11645
11646**Returns**
11647
11648Returns the matrix value.
11649
11650
11651### OH_Drawing_MatrixInvert()
11652
11653```
11654bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse )
11655```
11656
11657**Description**
11658
11659Inverts a matrix and returns the result.
11660
11661Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11662
11663If either **OH_Drawing_Matrix** or **inverse** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11664
11665**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11666
11667**Since**: 12
11668
11669**Parameters**
11670
11671| Name              | Description                                                  |
11672| ----------------- | ------------------------------------------------------------ |
11673| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11674| inverse           | Pointer to the matrix to invert, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. The object can be created by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). |
11675
11676**Returns**
11677
11678Returns **true** if the matrix is reversible and the passed-in **inverse** is inverted; returns **false** otherwise.
11679
11680
11681### OH_Drawing_MatrixIsEqual()
11682
11683```
11684bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other )
11685```
11686
11687**Description**
11688
11689Checks whether two **OH_Drawing_Matrix** objects are equal.
11690
11691Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11692
11693If either **OH_Drawing_Matrix** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11694
11695**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11696
11697**Since**: 12
11698
11699**Parameters**
11700
11701| Name              | Description                                                  |
11702| ----------------- | ------------------------------------------------------------ |
11703| OH_Drawing_Matrix | Pointer to a matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11704| other             | Pointer to the other matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11705
11706**Returns**
11707
11708Returns **true** if the two matrices are equal; returns **false** otherwise.
11709
11710
11711### OH_Drawing_MatrixIsIdentity()
11712
11713```
11714bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* )
11715```
11716
11717**Description**
11718
11719Checks whether an **OH_Drawing_Matrix** object is an identity matrix.
11720
11721Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11722
11723If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11724
11725**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11726
11727**Since**: 12
11728
11729**Parameters**
11730
11731| Name              | Description                                                  |
11732| ----------------- | ------------------------------------------------------------ |
11733| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11734
11735**Returns**
11736
11737Returns **true** if the matrix is an identity matrix; returns **false** otherwise.
11738
11739
11740### OH_Drawing_MatrixPostRotate()
11741
11742```
11743void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11744```
11745
11746**Description**
11747
11748Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py).
11749
11750Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11751
11752If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11753
11754**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11755
11756**Since**: 12
11757
11758**Parameters**
11759
11760| Name              | Description                                                  |
11761| ----------------- | ------------------------------------------------------------ |
11762| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11763| degree            | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. |
11764| px                | X coordinate of the rotation point.                          |
11765| py                | Y coordinate of the rotation point.                          |
11766
11767
11768### OH_Drawing_MatrixPostScale()
11769
11770```
11771void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11772```
11773
11774**Description**
11775
11776Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
11777
11778Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11779
11780If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11781
11782
11783**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11784
11785**Since**: 12
11786
11787**Parameters**
11788
11789| Name              | Description                                                  |
11790| ----------------- | ------------------------------------------------------------ |
11791| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11792| sx                | Scale factor on the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. |
11793| sy                | Scale factor on the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. |
11794| px                | X coordinate of the scale point.                             |
11795| py                | Y coordinate of the scale point.                             |
11796
11797
11798### OH_Drawing_MatrixPostTranslate()
11799
11800```
11801void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy )
11802```
11803
11804**Description**
11805
11806Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
11807
11808Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11809
11810If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11811
11812
11813**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11814
11815**Since**: 12
11816
11817**Parameters**
11818
11819| Name              | Description                                                  |
11820| ----------------- | ------------------------------------------------------------ |
11821| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11822| dx                | Distance to translate on the X axis.                         |
11823| dy                | Distance to translate on the Y axis.                         |
11824
11825
11826### OH_Drawing_MatrixPreRotate()
11827
11828```
11829void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11830```
11831
11832**Description**
11833
11834Premultiplies a matrix by an identity matrix that rotates by a given degree around the rotation point (px, py).
11835
11836Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11837
11838If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11839
11840
11841**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11842
11843**Since**: 12
11844
11845**Parameters**
11846
11847| Name              | Description                                                  |
11848| ----------------- | ------------------------------------------------------------ |
11849| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11850| degree            | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. |
11851| px                | X coordinate of the rotation point.                          |
11852| py                | Y coordinate of the rotation point.                          |
11853
11854
11855### OH_Drawing_MatrixPreScale()
11856
11857```
11858void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11859```
11860
11861**Description**
11862
11863Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
11864
11865Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11866
11867If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11868
11869
11870**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11871
11872**Since**: 12
11873
11874**Parameters**
11875
11876| Name              | Description                                                  |
11877| ----------------- | ------------------------------------------------------------ |
11878| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11879| sx                | Scale factor on the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. |
11880| sy                | Scale factor on the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. |
11881| px                | X coordinate of the scale point.                             |
11882| py                | Y coordinate of the scale point.                             |
11883
11884
11885### OH_Drawing_MatrixPreTranslate()
11886
11887```
11888void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy )
11889```
11890
11891**Description**
11892
11893Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
11894
11895Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11896
11897If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11898
11899**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11900
11901**Since**: 12
11902
11903**Parameters**
11904
11905| Name              | Description                                                  |
11906| ----------------- | ------------------------------------------------------------ |
11907| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11908| dx                | Distance to translate on the X axis.                         |
11909| dy                | Distance to translate on the Y axis.                         |
11910
11911
11912### OH_Drawing_MatrixReset()
11913
11914```
11915void OH_Drawing_MatrixReset (OH_Drawing_Matrix* )
11916```
11917
11918**Description**
11919
11920Resets a matrix to an identity matrix: | 1 0 0 | | 0 1 0 | | 0 0 0 1 |.
11921
11922Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11923
11924If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11925
11926**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11927
11928**Since**: 12
11929
11930**Parameters**
11931
11932| Name              | Description                                                  |
11933| ----------------- | ------------------------------------------------------------ |
11934| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11935
11936
11937### OH_Drawing_MatrixRotate()
11938
11939```
11940void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py )
11941```
11942
11943**Description**
11944
11945Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py).
11946
11947Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11948
11949If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11950
11951**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11952
11953**Since**: 12
11954
11955**Parameters**
11956
11957| Name              | Description                                                  |
11958| ----------------- | ------------------------------------------------------------ |
11959| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11960| degree            | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. |
11961| px                | Coordinate point on the X axis.                              |
11962| py                | Coordinate point on the Y axis.                              |
11963
11964
11965### OH_Drawing_MatrixScale()
11966
11967```
11968void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
11969```
11970
11971**Description**
11972
11973Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py).
11974
11975Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11976
11977If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11978
11979**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11980
11981**Since**: 12
11982
11983**Parameters**
11984
11985| Name              | Description                                                  |
11986| ----------------- | ------------------------------------------------------------ |
11987| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11988| sx                | Scale factor on the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. |
11989| sy                | Scale factor on the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. |
11990| px                | Coordinate point on the X axis.                              |
11991| py                | Coordinate point on the Y axis.                              |
11992
11993
11994### OH_Drawing_MatrixSetMatrix()
11995
11996```
11997void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 )
11998```
11999
12000**Description**
12001
12002Sets matrix parameters for an **OH_Drawing_Matrix** object.
12003
12004Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12005
12006If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12007
12008**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12009
12010**Since**: 11
12011
12012**Parameters**
12013
12014| Name              | Description                                 |
12015| ----------------- | ------------------------------------------- |
12016| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Matrix** object. |
12017| scaleX            | Scale factor on the X axis.                 |
12018| skewX             | Skew factor on the X axis.                  |
12019| transX            | Translation coefficient on the X axis.      |
12020| skewY             | Skew factor on the Y axis.                  |
12021| scaleY            | Scale factor on the Y axis.                 |
12022| transY            | Translation coefficient on the Y axis.      |
12023| persp0            | Perspective coefficient of the X axis.      |
12024| persp1            | Perspective coefficient of the Y axis.      |
12025| persp2            | Perspective scale coefficient.              |
12026
12027
12028### OH_Drawing_MatrixSetPolyToPoly()
12029
12030```
12031bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count )
12032```
12033
12034**Description**
12035
12036Generates a transformation matrix by setting source points and destination points. Both the number of source points and that of destination points must be in the range [0, 4].
12037
12038Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12039
12040If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12041
12042If **count** is less than 0 or greater than 4, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12043
12044**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12045
12046**Since**: 12
12047
12048**Parameters**
12049
12050| Name              | Description                                                  |
12051| ----------------- | ------------------------------------------------------------ |
12052| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
12053| src               | Array of source points. If NULL is passed in, **count** must be 0. |
12054| dst               | Array of destination points. The number of destination points must be the same as that of source points. If NULL is passed in, **count** must be 0. |
12055| count             | Number of source points or destination points. If 0 is passed in, the matrix is set to an identity matrix. |
12056
12057**Returns**
12058
12059Returns **true** if the matrix is generated; returns **false** otherwise.
12060
12061
12062### OH_Drawing_MatrixSetRectToRect()
12063
12064```
12065bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf )
12066```
12067
12068**Description**
12069
12070Scales a matrix to map a source rectangle to a destination rectangle.
12071
12072Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12073
12074If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
12075
12076**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12077
12078**Since**: 12
12079
12080**Parameters**
12081
12082| Name              | Description                                                  |
12083| ----------------- | ------------------------------------------------------------ |
12084| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
12085| src               | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
12086| dst               | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
12087| stf               | Scaling mode. For details about the available options, see [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit). |
12088
12089**Returns**
12090
12091Returns **true** if the operation is successful; returns **false** if the operation fails. In particular, if either the width or the height of the source rectangle is less than or equal to 0, the function returns **false** and sets the matrix to an identity matrix. If either the width or height of the destination rectangle is less than or equal to 0, the function returns **true** and sets the matrix to a matrix with all values 0, except for a perspective scaling coefficient of 1.
12092
12093### OH_Drawing_MatrixTranslate()
12094
12095```
12096void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy )
12097```
12098
12099**Description**
12100
12101Sets a matrix as an identity matrix and translates it by a given distance (dx, dy).
12102
12103Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12104
12105If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12106
12107**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12108
12109**Since**: 12
12110
12111**Parameters**
12112
12113| Name              | Description                                                  |
12114| ----------------- | ------------------------------------------------------------ |
12115| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
12116| dx                | Distance to translate on the X axis. A positive number indicates a translation towards the positive direction of the X axis, and a negative number indicates a translation towards the negative direction of the X axis. The value is a floating point number. |
12117| dy                | Distance to translate on the Y axis. A positive number indicates a translation towards the positive direction of the Y axis, and a negative number indicates a translation towards the negative direction of the Y axis. The value is a floating point number. |
12118
12119
12120### OH_Drawing_MemoryStreamCreate()
12121
12122```
12123OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData )
12124```
12125
12126**Description**
12127
12128Creates an **OH_Drawing_MemoryStream** object.
12129
12130Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12131
12132If **data** is NULL or **length** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12133
12134**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12135
12136**Since**: 12
12137
12138**Parameters**
12139
12140| Name     | Description                                                  |
12141| -------- | ------------------------------------------------------------ |
12142| data     | Pointer to the data.                                         |
12143| length   | Length of the data.                                          |
12144| copyData | Whether to copy data. The value **true** means that the **OH_Drawing_MemoryStream** object copies the data, and **false** means that the **OH_Drawing_MemoryStream** object directly uses the data without copying. |
12145
12146**Returns**
12147
12148Returns the pointer to the [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object created.
12149
12150
12151### OH_Drawing_MemoryStreamDestroy()
12152
12153```
12154void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* )
12155```
12156
12157**Description**
12158
12159Destroys an **OH_Drawing_MemoryStream** object and reclaims the memory occupied by the object.
12160
12161**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12162
12163**Since**: 12
12164
12165**Parameters**
12166
12167| Name                    | Description                                                  |
12168| ----------------------- | ------------------------------------------------------------ |
12169| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. |
12170
12171
12172### OH_Drawing_PathAddArc()
12173
12174```
12175void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
12176```
12177
12178**Description**
12179
12180Adds an arc to a path as the start of a new contour. The arc added is part of the ellipse bounded by oval, from the start angle through the sweep angle, measured in degrees. A positive angle indicates a clockwise sweep, and a negative angle indicates a counterclockwise sweep. If the sweep angle is less than or equal to -360°, or if the sweep angle is greater than or equal to 360° and start angle modulo 90 is nearly zero, an oval instead of an ellipse is added.
12181
12182Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12183
12184If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12185
12186**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12187
12188**Since**: 12
12189
12190**Parameters**
12191
12192| Name            | Description                                                  |
12193| --------------- | ------------------------------------------------------------ |
12194| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12195| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
12196| startAngle      | Start angle of the arc, in degrees.                          |
12197| sweepAngle      | Angle to sweep, in degrees. A positive number indicates a clockwise sweep, and a negative value indicates a counterclockwise swipe. The actual swipe degree is the modulo operation result of the input parameter by 360. |
12198
12199### OH_Drawing_PathAddOval()
12200
12201```
12202void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection  )
12203```
12204
12205**Description**
12206
12207Adds an oval to a path in the specified direction.
12208
12209Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12210
12211If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12212
12213If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12214
12215**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12216
12217**Since**: 12
12218
12219**Parameters**
12220
12221| Name                     | Description                                                  |
12222| ------------------------ | ------------------------------------------------------------ |
12223| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12224| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
12225| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
12226
12227### OH_Drawing_PathAddOvalWithInitialPoint()
12228
12229```
12230void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection  )
12231```
12232
12233**Description**
12234
12235Adds an oval to a path. **OH_Drawing_Rect** specifies the outer tangent rectangle of the oval, and **OH_Drawing_PathDirection** specifies whether the drawing is clockwise or anticlockwise.
12236
12237Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12238
12239If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12240
12241If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12242
12243**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12244
12245**Since**: 12
12246
12247**Parameters**
12248
12249| Name                     | Description                                                  |
12250| ------------------------ | ------------------------------------------------------------ |
12251| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12252| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
12253| start                    | Start point of the oval.                                     |
12254| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
12255
12256
12257### OH_Drawing_PathAddPath()
12258
12259```
12260void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix*  )
12261```
12262
12263**Description**
12264
12265Transforms the points in a **src** path by a matrix and adds the new one to the current path.
12266
12267Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12268
12269If either **OH_Drawing_Path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12270
12271**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12272
12273**Since**: 12
12274
12275**Parameters**
12276
12277| Name              | Description                                                  |
12278| ----------------- | ------------------------------------------------------------ |
12279| OH_Drawing_Path   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12280| src               | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12281| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. |
12282
12283
12284### OH_Drawing_PathAddPathWithMatrixAndMode()
12285
12286```
12287void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode  )
12288```
12289
12290**Description**
12291
12292Transforms the points in a **src** path by a matrix and adds the new one to the current path with the specified adding mode.
12293
12294Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12295
12296If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12297
12298If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12299
12300**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12301
12302**Since**: 12
12303
12304**Parameters**
12305
12306| Name                   | Description                                                  |
12307| ---------------------- | ------------------------------------------------------------ |
12308| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12309| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12310| OH_Drawing_Matrix      | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. |
12311| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
12312
12313
12314### OH_Drawing_PathAddPathWithMode()
12315
12316```
12317void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode  )
12318```
12319
12320**Description**
12321
12322Adds a **src** path to the current path with the specified adding mode.
12323
12324Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12325
12326If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12327
12328If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12329
12330**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12331
12332**Since**: 12
12333
12334**Parameters**
12335
12336| Name                   | Description                                                  |
12337| ---------------------- | ------------------------------------------------------------ |
12338| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12339| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12340| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
12341
12342
12343### OH_Drawing_PathAddPathWithOffsetAndMode()
12344
12345```
12346void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode  )
12347```
12348
12349**Description**
12350
12351Translates a **src** path by an offset and adds the new one to the current path with the specified adding mode.
12352
12353Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12354
12355If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12356
12357If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12358
12359**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12360
12361**Since**: 12
12362
12363**Parameters**
12364
12365| Name                   | Description                                                  |
12366| ---------------------- | ------------------------------------------------------------ |
12367| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12368| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12369| dx                     | X offset.                                                    |
12370| dy                     | Y offset.                                                    |
12371| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
12372
12373
12374### OH_Drawing_PathAddRect()
12375
12376```
12377void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection  )
12378```
12379
12380**Description**
12381
12382Adds a rectangle to a path in the specified direction. The start point is the upper left corner of the rectangle.
12383
12384Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12385
12386If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12387
12388If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12389
12390**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12391
12392**Since**: 12
12393
12394**Parameters**
12395
12396| Name                     | Description                                                  |
12397| ------------------------ | ------------------------------------------------------------ |
12398| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12399| left                     | X coordinate of the upper left corner of the rectangle.      |
12400| top                      | Y coordinate of the upper left corner of the rectangle.      |
12401| right                    | X coordinate of the lower right corner of the rectangle.     |
12402| bottom                   | Y coordinate of the lower right corner of the rectangle.     |
12403| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
12404
12405
12406### OH_Drawing_PathAddRectWithInitialCorner()
12407
12408```
12409void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start )
12410```
12411
12412**Description**
12413
12414Adds a rectangle contour to a path in the specified direction.
12415
12416Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12417
12418If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12419
12420If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12421
12422**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12423
12424**Since**: 12
12425
12426**Parameters**
12427
12428| Name                     | Description                                                  |
12429| ------------------------ | ------------------------------------------------------------ |
12430| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12431| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
12432| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
12433| start                    | Start point, indicating the corner of the rectangle from which the path is drawn. The value **0** means the upper left corner, **1** means the upper right corner, **2** means the lower right corner, and **3** means the lower left corner. |
12434
12435
12436### OH_Drawing_PathAddRoundRect()
12437
12438```
12439void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection  )
12440```
12441
12442**Description**
12443
12444Adds a rounded rectangle contour to a path in the specified direction. When the path direction is clockwise, the start point is at the intersection of the rounded rectangle's left boundary and its lower left corner. When the path direction is counterclockwise, the start point is at the intersection point between the left boundary and the upper left corner.
12445
12446Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12447
12448If either **OH_Drawing_Path** or **roundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12449
12450If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12451
12452**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12453
12454**Since**: 12
12455
12456**Parameters**
12457
12458| Name                     | Description                                                  |
12459| ------------------------ | ------------------------------------------------------------ |
12460| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12461| roundRect                | Pointer to an [OH_Drawing_RoundRect](#oh_drawing_roundrect) object. |
12462| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
12463
12464
12465### OH_Drawing_PathArcTo()
12466
12467```
12468void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
12469```
12470
12471**Description**
12472
12473Draws 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.
12474
12475Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12476
12477If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12478
12479**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12480
12481**Since**: 8
12482
12483**Parameters**
12484
12485| Name            | Description                                                  |
12486| --------------- | ------------------------------------------------------------ |
12487| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object.                    |
12488| x1              | X coordinate of the upper left corner of the rectangle.      |
12489| y1              | Y coordinate of the upper left corner of the rectangle.      |
12490| x2              | X coordinate of the lower right corner of the rectangle.     |
12491| y2              | Y coordinate of the lower right corner of the rectangle.     |
12492| startDeg        | Start angle. The start direction (0°) of the angle is the positive direction of the X axis. |
12493| sweepDeg        | Angle to sweep, in degrees. A positive number indicates a clockwise sweep, and a negative value indicates a counterclockwise swipe. The actual swipe degree is the modulo operation result of the input parameter by 360. |
12494
12495
12496### OH_Drawing_PathClose()
12497
12498```
12499void OH_Drawing_PathClose (OH_Drawing_Path* )
12500```
12501
12502**Description**
12503
12504Closes a path by drawing a line segment from the current point to the start point of the path.
12505
12506Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12507
12508If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12509
12510**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12511
12512**Since**: 8
12513
12514**Parameters**
12515
12516| Name            | Description                               |
12517| --------------- | ----------------------------------------- |
12518| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12519
12520
12521### OH_Drawing_PathConicTo()
12522
12523```
12524void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
12525```
12526
12527**Description**
12528
12529Draws a conic curve from the last point of a path to the target point. If the path is empty, the start point (0, 0) is used.
12530
12531Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12532
12533If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12534
12535**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12536
12537**Since**: 12
12538
12539**Parameters**
12540
12541| Name            | Description                                                  |
12542| --------------- | ------------------------------------------------------------ |
12543| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12544| ctrlX           | X coordinate of the control point.                           |
12545| ctrlY           | Y coordinate of the control point.                           |
12546| endX            | X coordinate of the target point.                            |
12547| endY            | Y coordinate of the target point.                            |
12548| weight          | Weight of the curve, which determines its shape. The larger the value, the closer of the curve to the control point. If the value is less than or equal to 0, this function is equivalent to [OH_Drawing_PathLineTo](#oh_drawing_pathlineto), that is, adding a line segment from the last point of the path to the target point. If the value is 1, this function is equivalent to [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto). |
12549
12550
12551### OH_Drawing_PathContains()
12552
12553```
12554bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y )
12555```
12556
12557**Description**
12558
12559Checks whether a coordinate point is included in this path. For details, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1).
12560
12561Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12562
12563If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12564
12565**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12566
12567**Since**: 12
12568
12569**Parameters**
12570
12571| Name            | Description                                               |
12572| --------------- | --------------------------------------------------------- |
12573| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
12574| x               | Coordinate point on the X axis.                           |
12575| y               | Coordinate point on the Y axis.                           |
12576
12577**Returns**
12578
12579Returns **true** if the coordinate point is included in the path; returns **false** otherwise.
12580
12581
12582### OH_Drawing_PathCopy()
12583
12584```
12585OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* )
12586```
12587
12588**Description**
12589
12590Copies an existing [OH_Drawing_Path](#oh_drawing_path) object to create a new one.
12591
12592Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12593
12594If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12595
12596**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12597
12598**Since**: 12
12599
12600**Parameters**
12601
12602| Name            | Description                                               |
12603| --------------- | --------------------------------------------------------- |
12604| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
12605
12606**Returns**
12607
12608Returns the pointer to the [OH_Drawing_Path](#oh_drawing_path) object created.
12609
12610
12611### OH_Drawing_PathCreate()
12612
12613```
12614OH_Drawing_Path* OH_Drawing_PathCreate (void )
12615```
12616
12617**Description**
12618
12619Creates an **OH_Drawing_Path** object.
12620
12621**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12622
12623**Since**: 8
12624
12625**Returns**
12626
12627Returns the pointer to the **OH_Drawing_Path** object created.
12628
12629
12630### OH_Drawing_PathCubicTo()
12631
12632```
12633void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
12634```
12635
12636**Description**
12637
12638Draws a cubic Bezier curve from the last point of a path to the target point. If the path is empty, the start point (0, 0) is used.
12639
12640Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12641
12642If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12643
12644**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12645
12646**Since**: 8
12647
12648**Parameters**
12649
12650| Name            | Description                               |
12651| --------------- | ----------------------------------------- |
12652| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12653| ctrlX1          | X coordinate of the first control point.  |
12654| ctrlY1          | Y coordinate of the first control point.  |
12655| ctrlX2          | X coordinate of the second control point. |
12656| ctrlY2          | Y coordinate of the second control point. |
12657| endX            | X coordinate of the target point.         |
12658| endY            | Y coordinate of the target point.         |
12659
12660
12661### OH_Drawing_PathDestroy()
12662
12663```
12664void OH_Drawing_PathDestroy (OH_Drawing_Path* )
12665```
12666
12667**Description**
12668
12669Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object.
12670
12671**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12672
12673**Since**: 8
12674
12675**Parameters**
12676
12677| Name            | Description                               |
12678| --------------- | ----------------------------------------- |
12679| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12680
12681
12682### OH_Drawing_PathEffectDestroy()
12683
12684```
12685void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* )
12686```
12687
12688**Description**
12689
12690Destroys an **OH_Drawing_PathEffect** object and reclaims the memory occupied by the object.
12691
12692**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12693
12694**Since**: 12
12695
12696**Parameters**
12697
12698| Name                  | Description                                                  |
12699| --------------------- | ------------------------------------------------------------ |
12700| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
12701
12702
12703### OH_Drawing_PathGetLength()
12704
12705```
12706float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed )
12707```
12708
12709**Description**
12710
12711Obtains the length of a path.
12712
12713Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12714
12715If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12716
12717**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12718
12719**Since**: 12
12720
12721**Parameters**
12722
12723| Name            | Description                                                  |
12724| --------------- | ------------------------------------------------------------ |
12725| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12726| forceClosed     | Whether the path is measured as a closed path. The value **true** means that the path is considered closed during measurement, and **false** means that the path is measured based on the actual closed status. |
12727
12728**Returns**
12729
12730Returns the length of the path.
12731
12732
12733### OH_Drawing_PathLineTo()
12734
12735```
12736void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y )
12737```
12738
12739**Description**
12740
12741Draws a line segment from the last point of a path to the target point. If the path is empty, the start point (0, 0) is used.
12742
12743Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12744
12745If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12746
12747**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12748
12749**Since**: 8
12750
12751**Parameters**
12752
12753| Name            | Description                               |
12754| --------------- | ----------------------------------------- |
12755| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12756| x               | X coordinate of the target point.         |
12757| y               | Y coordinate of the target point.         |
12758
12759
12760### OH_Drawing_PathMoveTo()
12761
12762```
12763void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y )
12764```
12765
12766**Description**
12767
12768Sets the start point of a path.
12769
12770Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12771
12772If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12773
12774**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12775
12776**Since**: 8
12777
12778**Parameters**
12779
12780| Name            | Description                               |
12781| --------------- | ----------------------------------------- |
12782| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12783| x               | X coordinate of the start point.          |
12784| y               | Y coordinate of the start point.          |
12785
12786
12787### OH_Drawing_PathOffset()
12788
12789```
12790void OH_Drawing_PathOffset (OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy )
12791```
12792
12793**Description**
12794
12795Translates a path by an offset along the X axis and Y axis and adds the new one to the **dst** path.
12796
12797Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12798
12799If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12800
12801**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12802
12803**Since**: 12
12804
12805**Parameters**
12806
12807| Name | Description                                                  |
12808| ---- | ------------------------------------------------------------ |
12809| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
12810| dst  | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object. If NULL is passed in, the result is stored in the current path. |
12811| dx   | X offset.                                                    |
12812| dy   | Y offset.                                                    |
12813
12814
12815### OH_Drawing_PathQuadTo()
12816
12817```
12818void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
12819```
12820
12821**Description**
12822
12823Draws a quadratic Bezier curve from the last point of a path to the target point. If the path is empty, the start point (0, 0) is used.
12824
12825Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12826
12827If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12828
12829**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12830
12831**Since**: 8
12832
12833**Parameters**
12834
12835| Name            | Description                               |
12836| --------------- | ----------------------------------------- |
12837| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12838| ctrlX           | X coordinate of the control point.        |
12839| ctrlY           | Y coordinate of the control point.        |
12840| endX            | X coordinate of the target point.         |
12841| endY            | Y coordinate of the target point.         |
12842
12843
12844### OH_Drawing_PathRConicTo()
12845
12846```
12847void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
12848```
12849
12850**Description**
12851
12852Draws a conic curve from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.
12853
12854Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12855
12856If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12857
12858**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12859
12860**Since**: 12
12861
12862**Parameters**
12863
12864| Name            | Description                                                  |
12865| --------------- | ------------------------------------------------------------ |
12866| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12867| ctrlX           | X offset relative to the last point, which is used to specify the X coordinate of the control point. |
12868| ctrlY           | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. |
12869| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
12870| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
12871| weight          | Weight of the curve, which determines its shape. The larger the value, the closer of the curve to the control point. If the value is less than or equal to 0, this function is equivalent to [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto), that is, adding a line segment from the last point of the path to the target point. If the value is 1, this function is equivalent to [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto). |
12872
12873
12874### OH_Drawing_PathRCubicTo()
12875
12876```
12877void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
12878```
12879
12880**Description**
12881
12882Draws a cubic Bezier curve from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.
12883
12884Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12885
12886If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12887
12888**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12889
12890**Since**: 12
12891
12892**Parameters**
12893
12894| Name            | Description                                                  |
12895| --------------- | ------------------------------------------------------------ |
12896| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12897| ctrlX1          | X offset relative to the last point, which is used to specify the X coordinate of the first control point. |
12898| ctrlY1          | Y offset relative to the last point, which is used to specify the Y coordinate of the first control point. |
12899| ctrlX2          | X offset relative to the last point, which is used to specify the X coordinate of the second control point. |
12900| ctrlY2          | Y offset relative to the last point, which is used to specify the Y coordinate of the second control point. |
12901| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
12902| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
12903
12904
12905### OH_Drawing_PathReset()
12906
12907```
12908void OH_Drawing_PathReset (OH_Drawing_Path* )
12909```
12910
12911**Description**
12912
12913Resets path data.
12914
12915Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12916
12917If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12918
12919**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12920
12921**Since**: 8
12922
12923**Parameters**
12924
12925| Name            | Description                               |
12926| --------------- | ----------------------------------------- |
12927| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
12928
12929
12930### OH_Drawing_PathRLineTo()
12931
12932```
12933void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y )
12934```
12935
12936**Description**
12937
12938Draws a line segment from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.
12939
12940Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12941
12942If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12943
12944**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12945
12946**Since**: 12
12947
12948**Parameters**
12949
12950| Name            | Description                                                  |
12951| --------------- | ------------------------------------------------------------ |
12952| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12953| x               | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
12954| y               | Y offset relative to the last point, which is used to specify the X coordinate of the target point. |
12955
12956
12957### OH_Drawing_PathRMoveTo()
12958
12959```
12960void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y )
12961```
12962
12963**Description**
12964
12965Sets the start position relative to the last point of a path. If the path is empty, the start point (0, 0) is used.
12966
12967Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12968
12969If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12970
12971**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12972
12973**Since**: 12
12974
12975**Parameters**
12976
12977| Name            | Description                                                  |
12978| --------------- | ------------------------------------------------------------ |
12979| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
12980| x               | X offset of the target point relative to the last point. A positive number indicates a rightward shift from the last point, and a negative number indicates a leftward shift from the last point. The value is a floating point number. |
12981| y               | Y offset of the target point relative to the last point. A positive number indicates an upward shift from the last point, and a negative number indicates a downward shift from the last point. The value is a floating point number. |
12982
12983
12984### OH_Drawing_PathRQuadTo()
12985
12986```
12987void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
12988```
12989
12990**Description**
12991
12992Draws a quadratic Bezier curve from the last point of a path to a point relative to the last point. If the path is empty, the start point (0, 0) is used.
12993
12994Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12995
12996If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12997
12998**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12999
13000**Since**: 12
13001
13002**Parameters**
13003
13004| Name            | Description                                                  |
13005| --------------- | ------------------------------------------------------------ |
13006| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
13007| ctrlX           | X offset relative to the last point, which is used to specify the X coordinate of the control point. |
13008| ctrlY           | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. |
13009| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
13010| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
13011
13012
13013### OH_Drawing_PathSetFillType()
13014
13015```
13016void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType  )
13017```
13018
13019**Description**
13020
13021Sets the fill type of a path. The fill type determines how "inside" of the path is drawn. For example, when the fill type **Winding** is used, "inside" of the path is determined by a non-zero sum of signed edge crossings. When **EvenOdd** is used, "inside" of the path is determined by an odd number of edge crossings.
13022
13023Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13024
13025If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13026
13027If **OH_Drawing_PathFillType** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13028
13029**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13030
13031**Since**: 12
13032
13033**Parameters**
13034
13035| Name                    | Description                                                  |
13036| ----------------------- | ------------------------------------------------------------ |
13037| OH_Drawing_Path         | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
13038| OH_Drawing_PathFillType | Fill type of the path. For details about the available options, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype). |
13039
13040
13041### OH_Drawing_PathTransform()
13042
13043```
13044void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix*  )
13045```
13046
13047**Description**
13048
13049Transforms the points in a path by matrix.
13050
13051Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13052
13053If either **OH_Drawing_Path** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13054
13055**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13056
13057**Since**: 12
13058
13059**Parameters**
13060
13061| Name              | Description                                                  |
13062| ----------------- | ------------------------------------------------------------ |
13063| OH_Drawing_Path   | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
13064| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
13065
13066
13067### OH_Drawing_PathTransformWithPerspectiveClip()
13068
13069```
13070void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip )
13071```
13072
13073**Description**
13074
13075Transforms the points in a **src** path by a matrix and uses the new one to replace the **dst** path. If the **dst** path does not exist, the **src** path is replaced.
13076
13077Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13078
13079If either **src** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13080
13081**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13082
13083**Since**: 12
13084
13085**Parameters**
13086
13087| Name                 | Description                                                  |
13088| -------------------- | ------------------------------------------------------------ |
13089| src                  | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
13090| OH_Drawing_Matrix    | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
13091| dst                  | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
13092| applyPerspectiveClip | Whether to apply perspective cropping to the new path. The value **true** means to apply perspective cropping, and **false** means the opposite. |
13093
13094### OH_Drawing_PenCreate()
13095
13096```
13097OH_Drawing_Pen* OH_Drawing_PenCreate (void )
13098```
13099
13100**Description**
13101
13102Creates an **OH_Drawing_Pen** object.
13103
13104**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13105
13106**Since**: 8
13107
13108**Returns**
13109
13110Returns the pointer to the **OH_Drawing_Pen** object created.
13111
13112
13113### OH_Drawing_PenDestroy()
13114
13115```
13116void OH_Drawing_PenDestroy (OH_Drawing_Pen* )
13117```
13118
13119**Description**
13120
13121Destroys an **OH_Drawing_Pen** object and reclaims the memory occupied by the object.
13122
13123**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13124
13125**Since**: 8
13126
13127**Parameters**
13128
13129| Name           | Description                              |
13130| -------------- | ---------------------------------------- |
13131| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13132
13133
13134### OH_Drawing_PenGetAlpha()
13135
13136```
13137uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* )
13138```
13139
13140**Description**
13141
13142Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape.
13143
13144Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13145
13146If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13147
13148**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13149
13150**Since**: 11
13151
13152**Parameters**
13153
13154| Name           | Description                              |
13155| -------------- | ---------------------------------------- |
13156| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13157
13158**Returns**
13159
13160Returns an 8-bit variable that describes the alpha value.
13161
13162
13163### OH_Drawing_PenGetCap()
13164
13165```
13166OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* )
13167```
13168
13169**Description**
13170
13171Obtains the line cap style of a pen.
13172
13173Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13174
13175If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13176
13177**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13178
13179**Since**: 8
13180
13181**Parameters**
13182
13183| Name           | Description                              |
13184| -------------- | ---------------------------------------- |
13185| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13186
13187**Returns**
13188
13189Returns the line cap style.
13190
13191
13192### OH_Drawing_PenGetColor()
13193
13194```
13195uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* )
13196```
13197
13198**Description**
13199
13200Obtains the color of a pen. The color is used by the pen to outline a shape.
13201
13202Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13203
13204If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13205
13206**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13207
13208**Since**: 8
13209
13210**Parameters**
13211
13212| Name           | Description                              |
13213| -------------- | ---------------------------------------- |
13214| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13215
13216**Returns**
13217
13218Returns a 32-bit (ARGB) variable that describes the color.
13219
13220
13221### OH_Drawing_PenGetFilter()
13222
13223```
13224void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
13225```
13226
13227**Description**
13228
13229Obtains the filter of a pen. The filter is a container that holds a mask filter and color filter.
13230
13231Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13232
13233If either **OH_Drawing_Pen** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13234
13235**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13236
13237**Since**: 12
13238
13239**Parameters**
13240
13241| Name              | Description                                                  |
13242| ----------------- | ------------------------------------------------------------ |
13243| OH_Drawing_Pen    | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
13244| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. |
13245
13246
13247### OH_Drawing_PenGetJoin()
13248
13249```
13250OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* )
13251```
13252
13253**Description**
13254
13255Obtains the line join style of a pen.
13256
13257Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13258
13259If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13260
13261**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13262
13263**Since**: 8
13264
13265**Parameters**
13266
13267| Name           | Description                              |
13268| -------------- | ---------------------------------------- |
13269| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13270
13271**Returns**
13272
13273Returns the line join style.
13274
13275### OH_Drawing_PenGetMiterLimit()
13276
13277```
13278float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* )
13279```
13280
13281**Description**
13282
13283Obtains 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.
13284
13285Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13286
13287If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13288
13289**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13290
13291**Since**: 8
13292
13293**Parameters**
13294
13295| Name           | Description                              |
13296| -------------- | ---------------------------------------- |
13297| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13298
13299**Returns**
13300
13301Returns the miter limit.
13302
13303
13304### OH_Drawing_PenGetWidth()
13305
13306```
13307float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* )
13308```
13309
13310**Description**
13311
13312Obtains the width of a pen. The width describes the thickness of the outline of a shape.
13313
13314Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13315
13316If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13317
13318**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13319
13320**Since**: 8
13321
13322**Parameters**
13323
13324| Name           | Description                              |
13325| -------------- | ---------------------------------------- |
13326| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13327
13328**Returns**
13329
13330Returns the width of the pen.
13331
13332
13333### OH_Drawing_PenIsAntiAlias()
13334
13335```
13336bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* )
13337```
13338
13339**Description**
13340
13341Checks whether anti-aliasing is enabled for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
13342
13343Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13344
13345If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13346
13347**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13348
13349**Since**: 8
13350
13351**Parameters**
13352
13353| Name           | Description                              |
13354| -------------- | ---------------------------------------- |
13355| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13356
13357**Returns**
13358
13359Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
13360
13361
13362### OH_Drawing_PenReset()
13363
13364```
13365void OH_Drawing_PenReset (OH_Drawing_Pen* )
13366```
13367
13368**Description**
13369
13370Resets a pen to the initial state.
13371
13372Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13373
13374If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13375
13376**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13377
13378**Since**: 12
13379
13380**Parameters**
13381
13382| Name           | Description                                             |
13383| -------------- | ------------------------------------------------------- |
13384| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. |
13385
13386
13387### OH_Drawing_PenSetAlpha()
13388
13389```
13390void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha )
13391```
13392
13393**Description**
13394
13395Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape.
13396
13397Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13398
13399If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13400
13401**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13402
13403**Since**: 11
13404
13405**Parameters**
13406
13407| Name           | Description                              |
13408| -------------- | ---------------------------------------- |
13409| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13410| alpha          | Alpha value, which is an 8-bit variable. |
13411
13412
13413### OH_Drawing_PenSetAntiAlias()
13414
13415```
13416void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool  )
13417```
13418
13419**Description**
13420
13421Enables or disables anti-aliasing for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
13422
13423Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13424
13425If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13426
13427**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13428
13429**Since**: 8
13430
13431**Parameters**
13432
13433| Name           | Description                                                  |
13434| -------------- | ------------------------------------------------------------ |
13435| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object.                     |
13436| bool           | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
13437
13438
13439### OH_Drawing_PenSetBlendMode()
13440
13441```
13442void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode  )
13443```
13444
13445**Description**
13446
13447Sets a blender for a pen. The blender implements the specified blend mode.
13448
13449Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13450
13451If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13452
13453If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13454
13455**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13456
13457**Since**: 12
13458
13459**Parameters**
13460
13461| Name                 | Description                                                  |
13462| -------------------- | ------------------------------------------------------------ |
13463| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
13464| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
13465
13466
13467### OH_Drawing_PenSetCap()
13468
13469```
13470void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle  )
13471```
13472
13473**Description**
13474
13475Sets the line cap style for a pen.
13476
13477Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13478
13479If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13480
13481If **OH_Drawing_PenLineCapStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13482
13483**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13484
13485**Since**: 8
13486
13487**Parameters**
13488
13489| Name                       | Description                              |
13490| -------------------------- | ---------------------------------------- |
13491| OH_Drawing_Pen             | Pointer to an **OH_Drawing_Pen** object. |
13492| OH_Drawing_PenLineCapStyle | Line cap style, which is a variable.     |
13493
13494
13495### OH_Drawing_PenSetColor()
13496
13497```
13498void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color )
13499```
13500
13501**Description**
13502
13503Sets the color for a pen. The color is used by the pen to outline a shape.
13504
13505Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13506
13507If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13508
13509**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13510
13511**Since**: 8
13512
13513**Parameters**
13514
13515| Name           | Description                               |
13516| -------------- | ----------------------------------------- |
13517| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object.  |
13518| color          | Color, which is a 32-bit (ARGB) variable. |
13519
13520
13521### OH_Drawing_PenSetFilter()
13522
13523```
13524void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
13525```
13526
13527**Description**
13528
13529Sets a filter for a pen.
13530
13531Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13532
13533If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13534
13535**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13536
13537**Since**: 11
13538
13539**Parameters**
13540
13541| Name              | Description                                                  |
13542| ----------------- | ------------------------------------------------------------ |
13543| OH_Drawing_Pen    | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
13544| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. If NULL is passed in, the filter will be cleared. |
13545
13546
13547### OH_Drawing_PenSetJoin()
13548
13549```
13550void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle  )
13551```
13552
13553**Description**
13554
13555Sets the line join style for a pen.
13556
13557Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13558
13559If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13560
13561If **OH_Drawing_PenLineJoinStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13562
13563**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13564
13565**Since**: 8
13566
13567**Parameters**
13568
13569| Name                        | Description                              |
13570| --------------------------- | ---------------------------------------- |
13571| OH_Drawing_Pen              | Pointer to an **OH_Drawing_Pen** object. |
13572| OH_Drawing_PenLineJoinStyle | Line join style.                         |
13573
13574
13575### OH_Drawing_PenSetMiterLimit()
13576
13577```
13578void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter )
13579```
13580
13581**Description**
13582
13583Sets 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.
13584
13585Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13586
13587If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13588
13589**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13590
13591**Since**: 8
13592
13593**Parameters**
13594
13595| Name           | Description                              |
13596| -------------- | ---------------------------------------- |
13597| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13598| miter          | Stroke miter limit, which is a variable. |
13599
13600
13601### OH_Drawing_PenSetPathEffect()
13602
13603```
13604void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect*  )
13605```
13606
13607**Description**
13608
13609Sets the path effect for a pen.
13610
13611Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13612
13613If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13614
13615**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13616
13617**Since**: 12
13618
13619**Parameters**
13620
13621| Name                  | Description                                                  |
13622| --------------------- | ------------------------------------------------------------ |
13623| OH_Drawing_Pen        | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
13624| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. If NULL is passed in, the path effect will be cleared. |
13625
13626
13627### OH_Drawing_PenSetShaderEffect()
13628
13629```
13630void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect*  )
13631```
13632
13633**Description**
13634
13635Sets the shader effect for a pen.
13636
13637Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13638
13639If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13640
13641**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13642
13643**Since**: 11
13644
13645**Parameters**
13646
13647| Name                    | Description                                                  |
13648| ----------------------- | ------------------------------------------------------------ |
13649| OH_Drawing_Pen          | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
13650| OH_Drawing_ShaderEffect | Pointer to an [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object. If NULL is passed in, the shader effect will be cleared. |
13651
13652
13653### OH_Drawing_PenSetWidth()
13654
13655```
13656void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width )
13657```
13658
13659**Description**
13660
13661Sets the width for a pen. The value **0** is treated as an unusually thin width. During drawing, the width of 0 is always drawn as 1 pixel wide, regardless of any scaling applied to the canvas. Negative values are also regarded as the value **0** during the drawing process.
13662
13663Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13664
13665If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13666
13667**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13668
13669**Since**: 8
13670
13671**Parameters**
13672
13673| Name           | Description                              |
13674| -------------- | ---------------------------------------- |
13675| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
13676| width          | Width, which is a variable.              |
13677
13678
13679### OH_Drawing_PointCreate()
13680
13681```
13682OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y )
13683```
13684
13685**Description**
13686
13687Creates an **OH_Drawing_Point** object.
13688
13689**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13690
13691**Since**: 11
13692
13693**Parameters**
13694
13695| Name | Description                |
13696| ---- | -------------------------- |
13697| x    | X coordinate of the point. |
13698| y    | Y coordinate of the point. |
13699
13700**Returns**
13701
13702Returns the pointer to the **OH_Drawing_Point** object created.
13703
13704
13705### OH_Drawing_PointDestroy()
13706
13707```
13708void OH_Drawing_PointDestroy (OH_Drawing_Point* )
13709```
13710
13711**Description**
13712
13713Destroys an **OH_Drawing_Point** object and reclaims the memory occupied by the object.
13714
13715**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13716
13717**Since**: 11
13718
13719**Parameters**
13720
13721| Name             | Description                                |
13722| ---------------- | ------------------------------------------ |
13723| OH_Drawing_Point | Pointer to an **OH_Drawing_Point** object. |
13724
13725
13726### OH_Drawing_RectCopy()
13727
13728```
13729void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect )
13730```
13731
13732**Description**
13733
13734Copies a source rectangle to create a new one.
13735
13736Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13737
13738If either **sRect** or **dRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13739
13740**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13741
13742**Since**: 12
13743
13744**Parameters**
13745
13746| Name  | Description                                                  |
13747| ----- | ------------------------------------------------------------ |
13748| sRect | Pointer to a source rectangle, which is an **OH_Drawing_Rect** object. |
13749| dRect | Pointer to a destination rectangle, which is an **OH_Drawing_Rect** object. |
13750
13751
13752### OH_Drawing_RectCreate()
13753
13754```
13755OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom )
13756```
13757
13758**Description**
13759
13760Creates an **OH_Drawing_Rect** object, without sorting the coordinates passed in. This means that the coordinates of the upper left corner of the rectangle can be greater than those of the lower right corner.
13761
13762**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13763
13764**Since**: 11
13765
13766**Parameters**
13767
13768| Name   | Description                                              |
13769| ------ | -------------------------------------------------------- |
13770| left   | X coordinate of the upper left corner of the rectangle.  |
13771| top    | Y coordinate of the upper left corner of the rectangle.  |
13772| right  | X coordinate of the lower right corner of the rectangle. |
13773| bottom | Y coordinate of the lower right corner of the rectangle. |
13774
13775**Returns**
13776
13777Returns the pointer to the **OH_Drawing_Rect** object created.
13778
13779
13780### OH_Drawing_RectDestroy()
13781
13782```
13783void OH_Drawing_RectDestroy (OH_Drawing_Rect* )
13784```
13785
13786**Description**
13787
13788Destroys an **OH_Drawing_Rect** object and reclaims the memory occupied by the object.
13789
13790**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13791
13792**Since**: 11
13793
13794**Parameters**
13795
13796| Name            | Description                               |
13797| --------------- | ----------------------------------------- |
13798| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13799
13800
13801### OH_Drawing_RectGetBottom()
13802
13803```
13804float OH_Drawing_RectGetBottom (OH_Drawing_Rect* )
13805```
13806
13807**Description**
13808
13809Obtains the Y coordinate of the lower right corner of a rectangle.
13810
13811Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13812
13813If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13814
13815**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13816
13817**Since**: 12
13818
13819**Parameters**
13820
13821| Name            | Description                               |
13822| --------------- | ----------------------------------------- |
13823| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13824
13825**Returns**
13826
13827Returns the Y coordinate of the lower right corner of the rectangle.
13828
13829
13830### OH_Drawing_RectGetHeight()
13831
13832```
13833float OH_Drawing_RectGetHeight (OH_Drawing_Rect* )
13834```
13835
13836**Description**
13837
13838Obtains the height of a rectangle. The height is calculated by using the Y coordinate of the lower right corner of the rectangle minus the Y coordinate of the upper left corner.
13839
13840Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13841
13842If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13843
13844**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13845
13846**Since**: 12
13847
13848**Parameters**
13849
13850| Name            | Description                               |
13851| --------------- | ----------------------------------------- |
13852| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13853
13854**Returns**
13855
13856Returns the height of the rectangle, in pixels.
13857
13858
13859### OH_Drawing_RectGetLeft()
13860
13861```
13862float OH_Drawing_RectGetLeft (OH_Drawing_Rect* )
13863```
13864
13865**Description**
13866
13867Obtains the X coordinate of the upper left corner of a rectangle.
13868
13869Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13870
13871If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13872
13873**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13874
13875**Since**: 12
13876
13877**Parameters**
13878
13879| Name            | Description                               |
13880| --------------- | ----------------------------------------- |
13881| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13882
13883**Returns**
13884
13885Returns the X coordinate of the upper left corner of the rectangle.
13886
13887
13888### OH_Drawing_RectGetRight()
13889
13890```
13891float OH_Drawing_RectGetRight (OH_Drawing_Rect* )
13892```
13893
13894**Description**
13895
13896Obtains the X coordinate of the lower right corner of a rectangle.
13897
13898Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13899
13900If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13901
13902**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13903
13904**Since**: 12
13905
13906**Parameters**
13907
13908| Name            | Description                               |
13909| --------------- | ----------------------------------------- |
13910| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13911
13912**Returns**
13913
13914Returns the X coordinate of the lower right corner of the rectangle.
13915
13916
13917### OH_Drawing_RectGetTop()
13918
13919```
13920float OH_Drawing_RectGetTop (OH_Drawing_Rect* )
13921```
13922
13923**Description**
13924
13925Obtains the Y coordinate of the upper left corner of a rectangle.
13926
13927Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13928
13929If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13930
13931**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13932
13933**Since**: 12
13934
13935**Parameters**
13936
13937| Name            | Description                               |
13938| --------------- | ----------------------------------------- |
13939| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13940
13941**Returns**
13942
13943Returns the Y coordinate of the upper left corner of the rectangle.
13944
13945
13946### OH_Drawing_RectGetWidth()
13947
13948```
13949float OH_Drawing_RectGetWidth (OH_Drawing_Rect* )
13950```
13951
13952**Description**
13953
13954Obtains the width of a rectangle. The width is calculated by using the X coordinate of the lower right corner of the rectangle minus the X coordinate of the upper left corner.
13955
13956Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13957
13958If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13959
13960**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13961
13962**Since**: 12
13963
13964**Parameters**
13965
13966| Name            | Description                               |
13967| --------------- | ----------------------------------------- |
13968| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
13969
13970**Returns**
13971
13972Returns the weight of the rectangle, in pixels.
13973
13974
13975### OH_Drawing_RectIntersect()
13976
13977```
13978bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
13979```
13980
13981**Description**
13982
13983Checks whether two rectangles intersect and if yes, sets **rect** to the area of intersection.
13984
13985Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13986
13987If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13988
13989**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13990
13991**Since**: 12
13992
13993**Parameters**
13994
13995| Name  | Description                                                  |
13996| ----- | ------------------------------------------------------------ |
13997| rect  | Pointer to the first rectangle, which is an **OH_Drawing_Rect** object. |
13998| other | Pointer to the second rectangle, which is an **OH_Drawing_Rect** object. |
13999
14000**Returns**
14001
14002Returns **true** if they intersect (**rect** is set to the intersection area); returns **false** otherwise (**rect** remains unchanged).
14003
14004
14005### OH_Drawing_RectSetBottom()
14006
14007```
14008void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom )
14009```
14010
14011**Description**
14012
14013Sets the vertical coordinate of the lower right corner of a rectangle.
14014
14015Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14016
14017If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14018
14019**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14020
14021**Since**: 12
14022
14023**Parameters**
14024
14025| Name   | Description                                              |
14026| ------ | -------------------------------------------------------- |
14027| rect   | Pointer to an **OH_Drawing_Rect** object.                |
14028| bottom | Y coordinate of the lower right corner of the rectangle. |
14029
14030
14031### OH_Drawing_RectSetLeft()
14032
14033```
14034void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left )
14035```
14036
14037**Description**
14038
14039Sets the horizontal coordinate of the upper left corner of a rectangle.
14040
14041Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14042
14043If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14044
14045**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14046
14047**Since**: 12
14048
14049**Parameters**
14050
14051| Name | Description                                             |
14052| ---- | ------------------------------------------------------- |
14053| rect | Pointer to an **OH_Drawing_Rect** object.               |
14054| left | X coordinate of the upper left corner of the rectangle. |
14055
14056
14057### OH_Drawing_RectSetRight()
14058
14059```
14060void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right )
14061```
14062
14063**Description**
14064
14065Sets the horizontal coordinate of the lower right corner of a rectangle.
14066
14067Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14068
14069If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14070
14071**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14072
14073**Since**: 12
14074
14075**Parameters**
14076
14077| Name  | Description                                              |
14078| ----- | -------------------------------------------------------- |
14079| rect  | Pointer to an **OH_Drawing_Rect** object.                |
14080| right | X coordinate of the lower right corner of the rectangle. |
14081
14082
14083### OH_Drawing_RectSetTop()
14084
14085```
14086void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top )
14087```
14088
14089**Description**
14090
14091Sets the vertical coordinate of the upper left corner of a rectangle.
14092
14093Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14094
14095If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14096
14097**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14098
14099**Since**: 12
14100
14101**Parameters**
14102
14103| Name | Description                                             |
14104| ---- | ------------------------------------------------------- |
14105| rect | Pointer to an **OH_Drawing_Rect** object.               |
14106| top  | Y coordinate of the upper left corner of the rectangle. |
14107
14108
14109### OH_Drawing_RegionCreate()
14110
14111```
14112OH_Drawing_Region* OH_Drawing_RegionCreate (void )
14113```
14114
14115**Description**
14116
14117Creates an **OH_Drawing_Region** object for more accurate graphical control.
14118
14119**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14120
14121**Since**: 12
14122
14123**Returns**
14124
14125Returns the pointer to the **OH_Drawing_Region** object created.
14126
14127
14128### OH_Drawing_RegionDestroy()
14129
14130```
14131void OH_Drawing_RegionDestroy (OH_Drawing_Region* )
14132```
14133
14134**Description**
14135
14136Destroys an **OH_Drawing_Region** object and reclaims the memory occupied by the object.
14137
14138**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14139
14140**Since**: 12
14141
14142**Parameters**
14143
14144| Name              | Description                                 |
14145| ----------------- | ------------------------------------------- |
14146| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. |
14147
14148
14149### OH_Drawing_RegionSetRect()
14150
14151```
14152bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect )
14153```
14154
14155**Description**
14156
14157Sets the boundary for an **OH_Drawing_Region** object.
14158
14159Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14160
14161If either **region** or **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14162
14163**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14164
14165**Since**: 12
14166
14167**Parameters**
14168
14169| Name   | Description                                 |
14170| ------ | ------------------------------------------- |
14171| region | Pointer to an **OH_Drawing_Region** object. |
14172| rect   | Pointer to an **OH_Drawing_Rect** object.   |
14173
14174**Returns**
14175
14176Returns **true** if the setting is successful; returns **false** otherwise.
14177
14178
14179### OH_Drawing_RegisterFont()
14180
14181```
14182uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc )
14183```
14184
14185**Description**
14186
14187Registers a custom font with the font manager. The supported font file formats are .ttf and .otf.
14188
14189**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14190
14191**Since**: 11
14192
14193**Parameters**
14194
14195| Name                      | Description                                         |
14196| ------------------------- | --------------------------------------------------- |
14197| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
14198| fontFamily                | Pointer to the family name of the font to register. |
14199| familySrc                 | Pointer to the path of the font file.               |
14200
14201**Returns**
14202
14203Returns **0** if the font is registered; returns **1** if the file does not exist; returns **2** if opening the file fails; returns **3** if reading the file fails; returns **4** if the file is not found; returns **5** if the file size is not obtained; returns **9** if the file is damaged.
14204
14205
14206### OH_Drawing_RegisterFontBuffer()
14207
14208```
14209uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length )
14210```
14211
14212**Description**
14213
14214Registers a font buffer with the font manager.
14215
14216**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14217
14218**Since**: 11
14219
14220**Parameters**
14221
14222| Name                      | Description                                         |
14223| ------------------------- | --------------------------------------------------- |
14224| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
14225| fontFamily                | Pointer to the family name of the font to register. |
14226| fontBuffer                | Pointer to the buffer of the font file.             |
14227| length                    | Length of the font file.                            |
14228
14229**Returns**
14230
14231Returns **0** if the font is registered; returns **6** if the buffer size is zero; returns **7** if the font set is empty; returns **9** if the file is damaged.
14232
14233
14234### OH_Drawing_RoundRectCreate()
14235
14236```
14237OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad )
14238```
14239
14240**Description**
14241
14242Creates an **OH_Drawing_RoundRect** object.
14243
14244Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14245
14246If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14247
14248**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14249
14250**Since**: 11
14251
14252**Parameters**
14253
14254| Name            | Description                                                  |
14255| --------------- | ------------------------------------------------------------ |
14256| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object.                    |
14257| xRad            | Radius of the rounded corner on the X axis. A negative number is invalid. |
14258| yRad            | Radius of the rounded corner on the Y axis. A negative number is invalid. |
14259
14260**Returns**
14261
14262Returns the pointer to the **OH_Drawing_RoundRect** object created.
14263
14264
14265### OH_Drawing_RoundRectDestroy()
14266
14267```
14268void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* )
14269```
14270
14271**Description**
14272
14273Destroys an **OH_Drawing_RoundRect** object and reclaims the memory occupied by the object.
14274
14275**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14276
14277**Since**: 11
14278
14279**Parameters**
14280
14281| Name                 | Description                                    |
14282| -------------------- | ---------------------------------------------- |
14283| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. |
14284
14285
14286### OH_Drawing_RoundRectGetCorner()
14287
14288```
14289OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos )
14290```
14291
14292**Description**
14293
14294Obtains the radii of the specified rounded corner in a rounded rectangle.
14295
14296Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14297
14298If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14299
14300**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14301
14302**Since**: 12
14303
14304**Parameters**
14305
14306| Name                 | Description                                                  |
14307| -------------------- | ------------------------------------------------------------ |
14308| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object.               |
14309| pos                  | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). |
14310
14311**Returns**
14312
14313Returns an [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis.
14314
14315
14316### OH_Drawing_RoundRectSetCorner()
14317
14318```
14319void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii  )
14320```
14321
14322**Description**
14323
14324Sets the radii of the specified rounded corner in a rounded rectangle.
14325
14326Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14327
14328If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14329
14330**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14331
14332**Since**: 12
14333
14334**Parameters**
14335
14336| Name                    | Description                                                  |
14337| ----------------------- | ------------------------------------------------------------ |
14338| OH_Drawing_RoundRect    | Pointer to an **OH_Drawing_RoundRect** object.               |
14339| pos                     | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). |
14340| OH_Drawing_Corner_Radii | [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis. The value must be greater than or equal to 0. |
14341
14342
14343### OH_Drawing_SamplingOptionsCreate()
14344
14345```
14346OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode  )
14347```
14348
14349**Description**
14350
14351Creates an **OH_Drawing_SamplingOptions** object.
14352
14353Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14354
14355If **OH_Drawing_MipmapMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
14356
14357**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14358
14359**Since**: 12
14360
14361**Parameters**
14362
14363| Name                  | Description                                                  |
14364| --------------------- | ------------------------------------------------------------ |
14365| OH_Drawing_FilterMode | Filter mode. For details about the available options, see [OH_Drawing_FilterMode](#oh_drawing_filtermode). |
14366| OH_Drawing_MipmapMode | Mipmap mode. For details about the available options, see [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode). |
14367
14368**Returns**
14369
14370Returns the pointer to the [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object created.
14371
14372
14373### OH_Drawing_SamplingOptionsDestroy()
14374
14375```
14376void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* )
14377```
14378
14379**Description**
14380
14381Destroys an **OH_Drawing_SamplingOptions** object and reclaims the memory occupied by the object.
14382
14383**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14384
14385**Since**: 12
14386
14387**Parameters**
14388
14389| Name                       | Description                                                  |
14390| -------------------------- | ------------------------------------------------------------ |
14391| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. |
14392
14393
14394### OH_Drawing_SetTextStyleBackgroundBrush()
14395
14396```
14397void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14398```
14399
14400**Description**
14401
14402Sets the background brush for a text style.
14403
14404**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14405
14406**Since**: 12
14407
14408**Parameters**
14409
14410| Name                 | Description                                                  |
14411| -------------------- | ------------------------------------------------------------ |
14412| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14413| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
14414
14415
14416### OH_Drawing_SetTextStyleBackgroundPen()
14417
14418```
14419void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14420```
14421
14422**Description**
14423
14424Sets the background pen for a text style.
14425
14426**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14427
14428**Since**: 12
14429
14430**Parameters**
14431
14432| Name                 | Description                                                  |
14433| -------------------- | ------------------------------------------------------------ |
14434| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14435| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
14436
14437
14438### OH_Drawing_SetTextStyleBaseLine()
14439
14440```
14441void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int  )
14442```
14443
14444**Description**
14445
14446Sets the baseline for a text style.
14447
14448**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14449
14450**Since**: 8
14451
14452**Parameters**
14453
14454| Name                 | Description                                                  |
14455| -------------------- | ------------------------------------------------------------ |
14456| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14457| int                  | Text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline). |
14458
14459
14460### OH_Drawing_SetTextStyleColor()
14461
14462```
14463void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t  )
14464```
14465
14466**Description**
14467
14468Sets the color for a text style.
14469
14470**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14471
14472**Since**: 8
14473
14474**Parameters**
14475
14476| Name                 | Description                                                  |
14477| -------------------- | ------------------------------------------------------------ |
14478| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14479| uint32_t             | Color.                                                       |
14480
14481
14482### OH_Drawing_SetTextStyleDecoration()
14483
14484```
14485void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int  )
14486```
14487
14488**Description**
14489
14490Sets the decoration for a text style. Only one decoration can be set. To add multiple decorations, use [OH_Drawing_AddTextStyleDecoration](#oh_drawing_addtextstyledecoration).
14491
14492**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14493
14494**Since**: 8
14495
14496**Parameters**
14497
14498| Name                 | Description                                                  |
14499| -------------------- | ------------------------------------------------------------ |
14500| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14501| int                  | Text decoration. For details about the available options, see [OH_Drawing_TextDecoration](#oh_drawing_textdecoration). |
14502
14503
14504### OH_Drawing_SetTextStyleDecorationColor()
14505
14506```
14507void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t  )
14508```
14509
14510**Description**
14511
14512Sets the decoration color for a text style.
14513
14514**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14515
14516**Since**: 8
14517
14518**Parameters**
14519
14520| Name                 | Description                                                  |
14521| -------------------- | ------------------------------------------------------------ |
14522| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14523| uint32_t             | Color.                                                       |
14524
14525
14526### OH_Drawing_SetTextStyleDecorationStyle()
14527
14528```
14529void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int  )
14530```
14531
14532**Description**
14533
14534Sets the decoration style for a text style.
14535
14536**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14537
14538**Since**: 11
14539
14540**Parameters**
14541
14542| Name                 | Description                                                  |
14543| -------------------- | ------------------------------------------------------------ |
14544| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14545| int                  | Text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle). |
14546
14547
14548### OH_Drawing_SetTextStyleDecorationThicknessScale()
14549
14550```
14551void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double  )
14552```
14553
14554**Description**
14555
14556Sets the thickness scale factor for the decoration style of a text style.
14557
14558**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14559
14560**Since**: 11
14561
14562**Parameters**
14563
14564| Name                 | Description                                                  |
14565| -------------------- | ------------------------------------------------------------ |
14566| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14567| double               | Scale factor.                                                |
14568
14569
14570### OH_Drawing_SetTextStyleEllipsis()
14571
14572```
14573void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char*  )
14574```
14575
14576**Description**
14577
14578Sets the ellipsis content for a text style.
14579
14580**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14581
14582**Since**: 11
14583
14584**Parameters**
14585
14586| Name                 | Description                                                  |
14587| -------------------- | ------------------------------------------------------------ |
14588| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14589| char\*               | Pointer to the ellipsis content. The data type is a pointer pointing to char. |
14590
14591
14592### OH_Drawing_SetTextStyleEllipsisModal()
14593
14594```
14595void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int  )
14596```
14597
14598**Description**
14599
14600Sets the ellipsis style for a text style.
14601
14602**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14603
14604**Since**: 11
14605
14606**Parameters**
14607
14608| Name                 | Description                                                  |
14609| -------------------- | ------------------------------------------------------------ |
14610| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14611| int                  | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). |
14612
14613
14614### OH_Drawing_SetTextStyleFontFamilies()
14615
14616```
14617void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] )
14618```
14619
14620**Description**
14621
14622Sets the font families for a text style.
14623
14624**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14625
14626**Since**: 8
14627
14628**Parameters**
14629
14630| Name                 | Description                                                  |
14631| -------------------- | ------------------------------------------------------------ |
14632| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14633| int                  | Number of font families. A negative number is not allowed.   |
14634| char*                | Pointer to the font families.                                |
14635
14636
14637### OH_Drawing_SetTextStyleFontHeight()
14638
14639```
14640void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double  )
14641```
14642
14643**Description**
14644
14645Sets the line height based on the multiple of the font size.
14646
14647**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14648
14649**Since**: 8
14650
14651**Parameters**
14652
14653| Name                 | Description                                                  |
14654| -------------------- | ------------------------------------------------------------ |
14655| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14656| double               | Multiple of the font size.                                   |
14657
14658
14659### OH_Drawing_SetTextStyleFontSize()
14660
14661```
14662void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double  )
14663```
14664
14665**Description**
14666
14667Sets the font size for a text style.
14668
14669**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14670
14671**Since**: 8
14672
14673**Parameters**
14674
14675| Name                 | Description                                                  |
14676| -------------------- | ------------------------------------------------------------ |
14677| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14678| double               | Font size.                                                   |
14679
14680
14681### OH_Drawing_SetTextStyleFontStyle()
14682
14683```
14684void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int)
14685```
14686
14687**Description**
14688
14689Sets the font style for a text style.
14690
14691**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14692
14693**Since**: 8
14694
14695**Parameters**
14696
14697| Name                 | Description                                                  |
14698| -------------------- | ------------------------------------------------------------ |
14699| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14700| int                  | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
14701
14702
14703### OH_Drawing_SetTextStyleFontStyleStruct()
14704
14705```
14706void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle )
14707```
14708
14709**Description**
14710
14711Sets the font style, including the font weight, width, and slant, for a text style.
14712
14713**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14714
14715**Since**: 12
14716
14717**Parameters**
14718
14719| Name                                                         | Description                                                  |
14720| ------------------------------------------------------------ | ------------------------------------------------------------ |
14721| OH_Drawing_TextStyle                                         | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14722| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
14723
14724
14725### OH_Drawing_SetTextStyleFontWeight()
14726
14727```
14728void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int)
14729```
14730
14731**Description**
14732
14733Sets the font weight for a text style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
14734
14735**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14736
14737**Since**: 8
14738
14739**Parameters**
14740
14741| Name                 | Description                                                  |
14742| -------------------- | ------------------------------------------------------------ |
14743| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14744| int                  | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
14745
14746
14747### OH_Drawing_SetTextStyleForegroundBrush()
14748
14749```
14750void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14751```
14752
14753**Description**
14754
14755Sets the foreground brush for a text style.
14756
14757**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14758
14759**Since**: 12
14760
14761**Parameters**
14762
14763| Name                 | Description                                                  |
14764| -------------------- | ------------------------------------------------------------ |
14765| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14766| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
14767
14768
14769### OH_Drawing_SetTextStyleForegroundPen()
14770
14771```
14772void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14773```
14774
14775**Description**
14776
14777Sets the foreground pen for a text style.
14778
14779**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14780
14781**Since**: 12
14782
14783**Parameters**
14784
14785| Name                 | Description                                                  |
14786| -------------------- | ------------------------------------------------------------ |
14787| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14788| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
14789
14790
14791### OH_Drawing_SetTextStyleHalfLeading()
14792
14793```
14794void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool  )
14795```
14796
14797**Description**
14798
14799Sets whether to enable half leading for a text style.
14800
14801**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14802
14803**Since**: 11
14804
14805**Parameters**
14806
14807| Name                 | Description                                                  |
14808| -------------------- | ------------------------------------------------------------ |
14809| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14810| bool                 | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
14811
14812
14813### OH_Drawing_SetTextStyleLetterSpacing()
14814
14815```
14816void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double  )
14817```
14818
14819**Description**
14820
14821Sets the letter spacing for a text style.
14822
14823**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14824
14825**Since**: 11
14826
14827**Parameters**
14828
14829| Name                 | Description                                                  |
14830| -------------------- | ------------------------------------------------------------ |
14831| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14832| double               | Letter spacing.                                              |
14833
14834
14835### OH_Drawing_SetTextStyleLocale()
14836
14837```
14838void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char*  )
14839```
14840
14841**Description**
14842
14843Sets the locale for a text style.
14844
14845**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14846
14847**Since**: 8
14848
14849**Parameters**
14850
14851| Name                 | Description                                                  |
14852| -------------------- | ------------------------------------------------------------ |
14853| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14854| char                 | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. |
14855
14856
14857### OH_Drawing_SetTextStyleWordSpacing()
14858
14859```
14860void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double  )
14861```
14862
14863**Description**
14864
14865Sets the word spacing for a text style.
14866
14867**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14868
14869**Since**: 11
14870
14871**Parameters**
14872
14873| Name                 | Description                                                  |
14874| -------------------- | ------------------------------------------------------------ |
14875| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14876| double               | Letter spacing.                                              |
14877
14878
14879### OH_Drawing_SetTypographyStyleFontStyleStruct()
14880
14881```
14882void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle )
14883```
14884
14885**Description**
14886
14887Sets the font style, including the font weight, width, and slant, for the default text style of a typography style.
14888
14889**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14890
14891**Since**: 12
14892
14893**Parameters**
14894
14895| Name                                                         | Description                                                  |
14896| ------------------------------------------------------------ | ------------------------------------------------------------ |
14897| OH_Drawing_TypographyStyle                                   | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
14898| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
14899
14900
14901### OH_Drawing_SetTypographyStyleTextStrutStyle()
14902
14903```
14904void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle*  )
14905```
14906
14907**Description**
14908
14909Sets the strut style for a typography style.
14910
14911**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14912
14913**Since**: 12
14914
14915**Parameters**
14916
14917| Name                                                     | Description                                                  |
14918| -------------------------------------------------------- | ------------------------------------------------------------ |
14919| OH_Drawing_TypographyStyle                               | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
14920| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | Pointer to an [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) object, which is obtained by calling [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle). |
14921
14922
14923### OH_Drawing_SetTypographyTextAlign()
14924
14925```
14926void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int  )
14927```
14928
14929**Description**
14930
14931Sets the text alignment mode.
14932
14933**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14934
14935**Since**: 8
14936
14937**Parameters**
14938
14939| Name                       | Description                                                  |
14940| -------------------------- | ------------------------------------------------------------ |
14941| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
14942| int                        | Text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign). |
14943
14944
14945### OH_Drawing_SetTypographyTextBreakStrategy()
14946
14947```
14948void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int  )
14949```
14950
14951**Description**
14952
14953Sets the text break strategy.
14954
14955**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14956
14957**Since**: 11
14958
14959**Parameters**
14960
14961| Name                       | Description                                                  |
14962| -------------------------- | ------------------------------------------------------------ |
14963| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
14964| int                        | Text break strategy. For details about the available options, see [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy). |
14965
14966
14967### OH_Drawing_SetTypographyTextDirection()
14968
14969```
14970void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int  )
14971```
14972
14973**Description**
14974
14975Sets the text direction in a typography style.
14976
14977**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14978
14979**Since**: 8
14980
14981**Parameters**
14982
14983| Name                       | Description                                                  |
14984| -------------------------- | ------------------------------------------------------------ |
14985| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
14986| int                        | Text direction. For details about the available options, see [OH_Drawing_TextDirection](#oh_drawing_textdirection). |
14987
14988
14989### OH_Drawing_SetTypographyTextEllipsis()
14990
14991```
14992void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis )
14993```
14994
14995**Description**
14996
14997Sets the ellipsis text for a typography style.
14998
14999**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15000
15001**Since**: 12
15002
15003**Parameters**
15004
15005| Name                       | Description                                                  |
15006| -------------------------- | ------------------------------------------------------------ |
15007| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15008| char                       | Pinter to an ellipsis style.                                 |
15009
15010
15011### OH_Drawing_SetTypographyTextEllipsisModal()
15012
15013```
15014void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int)
15015```
15016
15017**Description**
15018
15019Sets the text ellipsis style for a typography style.
15020
15021**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15022
15023**Since**: 11
15024
15025**Parameters**
15026
15027| Name                       | Description                                                  |
15028| -------------------------- | ------------------------------------------------------------ |
15029| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15030| int                        | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). |
15031
15032
15033### OH_Drawing_SetTypographyTextFontFamily()
15034
15035```
15036void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char*  )
15037```
15038
15039**Description**
15040
15041Sets the font family name for text.
15042
15043**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15044
15045**Since**: 12
15046
15047**Parameters**
15048
15049| Name                       | Description                                                  |
15050| -------------------------- | ------------------------------------------------------------ |
15051| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15052| char                       | Pointer to the name of the font family.                      |
15053
15054
15055### OH_Drawing_SetTypographyTextFontHeight()
15056
15057```
15058void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double  )
15059```
15060
15061**Description**
15062
15063Sets the font height for text.
15064
15065**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15066
15067**Since**: 12
15068
15069**Parameters**
15070
15071| Name                       | Description                                                  |
15072| -------------------------- | ------------------------------------------------------------ |
15073| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15074| double                     | Font height.                                                 |
15075
15076
15077### OH_Drawing_SetTypographyTextFontSize()
15078
15079```
15080void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double  )
15081```
15082
15083**Description**
15084
15085Sets the font size for text.
15086
15087**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15088
15089**Since**: 12
15090
15091**Parameters**
15092
15093| Name                       | Description                                                  |
15094| -------------------------- | ------------------------------------------------------------ |
15095| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15096| double                     | Font size, which must be greater than 0.                     |
15097
15098
15099### OH_Drawing_SetTypographyTextFontStyle()
15100
15101```
15102void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int)
15103```
15104
15105**Description**
15106
15107Sets the default font style for a typography style.
15108
15109**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15110
15111**Since**: 12
15112
15113**Parameters**
15114
15115| Name                       | Description                                                  |
15116| -------------------------- | ------------------------------------------------------------ |
15117| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15118| int                        | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
15119
15120
15121### OH_Drawing_SetTypographyTextFontWeight()
15122
15123```
15124void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int)
15125```
15126
15127**Description**
15128
15129Sets the default font weight for a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
15130
15131**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15132
15133**Since**: 12
15134
15135**Parameters**
15136
15137| Name                       | Description                                                  |
15138| -------------------------- | ------------------------------------------------------------ |
15139| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15140| int                        | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
15141
15142
15143### OH_Drawing_SetTypographyTextHalfLeading()
15144
15145```
15146void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool  )
15147```
15148
15149**Description**
15150
15151Sets whether to enable half leading for text.
15152
15153**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15154
15155**Since**: 12
15156
15157**Parameters**
15158
15159| Name                       | Description                                                  |
15160| -------------------------- | ------------------------------------------------------------ |
15161| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15162| bool                       | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
15163
15164
15165### OH_Drawing_SetTypographyTextLineStyleFontFamilies()
15166
15167```
15168void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] )
15169```
15170
15171**Description**
15172
15173Sets the font families for a text line style.
15174
15175**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15176
15177**Since**: 12
15178
15179**Parameters**
15180
15181| Name                       | Description                                                  |
15182| -------------------------- | ------------------------------------------------------------ |
15183| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15184| int                        | Number of font families.                                     |
15185| char                       | Pointer to the font families.                                |
15186
15187
15188### OH_Drawing_SetTypographyTextLineStyleFontHeight()
15189
15190```
15191void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double  )
15192```
15193
15194**Description**
15195
15196Sets the font height for a text line style.
15197
15198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15199
15200**Since**: 12
15201
15202**Parameters**
15203
15204| Name                       | Description                                                  |
15205| -------------------------- | ------------------------------------------------------------ |
15206| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15207| double                     | Font height.                                                 |
15208
15209
15210### OH_Drawing_SetTypographyTextLineStyleFontSize()
15211
15212```
15213void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double  )
15214```
15215
15216**Description**
15217
15218Sets the font size for a text line style.
15219
15220**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15221
15222**Since**: 12
15223
15224**Parameters**
15225
15226| Name                       | Description                                                  |
15227| -------------------------- | ------------------------------------------------------------ |
15228| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15229| double                     | Font size, which must be greater than 0.                     |
15230
15231
15232### OH_Drawing_SetTypographyTextLineStyleFontStyle()
15233
15234```
15235void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int  )
15236```
15237
15238**Description**
15239
15240Sets the font style of the strut style in a typography style.
15241
15242**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15243
15244**Since**: 12
15245
15246**Parameters**
15247
15248| Name                       | Description                                                  |
15249| -------------------------- | ------------------------------------------------------------ |
15250| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15251| int                        | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
15252
15253
15254### OH_Drawing_SetTypographyTextLineStyleFontWeight()
15255
15256```
15257void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int)
15258```
15259
15260**Description**
15261
15262Sets the text font weight of the strut style in a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
15263
15264**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15265
15266**Since**: 12
15267
15268**Parameters**
15269
15270| Name                       | Description                                                  |
15271| -------------------------- | ------------------------------------------------------------ |
15272| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15273| int                        | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
15274
15275
15276### OH_Drawing_SetTypographyTextLineStyleHalfLeading()
15277
15278```
15279void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool  )
15280```
15281
15282**Description**
15283
15284Sets whether to enable half leading for the strut style in a typography style.
15285
15286**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15287
15288**Since**: 12
15289
15290**Parameters**
15291
15292| Name                       | Description                                                  |
15293| -------------------------- | ------------------------------------------------------------ |
15294| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15295| bool                       | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
15296
15297
15298### OH_Drawing_SetTypographyTextLineStyleOnly()
15299
15300```
15301void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool  )
15302```
15303
15304**Description**
15305
15306Sets whether to enable the text line style only.
15307
15308**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15309
15310**Since**: 12
15311
15312**Parameters**
15313
15314| Name                       | Description                                                  |
15315| -------------------------- | ------------------------------------------------------------ |
15316| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15317| bool                       | Whether to enable the text line style only. The value **true** means to enable the text line style only, and **false** means the opposite. |
15318
15319
15320### OH_Drawing_SetTypographyTextLineStyleSpacingScale()
15321
15322```
15323void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double  )
15324```
15325
15326**Description**
15327
15328Sets the spacing ratio of the text line style.
15329
15330**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15331
15332**Since**: 12
15333
15334**Parameters**
15335
15336| Name                       | Description                                                  |
15337| -------------------------- | ------------------------------------------------------------ |
15338| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15339| double                     | Spacing ratio.                                               |
15340
15341
15342### OH_Drawing_SetTypographyTextLocale()
15343
15344```
15345void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale )
15346```
15347
15348**Description**
15349
15350Sets the locale for a typography style.
15351
15352**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15353
15354**Since**: 12
15355
15356**Parameters**
15357
15358| Name                       | Description                                                  |
15359| -------------------------- | ------------------------------------------------------------ |
15360| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15361| char                       | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. |
15362
15363
15364### OH_Drawing_SetTypographyTextMaxLines()
15365
15366```
15367void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int  )
15368```
15369
15370**Description**
15371
15372Sets the maximum number of lines in the text.
15373
15374**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15375
15376**Since**: 8
15377
15378**Parameters**
15379
15380| Name                       | Description                                                  |
15381| -------------------------- | ------------------------------------------------------------ |
15382| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15383| int                        | Maximum number of lines.                                     |
15384
15385### OH_Drawing_SetTypographyTextSplitRatio()
15386
15387```
15388void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio )
15389```
15390
15391**Description**
15392
15393Sets the text split ratio.
15394
15395**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15396
15397**Since**: 12
15398
15399**Parameters**
15400
15401| Name                       | Description                                                  |
15402| -------------------------- | ------------------------------------------------------------ |
15403| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15404| float                      | Text split ratio.                                            |
15405
15406
15407### OH_Drawing_SetTypographyTextStyle()
15408
15409```
15410void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle*  )
15411```
15412
15413**Description**
15414
15415Sets a text style.
15416
15417**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15418
15419**Since**: 12
15420
15421**Parameters**
15422
15423| Name                       | Description                                                  |
15424| -------------------------- | ------------------------------------------------------------ |
15425| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15426| OH_Drawing_TextStyle       | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15427
15428
15429### OH_Drawing_SetTypographyTextUseLineStyle()
15430
15431```
15432void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool  )
15433```
15434
15435**Description**
15436
15437Sets whether to enable the text line style.
15438
15439**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15440
15441**Since**: 12
15442
15443**Parameters**
15444
15445| Name                       | Description                                                  |
15446| -------------------------- | ------------------------------------------------------------ |
15447| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15448| bool                       | Whether to enable the line style. The value **true** means to enable the line style, and **false** means the opposite. |
15449
15450
15451### OH_Drawing_SetTypographyTextWordBreakType()
15452
15453```
15454void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int  )
15455```
15456
15457**Description**
15458
15459Sets the word break type.
15460
15461**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15462
15463**Since**: 11
15464
15465**Parameters**
15466
15467| Name                       | Description                                                  |
15468| -------------------------- | ------------------------------------------------------------ |
15469| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15470| int                        | Word break type. For details about the available options, see [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype). |
15471
15472
15473### OH_Drawing_ShaderEffectCreateImageShader()
15474
15475```
15476OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix*  )
15477```
15478
15479**Description**
15480
15481Creates an **OH_Drawing_ShaderEffect** object for an image shader. You are advised not to use the API for the canvas of the capture type because it affects the performance.
15482
15483Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15484
15485If either **OH_Drawing_Image** or **OH_Drawing_SamplingOptions** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15486
15487If either **tileX** or **tileY** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15488
15489**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15490
15491**Since**: 12
15492
15493**Parameters**
15494
15495| Name                       | Description                                                  |
15496| -------------------------- | ------------------------------------------------------------ |
15497| OH_Drawing_Image           | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
15498| tileX                      | Tile mode of the shader effect in the horizontal direction. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
15499| tileY                      | Tile mode of the shader effect in the vertical direction. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
15500| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. |
15501| OH_Drawing_Matrix          | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If the pointer array is empty, the identity matrix is passed in. |
15502
15503**Returns**
15504
15505Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
15506
15507
15508### OH_Drawing_ShaderEffectCreateLinearGradient()
15509
15510```
15511OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient (const OH_Drawing_Point* startPt, const OH_Drawing_Point* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
15512```
15513
15514**Description**
15515
15516Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.
15517
15518Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15519
15520If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15521
15522If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15523
15524**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15525
15526**Since**: 11
15527
15528**Parameters**
15529
15530| Name                | Description                                                  |
15531| ------------------- | ------------------------------------------------------------ |
15532| startPt             | Start point.                                                 |
15533| endPt               | End point.                                                   |
15534| colors              | Colors to distribute.                                        |
15535| pos                 | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the start point and end point. |
15536| size                | Number of colors and positions (if **pos** is not NULL).     |
15537| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
15538
15539**Returns**
15540
15541Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
15542
15543
15544### OH_Drawing_ShaderEffectCreateRadialGradient()
15545
15546```
15547OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient (const OH_Drawing_Point* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
15548```
15549
15550**Description**
15551
15552Creates an **OH_Drawing_ShaderEffect** object that generates a radial gradient based on the center and radius of a circle. The radial gradient transitions colors from the center to the ending shape in a radial manner.
15553
15554Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15555
15556If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15557
15558If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15559
15560**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15561
15562**Since**: 11
15563
15564**Parameters**
15565
15566| Name                | Description                                                  |
15567| ------------------- | ------------------------------------------------------------ |
15568| centerPt            | Center of the circle.                                        |
15569| radius              | Circle radius of the gradient. The value should be a non-negative number. |
15570| colors              | Colors to distribute in the radial direction.                |
15571| pos                 | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction. |
15572| size                | Number of colors and positions (if **pos** is not NULL).     |
15573| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
15574
15575**Returns**
15576
15577Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
15578
15579
15580### OH_Drawing_ShaderEffectCreateSweepGradient()
15581
15582```
15583OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
15584```
15585
15586**Description**
15587
15588Creates an **OH_Drawing_ShaderEffect** object that generates a sweep gradient based on the center. A sweep gradient paints a gradient in a sweeping arc ranging from 0° to 360°.
15589
15590Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15591
15592If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15593
15594If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15595
15596**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15597
15598**Since**: 11
15599
15600**Parameters**
15601
15602| Name                | Description                                                  |
15603| ------------------- | ------------------------------------------------------------ |
15604| centerPt            | Center of the circle.                                        |
15605| colors              | Colors to distribute.                                        |
15606| pos                 | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the start angle (0°) and end angle (360°). |
15607| size                | Number of colors and positions (if **pos** is not NULL).     |
15608| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
15609
15610**Returns**
15611
15612Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
15613
15614
15615### OH_Drawing_ShaderEffectDestroy()
15616
15617```
15618void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* )
15619```
15620
15621**Description**
15622
15623Destroys an **OH_Drawing_ShaderEffect** object and reclaims the memory occupied by the object.
15624
15625**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15626
15627**Since**: 11
15628
15629**Parameters**
15630
15631| Name                    | Description                                       |
15632| ----------------------- | ------------------------------------------------- |
15633| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. |
15634
15635
15636### OH_Drawing_SurfaceCreateFromGpuContext()
15637
15638```
15639OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info  )
15640```
15641
15642**Description**
15643
15644Creates an **OH_Drawing_Surface** object using the GPU context to manage the content drawn on the canvas.
15645
15646Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15647
15648If **OH_Drawing_GpuContext** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15649
15650**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15651
15652**Since**: 12
15653
15654**Parameters**
15655
15656| Name                                                      | Description                                                  |
15657| --------------------------------------------------------- | ------------------------------------------------------------ |
15658| OH_Drawing_GpuContext                                     | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. |
15659| budgeted                                                  | Whether memory allocation is included in the cache budget. The value **true** means that memory allocation is included in the cache budget, and **false** means the opposite. |
15660| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. |
15661
15662**Returns**
15663
15664Returns the pointer to the [OH_Drawing_Surface](#oh_drawing_surface) object created.
15665
15666
15667### OH_Drawing_SurfaceDestroy()
15668
15669```
15670void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* )
15671```
15672
15673**Description**
15674
15675Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied.
15676
15677**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15678
15679**Since**: 12
15680
15681**Parameters**
15682
15683| Name               | Description                                  |
15684| ------------------ | -------------------------------------------- |
15685| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. |
15686
15687
15688### OH_Drawing_SurfaceGetCanvas()
15689
15690```
15691OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* )
15692```
15693
15694**Description**
15695
15696Obtains a canvas from an **OH_Drawing_Surface** object.
15697
15698Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15699
15700If **OH_Drawing_Surface** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15701
15702**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15703
15704**Since**: 12
15705
15706**Parameters**
15707
15708| Name               | Description                                  |
15709| ------------------ | -------------------------------------------- |
15710| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. |
15711
15712**Returns**
15713
15714Returns the pointer to the [OH_Drawing_Canvas](#oh_drawing_canvas) object created. The pointer returned does not need to be managed by the caller.
15715
15716
15717### OH_Drawing_TextBlobBuilderAllocRunPos()
15718
15719```
15720const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect*  )
15721```
15722
15723**Description**
15724
15725Allocates a run to store glyphs and positions. The pointer returned does not need to be managed by the caller. It can no longer be used after [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) is called.
15726
15727Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15728
15729If either **OH_Drawing_TextBlobBuilder** or **OH_Drawing_Font** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15730
15731**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15732
15733**Since**: 11
15734
15735**Parameters**
15736
15737| Name                       | Description                                                  |
15738| -------------------------- | ------------------------------------------------------------ |
15739| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object.         |
15740| OH_Drawing_Font            | Pointer to an **OH_Drawing_Font** object.                    |
15741| count                      | Number of text blobs.                                        |
15742| OH_Drawing_Rect            | Rectangle of the text blob. The value NULL means that no rectangle is set. |
15743
15744
15745### OH_Drawing_TextBlobBuilderCreate()
15746
15747```
15748OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void )
15749```
15750
15751**Description**
15752
15753Creates an **OH_Drawing_TextBlobBuilder** object.
15754
15755**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15756
15757**Since**: 11
15758
15759**Returns**
15760
15761Returns the pointer to the **OH_Drawing_TextBlobBuilder** object created.
15762
15763
15764### OH_Drawing_TextBlobBuilderDestroy()
15765
15766```
15767void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* )
15768```
15769
15770**Description**
15771
15772Destroys an **OH_Drawing_TextBlobBuilder** object and reclaims the memory occupied by the object.
15773
15774**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15775
15776**Since**: 11
15777
15778**Parameters**
15779
15780| Name                       | Description                                          |
15781| -------------------------- | ---------------------------------------------------- |
15782| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. |
15783
15784
15785### OH_Drawing_TextBlobBuilderMake()
15786
15787```
15788OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* )
15789```
15790
15791**Description**
15792
15793Makes an **OH_Drawing_TextBlob** object from an **OH_Drawing_TextBlobBuilder**.
15794
15795Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15796
15797If **OH_Drawing_TextBlobBuilder** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15798
15799**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15800
15801**Since**: 11
15802
15803**Parameters**
15804
15805| Name                       | Description                                          |
15806| -------------------------- | ---------------------------------------------------- |
15807| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. |
15808
15809**Returns**
15810
15811Returns the pointer to the **OH_Drawing_TextBlob** object created.
15812
15813
15814### OH_Drawing_TextBlobCreateFromPosText()
15815
15816```
15817OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15818```
15819
15820**Description**
15821
15822Creates an **OH_Drawing_TextBlob** object from the text. The coordinates of each character in the **OH_Drawing_TextBlob** object are determined by the coordinate information in the **OH_Drawing_Point2D** array.
15823
15824Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15825
15826If any of **text**, **OH_Drawing_Point2D**, and **OH_Drawing_Font** is NULL or **byteLength** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15827
15828If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15829
15830**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15831
15832**Since**: 12
15833
15834**Parameters**
15835
15836| Name                                               | Description                                                  |
15837| -------------------------------------------------- | ------------------------------------------------------------ |
15838| text                                               | Pointer to the text.                                         |
15839| byteLength                                         | Length of the text, in bytes.                                |
15840| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Pointer to the start address of an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) array. The number of entries in the array is the value obtained by calling [OH_Drawing_FontCountText](#oh_drawing_fontcounttext). |
15841| OH_Drawing_Font                                    | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
15842| OH_Drawing_TextEncoding                            | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
15843
15844**Returns**
15845
15846Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
15847
15848
15849### OH_Drawing_TextBlobCreateFromString()
15850
15851```
15852OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15853```
15854
15855**Description**
15856
15857Creates an **OH_Drawing_TextBlob** object from a string.
15858
15859Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15860
15861If either **str** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15862
15863If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15864
15865**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15866
15867**Since**: 12
15868
15869**Parameters**
15870
15871| Name                    | Description                                                  |
15872| ----------------------- | ------------------------------------------------------------ |
15873| str                     | Pointer to a string.                                         |
15874| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
15875| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). Currently, only **TEXT_ENCODING_UTF8** takes effect, and other encoding types are treated as **TEXT_ENCODING_UTF8**. |
15876
15877**Returns**
15878
15879Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
15880
15881
15882### OH_Drawing_TextBlobCreateFromText()
15883
15884```
15885OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
15886```
15887
15888**Description**
15889
15890Creates an **OH_Drawing_TextBlob** object from the text.
15891
15892Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15893
15894If either **text** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15895
15896If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
15897
15898**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15899
15900**Since**: 12
15901
15902**Parameters**
15903
15904| Name                    | Description                                                  |
15905| ----------------------- | ------------------------------------------------------------ |
15906| text                    | Pointer to the text.                                         |
15907| byteLength              | Length of the text, in bytes.                                |
15908| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
15909| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
15910
15911**Returns**
15912
15913Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
15914
15915
15916### OH_Drawing_TextBlobDestroy()
15917
15918```
15919void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* )
15920```
15921
15922**Description**
15923
15924Destroys an **OH_Drawing_TextBlob** object and reclaims the memory occupied by the object.
15925
15926**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15927
15928**Since**: 11
15929
15930**Parameters**
15931
15932| Name                | Description                                   |
15933| ------------------- | --------------------------------------------- |
15934| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object. |
15935
15936
15937### OH_Drawing_TextBlobGetBounds()
15938
15939```
15940void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect*  )
15941```
15942
15943**Description**
15944
15945Obtains the bounds of an **OH_Drawing_TextBlob** object.
15946
15947Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15948
15949If either **OH_Drawing_TextBlob** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15950
15951**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15952
15953**Since**: 12
15954
15955**Parameters**
15956
15957| Name                | Description                                                  |
15958| ------------------- | ------------------------------------------------------------ |
15959| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object. |
15960| OH_Drawing_Rect     | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). |
15961
15962
15963### OH_Drawing_TextStyleAddFontFeature()
15964
15965```
15966void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value )
15967```
15968
15969**Description**
15970
15971Adds a font feature for a text style.
15972
15973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15974
15975**Since**: 12
15976
15977**Parameters**
15978
15979| Name                 | Description                                                  |
15980| -------------------- | ------------------------------------------------------------ |
15981| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15982| char                 | Pointer to the string identified by the keyword in the font feature key-value pair. |
15983| int                  | Value of the font feature key-value pair.                    |
15984
15985
15986### OH_Drawing_TextStyleAddFontVariation()
15987
15988```
15989void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* , const float  )
15990```
15991
15992**Description**
15993
15994Adds a font variation. This function takes effect only when the corresponding font file (.ttf file) supports variable adjustment. Otherwise, calling this function does not take effect.
15995
15996**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15997
15998**Since**: 12
15999
16000**Parameters**
16001
16002| Name                 | Description                                                  |
16003| -------------------- | ------------------------------------------------------------ |
16004| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16005| char\*               | Pointer to the key in the font variation key-value pair. Currently, only **'wght'** is supported, indicating the font weight. |
16006| float                | Value of the font variation key-value pair. Currently, the value range of **'wght'** for the default font is \[0,900\]. |
16007
16008
16009### OH_Drawing_TextStyleAddShadow()
16010
16011```
16012void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow*  )
16013```
16014
16015**Description**
16016
16017Adds a shadow to a text shadow container.
16018
16019**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16020
16021**Since**: 12
16022
16023**Parameters**
16024
16025| Name                  | Description                                                  |
16026| --------------------- | ------------------------------------------------------------ |
16027| OH_Drawing_TextStyle  | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16028| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
16029
16030
16031### OH_Drawing_TextStyleClearFontFeature()
16032
16033```
16034void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* )
16035```
16036
16037**Description**
16038
16039Clears all the contents in a font feature map container of a text style.
16040
16041**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16042
16043**Since**: 12
16044
16045**Parameters**
16046
16047| Name                 | Description                                                  |
16048| -------------------- | ------------------------------------------------------------ |
16049| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16050
16051
16052### OH_Drawing_TextStyleClearShadows()
16053
16054```
16055void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* )
16056```
16057
16058**Description**
16059
16060Clears all shadows in a text shadow container.
16061
16062**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16063
16064**Since**: 12
16065
16066**Parameters**
16067
16068| Name                 | Description                                                  |
16069| -------------------- | ------------------------------------------------------------ |
16070| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16071
16072
16073### OH_Drawing_TextStyleDestroyFontFamilies()
16074
16075```
16076void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num)
16077```
16078
16079**Description**
16080
16081Reclaims the memory occupied by the font families, where **num** specifies the number of font families.
16082
16083**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16084
16085**Since**: 12
16086
16087**Parameters**
16088
16089| Name         | Description                          |
16090| ------------ | ------------------------------------ |
16091| fontFamilies | Double pointer to the font families. |
16092| num          | Number of font families.             |
16093
16094
16095### OH_Drawing_TextStyleDestroyFontFeatures()
16096
16097```
16098void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize )
16099```
16100
16101**Description**
16102
16103Reclaims the memory occupied by the struct array that holds all the font features.
16104
16105**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16106
16107**Since**: 12
16108
16109**Parameters**
16110
16111| Name                                                       | Description                                                  |
16112| ---------------------------------------------------------- | ------------------------------------------------------------ |
16113| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | Pointer to the struct array that holds all the font features. The pointer is obtained by calling [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures). |
16114| fontFeatureSize                                            | Size of the struct array that holds all the font features.   |
16115
16116
16117### OH_Drawing_TextStyleGetBackgroundBrush()
16118
16119```
16120void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
16121```
16122
16123**Description**
16124
16125Obtains the background brush.
16126
16127**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16128
16129**Since**: 12
16130
16131**Parameters**
16132
16133| Name                 | Description                                                  |
16134| -------------------- | ------------------------------------------------------------ |
16135| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16136| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
16137
16138
16139### OH_Drawing_TextStyleGetBackgroundPen()
16140
16141```
16142void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
16143```
16144
16145**Description**
16146
16147Obtains the background pen.
16148
16149**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16150
16151**Since**: 12
16152
16153**Parameters**
16154
16155| Name                 | Description                                                  |
16156| -------------------- | ------------------------------------------------------------ |
16157| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16158| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
16159
16160
16161### OH_Drawing_TextStyleGetBaseline()
16162
16163```
16164OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* )
16165```
16166
16167**Description**
16168
16169Obtains the baseline of a text style.
16170
16171**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16172
16173**Since**: 12
16174
16175**Parameters**
16176
16177| Name                 | Description                                                  |
16178| -------------------- | ------------------------------------------------------------ |
16179| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16180
16181**Returns**
16182
16183Returns the text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline).
16184
16185
16186### OH_Drawing_TextStyleGetBaselineShift()
16187
16188```
16189double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle*)
16190```
16191
16192**Description**
16193
16194Obtains the baseline drift of a text style.
16195
16196**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16197
16198**Since**: 12
16199
16200**Parameters**
16201
16202| Name                 | Description                                                  |
16203| -------------------- | ------------------------------------------------------------ |
16204| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16205
16206**Returns**
16207
16208Returns the baseline drift.
16209
16210
16211### OH_Drawing_TextStyleGetColor()
16212
16213```
16214uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* )
16215```
16216
16217**Description**
16218
16219Obtains the color of a text style.
16220
16221**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16222
16223**Since**: 12
16224
16225**Parameters**
16226
16227| Name                 | Description                                                  |
16228| -------------------- | ------------------------------------------------------------ |
16229| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16230
16231**Returns**
16232
16233Returns the text color.
16234
16235
16236### OH_Drawing_TextStyleGetDecorationStyle()
16237
16238```
16239OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* )
16240```
16241
16242**Description**
16243
16244Obtains the decoration style of a text style.
16245
16246**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16247
16248**Since**: 12
16249
16250**Parameters**
16251
16252| Name                 | Description                                                  |
16253| -------------------- | ------------------------------------------------------------ |
16254| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16255
16256**Returns**
16257
16258Returns the text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle).
16259
16260
16261### OH_Drawing_TextStyleGetFontFamilies()
16262
16263```
16264char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num )
16265```
16266
16267**Description**
16268
16269Obtains the font families of a text style.
16270
16271**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16272
16273**Since**: 12
16274
16275**Parameters**
16276
16277| Name                 | Description                                                  |
16278| -------------------- | ------------------------------------------------------------ |
16279| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16280| num                  | Pointer to the number of font families.                      |
16281
16282**Returns**
16283
16284Returns the font families.
16285
16286
16287### OH_Drawing_TextStyleGetFontFeatures()
16288
16289```
16290OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* )
16291```
16292
16293**Description**
16294
16295Obtains all the contents in a font feature map container of a text style.
16296
16297**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16298
16299**Since**: 12
16300
16301**Parameters**
16302
16303| Name                 | Description                                                  |
16304| -------------------- | ------------------------------------------------------------ |
16305| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16306
16307**Returns**
16308
16309Returns the pointer to the [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) struct, which stores all the contents obtained.
16310
16311
16312### OH_Drawing_TextStyleGetFontFeatureSize()
16313
16314```
16315size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* )
16316```
16317
16318**Description**
16319
16320Obtains the size of a font feature map container in a text style.
16321
16322**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16323
16324**Since**: 12
16325
16326**Parameters**
16327
16328| Name                 | Description                                                  |
16329| -------------------- | ------------------------------------------------------------ |
16330| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16331
16332**Returns**
16333
16334Returns the size.
16335
16336
16337### OH_Drawing_TextStyleGetFontHeight()
16338
16339```
16340double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* )
16341```
16342
16343**Description**
16344
16345Obtains the font height of a text style.
16346
16347**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16348
16349**Since**: 12
16350
16351**Parameters**
16352
16353| Name                 | Description                                                  |
16354| -------------------- | ------------------------------------------------------------ |
16355| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16356
16357**Returns**
16358
16359Returns the font height.
16360
16361
16362### OH_Drawing_TextStyleGetFontMetrics()
16363
16364```
16365bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics*  )
16366```
16367
16368**Description**
16369
16370Obtains the font metrics.
16371
16372**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16373
16374**Since**: 12
16375
16376**Parameters**
16377
16378| Name                    | Description                                                  |
16379| ----------------------- | ------------------------------------------------------------ |
16380| OH_Drawing_Typography   | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16381| OH_Drawing_TextStyle    | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16382| OH_Drawing_Font_Metrics | Pointer to an [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) object, which is obtained by calling [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md). |
16383
16384**Returns**
16385
16386Returns **true** if the font metrics are obtained; returns **false** otherwise.
16387
16388
16389### OH_Drawing_TextStyleGetFontSize()
16390
16391```
16392double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle*)
16393```
16394
16395**Description**
16396
16397Obtains the font size of a text style.
16398
16399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16400
16401**Since**: 12
16402
16403**Parameters**
16404
16405| Name                 | Description                                                  |
16406| -------------------- | ------------------------------------------------------------ |
16407| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16408
16409**Returns**
16410
16411Returns the font size.
16412
16413
16414### OH_Drawing_TextStyleGetFontStyle()
16415
16416```
16417OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* )
16418```
16419
16420**Description**
16421
16422Obtains the font style of a text style.
16423
16424**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16425
16426**Since**: 12
16427
16428**Parameters**
16429
16430| Name                 | Description                                                  |
16431| -------------------- | ------------------------------------------------------------ |
16432| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16433
16434**Returns**
16435
16436Returns the font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle).
16437
16438
16439### OH_Drawing_TextStyleGetFontStyleStruct()
16440
16441```
16442OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle)
16443```
16444
16445**Description**
16446
16447Obtains the font style, including the font weight, width, and slant, of a text style.
16448
16449**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16450
16451**Since**: 12
16452
16453**Parameters**
16454
16455| Name                 | Description                                                  |
16456| -------------------- | ------------------------------------------------------------ |
16457| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16458
16459**Returns**
16460
16461Returns the font style, including the font weight, width, and slant.
16462
16463
16464### OH_Drawing_TextStyleGetFontWeight()
16465
16466```
16467OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle*)
16468```
16469
16470**Description**
16471
16472Obtains the font weight of a text style.
16473
16474**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16475
16476**Since**: 12
16477
16478**Parameters**
16479
16480| Name                 | Description                                                  |
16481| -------------------- | ------------------------------------------------------------ |
16482| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16483
16484**Returns**
16485
16486Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight).
16487
16488
16489### OH_Drawing_TextStyleGetForegroundBrush()
16490
16491```
16492void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
16493```
16494
16495**Description**
16496
16497Obtains the foreground brush of a text style.
16498
16499**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16500
16501**Since**: 12
16502
16503**Parameters**
16504
16505| Name                 | Description                                                  |
16506| -------------------- | ------------------------------------------------------------ |
16507| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16508| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
16509
16510
16511### OH_Drawing_TextStyleGetForegroundPen()
16512
16513```
16514void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
16515```
16516
16517**Description**
16518
16519Obtains the foreground pen of a text style.
16520
16521**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16522
16523**Since**: 12
16524
16525**Parameters**
16526
16527| Name                 | Description                                                  |
16528| -------------------- | ------------------------------------------------------------ |
16529| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16530| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
16531
16532
16533### OH_Drawing_TextStyleGetHalfLeading()
16534
16535```
16536bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle*)
16537```
16538
16539**Description**
16540
16541Checks whether half leading is enabled for a text style.
16542
16543**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16544
16545**Since**: 12
16546
16547**Parameters**
16548
16549| Name                 | Description                                                  |
16550| -------------------- | ------------------------------------------------------------ |
16551| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16552
16553**Returns**
16554
16555Returns **true** if half leading is enabled; returns **false** otherwise.
16556
16557
16558### OH_Drawing_TextStyleGetLetterSpacing()
16559
16560```
16561double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle*)
16562```
16563
16564**Description**
16565
16566Obtains the letter spacing of a text style.
16567
16568**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16569
16570**Since**: 12
16571
16572**Parameters**
16573
16574| Name                 | Description                                                  |
16575| -------------------- | ------------------------------------------------------------ |
16576| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16577
16578**Returns**
16579
16580Returns the letter spacing.
16581
16582
16583### OH_Drawing_TextStyleGetLocale()
16584
16585```
16586const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle*)
16587```
16588
16589**Description**
16590
16591Obtains the locale of a text style.
16592
16593**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16594
16595**Since**: 12
16596
16597**Parameters**
16598
16599| Name                 | Description                                                  |
16600| -------------------- | ------------------------------------------------------------ |
16601| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16602
16603**Returns**
16604
16605Returns the pointer to the locale, in the format of language-country. For example, zh-CN indicates Chinese (China), and en-US indicates English (United States). For details, see BCP 47.
16606
16607
16608### OH_Drawing_TextStyleGetShadowCount()
16609
16610```
16611int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* )
16612```
16613
16614**Description**
16615
16616Obtains the size of a text shadow container.
16617
16618**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16619
16620**Since**: 12
16621
16622**Parameters**
16623
16624| Name                 | Description                                                  |
16625| -------------------- | ------------------------------------------------------------ |
16626| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16627
16628**Returns**
16629
16630Returns the size.
16631
16632
16633### OH_Drawing_TextStyleGetShadows()
16634
16635```
16636OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* )
16637```
16638
16639**Description**
16640
16641Obtains a text shadow container. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) to release the pointer to the object.
16642
16643**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16644
16645**Since**: 12
16646
16647**Parameters**
16648
16649| Name                 | Description                                                  |
16650| -------------------- | ------------------------------------------------------------ |
16651| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16652
16653**Returns**
16654
16655Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object.
16656
16657
16658### OH_Drawing_TextStyleGetShadowWithIndex()
16659
16660```
16661OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int  )
16662```
16663
16664**Description**
16665
16666Obtains a shadow with a given index in a text shadow container.
16667
16668**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16669
16670**Since**: 12
16671
16672**Parameters**
16673
16674| Name                 | Description                                                  |
16675| -------------------- | ------------------------------------------------------------ |
16676| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16677| int                  | Index.                                                       |
16678
16679**Returns**
16680
16681Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object.
16682
16683
16684### OH_Drawing_TextStyleGetWordSpacing()
16685
16686```
16687double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle*)
16688```
16689
16690**Description**
16691
16692Obtains the word spacing of a text style.
16693
16694**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16695
16696**Since**: 12
16697
16698**Parameters**
16699
16700| Name                 | Description                                                  |
16701| -------------------- | ------------------------------------------------------------ |
16702| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16703
16704**Returns**
16705
16706Returns the word spacing.
16707
16708
16709### OH_Drawing_TextStyleIsAttributeMatched()
16710
16711```
16712bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType )
16713```
16714
16715**Description**
16716
16717Checks whether two text styles have the same text style type.
16718
16719**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16720
16721**Since**: 12
16722
16723**Parameters**
16724
16725| Name          | Description                                                  |
16726| ------------- | ------------------------------------------------------------ |
16727| style         | Pointer to the first text style.                             |
16728| comparedStyle | Pointer to the second text style.                            |
16729| textStyleType | Text style type. For details about the available options, see [OH_Drawing_TextStyleType](#oh_drawing_textstyletype). |
16730
16731**Returns**
16732
16733Returns **true** if the two are the same; returns **false** otherwise.
16734
16735
16736### OH_Drawing_TextStyleIsEqual()
16737
16738```
16739bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
16740```
16741
16742**Description**
16743
16744Checks whether two text styles are equal. The word width property is not involved in the comparison.
16745
16746**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16747
16748**Since**: 12
16749
16750**Parameters**
16751
16752| Name          | Description                       |
16753| ------------- | --------------------------------- |
16754| style         | Pointer to the first text style.  |
16755| comparedStyle | Pointer to the second text style. |
16756
16757**Returns**
16758
16759Returns **true** if the two are equal; returns **false** otherwise.
16760
16761
16762### OH_Drawing_TextStyleIsEqualByFont()
16763
16764```
16765bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
16766```
16767
16768**Description**
16769
16770Checks whether the font style properties of two text styles are equal.
16771
16772**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16773
16774**Since**: 12
16775
16776**Parameters**
16777
16778| Name          | Description                       |
16779| ------------- | --------------------------------- |
16780| style         | Pointer to the first text style.  |
16781| comparedStyle | Pointer to the second text style. |
16782
16783**Returns**
16784
16785Returns **true** if the two are equal; returns **false** otherwise.
16786
16787
16788### OH_Drawing_TextStyleIsPlaceholder()
16789
16790```
16791bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style)
16792```
16793
16794**Description**
16795
16796Checks whether a placeholder is set for a text style.
16797
16798**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16799
16800**Since**: 12
16801
16802**Parameters**
16803
16804| Name                 | Description                                                  |
16805| -------------------- | ------------------------------------------------------------ |
16806| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16807
16808**Returns**
16809
16810Returns **true** if a placeholder is set; returns **false** otherwise.
16811
16812
16813### OH_Drawing_TextStyleSetBackgroundRect()
16814
16815```
16816void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId )
16817```
16818
16819**Description**
16820
16821Sets a background rectangle and style ID for a text style. The style ID is valid only when the background box is a rounded rectangle.
16822
16823**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16824
16825**Since**: 12
16826
16827**Parameters**
16828
16829| Name                                                         | Description                                                  |
16830| ------------------------------------------------------------ | ------------------------------------------------------------ |
16831| OH_Drawing_TextStyle                                         | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16832| [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | Pointer to an [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) object. |
16833| int                                                          | Style ID. The style ID is valid only when the background box is a rounded rectangle. Text processing is divided into multiple segments. Each segment has its own text style. **id** indicates the sequence number of the background box in which the segment is drawn. If the ID of each segment in a row is 0, all segments are drawn in the same background box. If the IDs in a row are 0 and 1, the segment whose ID is 0 is drawn in a background box, the segment whose ID is 1 is drawn in another background box. Other cases can be deduced in the same way. |
16834
16835
16836### OH_Drawing_TextStyleSetBaselineShift()
16837
16838```
16839void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle*, double lineShift)
16840```
16841
16842**Description**
16843
16844Sets a baseline drift for a text style.
16845
16846**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16847
16848**Since**: 12
16849
16850**Parameters**
16851
16852| Name                 | Description                                                  |
16853| -------------------- | ------------------------------------------------------------ |
16854| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16855| double               | Baseline drift of the text style.                            |
16856
16857
16858### OH_Drawing_TextStyleSetPlaceholder()
16859
16860```
16861void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style)
16862```
16863
16864**Description**
16865
16866Sets a placeholder for a text style.
16867
16868**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16869
16870**Since**: 12
16871
16872**Parameters**
16873
16874| Name                 | Description                                                  |
16875| -------------------- | ------------------------------------------------------------ |
16876| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16877
16878
16879### OH_Drawing_TypefaceCreateDefault()
16880
16881```
16882OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void )
16883```
16884
16885**Description**
16886
16887Creates a default **OH_Drawing_Typeface** object.
16888
16889**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16890
16891**Since**: 11
16892
16893**Returns**
16894
16895Returns the pointer to the **OH_Drawing_Typeface** object created.
16896
16897
16898### OH_Drawing_TypefaceCreateFromFile()
16899
16900```
16901OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index )
16902```
16903
16904**Description**
16905
16906Creates an **OH_Drawing_Typeface** object through a file.
16907
16908Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
16909
16910If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
16911
16912**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16913
16914**Since**: 12
16915
16916**Parameters**
16917
16918| Name  | Description               |
16919| ----- | ------------------------- |
16920| path  | Pointer to the file path. |
16921| index | File index.               |
16922
16923**Returns**
16924
16925Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created.
16926
16927
16928### OH_Drawing_TypefaceCreateFromStream()
16929
16930```
16931OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index )
16932```
16933
16934**Description**
16935
16936Creates an **OH_Drawing_Typeface** object through a memory stream. If the memory stream is an invalid font file, a null pointer is returned. After the memory stream is passed in, the ownership is transferred and you cannot release it.
16937
16938Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
16939
16940If **OH_Drawing_MemoryStream** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
16941
16942**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16943
16944**Since**: 12
16945
16946**Parameters**
16947
16948| Name                    | Description                                                  |
16949| ----------------------- | ------------------------------------------------------------ |
16950| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. |
16951| index                   | Index of the memory stream.                                  |
16952
16953**Returns**
16954
16955Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created.
16956
16957
16958### OH_Drawing_TypefaceDestroy()
16959
16960```
16961void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* )
16962```
16963
16964**Description**
16965
16966Destroys an **OH_Drawing_Typeface** object and reclaims the memory occupied by the object.
16967
16968**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16969
16970**Since**: 11
16971
16972**Parameters**
16973
16974| Name                | Description                                   |
16975| ------------------- | --------------------------------------------- |
16976| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. |
16977
16978
16979### OH_Drawing_TypographyDestroyEllipsis()
16980
16981```
16982void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis)
16983```
16984
16985**Description**
16986
16987Reclaims the memory occupied by the text ellipsis names.
16988
16989**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16990
16991**Since**: 12
16992
16993**Parameters**
16994
16995| Name     | Description                         |
16996| -------- | ----------------------------------- |
16997| ellipsis | Pointer to the text ellipsis names. |
16998
16999
17000### OH_Drawing_TypographyDestroyLineFontMetrics()
17001
17002```
17003void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* )
17004```
17005
17006**Description**
17007
17008Reclaims the memory occupied by the struct array that holds all the font metrics of a given line.
17009
17010**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17011
17012**Since**: 12
17013
17014**Parameters**
17015
17016| Name                                                         | Description                                       |
17017| ------------------------------------------------------------ | ------------------------------------------------- |
17018| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Pointer to the first address of the struct array. |
17019
17020
17021### OH_Drawing_TypographyDidExceedMaxLines()
17022
17023```
17024bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* )
17025```
17026
17027**Description**
17028
17029Checks whether the maximum number of lines of a typography object is exceeded. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. If the maximum number of lines is not set by calling [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines), **false** is returned.
17030
17031**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17032
17033**Since**: 11
17034
17035**Parameters**
17036
17037| Name                  | Description                                                  |
17038| --------------------- | ------------------------------------------------------------ |
17039| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17040
17041**Returns**
17042
17043Returns **true** if the maximum number of lines is exceeded; returns **false** otherwise.
17044
17045
17046### OH_Drawing_TypographyGetAlphabeticBaseline()
17047
17048```
17049double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* )
17050```
17051
17052**Description**
17053
17054Obtains the alphabetic baseline in a typography object.
17055
17056**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17057
17058**Since**: 9
17059
17060**Parameters**
17061
17062| Name                  | Description                                                  |
17063| --------------------- | ------------------------------------------------------------ |
17064| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17065
17066**Returns**
17067
17068Returns the alphabetic baseline.
17069
17070
17071### OH_Drawing_TypographyGetEffectiveAlignment()
17072
17073```
17074int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
17075```
17076
17077**Description**
17078
17079Obtains the text alignment mode.
17080
17081**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17082
17083**Since**: 12
17084
17085**Parameters**
17086
17087| Name                       | Description                                                  |
17088| -------------------------- | ------------------------------------------------------------ |
17089| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17090
17091**Returns**
17092
17093Returns the text alignment mode.
17094
17095
17096### OH_Drawing_TypographyGetGlyphPositionAtCoordinate()
17097
17098```
17099OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double  )
17100```
17101
17102**Description**
17103
17104Obtains the position and affinity of the glyph at the given coordinates.
17105
17106**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17107
17108**Since**: 11
17109
17110**Parameters**
17111
17112| Name                  | Description                                                  |
17113| --------------------- | ------------------------------------------------------------ |
17114| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17115| double                | X coordinate.                                                |
17116| double                | Y coordinate.                                                |
17117
17118**Returns**
17119
17120Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph.
17121
17122
17123### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster()
17124
17125```
17126OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double  )
17127```
17128
17129**Description**
17130
17131Obtains the position and affinity of the glyph cluster to which the glyph at the given coordinates belongs. The glyph cluster is a container that holds one or more glyphs.
17132
17133**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17134
17135**Since**: 11
17136
17137**Parameters**
17138
17139| Name                  | Description                                                  |
17140| --------------------- | ------------------------------------------------------------ |
17141| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17142| double                | X coordinate.                                                |
17143| double                | Y coordinate.                                                |
17144
17145**Returns**
17146
17147Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph cluster.
17148
17149
17150### OH_Drawing_TypographyGetHeight()
17151
17152```
17153double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* )
17154```
17155
17156**Description**
17157
17158Obtains the overall height of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17159
17160**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17161
17162**Since**: 9
17163
17164**Parameters**
17165
17166| Name                  | Description                                                  |
17167| --------------------- | ------------------------------------------------------------ |
17168| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17169
17170**Returns**
17171
17172Returns the height.
17173
17174
17175### OH_Drawing_TypographyGetIdeographicBaseline()
17176
17177```
17178double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* )
17179```
17180
17181**Description**
17182
17183Obtains the ideographic baseline in a typography object.
17184
17185**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17186
17187**Since**: 9
17188
17189**Parameters**
17190
17191| Name                  | Description                                                  |
17192| --------------------- | ------------------------------------------------------------ |
17193| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17194
17195**Returns**
17196
17197Returns the ideographic baseline.
17198
17199
17200### OH_Drawing_TypographyGetIndentsWithIndex()
17201
17202```
17203float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int  )
17204```
17205
17206**Description**
17207
17208Obtains indents with a given index in a typography object. The line index starts from 0.
17209
17210**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17211
17212**Since**: 12
17213
17214**Parameters**
17215
17216| Name                  | Description                                                  |
17217| --------------------- | ------------------------------------------------------------ |
17218| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17219| int                   | Index.                                                       |
17220
17221**Returns**
17222
17223Returns the indents.
17224
17225
17226### OH_Drawing_TypographyGetLineCount()
17227
17228```
17229size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* )
17230```
17231
17232**Description**
17233
17234Obtains the number of lines in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17235
17236**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17237
17238**Since**: 11
17239
17240**Parameters**
17241
17242| Name                  | Description                                                  |
17243| --------------------- | ------------------------------------------------------------ |
17244| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17245
17246**Returns**
17247
17248Returns the number of lines.
17249
17250
17251### OH_Drawing_TypographyGetLineFontMetrics()
17252
17253```
17254OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize )
17255```
17256
17257**Description**
17258
17259Obtains all font metrics from a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. Otherwise, a null pointer is returned. When [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) is no longer required, call [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) to release the pointer to the object.
17260
17261**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17262
17263**Since**: 12
17264
17265**Parameters**
17266
17267| Name                  | Description                                                  |
17268| --------------------- | ------------------------------------------------------------ |
17269| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17270| lineNumber            | Line number, which is an integer. The minimum value is 1, and the maximum value depends on the number of lines parsed by the font engine after text input. If a value greater than the maximum number is passed in, an error value is returned and an error message is printed. |
17271| fontMetricsSize       | Pointer to the size of the struct.                           |
17272
17273**Returns**
17274
17275Returns all the font metrics.
17276
17277
17278### OH_Drawing_TypographyGetLineHeight()
17279
17280```
17281double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int  )
17282```
17283
17284**Description**
17285
17286Obtains the line height in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17287
17288**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17289
17290**Since**: 11
17291
17292**Parameters**
17293
17294| Name                  | Description                                                  |
17295| --------------------- | ------------------------------------------------------------ |
17296| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17297| int                   | Target line.                                                 |
17298
17299**Returns**
17300
17301Returns the height.
17302
17303
17304### OH_Drawing_TypographyGetLineInfo()
17305
17306```
17307bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics*  )
17308```
17309
17310**Description**
17311
17312Obtains the metrics of a given line or the metrics of the first character in a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17313
17314**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17315
17316**Since**: 12
17317
17318**Parameters**
17319
17320| Name                   | Description                                                  |
17321| ---------------------- | ------------------------------------------------------------ |
17322| OH_Drawing_Typography  | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17323| int                    | Row No.                                                      |
17324| bool                   | Whether to obtain the metrics of the entire line. The value **true** means to obtain the metrics of the entire line, and **false** means to obtain the metrics of the first character in the line. |
17325| bool                   | Whether whitespace characters are included in the text width. The value **true** means that whitespace characters are not included, **false** means the opposite. |
17326| OH_Drawing_LineMetrics | Pointer to an [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object, which is obtained by calling [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). |
17327
17328**Returns**
17329
17330Returns **true** if the metrics of the given line or the metrics of the first character in the given line is obtained; returns **false** otherwise.
17331
17332
17333### OH_Drawing_TypographyGetLineMetrics()
17334
17335```
17336OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* )
17337```
17338
17339**Description**
17340
17341Obtains the line metrics in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) is no longer required, call [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) to release the pointer to the object.
17342
17343**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17344
17345**Since**: 12
17346
17347**Parameters**
17348
17349| Name                  | Description                                                  |
17350| --------------------- | ------------------------------------------------------------ |
17351| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17352
17353**Returns**
17354
17355Returns the pointer to the [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object.
17356
17357
17358### OH_Drawing_TypographyGetLineMetricsAt()
17359
17360```
17361bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics*  )
17362```
17363
17364**Description**
17365
17366Obtains the metrics of a given line in a typography object. For details, see [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17367
17368**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17369
17370**Since**: 12
17371
17372**Parameters**
17373
17374| Name                                                       | Description                                                  |
17375| ---------------------------------------------------------- | ------------------------------------------------------------ |
17376| OH_Drawing_Typography                                      | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17377| int                                                        | Line No.                                                     |
17378| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | Pointer to an [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object, which is obtained by calling [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). |
17379
17380**Returns**
17381
17382Returns **true** if the metrics of the given line are obtained; returns **false** otherwise.
17383
17384
17385### OH_Drawing_TypographyGetLineTextRange()
17386
17387```
17388OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool  )
17389```
17390
17391**Description**
17392
17393Obtains the line bounds in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. This function can only be used to obtain the bounds of existing lines. That is, the line index must start from 0, and the maximum index is [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1.
17394
17395**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17396
17397**Since**: 12
17398
17399**Parameters**
17400
17401| Name                  | Description                                                  |
17402| --------------------- | ------------------------------------------------------------ |
17403| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17404| int                   | Row index.                                                   |
17405| bool                  | Whether the returned bounds contain spaces. The value **true** means that the bounds contain spaces, and **false** means the opposite. |
17406
17407**Returns**
17408
17409Returns the pointer to the [OH_Drawing_Range](#oh_drawing_range) object. If the line index is invalid, **start** and **end** in the result value are both **0**.
17410
17411
17412### OH_Drawing_TypographyGetLineWidth()
17413
17414```
17415double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int  )
17416```
17417
17418**Description**
17419
17420Obtains the line width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17421
17422**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17423
17424**Since**: 11
17425
17426**Parameters**
17427
17428| Name                  | Description                                                  |
17429| --------------------- | ------------------------------------------------------------ |
17430| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17431| int                   | Target line.                                                 |
17432
17433**Returns**
17434
17435Returns the width.
17436
17437
17438### OH_Drawing_TypographyGetLongestLine()
17439
17440```
17441double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* )
17442```
17443
17444**Description**
17445
17446Obtains the width of the longest line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.
17447
17448**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17449
17450**Since**: 9
17451
17452**Parameters**
17453
17454| Name                  | Description                                                  |
17455| --------------------- | ------------------------------------------------------------ |
17456| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17457
17458**Returns**
17459
17460Returns the width of the longest line.
17461
17462
17463### OH_Drawing_TypographyGetMaxIntrinsicWidth()
17464
17465```
17466double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* )
17467```
17468
17469**Description**
17470
17471Obtains the maximum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17472
17473**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17474
17475**Since**: 9
17476
17477**Parameters**
17478
17479| Name                  | Description                                                  |
17480| --------------------- | ------------------------------------------------------------ |
17481| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17482
17483**Returns**
17484
17485Returns the maximum intrinsic width.
17486
17487
17488### OH_Drawing_TypographyGetMaxWidth()
17489
17490```
17491double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* )
17492```
17493
17494**Description**
17495
17496Obtains the typography width set by the user. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17497
17498**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17499
17500**Since**: 9
17501
17502**Parameters**
17503
17504| Name                  | Description                                                  |
17505| --------------------- | ------------------------------------------------------------ |
17506| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17507
17508**Returns**
17509
17510Returns the typography width set by the user.
17511
17512
17513### OH_Drawing_TypographyGetMinIntrinsicWidth()
17514
17515```
17516double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* )
17517```
17518
17519**Description**
17520
17521Obtains the minimum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.
17522
17523**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17524
17525**Since**: 9
17526
17527**Parameters**
17528
17529| Name                  | Description                                                  |
17530| --------------------- | ------------------------------------------------------------ |
17531| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17532
17533**Returns**
17534
17535Returns the minimum intrinsic width.
17536
17537
17538### OH_Drawing_TypographyGetRectsForPlaceholders()
17539
17540```
17541OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* )
17542```
17543
17544**Description**
17545
17546Obtains text boxes for placeholders in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.
17547
17548**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17549
17550**Since**: 11
17551
17552**Parameters**
17553
17554| Name                  | Description                                                  |
17555| --------------------- | ------------------------------------------------------------ |
17556| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17557
17558**Returns**
17559
17560Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes.
17561
17562### OH_Drawing_TypographyGetRectsForRange()
17563
17564```
17565OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle  )
17566```
17567
17568**Description**
17569
17570Obtains text boxes in a given range of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.
17571
17572**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17573
17574**Since**: 11
17575
17576**Parameters**
17577
17578| Name                       | Description                                                  |
17579| -------------------------- | ------------------------------------------------------------ |
17580| OH_Drawing_Typography      | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17581| size_t                     | Start position.                                              |
17582| size_t                     | End position.                                                |
17583| OH_Drawing_RectHeightStyle | Height style. For details about the available options, see [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle). |
17584| OH_Drawing_RectWidthStyle  | Width style. For details about the available options, see [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle). |
17585
17586**Returns**
17587
17588Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes.
17589
17590
17591### OH_Drawing_TypographyGetTextAlign()
17592
17593```
17594OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* )
17595```
17596
17597**Description**
17598
17599Obtains the text alignment mode.
17600
17601**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17602
17603**Since**: 12
17604
17605**Parameters**
17606
17607| Name                       | Description                                                  |
17608| -------------------------- | ------------------------------------------------------------ |
17609| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17610
17611**Returns**
17612
17613Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign).
17614
17615
17616### OH_Drawing_TypographyGetTextDirection()
17617
17618```
17619OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* )
17620```
17621
17622**Description**
17623
17624Obtains the text direction of a typography style.
17625
17626**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17627
17628**Since**: 12
17629
17630**Parameters**
17631
17632| Name                       | Description                                                  |
17633| -------------------------- | ------------------------------------------------------------ |
17634| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17635
17636**Returns**
17637
17638Returns the text direction. For details about the available options, see [OH_Drawing_TextDirection](#oh_drawing_textdirection).
17639
17640
17641### OH_Drawing_TypographyGetTextEllipsis()
17642
17643```
17644char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* )
17645```
17646
17647**Description**
17648
17649Obtains the text ellipsis content of a typography style.
17650
17651**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17652
17653**Since**: 12
17654
17655**Parameters**
17656
17657| Name                       | Description                                                  |
17658| -------------------------- | ------------------------------------------------------------ |
17659| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17660
17661**Returns**
17662
17663Returns the pointer to the text ellipsis content obtained.
17664
17665
17666### OH_Drawing_TypographyGetTextMaxLines()
17667
17668```
17669size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* )
17670```
17671
17672**Description**
17673
17674Obtains the maximum number of lines.
17675
17676**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17677
17678**Since**: 12
17679
17680**Parameters**
17681
17682| Name                       | Description                                                  |
17683| -------------------------- | ------------------------------------------------------------ |
17684| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17685
17686**Returns**
17687
17688Returns the maximum number of lines.
17689
17690
17691### OH_Drawing_TypographyGetTextStyle()
17692
17693```
17694OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style)
17695```
17696
17697**Description**
17698
17699Obtains the default text style of a typography style.
17700
17701**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17702
17703**Since**: 12
17704
17705**Parameters**
17706
17707| Name                       | Description                                                  |
17708| -------------------------- | ------------------------------------------------------------ |
17709| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17710
17711**Returns**
17712
17713Returns the pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object. If the object is no longer required, call [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) to release the pointer to the object.
17714
17715
17716### OH_Drawing_TypographyGetUnresolvedGlyphsCount()
17717
17718```
17719int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* )
17720```
17721
17722**Description**
17723
17724Obtains the number of unresolved glyphs in a typography object. This function can be called only after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.
17725
17726**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17727
17728**Since**: 12
17729
17730**Parameters**
17731
17732| Name                  | Description                                                  |
17733| --------------------- | ------------------------------------------------------------ |
17734| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17735
17736**Returns**
17737
17738Returns the number of unresolved glyphs.
17739
17740
17741### OH_Drawing_TypographyGetWordBoundary()
17742
17743```
17744OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t  )
17745```
17746
17747**Description**
17748
17749Obtains the word boundary in a typography object.
17750
17751**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17752
17753**Since**: 11
17754
17755**Parameters**
17756
17757| Name                  | Description                                                  |
17758| --------------------- | ------------------------------------------------------------ |
17759| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17760| size_t                | Index of the word.                                           |
17761
17762**Returns**
17763
17764Returns the [OH_Drawing_Range](#oh_drawing_range) struct that holds the word boundary.
17765
17766
17767### OH_Drawing_TypographyHandlerAddPlaceholder()
17768
17769```
17770void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan*  )
17771```
17772
17773**Description**
17774
17775Adds a placeholder.
17776
17777**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17778
17779**Since**: 11
17780
17781**Parameters**
17782
17783| Name                        | Description                                                  |
17784| --------------------------- | ------------------------------------------------------------ |
17785| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
17786| OH_Drawing_PlaceholderSpan  | Pointer to an [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) object. |
17787
17788
17789### OH_Drawing_TypographyHandlerAddSymbol()
17790
17791```
17792void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol )
17793```
17794
17795**Description**
17796
17797Adds the symbol to use in the typography creation process.
17798
17799**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17800
17801**Since**: 12
17802
17803**Parameters**
17804
17805| Name                        | Description                                                  |
17806| --------------------------- | ------------------------------------------------------------ |
17807| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
17808| uint32_t                    | Symbol. For details about the supported symbols, see the value in the JSON file. For details about the configurable symbols (unicode values in the list view), see [HarmonyOS Symbol](https://developer.huawei.com/consumer/en/design/harmonyos-symbol/). |
17809
17810
17811### OH_Drawing_TypographyHandlerAddText()
17812
17813```
17814void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char*  )
17815```
17816
17817**Description**
17818
17819Adds text.
17820
17821**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17822
17823**Since**: 8
17824
17825**Parameters**
17826
17827| Name                        | Description                                                  |
17828| --------------------------- | ------------------------------------------------------------ |
17829| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
17830| char                        | Pointer to the text content.                                 |
17831
17832
17833### OH_Drawing_TypographyHandlerPopTextStyle()
17834
17835```
17836void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* )
17837```
17838
17839**Description**
17840
17841Pops the top text style out of the text style stack.
17842
17843**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17844
17845**Since**: 8
17846
17847**Parameters**
17848
17849| Name                        | Description                                                  |
17850| --------------------------- | ------------------------------------------------------------ |
17851| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
17852
17853
17854### OH_Drawing_TypographyHandlerPushTextStyle()
17855
17856```
17857void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle*  )
17858```
17859
17860**Description**
17861
17862Pushes a text style into the text style stack. Any text added afterward will use the style currently on top of the stack.
17863
17864**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17865
17866**Since**: 8
17867
17868**Parameters**
17869
17870| Name                        | Description                                                  |
17871| --------------------------- | ------------------------------------------------------------ |
17872| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
17873| OH_Drawing_TextStyle        | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
17874
17875
17876### OH_Drawing_TypographyIsEllipsized()
17877
17878```
17879bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style)
17880```
17881
17882**Description**
17883
17884Checks whether an ellipsis is configured for a typography style.
17885
17886**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17887
17888**Since**: 12
17889
17890**Parameters**
17891
17892| Name                       | Description                                                  |
17893| -------------------------- | ------------------------------------------------------------ |
17894| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17895
17896**Returns**
17897
17898Returns **true** if the text has an ellipsis; returns **false** otherwise.
17899
17900
17901### OH_Drawing_TypographyIsLineUnlimited()
17902
17903```
17904bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style)
17905```
17906
17907**Description**
17908
17909Checks whether the maximum number of lines is limited for text.
17910
17911**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17912
17913**Since**: 12
17914
17915**Parameters**
17916
17917| Name                       | Description                                                  |
17918| -------------------------- | ------------------------------------------------------------ |
17919| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
17920
17921**Returns**
17922
17923Returns **true** if that the maximum number of lines is limited; returns **false** otherwise.
17924
17925
17926### OH_Drawing_TypographyLayout()
17927
17928```
17929void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double  )
17930```
17931
17932**Description**
17933
17934Lays out the typography.
17935
17936**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17937
17938**Since**: 8
17939
17940**Parameters**
17941
17942| Name                  | Description                                                  |
17943| --------------------- | ------------------------------------------------------------ |
17944| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17945| double                | Maximum text width.                                          |
17946
17947
17948### OH_Drawing_TypographyMarkDirty()
17949
17950```
17951void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* )
17952```
17953
17954**Description**
17955
17956Marks a typography object as dirty data. This function is used to initialize the typography state.
17957
17958**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17959
17960**Since**: 12
17961
17962**Parameters**
17963
17964| Name                  | Description                                                  |
17965| --------------------- | ------------------------------------------------------------ |
17966| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17967
17968
17969### OH_Drawing_TypographyPaint()
17970
17971```
17972void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double  )
17973```
17974
17975**Description**
17976
17977Draws text from the upper left corner at a specified position. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.
17978
17979**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
17980
17981**Since**: 8
17982
17983**Parameters**
17984
17985| Name                  | Description                                                  |
17986| --------------------- | ------------------------------------------------------------ |
17987| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
17988| OH_Drawing_Canvas     | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling **OH_Drawing_CanvasCreate()**. |
17989| double                | X coordinate.                                                |
17990| double                | Y coordinate.                                                |
17991
17992
17993### OH_Drawing_TypographySetIndents()
17994
17995```
17996void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] )
17997```
17998
17999**Description**
18000
18001Sets indents for typography. If this function is not called, texts will have no indentation applied.
18002
18003**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18004
18005**Since**: 12
18006
18007**Parameters**
18008
18009| Name                  | Description                                                  |
18010| --------------------- | ------------------------------------------------------------ |
18011| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
18012| int                   | Number of indents. The value must be less than or equal to the length of the indents array to avoid display exceptions caused by access to the out-of-bounds array. |
18013| float                 | Pointer to a floating-point array, in which each element indicates an indentation width, in px. Before using [OH_Drawing_Typography](#oh_drawing_typography), you must declare and initialize the floating-point array. |
18014
18015
18016### OH_Drawing_TypographyStyleDestroyStrutStyle()
18017
18018```
18019void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* )
18020```
18021
18022**Description**
18023
18024Reclaims the memory occupied by a strut style.
18025
18026**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18027
18028**Since**: 12
18029
18030**Parameters**
18031
18032| Name                                                     | Description                                                  |
18033| -------------------------------------------------------- | ------------------------------------------------------------ |
18034| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | Pointer to an [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) object, which is obtained by calling [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle). |
18035
18036
18037### OH_Drawing_TypographyStyleEquals()
18038
18039```
18040bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to )
18041```
18042
18043**Description**
18044
18045Checks whether two typography styles are the same. The text height modifier mode [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) is not involved in the comparison.
18046
18047**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18048
18049**Since**: 12
18050
18051**Parameters**
18052
18053| Name | Description                             |
18054| ---- | --------------------------------------- |
18055| from | Pointer to the first typography style.  |
18056| to   | Pointer to the second typography style. |
18057
18058**Returns**
18059
18060Returns **true** if the two are the same; returns **false** otherwise.
18061
18062
18063### OH_Drawing_TypographyStyleGetEffectiveAlignment()
18064
18065```
18066OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
18067```
18068
18069**Description**
18070
18071Obtains the text alignment mode.
18072
18073**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18074
18075**Since**: 12
18076
18077**Parameters**
18078
18079| Name                       | Description                                                  |
18080| -------------------------- | ------------------------------------------------------------ |
18081| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18082
18083**Returns**
18084
18085Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign).
18086
18087
18088### OH_Drawing_TypographyStyleGetFontStyleStruct()
18089
18090```
18091OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle)
18092```
18093
18094**Description**
18095
18096Obtains the font style, including the font weight, width, and slant, of the default text style of a typography style.
18097
18098**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18099
18100**Since**: 12
18101
18102**Parameters**
18103
18104| Name                       | Description                                                  |
18105| -------------------------- | ------------------------------------------------------------ |
18106| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18107
18108**Returns**
18109
18110Returns the font style, including the font weight, width, and slant.
18111
18112
18113### OH_Drawing_TypographyStyleGetStrutStyle()
18114
18115```
18116OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* )
18117```
18118
18119**Description**
18120
18121Obtains the strut style of a typography style.
18122
18123**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18124
18125**Since**: 12
18126
18127**Parameters**
18128
18129| Name                       | Description                                                  |
18130| -------------------------- | ------------------------------------------------------------ |
18131| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18132
18133**Returns**
18134
18135Returns the pointer to the strut style, which is an [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) object.
18136
18137
18138### OH_Drawing_TypographyStyleIsHintEnabled()
18139
18140```
18141bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style)
18142```
18143
18144**Description**
18145
18146Checks whether font hinting is enabled for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.
18147
18148**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18149
18150**Since**: 12
18151
18152**Parameters**
18153
18154| Name                       | Description                                                  |
18155| -------------------------- | ------------------------------------------------------------ |
18156| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18157
18158**Returns**
18159
18160Returns **true** if font hinting is enabled; returns **false** otherwise.
18161
18162
18163### OH_Drawing_TypographyStyleSetHintsEnabled()
18164
18165```
18166void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled )
18167```
18168
18169**Description**
18170
18171Sets whether to enable font hinting for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.
18172
18173**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18174
18175**Since**: 12
18176
18177**Parameters**
18178
18179| Name                       | Description                                                  |
18180| -------------------------- | ------------------------------------------------------------ |
18181| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18182| hintsEnabled               | Whether to enable font hinting. The value **true** means to enable font hinting, and **false** means the opposite. |
18183
18184
18185### OH_Drawing_TypographyStyleStrutStyleEquals()
18186
18187```
18188bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to )
18189```
18190
18191**Description**
18192
18193Checks whether two strut styles are equal.
18194
18195**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18196
18197**Since**: 12
18198
18199**Parameters**
18200
18201| Name | Description                        |
18202| ---- | ---------------------------------- |
18203| from | Pointer to the first strut style.  |
18204| to   | Pointer to the second strut style. |
18205
18206**Returns**
18207
18208Returns **true** if the two strut styles are the same; returns **false** otherwise.
18209
18210### OH_Drawing_TypographyTextGetHeightBehavior()
18211
18212```
18213OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* )
18214```
18215
18216**Description**
18217
18218Obtains the text height modifier pattern.
18219
18220**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18221
18222**Since**: 12
18223
18224**Parameters**
18225
18226| Name                       | Description                                                  |
18227| -------------------------- | ------------------------------------------------------------ |
18228| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18229
18230**Returns**
18231
18232Returns the text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior).
18233
18234
18235### OH_Drawing_TypographyTextGetLineStyle()
18236
18237```
18238bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* )
18239```
18240
18241**Description**
18242
18243Checks whether the text line style is enabled for a typography style.
18244
18245**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18246
18247**Since**: 12
18248
18249**Parameters**
18250
18251| Name                       | Description                                                  |
18252| -------------------------- | ------------------------------------------------------------ |
18253| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18254
18255**Returns**
18256
18257Returns **true** if the text line style is enabled; returns **false** otherwise.
18258
18259
18260### OH_Drawing_TypographyTextlineGetStyleOnly()
18261
18262```
18263bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* )
18264```
18265
18266**Description**
18267
18268Checks whether only the text line style is enabled for a typography style.
18269
18270**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18271
18272**Since**: 12
18273
18274**Parameters**
18275
18276| Name                       | Description                                                  |
18277| -------------------------- | ------------------------------------------------------------ |
18278| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18279
18280**Returns**
18281
18282Returns **true** if only the text line style is enabled; returns **false** otherwise.
18283
18284
18285### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies()
18286
18287```
18288void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum )
18289```
18290
18291**Description**
18292
18293Reclaims the memory occupied by the font families.
18294
18295**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18296
18297**Since**: 12
18298
18299**Parameters**
18300
18301| Name            | Description                          |
18302| --------------- | ------------------------------------ |
18303| fontFamilies    | Double pointer to the font families. |
18304| fontFamiliesNum | Number of font families.             |
18305
18306
18307### OH_Drawing_TypographyTextlineStyleGetFontFamilies()
18308
18309```
18310char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* , size_t* num)
18311```
18312
18313**Description**
18314
18315Obtains the font families of a text line style.
18316
18317**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18318
18319**Since**: 12
18320
18321**Parameters**
18322
18323| Name                       | Description                                                  |
18324| -------------------------- | ------------------------------------------------------------ |
18325| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18326| num                        | Pointer to the number of font families.                      |
18327
18328**Returns**
18329
18330Returns the font families.
18331
18332
18333### OH_Drawing_TypographyTextlineStyleGetFontSize()
18334
18335```
18336double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* )
18337```
18338
18339**Description**
18340
18341Obtains the font size of a text line style.
18342
18343**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18344
18345**Since**: 12
18346
18347**Parameters**
18348
18349| Name                       | Description                                                  |
18350| -------------------------- | ------------------------------------------------------------ |
18351| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18352
18353**Returns**
18354
18355Returns the font size.
18356
18357
18358### OH_Drawing_TypographyTextlineStyleGetFontStyle()
18359
18360```
18361OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* )
18362```
18363
18364**Description**
18365
18366Obtains the font style of the strut style in a typography style.
18367
18368**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18369
18370**Since**: 12
18371
18372**Parameters**
18373
18374| Name                       | Description                                                  |
18375| -------------------------- | ------------------------------------------------------------ |
18376| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18377
18378**Returns**
18379
18380Returns the font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle).
18381
18382
18383### OH_Drawing_TypographyTextlineStyleGetFontWeight()
18384
18385```
18386OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle*)
18387```
18388
18389**Description**
18390
18391Obtains the font weight of the strut style in a typography style.
18392
18393**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18394
18395**Since**: 12
18396
18397**Parameters**
18398
18399| Name                       | Description                                                  |
18400| -------------------------- | ------------------------------------------------------------ |
18401| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18402
18403**Returns**
18404
18405Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight).
18406
18407
18408### OH_Drawing_TypographyTextlineStyleGetHalfLeading()
18409
18410```
18411bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* )
18412```
18413
18414**Description**
18415
18416Checks whether half leading is enabled for a text line style.
18417
18418**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18419
18420**Since**: 12
18421
18422**Parameters**
18423
18424| Name                       | Description                                                  |
18425| -------------------------- | ------------------------------------------------------------ |
18426| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18427
18428**Returns**
18429
18430Returns **true** if half leading is enabled; returns **false** otherwise.
18431
18432
18433### OH_Drawing_TypographyTextlineStyleGetHeightOnly()
18434
18435```
18436bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* )
18437```
18438
18439**Description**
18440
18441Checks whether only the font height is used for a text line style.
18442
18443**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18444
18445**Since**: 12
18446
18447**Parameters**
18448
18449| Name                       | Description                                                  |
18450| -------------------------- | ------------------------------------------------------------ |
18451| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18452
18453**Returns**
18454
18455Returns **true** if only the font height is used; returns false otherwise.
18456
18457
18458### OH_Drawing_TypographyTextlineStyleGetHeightScale()
18459
18460```
18461double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* )
18462```
18463
18464**Description**
18465
18466Obtains the height scale factor of a text line style.
18467
18468**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18469
18470**Since**: 12
18471
18472**Parameters**
18473
18474| Name                       | Description                                                  |
18475| -------------------------- | ------------------------------------------------------------ |
18476| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18477
18478**Returns**
18479
18480Returns the height scale factor.
18481
18482
18483### OH_Drawing_TypographyTextlineStyleGetSpacingScale()
18484
18485```
18486double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* )
18487```
18488
18489**Description**
18490
18491Obtains the spacing scale factor of a text line style.
18492
18493**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18494
18495**Since**: 12
18496
18497**Parameters**
18498
18499| Name                       | Description                                                  |
18500| -------------------------- | ------------------------------------------------------------ |
18501| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18502
18503**Returns**
18504
18505Returns the spacing scale factor.
18506
18507
18508### OH_Drawing_TypographyTextSetHeightBehavior()
18509
18510```
18511void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode )
18512```
18513
18514**Description**
18515
18516Sets a text height modifier pattern.
18517
18518**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18519
18520**Since**: 12
18521
18522**Parameters**
18523
18524| Name                       | Description                                                  |
18525| -------------------------- | ------------------------------------------------------------ |
18526| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
18527| heightMode                 | Text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior). |
18528
18529
18530### OH_Drawing_TypographyUpdateFontSize()
18531
18532```
18533void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize )
18534```
18535
18536**Description**
18537
18538Updates the font size in a typography object.
18539
18540**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
18541
18542**Since**: 12
18543
18544**Parameters**
18545
18546| Name                  | Description                                                  |
18547| --------------------- | ------------------------------------------------------------ |
18548| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
18549| from                  | Reserved field, which is not used.                           |
18550| to                    | Reserved field, which is not used.                           |
18551| fontSize              | New font size.                                               |