• 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.|
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_typography.h](drawing__text__typography_8h.md) | Declares the functions related to typography in the drawing module.|
54| [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.|
55| [drawing_types.h](drawing__types_8h.md) | Declares the data types of the canvas, brush, pen, bitmap, and path used to draw 2D graphics.|
56
57
58### Structs
59
60| Name| Description|
61| -------- | -------- |
62| struct  [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Describes the pixel format of a bitmap, including the color type and alpha type.|
63| struct  [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Describes the measurement information about a font.|
64| struct  [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | Describes the options about the GPU context.|
65| struct  [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | Describes a run, which provides storage for glyphs and positions.|
66| struct  [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | Describes the placeholder that acts as a span.|
67| struct  [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Describes the detailed information about a system font.|
68| struct  [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | Describes the measurement information about a line of text.|
69| struct  [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | Describes the information about a font fallback.|
70| struct  [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | Describes the information about a font fallback group.|
71| struct  [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | Describes the information about a font weight mapping.|
72| struct  [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | Describes the information about a font alias.|
73| struct  [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | Describes the information about generic fonts supported by the system.|
74| struct  [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | Describes the information about a system font configuration.|
75| struct  [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Describes a font style.|
76| struct  [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | Describes a font feature.|
77| 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.|
78| struct  [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Describes a two-dimensional coordinate point.|
79| struct  [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | Describes a three-dimensional coordinate point.|
80| struct  [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Describes the image information.|
81| struct  [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | Describes the style of a rectangle.|
82
83
84### Types
85
86| Name| Description|
87| -------- | -------- |
88| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | Defines a struct for font arguments.|
89| 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.|
90| 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.|
91| 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.|
92| 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.|
93| 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.|
94| 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.|
95| 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.|
96| 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.|
97| 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.|
98| 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.|
99| 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.|
100| 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.|
101| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)  [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | Defines an enum for the canvas clipping modes.|
102| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging)  [OH_Drawing_FontEdging](#oh_drawing_fontedging) | Defines an enum for the font edging types.|
103| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting)  [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | Defines an enum for the font hinting types.|
104| 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.|
105| 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.|
106| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype)  [OH_Drawing_BlurType](#oh_drawing_blurtype) | Defines an enum for the blur types.|
107| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)  [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | Defines an enum for the matrix scaling modes.|
108| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection)  [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | Defines an enum for the directions of a closed contour.|
109| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)  [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | Defines an enum for the fill types of a path.|
110| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)  [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | Defines an enum for the path adding modes.|
111| 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.|
112| 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.|
113| 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.|
114| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode)  [OH_Drawing_FilterMode](#oh_drawing_filtermode) | Defines an enum for the filter modes.|
115| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)  [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | Defines an enum for the mipmap modes.|
116| 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.|
117| 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.|
118| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection)  [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | Defines a struct used to load fonts.|
119| 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.|
120| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle)  [OH_Drawing_TextStyle](#oh_drawing_textstyle) | Defines a struct used to manage text colors and decorations.|
121| 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.|
122| 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.|
123| 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.|
124| 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.|
125| typedef struct [OH_Drawing_Range](#oh_drawing_range)  [OH_Drawing_Range](#oh_drawing_range) | Defines a struct for a range, which is used to receive the start position and end position of a glyph.|
126| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow)  [OH_Drawing_TextShadow](#oh_drawing_textshadow) | Defines a struct used to manage text shadows.|
127| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser)  [OH_Drawing_FontParser](#oh_drawing_fontparser) | Defines a struct used to parse system font files.|
128| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment)  [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | Defines an enum for the vertical alignment modes of placeholders.|
129| 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.|
130| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)  [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | Defines an enum for the text decoration styles.|
131| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)  [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | Defines an enum for the text ellipsis styles.|
132| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)  [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | Defines an enum for the text break strategies.|
133| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)  [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | Defines an enum for the word break types.|
134| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)  [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | Defines an enum for the rectangle height styles.|
135| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)  [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | Defines an enum for the rectangle width styles.|
136| 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.|
137| 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.|
138| 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.|
139| 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.|
140| 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.|
141| 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.|
142| 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.|
143| 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.|
144| 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.|
145| 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.|
146| 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.|
147| 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.|
148| 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.|
149| 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.|
150| 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.|
151| 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.|
152| 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.|
153| typedef struct [OH_Drawing_Point](#oh_drawing_point)  [OH_Drawing_Point](#oh_drawing_point) | Defines a struct for a coordinate point.|
154| 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.|
155| 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.|
156| 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.|
157| 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.|
158| 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.|
159| typedef struct [OH_Drawing_Rect](#oh_drawing_rect)  [OH_Drawing_Rect](#oh_drawing_rect) | Defines a struct for a rectangle.|
160| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect)  [OH_Drawing_RoundRect](#oh_drawing_roundrect) | Defines a struct for a rounded rectangle.|
161| 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.|
162| 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.|
163| 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.|
164| 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.|
165| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter)  [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | Defines a struct for a mask filter, which is used to convert a mask into a new one.|
166| 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.|
167| typedef struct [OH_Drawing_Font](#oh_drawing_font)  [OH_Drawing_Font](#oh_drawing_font) | Defines a struct for a font.|
168| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream)  [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | Defines a struct for a memory stream.|
169| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface)  [OH_Drawing_Typeface](#oh_drawing_typeface) | Defines a struct for a typeface.|
170| 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.|
171| 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.|
172| 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.|
173| 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.|
174| 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.|
175| 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.|
176| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat)  [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | Defines an enum for the storage formats of bitmap pixels.|
177| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)  [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | Defines an enum for the alpha formats of bitmap pixels.|
178| 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 on the four channels (red, green, blue, and alpha). The operations for the alpha channel are used as examples.|
179| 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.|
180| 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.|
181| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding)  [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | Defines an enum for the text encoding types.|
182| 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.|
183| 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.|
184| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | Defines an enum for the shadow flags.|
185
186### Enums
187
188| Name| Description|
189| -------- | -------- |
190| [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.|
191| [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.|
192| [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.|
193| [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.|
194| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | Enumerates the constraint types of the source rectangle.|
195| [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.|
196| [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.|
197| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | Enumerates the canvas clipping modes.|
198| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | Enumerates the font edging types.|
199| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | Enumerates the font hinting types.|
200| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | Enumerates the blur types.|
201| [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.|
202| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | Enumerates the directions of a closed contour.|
203| [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.|
204| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | Enumerates the path adding modes.|
205| [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.|
206| [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.|
207| [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.|
208| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | Enumerates the filter modes.|
209| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | Enumerates the mipmap modes.|
210| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | Enumerates the tile modes of the shader effect.|
211| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | Enumerates the text directions.|
212| [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.|
213| [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.|
214| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | Enumerates the text baselines.|
215| [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.|
216| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | Enumerates the font styles.|
217| [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.|
218| [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.|
219| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | Enumerates the text ellipsis styles.|
220| [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.|
221| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype-1) { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2 } | Enumerates the word break types.|
222| [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.|
223| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | Enumerates the rectangle width styles.|
224| [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.|
225| [OH_Drawing_FontWidth](#oh_drawing_fontwidth) {<br>ULTRA_CONDENSED_WIDTH = 1, EXTRA_CONDENSED_WIDTH = 2, CONDENSED_WIDTH = 3, SEMI_CONDENSED_WIDTH = 4,<br>NORMAL_WIDTH = 5, SEMI_EXPANDED_WIDTH = 6, EXPANDED_WIDTH = 7, EXTRA_EXPANDED_WIDTH = 8,<br>ULTRA_EXPANDED_WIDTH = 9<br>} | Enumerates the font widths.|
226| [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.|
227| [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.|
228| [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.|
229| [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.|
230| [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 on the four channels (red, green, blue, and alpha). The operations for the alpha channel are used as examples.|
231| [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.|
232| [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.|
233
234
235### Functions
236
237| Name| Description|
238| -------- | -------- |
239| [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).|
240| [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.|
241| [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.|
242| [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.|
243| [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.|
244| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line, including its indentation. You are advised to round up the return value in actual use. If the text content is empty, **0.0** is returned.|
245| [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.|
246| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | Creates an **OH_Drawing_RecordCmdUtils** object.|
247| [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.|
248| [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.|
249| [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.|
250| [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.|
251| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Releases the memory occupied by a text box.|
252| 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.|
253| [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.|
254| [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.|
255| void [OH_Drawing_TypographyPaintOnPath](#oh_drawing_typographypaintonpath) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Path](#oh_drawing_path) \*, double, double) | Draws text along a path.|
256| [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.|
257| [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.|
258| [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.|
259| [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.|
260| [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.|
261| [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.|
262| [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.|
263| [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.|
264| [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.|
265| [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.|
266| [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.|
267| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)  [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | Obtains the error code of the module.|
268| [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.|
269| 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.|
270| [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.|
271| [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.|
272| 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.|
273| 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.|
274| 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.|
275| 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.|
276| 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.|
277| 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.|
278| 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.|
279| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | Checks whether a path is closed.|
280| 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.|
281| 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.|
282| 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.|
283| 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.|
284| [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.|
285| [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.|
286| [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.|
287| 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).|
288| 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.|
289| 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.|
290| 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.|
291| 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.|
292| [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.|
293| [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.|
294| [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.|
295| [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.|
296| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | Creates an **OH_Drawing_Bitmap** object.|
297| 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.|
298| [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.|
299| 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.|
300| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the width of a bitmap.|
301| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the height of a bitmap.|
302| [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.|
303| [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.|
304| 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.|
305| 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.|
306| 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.|
307| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | Creates an **OH_Drawing_Brush** object.|
308| 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.|
309| 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.|
310| 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.|
311| 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.|
312| 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.|
313| 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.|
314| 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.|
315| 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.|
316| 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.|
317| 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.|
318| 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.|
319| 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.|
320| 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.|
321| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | Creates an **OH_Drawing_Canvas** object.|
322| 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.|
323| 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.)|
324| 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.|
325| 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.|
326| 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.|
327| 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.|
328| 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.|
329| 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.|
330| 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.|
331| 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.|
332| 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).|
333| 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.|
334| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | Draws a path.|
335| 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.|
336| 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.|
337| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | Draws a region.|
338| 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.|
339| 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).|
340| 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.|
341| 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.|
342| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Resets the matrix of a canvas to an identity matrix.|
343| 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.|
344| 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.|
345| 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.|
346| 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.|
347| 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.|
348| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws a rectangle.|
349| 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.|
350| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws an oval.|
351| 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.|
352| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | Draws a rounded rectangle.|
353| 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.|
354| 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.|
355| [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.|
356| [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.|
357| [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.|
358| [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.|
359| [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.|
360| [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.|
361| 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.|
362| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | Creates an sRGB color space.|
363| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | Creates an sRGB linear (Gamma 1.0) color space.|
364| 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.|
365| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | Creates an **OH_Drawing_Filter** object.|
366| 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.|
367| 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.|
368| 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.|
369| 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.|
370| 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.|
371| 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.|
372| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | Sets a font edging effect.|
373| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font edging effect.|
374| 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.|
375| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether auto hinting is forcibly used.|
376| 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.|
377| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether sub-pixel rendering is used for a font.|
378| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | Creates an **OH_Drawing_Font** object.|
379| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | Sets the typeface for a font.|
380| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the typeface of a font.|
381| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | Sets the font size.|
382| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the text size.|
383| 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.|
384| 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.|
385| 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.|
386| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | Sets linear scaling for a font.|
387| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether linear scaling is used for a font.|
388| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | Sets a horizontal skew factor for a font.|
389| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal skew factor of a font.|
390| 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.|
391| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether fake bold is used for a font.|
392| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | Sets a horizontal scale factor for a font.|
393| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal scale factor of a font.|
394| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | Sets a font hinting effect.|
395| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font hinting effect.|
396| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | Sets whether to use bitmaps in a font.|
397| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether bitmaps are used in a font.|
398| 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.|
399| 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.|
400| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | Creates 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.|
401| 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.|
402| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the alternate fonts.|
403| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the system fonts.|
404| [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.|
405| 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.)|
406| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | Creates an **OH_Drawing_FontMgr** object.|
407| 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.|
408| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | Obtains the number of font families.|
409| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | Obtains the font family name based on an index.|
410| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | Reclaims the memory occupied by a font family name.|
411| [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.|
412| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Reclaims the memory occupied by a font style set.|
413| [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.|
414| [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.|
415| [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.|
416| [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.|
417| [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.|
418| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | Reclaims the memory occupied by a font style.|
419| [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.|
420| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Obtains the number of fonts in the font style set.|
421| [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.|
422| 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.|
423| [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.|
424| 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.|
425| 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.|
426| 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.|
427| 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.|
428| 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.|
429| [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 given blur type.|
430| 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.|
431| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | Creates an **OH_Drawing_Matrix** object.|
432| [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).|
433| [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).|
434| [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).|
435| 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.|
436| 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.|
437| 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).  |
438| 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).|
439| 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).|
440| 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).|
441| 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).|
442| 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).  |
443| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Resets a matrix to an identity matrix.|
444| 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.|
445| 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.|
446| 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).|
447| 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).|
448| 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).|
449| 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.|
450| 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].|
451| 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.|
452| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Checks whether an **OH_Drawing_Matrix** object is an identity matrix.|
453| 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.|
454| [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.|
455| 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.|
456| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | Creates an **OH_Drawing_Path** object.|
457| [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.|
458| 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.|
459| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Sets the start point of a path.|
460| 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.|
461| 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.|
462| 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.|
463| 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.|
464| 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.|
465| 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.|
466| 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.|
467| 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.|
468| 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.|
469| 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.|
470| 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 contour to a path in the specified direction.|
471| 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.|
472| 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.|
473| 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.|
474| 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.|
475| 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.|
476| 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.|
477| 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.|
478| 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.|
479| 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.|
480| 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-1).|
481| 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.|
482| 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.|
483| 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.|
484| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | Obtains the length of a path.|
485| 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.|
486| 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.|
487| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | Resets path data.|
488| [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.|
489| 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.|
490| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | Creates an **OH_Drawing_Pen** object.|
491| 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.|
492| 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.|
493| 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.|
494| 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.|
495| 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.|
496| 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.|
497| 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.|
498| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the width of a pen. The width describes the thickness of the outline of a shape.|
499| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | Sets 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.|
500| 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.|
501| 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.|
502| [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.|
503| 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.|
504| [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.|
505| 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.|
506| 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.|
507| 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.|
508| 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.|
509| 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.|
510| 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.|
511| 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.|
512| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | Resets a pen to the initial state.|
513| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | Creates an **OH_Drawing_Point** object.|
514| 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.|
515| [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.|
516| 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.|
517| 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.|
518| 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.|
519| 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.|
520| 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.|
521| 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.|
522| 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.|
523| 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.|
524| 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.|
525| 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.|
526| 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.|
527| 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.|
528| 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.|
529| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | Creates an **OH_Drawing_Region** object for more accurate graphical control.|
530| 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.|
531| 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.|
532| 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.|
533| 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.|
534| [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.|
535| 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.|
536| [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.|
537| 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.|
538| [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.|
539| 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.|
540| [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.|
541| [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.|
542| [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.|
543| [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.|
544| 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.|
545| [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.|
546| 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.|
547| [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.|
548| [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.|
549| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied.|
550| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | Creates an **OH_Drawing_TextBlobBuilder** object.|
551| [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.|
552| [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.|
553| [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.|
554| 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.|
555| 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.|
556| 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.|
557| [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**.|
558| 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.|
559| 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.|
560| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | Creates an **OH_Drawing_TypographyStyle** object.|
561| 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.|
562| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text direction.|
563| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text alignment mode.|
564| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.|
565| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the maximum number of lines in the text.|
566| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | Creates an **OH_Drawing_TextStyle** object.|
567| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text style of a typography style.|
568| 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.|
569| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the color for a text style.|
570| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the font size for a text style.|
571| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font weight for a text style.|
572| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the baseline for a text style.|
573| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration for a text style.|
574| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the decoration color for a text style.|
575| 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.|
576| 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.|
577| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font style for a text style.|
578| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the locale for a text style.|
579| 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.|
580| 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.|
581| 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.|
582| 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.|
583| 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.|
584| 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.|
585| 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.|
586| 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.|
587| [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.|
588| 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.|
589| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Pushes the text style.|
590| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | Adds text.|
591| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Removes the topmost text style in the stack, leaving the remaining styles in effect.|
592| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Creates an **OH_Drawing_Typography** object.|
593| 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.|
594| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | Lays out the typography.|
595| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | Paints text on the canvas.|
596| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum width.|
597| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the height.|
598| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line. You are advised to round up the return value in actual use. When the text content is empty, the minimum float value, that is, -340282346638528859811704183484516925440.000000, is returned.|
599| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the minimum intrinsic width.|
600| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum intrinsic width.|
601| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the alphabetic baseline.|
602| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the ideographic baseline.|
603| 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.|
604| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Checks whether the maximum number of lines is exceeded.|
605| [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.|
606| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains text boxes for placeholders.|
607| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the left position of a text box.|
608| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the right position of a text box.|
609| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the top position of a text box.|
610| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the bottom position of a text box.|
611| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the text direction of a text box.|
612| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Obtains the number of text boxes.|
613| [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.|
614| [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.|
615| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object.|
616| 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.|
617| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | Obtains the word boundary.|
618| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the start position of an **OH_Drawing_Range** object.|
619| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the end position of an **OH_Drawing_Range** object.|
620| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of lines.|
621| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration style for a text style.|
622| 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.|
623| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the letter spacing for a text style.|
624| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the word spacing for a text style.|
625| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | Sets whether to enable half leading for a text style.|
626| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the ellipsis content for a text style.|
627| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the ellipsis style for a text style.|
628| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text break strategy.|
629| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the word break type.|
630| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text ellipsis style.|
631| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | Sets the text ellipsis content.|
632| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line height.|
633| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line width.|
634| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | Sets the text split ratio.|
635| 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.|
636| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Checks whether the text has an ellipsis.|
637| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) |Sets the locale for text.|
638| 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.|
639| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Sets a text style.|
640| [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.|
641| 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.|
642| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | Creates an **OH_Drawing_FontParser** object to parse a system font.|
643| 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.|
644| 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.|
645| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | Reclaims the memory occupied by the system font list.|
646| [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.|
647| [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.|
648| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the number of lines.|
649| 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.|
650| 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.|
651| 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.|
652| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font weight for text.|
653| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font style for text.|
654| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | Sets the font family name for text.|
655| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for text.|
656| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for text.|
657| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for text.|
658| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style.|
659| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font weight for a text line style.|
660| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font style for a text line style.|
661| 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.|
662| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for a text line style.|
663| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for a text line style.|
664| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for a text line style.|
665| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the spacing scale factor for a text line style.|
666| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style only.|
667| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | Creates an **OH_Drawing_TextShadow** object.|
668| 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.|
669| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains a text shadow container.|
670| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a text shadow container.|
671| 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.|
672| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all shadows in a text shadow container.|
673| [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.|
674| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | Sets the indents for typography.|
675| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains indents with a given index.|
676| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | Obtains the line bounds.|
677| 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.|
678| [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.|
679| 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.|
680| 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.|
681| [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.|
682| 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 a typography style.|
683| [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 a typography style.|
684| 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.|
685| 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.|
686| 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.|
687| [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.|
688| 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.|
689| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a font feature map container.|
690| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all the contents in a font feature map container.|
691| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*axis, int value) | 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.|
692| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the baseline drift of a text style.|
693| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | Sets a baseline drift for a text style.|
694| 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.|
695| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text height modifier pattern.|
696| [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.|
697| 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.|
698| 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.|
699| 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.|
700| 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.|
701| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Sets a placeholder for a text style.|
702| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Checks whether a placeholder is set for a text style.|
703| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.|
704| 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.|
705| 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.|
706| [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.|
707| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | Reclaims the memory occupied by a strut style.|
708| 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.|
709| 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.|
710| 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.|
711| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of unresolved glyphs in a typography object.|
712| 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.|
713| 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.|
714| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font weight of a text line style.|
715| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font style of a text line style.|
716| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font families of a text line style.|
717| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | Reclaims the memory occupied by the font families.|
718| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font size of a text line style.|
719| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the height scale factor of a text line style.|
720| 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.|
721| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether half leading is enabled for a text line style.|
722| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the spacing scale factor of a text line style.|
723| 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.|
724| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text alignment mode.|
725| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text direction.|
726| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the maximum number of lines.|
727| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text ellipsis content.|
728| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | Reclaims the memory occupied by the text ellipsis names.|
729| 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.|
730| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the color of a text style.|
731| [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.|
732| [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.|
733| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the text style of a typography style.|
734| [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.|
735| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | Obtains the font families of a text style.|
736| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | Reclaims the memory occupied by the font families.|
737| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font size of a text style.|
738| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the letter spacing of a text style.|
739| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the word spacing of a text style.|
740| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font height of a text style.|
741| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Checks whether half leading is enabled for a text style.|
742| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the locale of a text style.|
743| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | Creates a default **OH_Drawing_Typeface** object.|
744| [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.|
745| [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.|
746| 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.|
747| 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.|
748| 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.|
749| 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.|
750| 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.|
751| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | Translates a canvas by a given distance.|
752| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | Scales a canvas.|
753| 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\| |
754| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | Clears a canvas by using a given color.|
755| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas width.|
756| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas height.|
757| 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.|
758| 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.|
759| 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.|
760| 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.|
761
762
763## Type Description
764
765### OH_Drawing_FontArguments
766
767```
768typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments
769```
770
771**Description**
772
773Defines a struct for font arguments.
774
775**Since**: 13
776
777### OH_Drawing_RecordCmd
778
779```
780typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd
781```
782
783**Description**
784
785Defines the recording command class, which is used to store the set of recording commands.
786
787**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
788
789**Since**: 13
790
791
792### OH_Drawing_RecordCmdUtils
793
794```
795typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils
796```
797
798**Description**
799
800Defines the recording command tool, which is used to generate recording commands.
801
802**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
803
804**Since**: 13
805
806
807### OH_Drawing_ErrorCode
808
809```
810typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode
811```
812
813
814**Description**
815
816Defines an enum for the error codes that may be generated by the module.
817
818**Since**: 12
819
820
821### OH_Drawing_PathOpMode
822
823```
824typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode
825```
826
827**Description**
828
829Defines an enum for the operation modes available for a path.
830
831**Since**: 12
832
833
834### OH_Drawing_PathMeasureMatrixFlags
835
836```
837typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags
838```
839
840**Description**
841
842Defines an enum for the types of matrix information obtained during path measurement.
843
844**Since**: 12
845
846
847### OH_Drawing_RegionOpMode
848
849```
850typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode
851```
852
853**Description**
854
855Defines an enum for the operation modes available for a region.
856
857**Since**: 12
858
859
860### OH_Drawing_ImageFilter
861
862```
863typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter
864```
865
866**Description**
867
868Defines a struct for an image filter, which is used to operate all color bits that make up image pixels.
869
870**Since**: 12
871
872
873### OH_Drawing_Filter
874
875```
876typedef struct OH_Drawing_Filter OH_Drawing_Filter
877```
878
879**Description**
880
881Defines a struct for a filter, which consists of a color filter, mask filter, and image filter.
882
883**Since**: 11
884
885### OH_Drawing_AlphaFormat
886
887```
888typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat
889```
890
891**Description**
892
893Defines an enum for the alpha formats of bitmap pixels.
894
895**Since**: 8
896
897
898### OH_Drawing_Bitmap
899
900```
901typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap
902```
903
904**Description**
905
906Defines a struct for a bitmap, which is a memory area that contains the pixel data of a shape.
907
908**Since**: 8
909
910
911### OH_Drawing_BitmapFormat
912
913```
914typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat
915```
916
917**Description**
918
919Defines a struct for the pixel format of a bitmap, including the color type and alpha type.
920
921**Since**: 8
922
923
924### OH_Drawing_BlendMode
925
926```
927typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode
928```
929
930**Description**
931
932Defines 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 on the four channels (red, green, blue, and alpha). The operations for the alpha channel are used as examples.
933
934For brevity, the following abbreviations are used:
935
936**s**: source.
937
938**d**: destination.
939
940**sa**: source alpha.
941
942**da**: destination alpha.
943
944The following abbreviations are used in the calculation result:
945
946**r**: The calculation methods of the four channels are the same.
947
948**ra**: Only the alpha channel is manipulated.
949
950**rc**: The other three color channels are manipulated.
951
952**Since**: 11
953
954
955### OH_Drawing_BlurType
956
957```
958typedef enum OH_Drawing_BlurType OH_Drawing_BlurType
959```
960
961**Description**
962
963Defines an enum for the blur types.
964
965**Since**: 11
966
967
968### OH_Drawing_BreakStrategy
969
970```
971typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy
972```
973
974**Description**
975
976Defines an enum for the text break strategies.
977
978**Since**: 11
979
980
981### OH_Drawing_Brush
982
983```
984typedef struct OH_Drawing_Brush OH_Drawing_Brush
985```
986
987**Description**
988
989Defines a struct for a brush, which is used to describe the style and color to fill in a shape.
990
991**Since**: 8
992
993
994### OH_Drawing_Canvas
995
996```
997typedef struct OH_Drawing_Canvas OH_Drawing_Canvas
998```
999
1000**Description**
1001
1002Defines a struct for a rectangular canvas, on which various shapes, images, and texts can be drawn by using the brush and pen.
1003
1004**Since**: 8
1005
1006
1007### OH_Drawing_CanvasClipOp
1008
1009```
1010typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp
1011```
1012
1013**Description**
1014
1015Defines an enum for the canvas clipping modes.
1016
1017**Since**: 11
1018
1019
1020### OH_Drawing_CanvasShadowFlags
1021
1022```
1023typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags
1024```
1025
1026**Description**
1027
1028Defines an enum for the shadow flags.
1029
1030**Since**: 12
1031
1032
1033### OH_Drawing_ColorFilter
1034
1035```
1036typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter
1037```
1038
1039**Description**
1040
1041Defines a struct for a color filter, which is used to convert a color into a new one.
1042
1043**Since**: 11
1044
1045
1046### OH_Drawing_ColorFormat
1047
1048```
1049typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat
1050```
1051
1052**Description**
1053
1054Defines an enum for the storage formats of bitmap pixels.
1055
1056**Since**: 8
1057
1058
1059### OH_Drawing_ColorSpace
1060
1061```
1062typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace
1063```
1064
1065**Description**
1066
1067Defines a struct for a color space, which is used to describe the color information.
1068
1069**Since**: 12
1070
1071
1072### OH_Drawing_Corner_Radii
1073
1074```
1075typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii
1076```
1077
1078**Description**
1079
1080Defines 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.
1081
1082**Since**: 12
1083
1084
1085### OH_Drawing_CornerPos
1086
1087```
1088typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos
1089```
1090
1091**Description**
1092
1093Defines an enum for the corner positions of a rounded rectangle.
1094
1095**Since**: 12
1096
1097
1098### OH_Drawing_EllipsisModal
1099
1100```
1101typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal
1102```
1103
1104**Description**
1105
1106Defines an enum for the text ellipsis styles.
1107
1108**Since**: 11
1109
1110
1111### OH_Drawing_FilterMode
1112
1113```
1114typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode
1115```
1116
1117**Description**
1118
1119Defines an enum for the filter modes.
1120
1121**Since**: 12
1122
1123
1124### OH_Drawing_Font
1125
1126```
1127typedef struct OH_Drawing_Font OH_Drawing_Font
1128```
1129
1130**Description**
1131
1132Defines a struct for a font.
1133
1134**Since**: 11
1135
1136
1137### OH_Drawing_Font_Metrics
1138
1139```
1140typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics
1141```
1142
1143**Description**
1144
1145Defines a struct for the measurement information about a font.
1146
1147**Since**: 12
1148
1149
1150### OH_Drawing_FontAdjustInfo
1151
1152```
1153typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo
1154```
1155
1156**Description**
1157
1158Defines a struct for the information about a font weight mapping.
1159
1160**Since**: 12
1161
1162
1163### OH_Drawing_FontAliasInfo
1164
1165```
1166typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo
1167```
1168
1169**Description**
1170
1171Defines a struct for the information about a font alias.
1172
1173**Since**: 12
1174
1175
1176### OH_Drawing_FontCollection
1177
1178```
1179typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection
1180```
1181
1182**Description**
1183
1184Defines a struct used to load fonts.
1185
1186**Since**: 8
1187
1188
1189### OH_Drawing_FontConfigInfo
1190
1191```
1192typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo
1193```
1194
1195**Description**
1196
1197Defines a struct for the information about a system font configuration.
1198
1199**Since**: 12
1200
1201
1202### OH_Drawing_FontDescriptor
1203
1204```
1205typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor
1206```
1207
1208**Description**
1209
1210Defines a struct for the detailed information about a system font.
1211
1212**Since**: 12
1213
1214
1215### OH_Drawing_FontEdging
1216
1217```
1218typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging
1219```
1220
1221**Description**
1222
1223Defines an enum for the font edging types.
1224
1225**Since**: 12
1226
1227
1228### OH_Drawing_FontFallbackGroup
1229
1230```
1231typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup
1232```
1233
1234**Description**
1235
1236Defines a struct for the information about a font fallback group.
1237
1238**Since**: 12
1239
1240
1241### OH_Drawing_FontFallbackInfo
1242
1243```
1244typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo
1245```
1246
1247**Description**
1248
1249Defines a struct for the information about a font fallback.
1250
1251**Since**: 12
1252
1253
1254### OH_Drawing_FontGenericInfo
1255
1256```
1257typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo
1258```
1259
1260**Description**
1261
1262Defines a struct for the information about generic fonts supported by the system.
1263
1264**Since**: 12
1265
1266
1267### OH_Drawing_FontHinting
1268
1269```
1270typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting
1271```
1272
1273**Description**
1274
1275Defines an enum for the font hinting types.
1276
1277**Since**: 12
1278
1279
1280### OH_Drawing_FontMgr
1281
1282```
1283typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr
1284```
1285
1286**Description**
1287
1288Defines a struct for the font manager, which is used for font management.
1289
1290**Since**: 12
1291
1292
1293### OH_Drawing_FontParser
1294
1295```
1296typedef struct OH_Drawing_FontParser OH_Drawing_FontParser
1297```
1298
1299**Description**
1300
1301Defines a struct used to parse system font files.
1302
1303**Since**: 12
1304
1305
1306### OH_Drawing_FontStyleSet
1307
1308```
1309typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet
1310```
1311
1312**Description**
1313
1314Defines a struct for a font style set, which is used for font style family matching.
1315
1316**Since**: 12
1317
1318
1319### OH_Drawing_FontStyleStruct
1320
1321```
1322typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct
1323```
1324
1325**Description**
1326
1327Defines a struct for a font style.
1328
1329**Since**: 12
1330
1331
1332### OH_Drawing_GpuContext
1333
1334```
1335typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext
1336```
1337
1338**Description**
1339
1340Defines a struct for the GPU context, which is used to describe the GPU backend context.
1341
1342**Since**: 12
1343
1344
1345### OH_Drawing_GpuContextOptions
1346
1347```
1348typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions
1349```
1350
1351**Description**
1352
1353Defines a struct for the options about the GPU context.
1354
1355**Since**: 12
1356
1357
1358### OH_Drawing_Image
1359
1360```
1361typedef struct OH_Drawing_Image OH_Drawing_Image
1362```
1363
1364**Description**
1365
1366Defines a struct for an image that describes a two-dimensional pixel array.
1367
1368**Since**: 12
1369
1370
1371### OH_Drawing_Image_Info
1372
1373```
1374typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info
1375```
1376
1377**Description**
1378
1379Defines a struct for the image information.
1380
1381**Since**: 12
1382
1383
1384### OH_Drawing_LineMetrics
1385
1386```
1387typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics
1388```
1389
1390**Description**
1391
1392Defines a struct for the measurement information about a line of text.
1393
1394**Since**: 12
1395
1396
1397### OH_Drawing_MaskFilter
1398
1399```
1400typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter
1401```
1402
1403**Description**
1404
1405Defines a struct for a mask filter, which is used to convert a mask into a new one.
1406
1407**Since**: 11
1408
1409
1410### OH_Drawing_Matrix
1411
1412```
1413typedef struct OH_Drawing_Matrix OH_Drawing_Matrix
1414```
1415
1416**Description**
1417
1418Defines a struct for a matrix, which is used to describe coordinate transformation.
1419
1420**Since**: 11
1421
1422
1423### OH_Drawing_MemoryStream
1424
1425```
1426typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream
1427```
1428
1429**Description**
1430
1431Defines a struct for a memory stream.
1432
1433**Since**: 12
1434
1435
1436### OH_Drawing_MipmapMode
1437
1438```
1439typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode
1440```
1441
1442**Description**
1443
1444Defines an enum for the mipmap modes.
1445
1446**Since**: 12
1447
1448
1449### OH_Drawing_Path
1450
1451```
1452typedef struct OH_Drawing_Path OH_Drawing_Path
1453```
1454
1455**Description**
1456
1457Defines a struct for a path, which is used to customize various shapes.
1458
1459**Since**: 8
1460
1461
1462### OH_Drawing_PathAddMode
1463
1464```
1465typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode
1466```
1467
1468**Description**
1469
1470Defines an enum for the path adding modes.
1471
1472**Since**: 12
1473
1474
1475### OH_Drawing_PathDirection
1476
1477```
1478typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection
1479```
1480
1481**Description**
1482
1483Defines an enum for the directions of a closed contour.
1484
1485**Since**: 12
1486
1487
1488### OH_Drawing_PathEffect
1489
1490```
1491typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect
1492```
1493
1494**Description**
1495
1496Defines a struct for a path effect that affects the stroke.
1497
1498**Since**: 12
1499
1500
1501### OH_Drawing_PathFillType
1502
1503```
1504typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType
1505```
1506
1507**Description**
1508
1509Defines an enum for the fill types of a path.
1510
1511**Since**: 12
1512
1513
1514### OH_Drawing_Pen
1515
1516```
1517typedef struct OH_Drawing_Pen OH_Drawing_Pen
1518```
1519
1520**Description**
1521
1522Defines a struct for a pen, which is used to describe the style and color to outline a shape.
1523
1524**Since**: 8
1525
1526
1527### OH_Drawing_PenLineCapStyle
1528
1529```
1530typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle
1531```
1532
1533**Description**
1534
1535Defines 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.
1536
1537**Since**: 8
1538
1539
1540### OH_Drawing_PenLineJoinStyle
1541
1542```
1543typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle
1544```
1545
1546**Description**
1547
1548Defines 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.
1549
1550**Since**: 8
1551
1552
1553### OH_Drawing_PixelMap
1554
1555```
1556typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap
1557```
1558
1559**Description**
1560
1561Defines a struct for a pixel map, which is used to wrap the real pixel map supported by the image framework.
1562
1563**Since**: 12
1564
1565
1566### OH_Drawing_PlaceholderSpan
1567
1568```
1569typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan
1570```
1571
1572**Description**
1573
1574Defines a struct for the placeholder that acts as a span.
1575
1576**Since**: 11
1577
1578
1579### OH_Drawing_PlaceholderVerticalAlignment
1580
1581```
1582typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment
1583```
1584
1585**Description**
1586
1587Defines an enum for the vertical alignment modes of placeholders.
1588
1589**Since**: 11
1590
1591
1592### OH_Drawing_Point
1593
1594```
1595typedef struct OH_Drawing_Point OH_Drawing_Point
1596```
1597
1598**Description**
1599
1600Defines a struct for a coordinate point.
1601
1602**Since**: 11
1603
1604
1605### OH_Drawing_Point2D
1606
1607```
1608typedef struct OH_Drawing_Point2D OH_Drawing_Point2D
1609```
1610
1611**Description**
1612
1613Defines a struct for a two-dimensional coordinate point.
1614
1615**Since**: 12
1616
1617
1618### OH_Drawing_Point3D
1619
1620```
1621typedef struct OH_Drawing_Point3D OH_Drawing_Point3D
1622```
1623
1624**Description**
1625
1626Defines a struct for a three-dimensional coordinate point.
1627
1628**Since**: 12
1629
1630
1631### OH_Drawing_PointMode
1632
1633```
1634typedef enum OH_Drawing_PointMode OH_Drawing_PointMode
1635```
1636
1637**Description**
1638
1639Defines an enum for the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.
1640
1641**Since**: 12
1642
1643
1644### OH_Drawing_PositionAndAffinity
1645
1646```
1647typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity
1648```
1649
1650**Description**
1651
1652Defines a struct used to receive the position and affinity of a glyph.
1653
1654**Since**: 11
1655
1656
1657### OH_Drawing_Range
1658
1659```
1660typedef struct OH_Drawing_Range OH_Drawing_Range
1661```
1662
1663**Description**
1664
1665Defines a struct for a range, which is used to receive the start position and end position of a glyph.
1666
1667**Since**: 11
1668
1669
1670### OH_Drawing_Rect
1671
1672```
1673typedef struct OH_Drawing_Rect OH_Drawing_Rect
1674```
1675
1676**Description**
1677
1678Defines a struct for a rectangle.
1679
1680**Since**: 11
1681
1682
1683### OH_Drawing_RectHeightStyle
1684
1685```
1686typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle
1687```
1688
1689**Description**
1690
1691Defines an enum for the rectangle height styles.
1692
1693**Since**: 11
1694
1695
1696### OH_Drawing_RectStyle_Info
1697
1698```
1699typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info
1700```
1701
1702**Description**
1703
1704Defines a struct for the style of a rectangle.
1705
1706**Since**: 12
1707
1708
1709### OH_Drawing_RectWidthStyle
1710
1711```
1712typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle
1713```
1714
1715**Description**
1716
1717Defines an enum for the rectangle width styles.
1718
1719**Since**: 11
1720
1721
1722### OH_Drawing_Region
1723
1724```
1725typedef struct OH_Drawing_Region OH_Drawing_Region
1726```
1727
1728**Description**
1729
1730Defines a struct for a region, which represents a closed area on the canvas for more accurate graphic control.
1731
1732**Since**: 12
1733
1734
1735### OH_Drawing_RoundRect
1736
1737```
1738typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect
1739```
1740
1741**Description**
1742
1743Defines a struct for a rounded rectangle.
1744
1745**Since**: 11
1746
1747
1748### OH_Drawing_RunBuffer
1749
1750```
1751typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer
1752```
1753
1754**Description**
1755
1756Defines a struct for a run, which provides storage for glyphs and positions.
1757
1758**Since**: 11
1759
1760
1761### OH_Drawing_SamplingOptions
1762
1763```
1764typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions
1765```
1766
1767**Description**
1768
1769Defines a struct for sampling options, which describe the sampling methods for images and bitmaps.
1770
1771**Since**: 12
1772
1773
1774### OH_Drawing_ScaleToFit
1775
1776```
1777typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit
1778```
1779
1780**Description**
1781
1782Defines an enum for the matrix scaling modes.
1783
1784**Since**: 12
1785
1786
1787### OH_Drawing_ShaderEffect
1788
1789```
1790typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect
1791```
1792
1793**Description**
1794
1795Defines a struct for a shader effect, which is used to describe the source color of the drawn content.
1796
1797**Since**: 11
1798
1799
1800### OH_Drawing_ShadowLayer
1801
1802```
1803typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer
1804```
1805
1806**Description**
1807
1808Defines a struct for a shadow, which is used to describe the shadow layer of the drawn content.
1809
1810**Since**: 12
1811
1812
1813### OH_Drawing_SrcRectConstraint
1814
1815```
1816typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint
1817```
1818
1819**Description**
1820
1821Defines an enum for the constraint types of the source rectangle.
1822
1823**Since**: 12
1824
1825
1826### OH_Drawing_StrutStyle
1827
1828```
1829typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle
1830```
1831
1832**Description**
1833
1834Defines 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.
1835
1836**Since**: 12
1837
1838
1839### OH_Drawing_Surface
1840
1841```
1842typedef struct OH_Drawing_Surface OH_Drawing_Surface
1843```
1844
1845**Description**
1846
1847Defines a struct for a surface, which is used to manage the content drawn on the canvas.
1848
1849**Since**: 12
1850
1851
1852### OH_Drawing_TextBlob
1853
1854```
1855typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob
1856```
1857
1858**Description**
1859
1860Defines a struct for a text blob, an immutable container that holds multiple texts. Each text blob consists of glyphs and position.
1861
1862**Since**: 11
1863
1864
1865### OH_Drawing_TextBlobBuilder
1866
1867```
1868typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder
1869```
1870
1871**Description**
1872
1873Defines a struct for a text blob builder, which is used to build a text blob.
1874
1875**Since**: 11
1876
1877
1878### OH_Drawing_TextBox
1879
1880```
1881typedef struct OH_Drawing_TextBox OH_Drawing_TextBox
1882```
1883
1884**Description**
1885
1886Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity.
1887
1888**Since**: 11
1889
1890
1891### OH_Drawing_TextDecorationStyle
1892
1893```
1894typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle
1895```
1896
1897**Description**
1898
1899Defines an enum for the text decoration styles.
1900
1901**Since**: 11
1902
1903
1904### OH_Drawing_TextEncoding
1905
1906```
1907typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding
1908```
1909
1910**Description**
1911
1912Defines an enum for the text encoding types.
1913
1914**Since**: 12
1915
1916
1917### OH_Drawing_TextShadow
1918
1919```
1920typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow
1921```
1922
1923**Description**
1924
1925Defines a struct used to manage text shadows.
1926
1927**Since**: 12
1928
1929
1930### OH_Drawing_TextStyle
1931
1932```
1933typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle
1934```
1935
1936**Description**
1937
1938Defines a struct used to manage text colors and decorations.
1939
1940**Since**: 8
1941
1942
1943### OH_Drawing_TileMode
1944
1945```
1946typedef enum OH_Drawing_TileMode OH_Drawing_TileMode
1947```
1948
1949**Description**
1950
1951Defines an enum for the tile modes of the shader effect.
1952
1953**Since**: 11
1954
1955
1956### OH_Drawing_Typeface
1957
1958```
1959typedef struct OH_Drawing_Typeface OH_Drawing_Typeface
1960```
1961
1962**Description**
1963
1964Defines a struct for a typeface.
1965
1966**Since**: 11
1967
1968
1969### OH_Drawing_Typography
1970
1971```
1972typedef struct OH_Drawing_Typography OH_Drawing_Typography
1973```
1974
1975**Description**
1976
1977Defines a struct used to manage the typography layout and display.
1978
1979**Since**: 8
1980
1981
1982### OH_Drawing_TypographyCreate
1983
1984```
1985typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate
1986```
1987
1988**Description**
1989
1990Defines a struct used to create an [OH_Drawing_Typography](#oh_drawing_typography) object.
1991
1992**Since**: 8
1993
1994
1995### OH_Drawing_TypographyStyle
1996
1997```
1998typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle
1999```
2000
2001**Description**
2002
2003Defines a struct used to manage the typography style, such as the text direction.
2004
2005**Since**: 8
2006
2007
2008### OH_Drawing_VertexMode
2009
2010```
2011typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode
2012```
2013
2014**Description**
2015
2016Defines an enum for the modes of interpreting the geometry of a given vertex.
2017
2018**Since**: 12
2019
2020
2021### OH_Drawing_WordBreakType
2022
2023```
2024typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType
2025```
2026
2027**Description**
2028
2029Defines an enum for the word break types.
2030
2031**Since**: 11
2032
2033
2034## Enum Description
2035
2036### OH_Drawing_ErrorCode
2037
2038```
2039enum OH_Drawing_ErrorCode
2040```
2041
2042**Description**
2043
2044Enumerates the error codes that may be generated by the module.
2045
2046**Since**: 12
2047
2048| Value| Description|
2049| -------- | -------- |
2050| OH_DRAWING_SUCCESS | Operation successful.|
2051| OH_DRAWING_ERROR_NO_PERMISSION | Permission verification fails.|
2052| OH_DRAWING_ERROR_INVALID_PARAMETER | Invalid input parameter. For example, NULL is passed in.|
2053| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | The input parameter is not in the valid range.|
2054| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | Failed to allocate memory.|
2055
2056### OH_Drawing_PathMeasureMatrixFlags
2057
2058```
2059enum OH_Drawing_PathMeasureMatrixFlags
2060```
2061
2062**Description**
2063
2064Enumerates the types of matrix information obtained during path measurement.
2065
2066**Since**: 12
2067
2068| Value| Description|
2069| -------- | -------- |
2070| GET_POSITION_MATRIX | Obtains the matrix corresponding to the location information.|
2071| GET_TANGENT_MATRIX | Obtains the matrix corresponding to the tangent information.|
2072| GET_POSITION_AND_TANGENT_MATRIX | Obtains the matrix corresponding to the location and tangent information.|
2073
2074
2075### OH_Drawing_PathOpMode
2076
2077```
2078enum OH_Drawing_PathOpMode
2079```
2080
2081**Description**
2082
2083Enumerates the operation modes available for a path.
2084
2085**Since**: 12
2086
2087| Value| Description|
2088| -------- | -------- |
2089| PATH_OP_MODE_DIFFERENCE | Difference operation.|
2090| PATH_OP_MODE_INTERSECT | Intersection operation.|
2091| PATH_OP_MODE_UNION | Union operation.|
2092| PATH_OP_MODE_XOR | XOR operation.|
2093| PATH_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.|
2094
2095
2096### OH_Drawing_RegionOpMode
2097
2098```
2099enum OH_Drawing_RegionOpMode
2100```
2101
2102**Description**
2103
2104Enumerates the operation modes available for a region.
2105
2106**Since**: 12
2107
2108| Value| Description|
2109| -------- | -------- |
2110| REGION_OP_MODE_DIFFERENCE | Difference operation.|
2111| REGION_OP_MODE_INTERSECT | Intersection operation.|
2112| REGION_OP_MODE_UNION | Union operation.|
2113| REGION_OP_MODE_XOR | XOR operation.|
2114| REGION_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.|
2115| REGION_OP_MODE_REPLACE | Replacement operation.|
2116
2117
2118### OH_Drawing_AlphaFormat
2119
2120```
2121enum OH_Drawing_AlphaFormat
2122```
2123
2124**Description**
2125
2126Enumerates the alpha formats of bitmap pixels.
2127
2128**Since**: 8
2129
2130| Value| Description|
2131| -------- | -------- |
2132| ALPHA_FORMAT_UNKNOWN | Unknown format.|
2133| ALPHA_FORMAT_OPAQUE | The bitmap does not have the alpha component.|
2134| ALPHA_FORMAT_PREMUL | The color component of each pixel is premultiplied by the alpha component.|
2135| ALPHA_FORMAT_UNPREMUL | The color component of each pixel is not premultiplied by the alpha component.|
2136
2137
2138### OH_Drawing_BlendMode
2139
2140```
2141enum OH_Drawing_BlendMode
2142```
2143
2144**Description**
2145
2146Enumerates 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 on the four channels (red, green, blue, and alpha). The operations for the alpha channel are used as examples.
2147
2148For brevity, the following abbreviations are used:
2149
2150**s**: source.
2151
2152**d**: destination.
2153
2154**sa**: source alpha.
2155
2156**da**: destination alpha.
2157
2158The following abbreviations are used in the calculation result:
2159
2160**r**: The calculation methods of the four channels are the same.
2161
2162**ra**: Only the alpha channel is manipulated.
2163
2164**rc**: The other three color channels are manipulated.
2165
2166**Since**: 11
2167
2168| Value| Description|
2169| -------- | -------- |
2170| BLEND_MODE_CLEAR | Clear mode. r = 0.|
2171| 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.)|
2172| 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.)|
2173| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. |
2174| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. |
2175| BLEND_MODE_SRC_IN | r = s \* da. |
2176| BLEND_MODE_DST_IN | r = d \* sa. |
2177| BLEND_MODE_SRC_OUT | r = s \* (1 - da). |
2178| BLEND_MODE_DST_OUT | r = d \* (1 - sa). |
2179| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). |
2180| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). |
2181| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). |
2182| BLEND_MODE_PLUS | r = min(s + d, 1). |
2183| BLEND_MODE_MODULATE | r = s \* d. |
2184| BLEND_MODE_SCREEN | Screen mode. r = s + d - s \* d|
2185| BLEND_MODE_OVERLAY | Overlay mode.|
2186| BLEND_MODE_DARKEN | Darken mode. rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d|
2187| BLEND_MODE_LIGHTEN | Lighten mode. rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d|
2188| BLEND_MODE_COLOR_DODGE | Color dodge mode.|
2189| BLEND_MODE_COLOR_BURN | Color burn mode.|
2190| BLEND_MODE_HARD_LIGHT | Hard light mode.|
2191| BLEND_MODE_SOFT_LIGHT | Soft light mode.|
2192| BLEND_MODE_DIFFERENCE | Difference mode. rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d|
2193| BLEND_MODE_EXCLUSION | Exclusion mode. rc = s + d - two(s \* d), ra = s + (1 - sa) \* d|
2194| BLEND_MODE_MULTIPLY | Multiply mode. r = s \* (1 - da) + d \* (1 - sa) + s \* d|
2195| BLEND_MODE_HUE | Hue mode.|
2196| BLEND_MODE_SATURATION | Saturation mode.|
2197| BLEND_MODE_COLOR | Color mode.|
2198| BLEND_MODE_LUMINOSITY | Luminosity mode.|
2199
2200
2201### OH_Drawing_BlurType
2202
2203```
2204enum OH_Drawing_BlurType
2205```
2206
2207**Description**
2208
2209Enumerates the blur types.
2210
2211**Since**: 11
2212
2213| Value| Description|
2214| -------- | -------- |
2215| NORMAL | Blurs both inside and outside the original border.|
2216| SOLID | Draws solid inside the border, and blurs outside.|
2217| OUTER | Draws nothing inside the border, and blurs outside.|
2218| INNER | Blurs inside the border, and draws nothing outside.|
2219
2220
2221### OH_Drawing_BreakStrategy
2222
2223```
2224enum OH_Drawing_BreakStrategy
2225```
2226
2227**Description**
2228
2229Enumerates the text break strategies.
2230
2231**Since**: 11
2232
2233| Value| Description|
2234| -------- | -------- |
2235| BREAK_STRATEGY_GREEDY | Each line is filled as much as possible during line break.|
2236| BREAK_STRATEGY_HIGH_QUALITY | Text continuity is preferentially considered during line break.|
2237| BREAK_STRATEGY_BALANCED | Line breaks are performed at the word boundary.|
2238
2239
2240### OH_Drawing_CanvasClipOp
2241
2242```
2243enum OH_Drawing_CanvasClipOp
2244```
2245
2246**Description**
2247
2248Enumerates the canvas clipping modes.
2249
2250**Since**: 11
2251
2252| Value| Description|
2253| -------- | -------- |
2254| DIFFERENCE | Clips a specified area. That is, the difference set is obtained.|
2255| INTERSECT | Retains a specified area. That is, the intersection is obtained.|
2256
2257
2258### OH_Drawing_CanvasShadowFlags
2259
2260```
2261enum OH_Drawing_CanvasShadowFlags
2262```
2263
2264**Description**
2265
2266Enumerates the shadow flags.
2267
2268**Since**: 12
2269
2270| Value| Description|
2271| -------- | -------- |
2272| SHADOW_FLAGS_NONE | There is no shadow flag.|
2273| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | The occluding object is transparent.|
2274| SHADOW_FLAGS_GEOMETRIC_ONLY | No analysis on the shadows is required.|
2275| SHADOW_FLAGS_ALL | All the preceding shadow flags are used.|
2276
2277
2278### OH_Drawing_ColorFormat
2279
2280```
2281enum OH_Drawing_ColorFormat
2282```
2283
2284**Description**
2285
2286Enumerates the storage formats of bitmap pixels.
2287
2288**Since**: 8
2289
2290| Value| Description|
2291| -------- | -------- |
2292| COLOR_FORMAT_UNKNOWN | Unknown format.|
2293| COLOR_FORMAT_ALPHA_8 | Each pixel is represented by 8 bits, which together indicate alpha.|
2294| 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.|
2295| 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.|
2296| 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.|
2297| 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.|
2298
2299
2300### OH_Drawing_CornerPos
2301
2302```
2303enum OH_Drawing_CornerPos
2304```
2305
2306**Description**
2307
2308Enumerates the corner positions of a rounded rectangle.
2309
2310**Since**: 12
2311
2312| Value| Description|
2313| -------- | -------- |
2314| CORNER_POS_TOP_LEFT | Top left corner of the rounded rectangle.|
2315| CORNER_POS_TOP_RIGHT | Top right corner of the rounded rectangle.|
2316| CORNER_POS_BOTTOM_RIGHT | Bottom right corner of the rounded rectangle.|
2317| CORNER_POS_BOTTOM_LEFT | Bottom left corner of the rounded rectangle.|
2318
2319
2320### OH_Drawing_EllipsisModal
2321
2322```
2323enum OH_Drawing_EllipsisModal
2324```
2325
2326**Description**
2327
2328Enumerates the text ellipsis styles.
2329
2330**Since**: 11
2331
2332| Value| Description|
2333| -------- | -------- |
2334| ELLIPSIS_MODAL_HEAD | Places the ellipsis in the text header.|
2335| ELLIPSIS_MODAL_MIDDLE | Places the ellipsis in the middle of the text.|
2336| ELLIPSIS_MODAL_TAIL | Places the ellipsis at the end of the text.|
2337
2338
2339### OH_Drawing_FilterMode
2340
2341```
2342enum OH_Drawing_FilterMode
2343```
2344
2345**Description**
2346
2347Enumerates the filter modes.
2348
2349**Since**: 12
2350
2351| Value| Description|
2352| -------- | -------- |
2353| FILTER_MODE_NEAREST | Nearest filter mode.|
2354| FILTER_MODE_LINEAR | Linear filter mode.|
2355
2356
2357### OH_Drawing_FontConfigInfoErrorCode
2358
2359```
2360enum OH_Drawing_FontConfigInfoErrorCode
2361```
2362
2363**Description**
2364
2365Enumerates the error codes that may be used during the obtaining of system font configurations.
2366
2367**Since**: 12
2368
2369| Value| Description|
2370| -------- | -------- |
2371| SUCCESS_FONT_CONFIG_INFO | Operation successful.|
2372| ERROR_FONT_CONFIG_INFO_UNKNOWN | Unknown error.|
2373| ERROR_FONT_CONFIG_INFO_PARSE_FILE | Failed to parse the system configuration file.|
2374| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | Failed to apply for a buffer.|
2375| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | Failed to copy the string data.|
2376
2377
2378### OH_Drawing_FontEdging
2379
2380```
2381enum OH_Drawing_FontEdging
2382```
2383
2384**Description**
2385
2386Enumerates the font edging types.
2387
2388**Since**: 12
2389
2390| Value| Description|
2391| -------- | -------- |
2392| FONT_EDGING_ALIAS | No anti-aliasing processing is used.|
2393| FONT_EDGING_ANTI_ALIAS | Uses anti-aliasing to smooth the jagged edges.|
2394| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | Uses sub-pixel anti-aliasing to provide a smoother effect for jagged edges.|
2395
2396
2397### OH_Drawing_FontHinting
2398
2399```
2400enum OH_Drawing_FontHinting
2401```
2402
2403**Description**
2404
2405Enumerates the font hinting types.
2406
2407**Since**: 12
2408
2409| Value| Description|
2410| -------- | -------- |
2411| FONT_HINTING_NONE | No font hinting is used.|
2412| FONT_HINTING_SLIGHT | Slight font hinting is used to improve contrast.|
2413| FONT_HINTING_NORMAL | Normal font hinting is used to improve contrast.|
2414| FONT_HINTING_FULL | Full font hinting is used to improve contrast.|
2415
2416
2417### OH_Drawing_FontStyle
2418
2419```
2420enum OH_Drawing_FontStyle
2421```
2422
2423**Description**
2424
2425Enumerates the font styles.
2426
2427| Value| Description|
2428| -------- | -------- |
2429| FONT_STYLE_NORMAL | Normal style.|
2430| FONT_STYLE_ITALIC | Italic.|
2431| FONT_STYLE_OBLIQUE | Oblique.<br>Since:<br>12 |
2432
2433
2434### OH_Drawing_FontWeight
2435
2436```
2437enum OH_Drawing_FontWeight
2438```
2439
2440**Description**
2441
2442Enumerates the font weights.
2443
2444| Value| Description|
2445| -------- | -------- |
2446| FONT_WEIGHT_100 | Thin.|
2447| FONT_WEIGHT_200 | Extra-light.|
2448| FONT_WEIGHT_300 | Light.|
2449| FONT_WEIGHT_400 | Normal/Regular.|
2450| FONT_WEIGHT_500 | Medium.|
2451| FONT_WEIGHT_600 | Semi-bold.|
2452| FONT_WEIGHT_700 | Bold.|
2453| FONT_WEIGHT_800 | Extra-bold.|
2454| FONT_WEIGHT_900 | Black.|
2455
2456
2457### OH_Drawing_FontWidth
2458
2459```
2460enum OH_Drawing_FontWidth
2461```
2462
2463**Description**
2464
2465Enumerates the font widths.
2466
2467**Since**: 12
2468
2469
2470### OH_Drawing_MipmapMode
2471
2472```
2473enum OH_Drawing_MipmapMode
2474```
2475
2476**Description**
2477
2478Enumerates the mipmap modes.
2479
2480**Since**: 12
2481
2482| Value| Description|
2483| -------- | -------- |
2484| MIPMAP_MODE_NONE | Mipmap level ignored.|
2485| MIPMAP_MODE_NEAREST | Nearest sampling from two adjacent mipmap levels.|
2486| MIPMAP_MODE_LINEAR | Linear interpolation sampling between two adjacent mipmap levels.|
2487
2488
2489### OH_Drawing_PathAddMode
2490
2491```
2492enum OH_Drawing_PathAddMode
2493```
2494
2495**Description**
2496
2497Enumerates the path adding modes.
2498
2499**Since**: 12
2500
2501| Value| Description|
2502| -------- | -------- |
2503| PATH_ADD_MODE_APPEND | Adds a path in append mode.|
2504| PATH_ADD_MODE_EXTEND | Adds a line segment to close the path if the previous path is not closed.|
2505
2506
2507### OH_Drawing_PathDirection
2508
2509```
2510enum OH_Drawing_PathDirection
2511```
2512
2513**Description**
2514
2515Enumerates the directions of a closed contour.
2516
2517**Since**: 12
2518
2519| Value| Description|
2520| -------- | -------- |
2521| PATH_DIRECTION_CW | Adds a closed contour clockwise.|
2522| PATH_DIRECTION_CCW | Adds a closed contour counterclockwise.|
2523
2524
2525### OH_Drawing_PathFillType
2526
2527```
2528enum OH_Drawing_PathFillType
2529```
2530
2531**Description**
2532
2533Enumerates the fill types of a path.
2534
2535**Since**: 12
2536
2537| Value| Description|
2538| -------- | -------- |
2539| 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.|
2540| 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.|
2541| PATH_FILL_TYPE_INVERSE_WINDING | Same as **PATH_FILL_TYPE_WINDING**, but draws outside of the path, rather than inside.|
2542| PATH_FILL_TYPE_INVERSE_EVEN_ODD | Same as **PATH_FILL_TYPE_EVEN_ODD**, but draws outside of the path, rather than inside.|
2543
2544
2545### OH_Drawing_PenLineCapStyle
2546
2547```
2548enum OH_Drawing_PenLineCapStyle
2549```
2550
2551**Description**
2552
2553Enumerates 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.
2554
2555**Since**: 8
2556
2557| Value| Description|
2558| -------- | -------- |
2559| LINE_FLAT_CAP | There is no cap style. Both ends of the line segment are cut off square.|
2560| 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.|
2561| 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.|
2562
2563
2564### OH_Drawing_PenLineJoinStyle
2565
2566```
2567enum OH_Drawing_PenLineJoinStyle
2568```
2569
2570**Description**
2571
2572Enumerates 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.
2573
2574**Since**: 8
2575
2576| Value| Description|
2577| -------- | -------- |
2578| 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.|
2579| LINE_ROUND_JOIN | Round corner.|
2580| LINE_BEVEL_JOIN | Beveled corner.|
2581
2582
2583### OH_Drawing_PlaceholderVerticalAlignment
2584
2585```
2586enum OH_Drawing_PlaceholderVerticalAlignment
2587```
2588
2589**Description**
2590
2591Enumerates the vertical alignment modes of placeholders.
2592
2593**Since**: 11
2594
2595| Value| Description|
2596| -------- | -------- |
2597| ALIGNMENT_OFFSET_AT_BASELINE | Aligned to the baseline.|
2598| ALIGNMENT_ABOVE_BASELINE | Aligned above the baseline.|
2599| ALIGNMENT_BELOW_BASELINE | Aligned below the baseline.|
2600| ALIGNMENT_TOP_OF_ROW_BOX | Aligned to the top of the row box.|
2601| ALIGNMENT_BOTTOM_OF_ROW_BOX | Aligned to the bottom of the row box.|
2602| ALIGNMENT_CENTER_OF_ROW_BOX | Aligned to the center of the row box.|
2603
2604
2605### OH_Drawing_PointMode
2606
2607```
2608enum OH_Drawing_PointMode
2609```
2610
2611**Description**
2612
2613Enumerates the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons.
2614
2615**Since**: 12
2616
2617| Value| Description|
2618| -------- | -------- |
2619| POINT_MODE_POINTS | Draws each point separately.|
2620| POINT_MODE_LINES | Draws every two points as a line segment.|
2621| POINT_MODE_POLYGON | Draws an array of points as an open polygon.|
2622
2623
2624### OH_Drawing_RectHeightStyle
2625
2626```
2627enum OH_Drawing_RectHeightStyle
2628```
2629
2630**Description**
2631
2632Enumerates the rectangle height styles.
2633
2634**Since**: 11
2635
2636| Value| Description|
2637| -------- | -------- |
2638| RECT_HEIGHT_STYLE_TIGHT | Tight style.|
2639| RECT_HEIGHT_STYLE_MAX | Maximum style.|
2640| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | Middle style that includes the line spacing.|
2641| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | Top style that includes the line spacing.|
2642| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | Bottom style that includes the line spacing.|
2643| RECT_HEIGHT_STYLE_STRUCT | Structure style.|
2644
2645
2646### OH_Drawing_RectWidthStyle
2647
2648```
2649enum OH_Drawing_RectWidthStyle
2650```
2651
2652**Description**
2653
2654Enumerates the rectangle width styles.
2655
2656**Since**: 11
2657
2658| Value| Description|
2659| -------- | -------- |
2660| RECT_WIDTH_STYLE_TIGHT | Tight style.|
2661| RECT_WIDTH_STYLE_MAX | Maximum style.|
2662
2663
2664### OH_Drawing_ScaleToFit
2665
2666```
2667enum OH_Drawing_ScaleToFit
2668```
2669
2670**Description**
2671
2672Enumerates the matrix scaling modes.
2673
2674**Since**: 12
2675
2676| Value| Description|
2677| -------- | -------- |
2678| SCALE_TO_FIT_FILL | Scales the source rectangle both horizontally and vertically to exactly match the destination rectangle.|
2679| SCALE_TO_FIT_START | Scales the source rectangle and aligns it to the left and top edges of the destination rectangle.|
2680| SCALE_TO_FIT_CENTER | Scales the source rectangle and aligns it to the center of the destination rectangle.|
2681| SCALE_TO_FIT_END | Scales the source rectangle and aligns it to the right and bottom edges of the destination rectangle.|
2682
2683
2684### OH_Drawing_SrcRectConstraint
2685
2686```
2687enum OH_Drawing_SrcRectConstraint
2688```
2689
2690**Description**
2691
2692Enumerates the constraint types of the source rectangle.
2693
2694**Since**: 12
2695
2696| Value| Description|
2697| -------- | -------- |
2698| STRICT_SRC_RECT_CONSTRAINT | The source rectangle must be completely contained in the image.|
2699| FAST_SRC_RECT_CONSTRAINT | The source rectangle can be partly outside the image.|
2700
2701
2702### OH_Drawing_TextAlign
2703
2704```
2705enum OH_Drawing_TextAlign
2706```
2707
2708**Description**
2709
2710Enumerates the text alignment modes.
2711
2712| Value| Description|
2713| -------- | -------- |
2714| TEXT_ALIGN_LEFT | Left-aligned.|
2715| TEXT_ALIGN_RIGHT | Right-aligned.|
2716| TEXT_ALIGN_CENTER | Center-aligned.|
2717| 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.|
2718| 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**.|
2719| 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**.|
2720
2721
2722### OH_Drawing_TextBaseline
2723
2724```
2725enum OH_Drawing_TextBaseline
2726```
2727
2728**Description**
2729
2730Enumerates the text baselines.
2731
2732| Value| Description|
2733| -------- | -------- |
2734| TEXT_BASELINE_ALPHABETIC | Alphabetic, where the letters in alphabets like English sit on.|
2735| TEXT_BASELINE_IDEOGRAPHIC | Ideographic, where the baseline is at the bottom of the text area.|
2736
2737
2738### OH_Drawing_TextDecoration
2739
2740```
2741enum OH_Drawing_TextDecoration
2742```
2743
2744**Description**
2745
2746Enumerates the text decorations.
2747
2748| Value| Description|
2749| -------- | -------- |
2750| TEXT_DECORATION_NONE | No decoration.|
2751| TEXT_DECORATION_UNDERLINE | An underline is used for decoration.|
2752| TEXT_DECORATION_OVERLINE | An overline is used for decoration.|
2753| TEXT_DECORATION_LINE_THROUGH | A strikethrough is used for decoration.|
2754
2755
2756### OH_Drawing_TextDecorationStyle
2757
2758```
2759enum OH_Drawing_TextDecorationStyle
2760```
2761
2762**Description**
2763
2764Enumerates the text decoration styles.
2765
2766**Since**: 11
2767
2768| Value| Description|
2769| -------- | -------- |
2770| TEXT_DECORATION_STYLE_SOLID | Solid style.|
2771| TEXT_DECORATION_STYLE_DOUBLE | Double style.|
2772| TEXT_DECORATION_STYLE_DOTTED | Dotted style.|
2773| TEXT_DECORATION_STYLE_DASHED | Dashed style.|
2774| TEXT_DECORATION_STYLE_WAVY | Wavy style.|
2775
2776
2777### OH_Drawing_TextDirection
2778
2779```
2780enum OH_Drawing_TextDirection
2781```
2782
2783**Description**
2784
2785Enumerates the text directions.
2786
2787| Value| Description|
2788| -------- | -------- |
2789| TEXT_DIRECTION_RTL | Right to left (RTL).|
2790| TEXT_DIRECTION_LTR | Left to right (LTR).|
2791
2792
2793### OH_Drawing_TextEncoding
2794
2795```
2796enum OH_Drawing_TextEncoding
2797```
2798
2799**Description**
2800
2801Enumerates the text encoding types.
2802
2803**Since**: 12
2804
2805| Value| Description|
2806| -------- | -------- |
2807| TEXT_ENCODING_UTF8 | One byte used to indicate UTF-8 or ASCII characters.|
2808| TEXT_ENCODING_UTF16 | Two bytes used to indicate most Unicode characters.|
2809| TEXT_ENCODING_UTF32 | Four bytes used to indicate all Unicode characters.|
2810| TEXT_ENCODING_GLYPH_ID | Two bytes used to indicate the glyph index.|
2811
2812
2813### OH_Drawing_TextHeightBehavior
2814
2815```
2816enum OH_Drawing_TextHeightBehavior
2817```
2818
2819**Description**
2820
2821Enumerates the text height modifier patterns.
2822
2823**Since**: 12
2824
2825| Value| Description|
2826| -------- | -------- |
2827| TEXT_HEIGHT_ALL | Enables ascent for the first and last rows of a paragraph.|
2828| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | Disables ascent for the first row of a paragraph.|
2829| TEXT_HEIGHT_DISABLE_LAST_ASCENT | Disables ascent for the last row of a paragraph.|
2830| TEXT_HEIGHT_DISABLE_ALL | Disables ascent for the first and last rows of a paragraph.|
2831
2832
2833### OH_Drawing_TextStyleType
2834
2835```
2836enum OH_Drawing_TextStyleType
2837```
2838
2839**Description**
2840
2841Enumerates the text style types.
2842
2843**Since**: 12
2844
2845| Value| Description|
2846| -------- | -------- |
2847| TEXT_STYLE_NONE | No text style.|
2848| TEXT_STYLE_ALL_ATTRIBUTES | All text styles.|
2849| TEXT_STYLE_FONT | Font style.|
2850| TEXT_STYLE_FOREGROUND | Text foreground style.|
2851| TEXT_STYLE_BACKGROUND | Text background style.|
2852| TEXT_STYLE_SHADOW | Text shadow style.|
2853| TEXT_STYLE_DECORATIONS | Text decoration style.|
2854| TEXT_STYLE_LETTER_SPACING | Text letter spacing style.|
2855| TEXT_STYLE_WORD_SPACING | Text word spacing style.|
2856
2857
2858### OH_Drawing_TileMode
2859
2860```
2861enum OH_Drawing_TileMode
2862```
2863
2864**Description**
2865
2866Enumerates the tile modes of the shader effect.
2867
2868**Since**: 11
2869
2870| Value| Description|
2871| -------- | -------- |
2872| CLAMP | Replicates the edge color if the shader effect draws outside of its original boundary.|
2873| REPEAT | Repeats the shader effect's image in both horizontal and vertical directions.|
2874| MIRROR | Repeats the shader effect's image in both horizontal and vertical directions, alternating mirror images.|
2875| DECAL | Renders the shader effect's image only within the original boundary, and returns transparent black elsewhere.|
2876
2877
2878### OH_Drawing_VertexMode
2879
2880```
2881enum OH_Drawing_VertexMode
2882```
2883
2884**Description**
2885
2886Enumerates the modes of interpreting the geometry of a given vertex.
2887
2888**Since**: 12
2889
2890| Value| Description|
2891| -------- | -------- |
2892| 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. |
2893| 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.|
2894| 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).|
2895
2896
2897### OH_Drawing_WordBreakType
2898
2899```
2900enum OH_Drawing_WordBreakType
2901```
2902
2903**Description**
2904
2905Enumerates the word break types.
2906
2907**Since**: 11
2908
2909| Value| Description|
2910| -------- | -------- |
2911| WORD_BREAK_TYPE_NORMAL | Normal mode.|
2912| WORD_BREAK_TYPE_BREAK_ALL | Breaks the words at any character to prevent overflow.|
2913| WORD_BREAK_TYPE_BREAK_WORD | Breaks the words at arbitrary points to prevent overflow.|
2914
2915
2916
2917## Function Description
2918
2919
2920### OH_Drawing_TypefaceCreateFromFileWithArguments()
2921
2922```
2923OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments )
2924```
2925
2926**Description**
2927
2928Creates 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).
2929
2930**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
2931
2932**Since**: 13
2933
2934**Parameters**
2935
2936| Name| Description|
2937| -------- | -------- |
2938| path | Pointer to the file path.|
2939| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
2940
2941**Returns**
2942
2943Returns 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.
2944
2945
2946### OH_Drawing_TypefaceCreateFromCurrent()
2947
2948```
2949OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments )
2950```
2951
2952**Description**
2953
2954Creates an **OH_Drawing_Typeface** object with font arguments based on an existing **OH_Drawing_Typeface** object.
2955
2956**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
2957
2958**Since**: 13
2959
2960**Parameters**
2961
2962| Name| Description|
2963| -------- | -------- |
2964| current | Pointer to an [OH_Drawing_Typeface](#oh_drawing_typeface) object.|
2965| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
2966
2967**Returns**
2968
2969Returns 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.
2970
2971
2972### OH_Drawing_FontArgumentsAddVariation()
2973
2974```
2975OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value )
2976```
2977
2978**Description**
2979
2980Adds a variation to an **OH_Drawing_FontArguments** object.
2981
2982**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
2983
2984**Since**: 13
2985
2986**Parameters**
2987
2988| Name| Description|
2989| -------- | -------- |
2990| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
2991| 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.|
2992| value | Value of the variation label.|
2993
2994**Returns**
2995
2996Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **fontArguments** or **axis** is NULL or the length of **axis** is not 4.
2997
2998
2999### OH_Drawing_FontArgumentsCreate()
3000
3001```
3002OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void)
3003```
3004
3005**Description**
3006
3007Creates an **OH_Drawing_FontArguments** object. The font arguments are used to create an **OH_Drawing_Typeface** object with custom attributes.
3008
3009**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3010
3011**Since**: 13
3012
3013**Returns**
3014
3015Returns the pointer to the **OH_Drawing_FontArguments** object created.
3016
3017
3018### OH_Drawing_FontArgumentsDestroy()
3019
3020```
3021OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments)
3022```
3023
3024**Description**
3025
3026Destroys an **OH_Drawing_FontArguments** object.
3027
3028**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3029
3030**Since**: 13
3031
3032**Parameters**
3033
3034| Name| Description|
3035| -------- | -------- |
3036| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.|
3037
3038**Returns**
3039
3040Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **fontArguments** is NULL.
3041
3042
3043### OH_Drawing_TypographyGetLongestLineWithIndent()
3044
3045```
3046double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* )
3047```
3048
3049**Description**
3050
3051Obtains the width of the longest line, including its indentation. You are advised to round up the return value in actual use. If the text content is empty, **0.0** is returned.
3052
3053**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3054
3055**Since**: 13
3056
3057**Parameters**
3058
3059| Name| Description|
3060| -------- | -------- |
3061| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).|
3062
3063**Returns**
3064
3065Returns the width of the longest line, including its indentation, in px.
3066
3067
3068
3069### OH_Drawing_RecordCmdDestroy()
3070
3071```
3072OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd)
3073```
3074
3075**Description**
3076
3077Destroys an **OH_Drawing_RecordCmd** object and reclaims the memory occupied by the object.
3078
3079**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3080
3081**Since**: 13
3082
3083**Parameters**
3084
3085| Name| Description|
3086| -------- | -------- |
3087| recordCmd | Pointer to an [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.|
3088
3089**Returns**
3090
3091Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmd** is NULL.
3092
3093
3094### OH_Drawing_RecordCmdUtilsBeginRecording()
3095
3096```
3097OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas )
3098```
3099
3100**Description**
3101
3102Starts recording. This function must be used in pair with [OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording).
3103
3104The **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.
3105
3106**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3107
3108**Since**: 13
3109
3110**Parameters**
3111
3112| Name| Description|
3113| -------- | -------- |
3114| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
3115| width | Width of the canvas.|
3116| height | Height of the canvas.|
3117| 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).|
3118
3119**Returns**
3120
3121Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **recordCmdUtils** or **canvas** is NULL. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **width** or **height** is less than 0. **OH_DRAWING_ERROR_ALLOCATION_FAILED** if the system memory is insufficient.
3122
3123
3124### OH_Drawing_RecordCmdUtilsCreate()
3125
3126```
3127OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void )
3128```
3129
3130**Description**
3131
3132Creates an **OH_Drawing_RecordCmdUtils** object.
3133
3134**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3135
3136**Since**: 13
3137
3138**Returns**
3139
3140Returns the pointer to the **OH_Drawing_RecordCmdUtils** object created.
3141
3142
3143### OH_Drawing_RecordCmdUtilsDestroy()
3144
3145```
3146OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils)
3147```
3148
3149**Description**
3150
3151Destroys an **OH_Drawing_RecordCmdUtils** object and reclaims the memory occupied by the object.
3152
3153**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3154
3155**Since**: 13
3156
3157**Parameters**
3158
3159| Name| Description|
3160| -------- | -------- |
3161| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
3162
3163**Returns**
3164
3165Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmdUtils** is NULL.
3166
3167
3168### OH_Drawing_RecordCmdUtilsFinishRecording()
3169
3170```
3171OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd )
3172```
3173
3174**Description**
3175
3176Ends recording. This function must be called after [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording).
3177
3178The **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.
3179
3180**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3181
3182**Since**: 13
3183
3184**Parameters**
3185
3186| Name| Description|
3187| -------- | -------- |
3188| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.|
3189| 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.|
3190
3191**Returns**
3192
3193Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **recordCmdUtils** or **recordCmd** is NULL. **OH_DRAWING_ERROR_ALLOCATION_FAILED** if the system memory is insufficient.
3194
3195
3196### OH_Drawing_CanvasDrawRecordCmd()
3197
3198```
3199OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd )
3200```
3201
3202**Description**
3203
3204Draws an **OH_Drawing_RecordCmd** object.
3205
3206**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3207
3208**Since**: 13
3209
3210**Parameters**
3211
3212| Name| Description|
3213| -------- | -------- |
3214| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. Only a canvas of the recording type is supported.|
3215| recordCmd | Pointer to the [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.|
3216
3217**Returns**
3218
3219Returns either of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **recordCmd** is NULL.
3220
3221
3222
3223### OH_Drawing_TypographyDestroyTextBox()
3224
3225```
3226void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* )
3227```
3228
3229**Description**
3230
3231Releases the memory occupied by a text box.
3232
3233**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3234
3235**Since**: 12
3236
3237**Parameters**
3238
3239| Name| Description|
3240| -------- | -------- |
3241| OH_Drawing_TextBox | Pointer to an [OH_Drawing_TextBox](#oh_drawing_textbox) object.|
3242
3243
3244### OH_Drawing_SetTextShadow()
3245
3246```
3247void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius )
3248```
3249
3250**Description**
3251
3252Sets a text shadow.
3253
3254**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3255
3256**Since**: 12
3257
3258**Parameters**
3259
3260| Name| Description|
3261| -------- | -------- |
3262| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow).|
3263| 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.|
3264| 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.|
3265| 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.|
3266
3267
3268
3269### OH_Drawing_CanvasDrawSingleCharacter()
3270
3271```
3272OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y )
3273```
3274
3275**Description**
3276
3277Draws 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.
3278
3279**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3280
3281**Since**: 12
3282
3283**Parameters**
3284
3285| Name| Description|
3286| -------- | -------- |
3287| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3288| 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.|
3289| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3290| x | X coordinate of the left point of the character baseline.|
3291| y | Y coordinate of the left point of the character baseline.|
3292
3293**Returns**
3294
3295Returns either of the following result codes:
3296- **OH_DRAWING_SUCCESS** if the operation is successful.
3297- **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**.
3298
3299
3300
3301### OH_Drawing_FontMeasureSingleCharacter()
3302
3303```
3304OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth )
3305```
3306
3307**Description**
3308
3309Measures 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.
3310
3311**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3312
3313**Since**: 12
3314
3315**Parameters**
3316
3317| Name| Description|
3318| -------- | -------- |
3319| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3320| 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.|
3321| textWidth | Pointer to the character width obtained.|
3322
3323**Returns**
3324
3325Returns either of the following result codes:
3326- **OH_DRAWING_SUCCESS** if the operation is successful.
3327- **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**.
3328
3329
3330
3331### OH_Drawing_TypographyPaintOnPath()
3332
3333```
3334void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* , OH_Drawing_Canvas* , OH_Drawing_Path* , double , double  )
3335```
3336
3337**Description**
3338
3339Draws text along a path.
3340
3341**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3342
3343**Since**: 12
3344
3345**Parameters**
3346
3347| Name| Description|
3348| -------- | -------- |
3349| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).|
3350| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate).|
3351| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object, which is obtained by calling [OH_Drawing_PathCreate](#oh_drawing_pathcreate).|
3352| double | Horizontal offset along the path direction. A positive number indicates a position that is ahead along the path from its start point, and a negative number indicates a position that is behind from the start point.|
3353| double | Vertical offset along the path direction. A positive number indicates a position on the left side of the path, and a negative number indicates a position on the right side of the path.|
3354
3355
3356### OH_Drawing_RoundRectOffset()
3357
3358```
3359OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy )
3360```
3361
3362**Description**
3363
3364Translates a rounded rectangle by an offset along the X axis and Y axis.
3365
3366**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3367
3368**Since**: 12
3369
3370**Parameters**
3371
3372| Name| Description|
3373| -------- | -------- |
3374| roundRect | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.|
3375| dx | X offset.|
3376| dy | Y offset.|
3377
3378**Returns**
3379
3380Returns either of the following result codes:
3381- **OH_DRAWING_SUCCESS** if the operation is successful.
3382- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **roundRect** is NULL.
3383
3384
3385### OH_Drawing_PointGetX()
3386
3387```
3388OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x )
3389```
3390
3391**Description**
3392
3393Obtains the X coordinate of a point.
3394
3395**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3396
3397**Since**: 12
3398
3399**Parameters**
3400
3401| Name| Description|
3402| -------- | -------- |
3403| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
3404| x | Pointer to the X coordinate.|
3405
3406**Returns**
3407
3408Returns either of the following result codes:
3409- **OH_DRAWING_SUCCESS** if the operation is successful.
3410- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **x** is NULL.
3411
3412
3413### OH_Drawing_PointGetY()
3414
3415```
3416OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y )
3417```
3418
3419**Description**
3420
3421Obtains the Y coordinate of a point.
3422
3423**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3424
3425**Since**: 12
3426
3427**Parameters**
3428
3429| Name| Description|
3430| -------- | -------- |
3431| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
3432| y | Pointer to the Y coordinate.|
3433
3434**Returns**
3435
3436Returns either of the following result codes:
3437- **OH_DRAWING_SUCCESS** if the operation is successful.
3438- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **y** is NULL.
3439
3440
3441### OH_Drawing_PointSet()
3442
3443```
3444OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y )
3445```
3446
3447**Description**
3448
3449Sets the X and Y coordinates of a point.
3450
3451**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3452
3453**Since**: 12
3454
3455**Parameters**
3456
3457| Name| Description|
3458| -------- | -------- |
3459| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.|
3460| x | Pointer to the X coordinate.|
3461| y | Pointer to the Y coordinate.|
3462
3463**Returns**
3464
3465Returns either of the following result codes:
3466- **OH_DRAWING_SUCCESS** if the operation is successful.
3467- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **point** is NULL.
3468
3469
3470### OH_Drawing_FontMeasureText()
3471
3472```
3473OH_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 )
3474```
3475
3476**Description**
3477
3478Obtains the text width and bounding box.
3479
3480**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3481
3482**Since**: 12
3483
3484**Parameters**
3485
3486| Name| Description|
3487| -------- | -------- |
3488| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
3489| text | Pointer to the text.|
3490| byteLength | Length of the text, in bytes.|
3491| encoding | Encoding type of the text.|
3492| bounds | Pointer to the bounding box. The value can be NULL.|
3493| textWidth | Pointer to the text width.|
3494
3495**Returns**
3496
3497Returns either of the following result codes:
3498- **OH_DRAWING_SUCCESS** if the operation is successful.
3499- **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the parameters **font**, **text**, and **textWidth** is NULL, or **byteLength** is **0**.
3500
3501
3502### OH_Drawing_CanvasClipRegion()
3503
3504```
3505OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp )
3506```
3507
3508**Description**
3509
3510Clips a rectangle.
3511
3512**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3513
3514**Since**: 12
3515
3516**Parameters**
3517
3518| Name| Description|
3519| -------- | -------- |
3520| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3521| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
3522| clipOp | Clip mode.|
3523
3524**Returns**
3525
3526Returns any of the following result codes:
3527- **OH_DRAWING_SUCCESS** if the operation is successful.
3528- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **region** is NULL.
3529- **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **clipOp** is not set to one of the enumerated values.
3530
3531
3532### OH_Drawing_CanvasDrawColor()
3533
3534```
3535OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode )
3536```
3537
3538**Description**
3539
3540Fills the entire canvas with the specified color and blend mode.
3541
3542**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3543
3544**Since**: 12
3545
3546**Parameters**
3547
3548| Name| Description|
3549| -------- | -------- |
3550| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3551| color | Color.|
3552| blendMode | Blend mode.|
3553
3554**Returns**
3555
3556Returns any of the following result codes:
3557- **OH_DRAWING_SUCCESS** if the operation is successful.
3558- **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas** is NULL.
3559- **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **blendMode** is not set to one of the enumerated values.
3560
3561
3562### OH_Drawing_CanvasGetImageInfo()
3563
3564```
3565OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo )
3566```
3567
3568**Description**
3569
3570Obtains the image information of a canvas.
3571
3572**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3573
3574**Since**: 12
3575
3576**Parameters**
3577
3578| Name| Description|
3579| -------- | -------- |
3580| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3581| imageInfo | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
3582
3583**Returns**
3584
3585Returns either of the following result codes:
3586- **OH_DRAWING_SUCCESS** if the operation is successful.
3587- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **imageInfo** is NULL.
3588
3589
3590### OH_Drawing_CanvasIsClipEmpty()
3591
3592```
3593OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty )
3594```
3595
3596**Description**
3597
3598Checks whether the region that can be drawn is empty after cropping.
3599
3600**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3601
3602**Since**: 12
3603
3604**Parameters**
3605
3606| Name| Description|
3607| -------- | -------- |
3608| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3609| 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.|
3610
3611**Returns**
3612
3613Returns either of the following result codes:
3614- **OH_DRAWING_SUCCESS** if the operation is successful.
3615- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **isClipEmpty** is NULL.
3616
3617
3618### OH_Drawing_CanvasDrawPoint()
3619
3620```
3621OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point )
3622```
3623
3624**Description**
3625
3626Draws a point.
3627
3628**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3629
3630**Since**: 12
3631
3632**Parameters**
3633
3634| Name| Description|
3635| -------- | -------- |
3636| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.|
3637| point | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.|
3638
3639**Returns**
3640
3641Returns either of the following result codes:
3642- **OH_DRAWING_SUCCESS** if the operation is successful.
3643- **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **point** is NULL.
3644
3645
3646### OH_Drawing_MatrixGetAll()
3647
3648```
3649OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] )
3650```
3651
3652**Description**
3653
3654Obtains all element values of a matrix.
3655
3656**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3657
3658**Since**: 12
3659
3660**Parameters**
3661
3662| Name| Description|
3663| -------- | -------- |
3664| matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
3665| value | Array used to store the obtained element values.|
3666
3667**Returns**
3668
3669Returns either of the following result codes:
3670- **OH_DRAWING_SUCCESS** if all element values of the matrix are successfully obtained.
3671- **OH_DRAWING_ERROR_INVALID_PARAMETER** if the matrix element values fail to be obtained. The failure cause is that **matrix** or **value** is NULL.
3672
3673
3674
3675### OH_Drawing_ErrorCodeGet()
3676
3677```
3678OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet ()
3679```
3680
3681**Description**
3682
3683Obtains the error code of the module.
3684
3685**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3686
3687**Since**: 12
3688
3689**Returns**
3690
3691Returns the enumerated values of the error code.
3692
3693### OH_Drawing_BrushCopy()
3694
3695```
3696OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush)
3697```
3698
3699**Description**
3700
3701Copies an existing [OH_Drawing_Brush](#oh_drawing_brush) object to create a new one.
3702
3703Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3704
3705If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3706
3707If **brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3708
3709**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3710
3711**Since**: 12
3712
3713**Parameters**
3714
3715| Name| Description|
3716| -------- | -------- |
3717| brush | Pointer to an **OH_Drawing_Brush** object.|
3718
3719**Returns**
3720
3721Returns 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.
3722
3723
3724
3725### OH_Drawing_FilterSetImageFilter()
3726
3727```
3728void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* )
3729```
3730
3731**Description**
3732
3733Sets an **OH_Drawing_ImageFilter** object for an **OH_Drawing_Filter** object.
3734
3735Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3736
3737If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3738
3739If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3740
3741**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3742
3743**Since**: 12
3744
3745**Parameters**
3746
3747| Name| Description|
3748| -------- | -------- |
3749| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object.|
3750| 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.|
3751
3752
3753### OH_Drawing_ImageFilterCreateBlur()
3754
3755```
3756OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input )
3757```
3758
3759**Description**
3760
3761Creates an **OH_Drawing_ImageFilter** object with a given blur type.
3762
3763**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3764
3765**Since**: 12
3766
3767**Parameters**
3768
3769| Name| Description|
3770| -------- | -------- |
3771| sigmaX | Deviation of the Gaussian blur to apply along the X axis.|
3772| sigmaY | Deviation of the Gaussian blur to apply along the Y axis.|
3773| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
3774| 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.|
3775
3776**Returns**
3777
3778Returns 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.
3779
3780
3781### OH_Drawing_ImageFilterCreateFromColorFilter()
3782
3783```
3784OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input )
3785```
3786
3787**Description**
3788
3789Creates an **OH_Drawing_ImageFilter** object with a color filter effect.
3790
3791Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3792
3793If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3794
3795If **colorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3796
3797**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3798
3799**Since**: 12
3800
3801**Parameters**
3802
3803| Name| Description|
3804| -------- | -------- |
3805| colorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object.|
3806| 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.|
3807
3808**Returns**
3809
3810Returns 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.
3811
3812
3813### OH_Drawing_ImageFilterDestroy()
3814
3815```
3816void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* )
3817```
3818
3819**Description**
3820
3821Destroys an **OH_Drawing_ImageFilter** object and reclaims the memory occupied by the object.
3822
3823**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3824
3825**Since**: 12
3826
3827**Parameters**
3828
3829| Name| Description|
3830| -------- | -------- |
3831| OH_Drawing_ImageFilter | Pointer to an [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object.|
3832
3833
3834### OH_Drawing_MatrixMapPoints()
3835
3836```
3837void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count )
3838```
3839
3840**Description**
3841
3842Maps a source point array to a destination point array by means of matrix transformation.
3843
3844Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3845
3846If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3847
3848If 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.
3849
3850**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3851
3852**Since**: 12
3853
3854**Parameters**
3855
3856| Name| Description|
3857| -------- | -------- |
3858| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
3859| src | Array of source points.|
3860| dst | Array of destination points. The number of destination points must be the same as that of source points.|
3861| count | Number of source points or destination points.|
3862
3863
3864### OH_Drawing_MatrixMapRect()
3865
3866```
3867bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst )
3868```
3869
3870**Description**
3871
3872Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices are mapped by means of matrix transformation.
3873
3874Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3875
3876If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3877
3878If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
3879
3880**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3881
3882**Since**: 12
3883
3884**Parameters**
3885
3886| Name| Description|
3887| -------- | -------- |
3888| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.|
3889| src | Pointer to the source rectangle.|
3890| dst | Pointer to the destination rectangle.|
3891
3892**Returns**
3893
3894Returns **true** if the source rectangle is equal to the destination rectangle; returns **false** otherwise.
3895
3896
3897### OH_Drawing_PathAddPolygon()
3898
3899```
3900void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed )
3901```
3902
3903**Description**
3904
3905Adds a polygon to a path.
3906
3907Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3908
3909If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3910
3911If either **path** or **points** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3912
3913**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3914
3915**Since**: 12
3916
3917**Parameters**
3918
3919| Name| Description|
3920| -------- | -------- |
3921| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
3922| points | Pointer to an array that holds the vertex coordinates of the polygon.|
3923| count | Size of the array.|
3924| isClosed | Whether the path is closed. The value **true** means that the path is closed, and **false** means the opposite.|
3925
3926
3927### OH_Drawing_PathAddCircle()
3928
3929```
3930void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection  )
3931```
3932
3933**Description**
3934
3935Adds a circle to a path in the specified direction.
3936
3937Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3938
3939If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3940
3941If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3942
3943If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
3944
3945If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
3946
3947**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3948
3949**Since**: 12
3950
3951**Parameters**
3952
3953| Name| Description|
3954| -------- | -------- |
3955| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
3956| x | X coordinate of the circle center.|
3957| y | Y coordinate of the circle center.|
3958| radius | Radius of the circle.|
3959| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection).|
3960
3961
3962### OH_Drawing_PathBuildFromSvgString()
3963
3964```
3965bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str )
3966```
3967
3968**Description**
3969
3970Parses the path represented by an SVG string.
3971
3972Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
3973
3974If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
3975
3976If either **path** or **str** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
3977
3978**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
3979
3980**Since**: 12
3981
3982**Parameters**
3983
3984| Name| Description|
3985| -------- | -------- |
3986| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
3987| str | Pointer to the SVG string.|
3988
3989**Returns**
3990
3991Returns **true** if the SVG string is parsed successfully; returns **false** otherwise.
3992
3993
3994### OH_Drawing_PathGetBounds()
3995
3996```
3997void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect*  )
3998```
3999
4000**Description**
4001
4002Obtains the minimum bounds that enclose a path.
4003
4004Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4005
4006If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4007
4008If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4009
4010**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4011
4012**Since**: 12
4013
4014**Parameters**
4015
4016| Name| Description|
4017| -------- | -------- |
4018| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4019| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.|
4020
4021
4022### OH_Drawing_PathIsClosed()
4023
4024```
4025bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed )
4026```
4027
4028**Description**
4029
4030Checks whether a path is closed.
4031
4032Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4033
4034If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4035
4036If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4037
4038**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4039
4040**Since**: 12
4041
4042**Parameters**
4043
4044| Name| Description|
4045| -------- | -------- |
4046| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4047| 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.|
4048
4049**Returns**
4050
4051Returns **true** if the path is closed; returns **false** otherwise.
4052
4053
4054### OH_Drawing_PathGetPositionTangent()
4055
4056```
4057bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent )
4058```
4059
4060**Description**
4061
4062Obtains the coordinates and tangent at a distance from the start point of a path.
4063
4064Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4065
4066If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4067
4068If any of **path**, **position**, or **tangent** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4069
4070**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4071
4072**Since**: 12
4073
4074**Parameters**
4075
4076| Name| Description|
4077| -------- | -------- |
4078| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4079| 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.|
4080| distance | Distance from the start point.|
4081| position | Pointer to the coordinates.|
4082| tangent | Pointer to the tangent.|
4083
4084**Returns**
4085
4086Returns **true** if the operation is successful; returns **false** otherwise.
4087
4088
4089### OH_Drawing_PathOp()
4090
4091```
4092bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op )
4093```
4094
4095**Description**
4096
4097Combines two paths based on the specified operation mode.
4098
4099Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4100
4101If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4102
4103If either **path** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4104
4105If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4106
4107**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4108
4109**Since**: 12
4110
4111**Parameters**
4112
4113| Name| Description|
4114| -------- | -------- |
4115| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, in which the resulting path is saved.|
4116| other | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4117| op | Operation mode of the path. For details about the available options, see [OH_Drawing_PathOpMode](#oh_drawing_pathopmode).|
4118
4119**Returns**
4120
4121Returns **true** if the resulting path is not empty; returns **false** otherwise.
4122
4123
4124### OH_Drawing_PathGetMatrix()
4125
4126```
4127bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag )
4128```
4129
4130**Description**
4131
4132Obtains a transformation matrix at a distance from the start point of a path.
4133
4134Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4135
4136If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4137
4138If either **path** or **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4139
4140If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4141
4142**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4143
4144**Since**: 12
4145
4146**Parameters**
4147
4148| Name| Description|
4149| -------- | -------- |
4150| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4151| 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.|
4152| distance | Distance from the start point.|
4153| matrix | Pointer to the transformation matrix.|
4154| flag | Type of the matrix information. For details about the available options, see [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags).|
4155
4156**Returns**
4157
4158Returns **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.
4159
4160
4161### OH_Drawing_PenGetFillPath()
4162
4163```
4164bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix*  )
4165```
4166
4167**Description**
4168
4169Obtains the source path outline drawn using a pen and represents it using a destination path.
4170
4171Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4172
4173If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4174
4175If any of **OH_Drawing_Pen**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4176
4177**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4178
4179**Since**: 12
4180
4181**Parameters**
4182
4183| Name| Description|
4184| -------- | -------- |
4185| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.|
4186| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
4187| dst | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object.|
4188| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. NULL is recommended.|
4189| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. NULL is recommended. The default value is an identity matrix.|
4190
4191**Returns**
4192
4193Returns **true** if the destination path is obtained; returns **false** otherwise.
4194
4195
4196### OH_Drawing_PenCopy()
4197
4198```
4199OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen)
4200```
4201
4202**Description**
4203
4204Copies an existing [OH_Drawing_Pen](#oh_drawing_pen) object to create a new one.
4205
4206Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4207
4208If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4209
4210If **pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4211
4212**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4213
4214**Since**: 12
4215
4216**Parameters**
4217
4218| Name| Description|
4219| -------- | -------- |
4220| pen | Pointer to an **OH_Drawing_Pen** object.|
4221
4222**Returns**
4223
4224Returns 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.
4225
4226
4227### OH_Drawing_PixelMapGetFromNativePixelMap()
4228
4229```
4230OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* )
4231```
4232
4233**Description**
4234
4235Obtains the pixel map defined by this module from a pixel map defined by the image framework.
4236
4237**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4238
4239**Since**: 12
4240
4241**Parameters**
4242
4243| Name| Description|
4244| -------- | -------- |
4245| NativePixelMap_ | Pointer to a **NativePixelMap_** object, which is the pixel map defined by the image framework.|
4246
4247**Returns**
4248
4249Returns 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.
4250
4251
4252### OH_Drawing_PixelMapGetFromOhPixelMapNative()
4253
4254```
4255OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* )
4256```
4257
4258**Description**
4259
4260Obtains the pixel map defined by this module from a pixel map defined by the image framework.
4261
4262**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4263
4264**Since**: 12
4265
4266**Parameters**
4267
4268| Name| Description|
4269| -------- | -------- |
4270| OH_PixelmapNative | Pointer to an **OH_PixelmapNative** object, which is the pixel map defined by the image framework.|
4271
4272**Returns**
4273
4274Returns 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.
4275
4276
4277### OH_Drawing_PixelMapDissolve()
4278
4279```
4280void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* )
4281```
4282
4283**Description**
4284
4285Removes 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).
4286
4287**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4288
4289**Since**: 12
4290
4291**Parameters**
4292
4293| Name| Description|
4294| -------- | -------- |
4295| OH_Drawing_PixelMap | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object.|
4296
4297
4298### OH_Drawing_RectJoin()
4299
4300```
4301bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
4302```
4303
4304**Description**
4305
4306Obtains the union of two rectangles.
4307
4308Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4309
4310If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4311
4312If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4313
4314**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4315
4316**Since**: 12
4317
4318**Parameters**
4319
4320| Name| Description|
4321| -------- | -------- |
4322| rect | Pointer to an **OH_Drawing_Rect** object.|
4323| other | Pointer to an **OH_Drawing_Rect** object.|
4324
4325**Returns**
4326
4327Returns **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.
4328
4329
4330### OH_Drawing_RegionContains()
4331
4332```
4333bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y )
4334```
4335
4336**Description**
4337
4338Checks whether a region contains the specified point.
4339
4340Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4341
4342If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4343
4344If **region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4345
4346**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4347
4348**Since**: 12
4349
4350**Parameters**
4351
4352| Name| Description|
4353| -------- | -------- |
4354| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
4355| int32_t | X coordinate of the point.|
4356| int32_t | Y coordinate of the point.|
4357
4358**Returns**
4359
4360Returns **true** if the region contains the specified point; returns **false** otherwise.
4361
4362
4363### OH_Drawing_RegionOp()
4364
4365```
4366bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op )
4367```
4368
4369**Description**
4370
4371Combines two regions based on the specified operation mode.
4372
4373Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4374
4375If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4376
4377If either **region** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4378
4379If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4380
4381**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4382
4383**Since**: 12
4384
4385**Parameters**
4386
4387| Name| Description|
4388| -------- | -------- |
4389| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object, in which the resulting region is saved.|
4390| other | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
4391| op | Operation mode of the region. For details about the available options, see [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode).|
4392
4393**Returns**
4394
4395Returns **true** if the resulting region is not empty; returns false otherwise.
4396
4397
4398### OH_Drawing_RegionSetPath()
4399
4400```
4401bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip )
4402```
4403
4404**Description**
4405
4406Sets a region to the area described by the path.
4407
4408Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4409
4410If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4411
4412If **region**, **path**, or **clip** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4413
4414**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4415
4416**Since**: 12
4417
4418**Parameters**
4419
4420| Name| Description|
4421| -------- | -------- |
4422| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
4423| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.|
4424| clip | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.|
4425
4426**Returns**
4427
4428Returns **true** if the resulting region is not empty; returns false otherwise.
4429
4430
4431### OH_Drawing_ShaderEffectCreateColorShader()
4432
4433```
4434OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color)
4435```
4436
4437**Description**
4438
4439Creates an **OH_Drawing_ShaderEffect** object with a single color.
4440
4441**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4442
4443**Since**: 12
4444
4445**Parameters**
4446
4447| Name| Description|
4448| -------- | -------- |
4449| color | Color of the shader.|
4450
4451**Returns**
4452
4453Returns 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.
4454
4455
4456### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix()
4457
4458```
4459OH_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*  )
4460```
4461
4462**Description**
4463
4464Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.
4465
4466Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4467
4468If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4469
4470If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4471
4472If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4473
4474**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4475
4476**Since**: 12
4477
4478**Parameters**
4479
4480| Name| Description|
4481| -------- | -------- |
4482| startPt | Start point.|
4483| endPt | End point.|
4484| colors | Colors to distribute between the two points.|
4485| 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.|
4486| size | Number of colors and positions (if **pos** is not NULL).|
4487| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
4488| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
4489
4490**Returns**
4491
4492Returns 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.
4493
4494
4495### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix()
4496
4497```
4498OH_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*  )
4499```
4500
4501**Description**
4502
4503Creates 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.
4504
4505Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4506
4507If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4508
4509If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER**} is returned.
4510
4511If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4512
4513**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4514
4515**Since**: 12
4516
4517**Parameters**
4518
4519| Name| Description|
4520| -------- | -------- |
4521| centerPt | Center of the circle.|
4522| radius | Radius of the gradient.|
4523| colors | Colors to distribute in the radial direction.|
4524| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction.|
4525| size | Number of colors and positions (if **pos** is not NULL).|
4526| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).|
4527| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
4528
4529**Returns**
4530
4531Returns 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.
4532
4533
4534### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient()
4535
4536```
4537OH_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*  )
4538```
4539
4540**Description**
4541
4542Creates an **OH_Drawing_ShaderEffect** object that generates a gradient between two given circles.
4543
4544Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4545
4546If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4547
4548If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4549
4550If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4551
4552**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4553
4554**Since**: 12
4555
4556**Parameters**
4557
4558| Name| Description|
4559| -------- | -------- |
4560| startPt | Pointer to the center of the start circle.|
4561| startRadius | Radius of the start circle.|
4562| endPt | Pointer to the center of the end circle.|
4563| endRadius | Radius of the end circle.|
4564| colors | Colors to distribute between the two circles.|
4565| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the two circles.|
4566| size | Number of colors and positions (if **pos** is not NULL).|
4567| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1).|
4568| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.|
4569
4570**Returns**
4571
4572Returns 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.
4573
4574
4575
4576### OH_Drawing_TextBlobUniqueID()
4577
4578```
4579uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* )
4580```
4581
4582**Description**
4583
4584Obtains the unique identifier of a text blob. The identifier is a non-zero value.
4585
4586Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4587
4588If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4589
4590If **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4591
4592**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4593
4594**Since**: 12
4595
4596**Parameters**
4597
4598| Name| Description|
4599| -------- | -------- |
4600| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object.|
4601
4602**Returns**
4603
4604Returns the unique identifier of the text blob.
4605
4606
4607### OH_Drawing_PenSetShadowLayer()
4608
4609```
4610void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* )
4611```
4612
4613**Description**
4614
4615Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn.
4616
4617Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4618
4619If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4620
4621If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4622
4623**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4624
4625**Since**: 12
4626
4627**Parameters**
4628
4629| Name| Description|
4630| -------- | -------- |
4631| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.|
4632| 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.|
4633
4634
4635### OH_Drawing_BrushSetShadowLayer()
4636
4637```
4638void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* )
4639```
4640
4641**Description**
4642
4643Sets the shadow layer for a brush. The shadow layer effect takes effect only when text is drawn.
4644
4645Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4646
4647If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4648
4649If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4650
4651**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4652
4653**Since**: 12
4654
4655**Parameters**
4656
4657| Name| Description|
4658| -------- | -------- |
4659| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object.|
4660| 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.|
4661
4662
4663### OH_Drawing_ShadowLayerCreate()
4664
4665```
4666OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color )
4667```
4668
4669**Description**
4670
4671Creates an **OH_Drawing_ShadowLayer** object.
4672
4673Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4674
4675If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4676
4677If **blurRadius** is less than or equal to **0**, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4678
4679**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4680
4681**Since**: 12
4682
4683**Parameters**
4684
4685| Name| Description|
4686| -------- | -------- |
4687| blurRadius | Radius of the shadow layer. The value must be greater than 0.|
4688| x | Offset on the X axis.|
4689| y | Offset on the Y axis.|
4690| color | Color of the shadow.|
4691
4692**Returns**
4693
4694Returns the pointer to the **OH_Drawing_ShadowLayer** object created.
4695
4696
4697### OH_Drawing_ShadowLayerDestroy()
4698
4699```
4700void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* )
4701```
4702
4703**Description**
4704
4705Destroys an **OH_Drawing_ShadowLayer** object and reclaims the memory occupied by the object.
4706
4707**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4708
4709**Since**: 12
4710
4711**Parameters**
4712
4713| Name| Description|
4714| -------- | -------- |
4715| OH_Drawing_ShadowLayer | Pointer to the shadow layer.|
4716
4717
4718### OH_Drawing_FontSetBaselineSnap()
4719
4720```
4721void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap )
4722```
4723
4724**Description**
4725
4726Sets whether to request that baselines be snapped to pixels when the current canvas matrix is axis aligned.
4727
4728Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4729
4730If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4731
4732If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4733
4734**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4735
4736**Since**: 12
4737
4738**Parameters**
4739
4740| Name| Description|
4741| -------- | -------- |
4742| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4743| baselineSnap | Whether to request that baselines be snapped to pixels. The value **true** means to request that baselines be snapped to pixels, and **false** means the opposite.|
4744
4745
4746### OH_Drawing_FontIsBaselineSnap()
4747
4748```
4749bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* )
4750```
4751
4752**Description**
4753
4754Checks whether baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned.
4755
4756Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4757
4758If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4759
4760If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4761
4762**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4763
4764**Since**: 12
4765
4766**Parameters**
4767
4768| Name| Description|
4769| -------- | -------- |
4770| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4771
4772**Returns**
4773
4774Returns **true** if baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned; returns **false** otherwise.
4775
4776
4777### OH_Drawing_FontSetEdging()
4778
4779```
4780void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging  )
4781```
4782
4783**Description**
4784
4785Sets a font edging effect.
4786
4787Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4788
4789If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4790
4791If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4792
4793If **OH_Drawing_FontEdging** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
4794
4795**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4796
4797**Since**: 12
4798
4799**Parameters**
4800
4801| Name| Description|
4802| -------- | -------- |
4803| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4804| OH_Drawing_FontEdging | Font edging effect.|
4805
4806
4807### OH_Drawing_FontGetEdging()
4808
4809```
4810OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* )
4811```
4812
4813**Description**
4814
4815Obtains the font edging effect.
4816
4817Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4818
4819If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4820
4821If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4822
4823**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4824
4825**Since**: 12
4826
4827**Parameters**
4828
4829| Name| Description|
4830| -------- | -------- |
4831| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4832
4833**Returns**
4834
4835Returns the font edging effect.
4836
4837
4838
4839### OH_Drawing_FontSetForceAutoHinting()
4840
4841```
4842void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting )
4843```
4844
4845**Description**
4846
4847Sets whether to forcibly use auto hinting, that is, whether to always hint glyphs.
4848
4849Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4850
4851If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4852
4853If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4854
4855**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4856
4857**Since**: 12
4858
4859**Parameters**
4860
4861| Name| Description|
4862| -------- | -------- |
4863| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4864| isForceAutoHinting | Whether to forcibly use auto hinting. The value **true** means to forcibly use auto hinting, and **false** means the opposite.|
4865
4866
4867### OH_Drawing_FontIsForceAutoHinting()
4868
4869```
4870bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* )
4871```
4872
4873**Description**
4874
4875Checks whether auto hinting is forcibly used.
4876
4877Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4878
4879If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4880
4881If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4882
4883**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4884
4885**Since**: 12
4886
4887**Parameters**
4888
4889| Name| Description|
4890| -------- | -------- |
4891| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4892
4893**Returns**
4894
4895Returns **true** if auto hinting is forcibly used; returns **false** otherwise.
4896
4897
4898### OH_Drawing_FontSetSubpixel()
4899
4900```
4901void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel )
4902```
4903
4904**Description**
4905
4906Sets whether to use sub-pixel rendering for a font.
4907
4908Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4909
4910If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4911
4912If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4913
4914**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4915
4916**Since**: 12
4917
4918**Parameters**
4919
4920| Name| Description|
4921| -------- | -------- |
4922| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4923| isSubpixel | Whether to use sub-pixel rendering for the font. The value **true** means to use sub-pixel rendering for the font, and **false** means the opposite.|
4924
4925
4926### OH_Drawing_FontIsSubpixel()
4927
4928```
4929bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* )
4930```
4931
4932**Description**
4933
4934Checks whether sub-pixel rendering is used for a font.
4935
4936Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4937
4938If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4939
4940If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4941
4942**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4943
4944**Since**: 12
4945
4946**Parameters**
4947
4948| Name| Description|
4949| -------- | -------- |
4950| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4951
4952**Returns**
4953
4954Returns **true** if sub-pixel rendering is used for the font; returns **false** otherwise.
4955
4956
4957### OH_Drawing_FontGetTextSize()
4958
4959```
4960float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* )
4961```
4962
4963**Description**
4964
4965Obtains the text size.
4966
4967Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4968
4969If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
4970
4971If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
4972
4973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
4974
4975**Since**: 12
4976
4977**Parameters**
4978
4979| Name| Description|
4980| -------- | -------- |
4981| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
4982
4983**Returns**
4984
4985Returns a floating point number representing the text size.
4986
4987
4988### OH_Drawing_FontTextToGlyphs()
4989
4990```
4991uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount )
4992```
4993
4994**Description**
4995
4996Converts text into glyph indices.
4997
4998Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
4999
5000If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5001
5002If 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.
5003
5004**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5005
5006**Since**: 12
5007
5008**Parameters**
5009
5010| Name| Description|
5011| -------- | -------- |
5012| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5013| text | Pointer to the start address of the storage.|
5014| byteLength | Text length, in bytes.|
5015| encoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding).|
5016| glyphs | Pointer to the start address for storing the glyph indices.|
5017| maxGlyphCount | Maximum number of glyphs.|
5018
5019**Returns**
5020
5021Returns the number of glyph indices.
5022
5023
5024### OH_Drawing_FontGetWidths()
5025
5026```
5027void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths )
5028```
5029
5030**Description**
5031
5032Obtains the width of each glyph in a string of text.
5033
5034Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5035
5036If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5037
5038If 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.
5039
5040**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5041
5042**Since**: 12
5043
5044**Parameters**
5045
5046| Name| Description|
5047| -------- | -------- |
5048| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5049| glyphs | Pointer to the start address for storing the glyph indices.|
5050| count | Number of glyph indices.|
5051| widths | Pointer to the start address for storing the glyph widths.|
5052
5053
5054### OH_Drawing_FontIsLinearText()
5055
5056```
5057bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* )
5058```
5059
5060**Description**
5061
5062Checks whether linear scaling is used for a font.
5063
5064Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5065
5066If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5067
5068If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5069
5070**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5071
5072**Since**: 12
5073
5074**Parameters**
5075
5076| Name| Description|
5077| -------- | -------- |
5078| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5079
5080**Returns**
5081
5082Returns **true** if linear scaling is used; returns **false** otherwise.
5083
5084
5085### OH_Drawing_FontGetTextSkewX()
5086
5087```
5088float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* )
5089```
5090
5091**Description**
5092
5093Obtains the horizontal skew factor of a font.
5094
5095Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5096
5097If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5098
5099If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5100
5101**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5102
5103**Since**: 12
5104
5105**Parameters**
5106
5107| Name| Description|
5108| -------- | -------- |
5109| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5110
5111**Returns**
5112
5113Returns a floating point number representing the horizontal skew factor.
5114
5115
5116### OH_Drawing_FontIsFakeBoldText()
5117
5118```
5119bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* )
5120```
5121
5122**Description**
5123
5124Checks whether fake bold is used for a font.
5125
5126Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5127
5128If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5129
5130If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5131
5132**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5133
5134**Since**: 12
5135
5136**Parameters**
5137
5138| Name| Description|
5139| -------- | -------- |
5140| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5141
5142**Returns**
5143
5144Returns **true** if fake bold is used; returns **false** otherwise.
5145
5146
5147### OH_Drawing_FontSetScaleX()
5148
5149```
5150void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX )
5151```
5152
5153**Description**
5154
5155Sets a horizontal scale factor for a font.
5156
5157Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5158
5159If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5160
5161If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5162
5163**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5164
5165**Since**: 12
5166
5167**Parameters**
5168
5169| Name| Description|
5170| -------- | -------- |
5171| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5172| scaleX | Horizontal scale factor.|
5173
5174
5175### OH_Drawing_FontGetScaleX()
5176
5177```
5178float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* )
5179```
5180
5181**Description**
5182
5183Obtains the horizontal scale factor of a font.
5184
5185Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5186
5187If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5188
5189If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5190
5191**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5192
5193**Since**: 12
5194
5195**Parameters**
5196
5197| Name| Description|
5198| -------- | -------- |
5199| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5200
5201**Returns**
5202
5203Returns the horizontal scale factor.
5204
5205
5206### OH_Drawing_FontSetHinting()
5207
5208```
5209void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting  )
5210```
5211
5212**Description**
5213
5214Sets a font hinting effect.
5215
5216Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5217
5218If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5219
5220If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5221
5222If **OH_Drawing_FontHinting** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
5223
5224**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5225
5226**Since**: 12
5227
5228**Parameters**
5229
5230| Name| Description|
5231| -------- | -------- |
5232| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5233| OH_Drawing_FontHinting | Font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting).|
5234
5235
5236### OH_Drawing_FontGetHinting()
5237
5238```
5239OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* )
5240```
5241
5242**Description**
5243
5244Obtains the font hinting effect.
5245
5246Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5247
5248If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5249
5250If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5251
5252**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5253
5254**Since**: 12
5255
5256**Parameters**
5257
5258| Name| Description|
5259| -------- | -------- |
5260| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5261
5262**Returns**
5263
5264Returns the font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting).
5265
5266
5267### OH_Drawing_FontSetEmbeddedBitmaps()
5268
5269```
5270void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps )
5271```
5272
5273**Description**
5274
5275Sets whether to use bitmaps in a font.
5276
5277Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5278
5279If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5280
5281If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5282
5283**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5284
5285**Since**: 12
5286
5287**Parameters**
5288
5289| Name| Description|
5290| -------- | -------- |
5291| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5292| isEmbeddedBitmaps | Whether to use bitmaps in the font. The value **true** means to use bitmaps in the font, and **false** means the opposite.|
5293
5294
5295### OH_Drawing_FontIsEmbeddedBitmaps()
5296
5297```
5298bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* )
5299```
5300
5301**Description**
5302
5303Checks whether bitmaps are used in a font.
5304
5305Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5306
5307If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5308
5309If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5310
5311**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5312
5313**Since**: 12
5314
5315**Parameters**
5316
5317| Name| Description|
5318| -------- | -------- |
5319| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.|
5320
5321**Returns**
5322
5323Returns **true** if bitmaps are used; returns **false** otherwise.
5324
5325
5326### OH_Drawing_BitmapBuild()
5327
5328```
5329void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*  )
5330```
5331
5332**Description**
5333
5334Initializes the width and height of a bitmap and sets the pixel format for the bitmap.
5335
5336Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5337
5338If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5339
5340If either **OH_Drawing_Bitmap** or **OH_Drawing_BitmapFormat** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5341
5342**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5343
5344**Since**: 8
5345
5346**Parameters**
5347
5348| Name| Description|
5349| -------- | -------- |
5350| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5351| width | Width of the bitmap to be initialized.|
5352| height | Height of the bitmap to be initialized.|
5353| [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.|
5354
5355
5356### OH_Drawing_BitmapCreate()
5357
5358```
5359OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void )
5360```
5361
5362**Description**
5363
5364Creates an **OH_Drawing_Bitmap** object.
5365
5366**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5367
5368**Since**: 8
5369
5370**Returns**
5371
5372Returns the pointer to the **OH_Drawing_Bitmap** object created.
5373
5374
5375### OH_Drawing_BitmapCreateFromPixels()
5376
5377```
5378OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes )
5379```
5380
5381**Description**
5382
5383Creates 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.
5384
5385Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5386
5387If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5388
5389If either **OH_Drawing_Image_Info** or **pixels** is NULL or **rowBytes** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5390
5391**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5392
5393**Since**: 12
5394
5395**Parameters**
5396
5397| Name| Description|
5398| -------- | -------- |
5399| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
5400| 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.|
5401| rowBytes | Size of pixels per row.|
5402
5403**Returns**
5404
5405Returns the pointer to the [OH_Drawing_Bitmap](#oh_drawing_bitmap) object created.
5406
5407
5408### OH_Drawing_BitmapDestroy()
5409
5410```
5411void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* )
5412```
5413
5414**Description**
5415
5416Destroys an **OH_Drawing_Bitmap** object and reclaims the memory occupied by the object.
5417
5418**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5419
5420**Since**: 8
5421
5422**Parameters**
5423
5424| Name| Description|
5425| -------- | -------- |
5426| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5427
5428
5429### OH_Drawing_BitmapGetAlphaFormat()
5430
5431```
5432OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* )
5433```
5434
5435**Description**
5436
5437Obtains the alpha component of a bitmap.
5438
5439Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5440
5441If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5442
5443If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5444
5445**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5446
5447**Since**: 12
5448
5449**Parameters**
5450
5451| Name| Description|
5452| -------- | -------- |
5453| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5454
5455**Returns**
5456
5457Returns the alpha component. For details about the supported formats, see [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat).
5458
5459
5460### OH_Drawing_BitmapGetColorFormat()
5461
5462```
5463OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* )
5464```
5465
5466**Description**
5467
5468Obtains the pixel format of a bitmap.
5469
5470Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5471
5472If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5473
5474If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5475
5476**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5477
5478**Since**: 12
5479
5480**Parameters**
5481
5482| Name| Description|
5483| -------- | -------- |
5484| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5485
5486**Returns**
5487
5488Returns the pixel format. For details about the supported formats, see [OH_Drawing_ColorFormat](#oh_drawing_colorformat).
5489
5490
5491### OH_Drawing_BitmapGetHeight()
5492
5493```
5494uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* )
5495```
5496
5497**Description**
5498
5499Obtains the height of a bitmap.
5500
5501Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5502
5503If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5504
5505If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5506
5507**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5508
5509**Since**: 8
5510
5511**Parameters**
5512
5513| Name| Description|
5514| -------- | -------- |
5515| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5516
5517**Returns**
5518
5519Returns the height.
5520
5521
5522### OH_Drawing_BitmapGetImageInfo()
5523
5524```
5525void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info*  )
5526```
5527
5528**Description**
5529
5530Obtains the image information of a bitmap.
5531
5532Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5533
5534If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5535
5536If either **OH_Drawing_Bitmap** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5537
5538**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5539
5540**Since**: 12
5541
5542**Parameters**
5543
5544| Name| Description|
5545| -------- | -------- |
5546| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.|
5547| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
5548
5549
5550### OH_Drawing_BitmapGetPixels()
5551
5552```
5553void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* )
5554```
5555
5556**Description**
5557
5558Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap.
5559
5560Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5561
5562If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5563
5564If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5565
5566**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5567
5568**Since**: 8
5569
5570**Parameters**
5571
5572| Name| Description|
5573| -------- | -------- |
5574| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5575
5576**Returns**
5577
5578Returns the pixel address.
5579
5580
5581### OH_Drawing_BitmapGetWidth()
5582
5583```
5584uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* )
5585```
5586
5587**Description**
5588
5589Obtains the width of a bitmap.
5590
5591Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5592
5593If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5594
5595If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5596
5597**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5598
5599**Since**: 8
5600
5601**Parameters**
5602
5603| Name| Description|
5604| -------- | -------- |
5605| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.|
5606
5607**Returns**
5608
5609Returns the width.
5610
5611### OH_Drawing_BitmapReadPixels()
5612
5613```
5614bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY )
5615```
5616
5617**Description**
5618
5619Reads pixels of a rectangle in a bitmap to the specified buffer.
5620
5621Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5622
5623If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5624
5625If any of **OH_Drawing_Bitmap**, **dstInfo**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5626
5627**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5628
5629**Since**: 12
5630
5631**Parameters**
5632
5633| Name| Description|
5634| -------- | -------- |
5635| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.|
5636| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.|
5637| dstPixels | Pointer to the buffer for storing the pixels read.|
5638| 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.|
5639| srcX | Start X coordinate of the pixel data to read from the bitmap. The value must be less than the width of the bitmap.|
5640| srcY | Start Y coordinate of the pixel data to read from the bitmap. The value must be less than the height of the bitmap.|
5641
5642**Returns**
5643
5644Returns **true** if the pixels are read; returns **false** otherwise.
5645
5646
5647### OH_Drawing_BrushCreate()
5648
5649```
5650OH_Drawing_Brush* OH_Drawing_BrushCreate (void )
5651```
5652
5653**Description**
5654
5655Creates an **OH_Drawing_Brush** object.
5656
5657**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5658
5659**Since**: 8
5660
5661**Returns**
5662
5663Returns the pointer to the **OH_Drawing_Brush** object created.
5664
5665
5666### OH_Drawing_BrushDestroy()
5667
5668```
5669void OH_Drawing_BrushDestroy (OH_Drawing_Brush* )
5670```
5671
5672**Description**
5673
5674Destroys an **OH_Drawing_Brush** object and reclaims the memory occupied by the object.
5675
5676**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5677
5678**Since**: 8
5679
5680**Parameters**
5681
5682| Name             | Description                                |
5683| ---------------- | ------------------------------------------ |
5684| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5685
5686
5687### OH_Drawing_BrushGetAlpha()
5688
5689```
5690uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* )
5691```
5692
5693**Description**
5694
5695Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape.
5696
5697Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5698
5699If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5700
5701If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5702
5703**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5704
5705**Since**: 11
5706
5707**Parameters**
5708
5709| Name             | Description                                |
5710| ---------------- | ------------------------------------------ |
5711| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5712
5713**Returns**
5714
5715Returns an 8-bit variable that describes the alpha value.
5716
5717
5718### OH_Drawing_BrushGetColor()
5719
5720```
5721uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* )
5722```
5723
5724**Description**
5725
5726Obtains the color of a brush. The color is used by the brush to fill in a shape.
5727
5728Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5729
5730If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5731
5732If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5733
5734**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5735
5736**Since**: 8
5737
5738**Parameters**
5739
5740| Name             | Description                                |
5741| ---------------- | ------------------------------------------ |
5742| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5743
5744**Returns**
5745
5746Returns a 32-bit (ARGB) variable that describes the color.
5747
5748
5749### OH_Drawing_BrushGetFilter()
5750
5751```
5752void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
5753```
5754
5755**Description**
5756
5757Obtains the filter of a brush. The filter is a container that holds a mask filter and color filter.
5758
5759Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5760
5761If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5762
5763If either **OH_Drawing_Brush** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5764
5765**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5766
5767**Since**: 12
5768
5769**Parameters**
5770
5771| Name              | Description                                                  |
5772| ----------------- | ------------------------------------------------------------ |
5773| OH_Drawing_Brush  | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object.  |
5774| OH_Drawing_Filter | Pointer to the [OH_Drawing_Filter](#oh_drawing_filter) object obtained. |
5775
5776
5777### OH_Drawing_BrushIsAntiAlias()
5778
5779```
5780bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* )
5781```
5782
5783**Description**
5784
5785Checks whether anti-aliasing is enabled for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.
5786
5787Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5788
5789If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5790
5791If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5792
5793**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5794
5795**Since**: 8
5796
5797**Parameters**
5798
5799| Name             | Description                                |
5800| ---------------- | ------------------------------------------ |
5801| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5802
5803**Returns**
5804
5805Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
5806
5807
5808### OH_Drawing_BrushReset()
5809
5810```
5811void OH_Drawing_BrushReset (OH_Drawing_Brush* )
5812```
5813
5814**Description**
5815
5816Resets a brush to the initial state. All configured attributes are cleared.
5817
5818Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5819
5820If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5821
5822If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5823
5824**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5825
5826**Since**: 12
5827
5828**Parameters**
5829
5830| Name             | Description                                                 |
5831| ---------------- | ----------------------------------------------------------- |
5832| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. |
5833
5834
5835### OH_Drawing_BrushSetAlpha()
5836
5837```
5838void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha )
5839```
5840
5841**Description**
5842
5843Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape.
5844
5845Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5846
5847If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5848
5849If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5850
5851**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5852
5853**Since**: 11
5854
5855**Parameters**
5856
5857| Name             | Description                                |
5858| ---------------- | ------------------------------------------ |
5859| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5860| alpha            | Alpha value, which is an 8-bit variable.   |
5861
5862
5863### OH_Drawing_BrushSetAntiAlias()
5864
5865```
5866void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool  )
5867```
5868
5869**Description**
5870
5871Enables or disables anti-aliasing for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent.
5872
5873Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5874
5875If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5876
5877If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5878
5879**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5880
5881**Since**: 8
5882
5883**Parameters**
5884
5885| Name             | Description                                                  |
5886| ---------------- | ------------------------------------------------------------ |
5887| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object.                   |
5888| bool             | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
5889
5890
5891### OH_Drawing_BrushSetBlendMode()
5892
5893```
5894void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode  )
5895```
5896
5897**Description**
5898
5899Sets a blender for a brush. The blender implements the specified blend mode.
5900
5901Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5902
5903If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5904
5905If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5906
5907If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
5908
5909**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5910
5911**Since**: 12
5912
5913**Parameters**
5914
5915| Name                 | Description                                                  |
5916| -------------------- | ------------------------------------------------------------ |
5917| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object.  |
5918| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
5919
5920
5921### OH_Drawing_BrushSetColor()
5922
5923```
5924void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color )
5925```
5926
5927**Description**
5928
5929Sets the color for a brush. The color is used by the brush to fill in a shape.
5930
5931Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5932
5933If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5934
5935If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5936
5937**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5938
5939**Since**: 8
5940
5941**Parameters**
5942
5943| Name             | Description                                |
5944| ---------------- | ------------------------------------------ |
5945| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. |
5946| color            | Color, which is a 32-bit (ARGB) variable.  |
5947
5948
5949### OH_Drawing_BrushSetFilter()
5950
5951```
5952void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter*  )
5953```
5954
5955**Description**
5956
5957Sets a filter for a brush. The filter is a container that holds a mask filter and color filter.
5958
5959Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5960
5961If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5962
5963If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5964
5965**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5966
5967**Since**: 11
5968
5969**Parameters**
5970
5971| Name              | Description                                                  |
5972| ----------------- | ------------------------------------------------------------ |
5973| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.                   |
5974| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. If null is passed in, the filter will be cleared. |
5975
5976
5977### OH_Drawing_BrushSetShaderEffect()
5978
5979```
5980void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect*  )
5981```
5982
5983**Description**
5984
5985Sets the shader effect for a brush.
5986
5987Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
5988
5989If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
5990
5991If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
5992
5993**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
5994
5995**Since**: 11
5996
5997**Parameters**
5998
5999| Name                    | Description                                                  |
6000| ----------------------- | ------------------------------------------------------------ |
6001| OH_Drawing_Brush        | Pointer to an **OH_Drawing_Brush** object.                   |
6002| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. If NULL is passed in, the shader effect of the brush will be cleared. |
6003
6004
6005### OH_Drawing_CanvasAttachBrush()
6006
6007```
6008void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
6009```
6010
6011**Description**
6012
6013Attaches a brush to a canvas so that the canvas can use the style and color of the brush to fill in a shape.
6014
6015Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6016
6017If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6018
6019If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6020
6021**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6022
6023**Since**: 8
6024
6025**Parameters**
6026
6027| Name              | Description                                 |
6028| ----------------- | ------------------------------------------- |
6029| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6030| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.  |
6031
6032
6033### OH_Drawing_CanvasAttachPen()
6034
6035```
6036void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen*  )
6037```
6038
6039**Description**
6040
6041Attaches a pen to a canvas so that the canvas can use the style and color of the pen to outline a shape.
6042
6043Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6044
6045If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6046
6047If either **OH_Drawing_Canvas** or **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6048
6049**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6050
6051**Since**: 8
6052
6053**Parameters**
6054
6055| Name              | Description                                 |
6056| ----------------- | ------------------------------------------- |
6057| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6058| OH_Drawing_Pen    | Pointer to an **OH_Drawing_Pen** object.    |
6059
6060
6061### OH_Drawing_CanvasBind()
6062
6063```
6064void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap*  )
6065```
6066
6067**Description**
6068
6069Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap. (This process is called CPU rendering.)
6070
6071Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6072
6073If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6074
6075If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6076
6077**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6078
6079**Since**: 8
6080
6081**Parameters**
6082
6083| Name              | Description                                 |
6084| ----------------- | ------------------------------------------- |
6085| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6086| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object. |
6087
6088
6089### OH_Drawing_CanvasClear()
6090
6091```
6092void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color )
6093```
6094
6095**Description**
6096
6097Clears a canvas by using a given color.
6098
6099Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6100
6101If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6102
6103If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6104
6105**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6106
6107**Since**: 8
6108
6109**Parameters**
6110
6111| Name              | Description                                 |
6112| ----------------- | ------------------------------------------- |
6113| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6114| color             | Color, which is a 32-bit (ARGB) variable.   |
6115
6116
6117### OH_Drawing_CanvasClipPath()
6118
6119```
6120void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6121```
6122
6123**Description**
6124
6125Clips a path.
6126
6127Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6128
6129If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6130
6131If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6132
6133If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6134
6135**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6136
6137**Since**: 11
6138
6139**Parameters**
6140
6141| Name              | Description                                                  |
6142| ----------------- | ------------------------------------------------------------ |
6143| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
6144| OH_Drawing_Path   | Pointer to an **OH_Drawing_Path** object.                    |
6145| clipOp            | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
6146| doAntiAlias       | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
6147
6148
6149### OH_Drawing_CanvasClipRect()
6150
6151```
6152void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6153```
6154
6155**Description**
6156
6157Clips a rectangle.
6158
6159Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6160
6161If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6162
6163If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6164
6165If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6166
6167**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6168
6169**Since**: 11
6170
6171**Parameters**
6172
6173| Name              | Description                                                  |
6174| ----------------- | ------------------------------------------------------------ |
6175| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
6176| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.                    |
6177| clipOp            | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
6178| doAntiAlias       | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
6179
6180### OH_Drawing_CanvasClipRoundRect()
6181
6182```
6183void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias )
6184```
6185
6186**Description**
6187
6188Clips a rounded rectangle.
6189
6190Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6191
6192If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6193
6194If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6195
6196If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6197
6198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6199
6200**Since**: 12
6201
6202**Parameters**
6203
6204| Name                 | Description                                                  |
6205| -------------------- | ------------------------------------------------------------ |
6206| OH_Drawing_Canvas    | Pointer to an **OH_Drawing_Canvas** object.                  |
6207| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object.               |
6208| clipOp               | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). |
6209| doAntiAlias          | Whether to perform anti-aliasing. The value **true** means to perform anti-aliasing, and **false** means the opposite. |
6210
6211### OH_Drawing_CanvasConcatMatrix()
6212
6213```
6214void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
6215```
6216
6217**Description**
6218
6219Preconcats the existing matrix with the passed-in matrix. The drawing operation triggered before this function is called is not affected.
6220
6221Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6222
6223If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6224
6225If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6226
6227**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6228
6229**Since**: 12
6230
6231**Parameters**
6232
6233| Name              | Description                                                  |
6234| ----------------- | ------------------------------------------------------------ |
6235| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6236| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
6237
6238
6239### OH_Drawing_CanvasCreate()
6240
6241```
6242OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void )
6243```
6244
6245**Description**
6246
6247Creates an **OH_Drawing_Canvas** object.
6248
6249**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6250
6251**Since**: 8
6252
6253**Returns**
6254
6255Returns the pointer to the **OH_Drawing_Canvas** object created.
6256
6257
6258### OH_Drawing_CanvasDestroy()
6259
6260```
6261void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* )
6262```
6263
6264**Description**
6265
6266Destroys an **OH_Drawing_Canvas** object and reclaims the memory occupied by the object.
6267
6268**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6269
6270**Since**: 8
6271
6272**Parameters**
6273
6274| Name              | Description                                 |
6275| ----------------- | ------------------------------------------- |
6276| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6277
6278
6279### OH_Drawing_CanvasDetachBrush()
6280
6281```
6282void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* )
6283```
6284
6285**Description**
6286
6287Detaches the brush from a canvas so that the canvas can no longer use the previously set brush to fill in a shape.
6288
6289Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6290
6291If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6292
6293If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6294
6295**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6296
6297**Since**: 8
6298
6299**Parameters**
6300
6301| Name              | Description                                 |
6302| ----------------- | ------------------------------------------- |
6303| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6304
6305
6306### OH_Drawing_CanvasDetachPen()
6307
6308```
6309void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* )
6310```
6311
6312**Description**
6313
6314Detaches the pen from a canvas so that the canvas can no longer use the style and color of the pen to outline a shape.
6315
6316Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6317
6318If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6319
6320If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6321
6322**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6323
6324**Since**: 8
6325
6326**Parameters**
6327
6328| Name              | Description                                 |
6329| ----------------- | ------------------------------------------- |
6330| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6331
6332
6333### OH_Drawing_CanvasDrawArc()
6334
6335```
6336void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
6337```
6338
6339**Description**
6340
6341Draws an arc.
6342
6343Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6344
6345If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6346
6347If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6348
6349**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6350
6351**Since**: 11
6352
6353**Parameters**
6354
6355| Name              | Description                                 |
6356| ----------------- | ------------------------------------------- |
6357| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6358| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.   |
6359| startAngle        | Start angle of the arc.                     |
6360| sweepAngle        | Sweep angle of the arc.                     |
6361
6362
6363### OH_Drawing_CanvasDrawBackground()
6364
6365```
6366void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush*  )
6367```
6368
6369**Description**
6370
6371Draws a background filled with a brush.
6372
6373Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6374
6375If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6376
6377If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6378
6379**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6380
6381**Since**: 12
6382
6383**Parameters**
6384
6385| Name              | Description                                 |
6386| ----------------- | ------------------------------------------- |
6387| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6388| OH_Drawing_Brush  | Pointer to an **OH_Drawing_Brush** object.  |
6389
6390
6391### OH_Drawing_CanvasDrawBitmap()
6392
6393```
6394void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top )
6395```
6396
6397**Description**
6398
6399Draws 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).
6400
6401Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6402
6403If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6404
6405If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6406
6407**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6408
6409**Since**: 11
6410
6411**Parameters**
6412
6413| Name              | Description                                          |
6414| ----------------- | ---------------------------------------------------- |
6415| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.          |
6416| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.          |
6417| left              | X coordinate of the upper left corner of the bitmap. |
6418| top               | Y coordinate of the upper left corner of the bitmap. |
6419
6420
6421### OH_Drawing_CanvasDrawBitmapRect()
6422
6423```
6424void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
6425```
6426
6427**Description**
6428
6429Draws a portion of a bitmap onto a specified area of the canvas.
6430
6431Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6432
6433If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6434
6435If any of **OH_Drawing_Canvas**, **OH_Drawing_Bitmap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6436
6437**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6438
6439**Since**: 12
6440
6441**Parameters**
6442
6443| Name                       | Description                                                  |
6444| -------------------------- | ------------------------------------------------------------ |
6445| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6446| OH_Drawing_Bitmap          | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
6447| src                        | Pointer to a rectangle on the bitmap. If NULL is passed in, it refers to the entire bitmap. |
6448| dst                        | Pointer to a rectangle on the canvas.                        |
6449| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
6450
6451
6452### OH_Drawing_CanvasDrawCircle()
6453
6454```
6455void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius )
6456```
6457
6458**Description**
6459
6460Draws a circle.
6461
6462Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6463
6464If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6465
6466If either **OH_Drawing_Canvas** or **OH_Drawing_Point** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6467
6468If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6469
6470**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6471
6472**Since**: 11
6473
6474**Parameters**
6475
6476| Name              | Description                                                  |
6477| ----------------- | ------------------------------------------------------------ |
6478| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
6479| OH_Drawing_Point  | Pointer to an **OH_Drawing_Point** object, which indicates the center of the circle. |
6480| radius            | Radius of the circle.                                        |
6481
6482
6483### OH_Drawing_CanvasDrawImageRect()
6484
6485```
6486void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*  )
6487```
6488
6489**Description**
6490
6491Draws an image onto a specified area of the canvas.
6492
6493Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6494
6495If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6496
6497If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6498
6499**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6500
6501**Since**: 12
6502
6503**Parameters**
6504
6505| Name                       | Description                                                  |
6506| -------------------------- | ------------------------------------------------------------ |
6507| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6508| OH_Drawing_Image           | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
6509| dst                        | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
6510| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
6511
6512
6513### OH_Drawing_CanvasDrawImageRectWithSrc()
6514
6515```
6516void 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  )
6517```
6518
6519**Description**
6520
6521Draws 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.
6522
6523Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6524
6525If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6526
6527If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6528
6529**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6530
6531**Since**: 12
6532
6533**Parameters**
6534
6535| Name                         | Description                                                  |
6536| ---------------------------- | ------------------------------------------------------------ |
6537| OH_Drawing_Canvas            | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6538| OH_Drawing_Image             | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
6539| src                          | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
6540| dst                          | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
6541| OH_Drawing_SamplingOptions   | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
6542| OH_Drawing_SrcRectConstraint | Constraint type. For details about the available options, see [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1). |
6543
6544
6545### OH_Drawing_CanvasDrawLine()
6546
6547```
6548void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 )
6549```
6550
6551**Description**
6552
6553Draws a line segment.
6554
6555Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6556
6557If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6558
6559If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6560
6561**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6562
6563**Since**: 8
6564
6565**Parameters**
6566
6567| Name              | Description                                          |
6568| ----------------- | ---------------------------------------------------- |
6569| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.          |
6570| x1                | X coordinate of the start point of the line segment. |
6571| y1                | Y coordinate of the start point of the line segment. |
6572| x2                | X coordinate of the end point of the line segment.   |
6573| y2                | Y coordinate of the end point of the line segment.   |
6574
6575
6576### OH_Drawing_CanvasDrawOval()
6577
6578```
6579void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
6580```
6581
6582**Description**
6583
6584Draws an oval.
6585
6586Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6587
6588If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6589
6590If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6591
6592**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6593
6594**Since**: 11
6595
6596**Parameters**
6597
6598| Name              | Description                                 |
6599| ----------------- | ------------------------------------------- |
6600| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6601| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.   |
6602
6603
6604### OH_Drawing_CanvasDrawPath()
6605
6606```
6607void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path*  )
6608```
6609
6610**Description**
6611
6612Draws a path.
6613
6614Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6615
6616If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6617
6618If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6619
6620**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6621
6622**Since**: 8
6623
6624**Parameters**
6625
6626| Name              | Description                                 |
6627| ----------------- | ------------------------------------------- |
6628| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6629| OH_Drawing_Path   | Pointer to an **OH_Drawing_Path** object.   |
6630
6631
6632### OH_Drawing_CanvasDrawPixelMapRect()
6633
6634```
6635void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*  )
6636```
6637
6638**Description**
6639
6640Draws a portion of a pixel map onto a specified area of the canvas.
6641
6642Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6643
6644If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6645
6646If any of **OH_Drawing_Canvas**, **OH_Drawing_PixelMap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6647
6648**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6649
6650**Since**: 12
6651
6652**Parameters**
6653
6654| Name                       | Description                                                  |
6655| -------------------------- | ------------------------------------------------------------ |
6656| OH_Drawing_Canvas          | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6657| OH_Drawing_PixelMap        | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object. |
6658| src                        | Pointer to a rectangle on the pixel map. If NULL is passed in, it refers to the entire pixel map. |
6659| dst                        | Pointer to a rectangle on the canvas.                        |
6660| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. |
6661
6662
6663### OH_Drawing_CanvasDrawPoints()
6664
6665```
6666void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D*  )
6667```
6668
6669**Description**
6670
6671Draws multiple points. You can draw a single point, a line segment, or an open polygon.
6672
6673Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6674
6675If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6676
6677If either **OH_Drawing_Canvas** or **OH_Drawing_Point2D** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6678
6679If **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6680
6681**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6682
6683**Since**: 12
6684
6685**Parameters**
6686
6687| Name                                               | Description                                                  |
6688| -------------------------------------------------- | ------------------------------------------------------------ |
6689| OH_Drawing_Canvas                                  | Pointer to an **OH_Drawing_Canvas** object.                  |
6690| mode                                               | Mode of drawing multiple points. For details about the available options, see [OH_Drawing_PointMode](#oh_drawing_pointmode). |
6691| count                                              | Number of vertices, that is, the number of vertices in the vertex array. |
6692| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Pointer to an array holding the vertices.                    |
6693
6694
6695### OH_Drawing_CanvasDrawRect()
6696
6697```
6698void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect*  )
6699```
6700
6701**Description**
6702
6703Draws a rectangle.
6704
6705Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6706
6707If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6708
6709If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6710
6711**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6712
6713**Since**: 11
6714
6715**Parameters**
6716
6717| Name              | Description                                 |
6718| ----------------- | ------------------------------------------- |
6719| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6720| OH_Drawing_Rect   | Pointer to an **OH_Drawing_Rect** object.   |
6721
6722
6723### OH_Drawing_CanvasDrawRegion()
6724
6725```
6726void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region*  )
6727```
6728
6729**Description**
6730
6731Draws a region.
6732
6733Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6734
6735If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6736
6737If either **OH_Drawing_Canvas** or **OH_Drawing_Region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6738
6739**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6740
6741**Since**: 12
6742
6743**Parameters**
6744
6745| Name              | Description                                 |
6746| ----------------- | ------------------------------------------- |
6747| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6748| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. |
6749
6750
6751### OH_Drawing_CanvasDrawRoundRect()
6752
6753```
6754void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect*  )
6755```
6756
6757**Description**
6758
6759Draws a rounded rectangle.
6760
6761Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6762
6763If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6764
6765If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6766
6767**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6768
6769**Since**: 11
6770
6771**Parameters**
6772
6773| Name                 | Description                                    |
6774| -------------------- | ---------------------------------------------- |
6775| OH_Drawing_Canvas    | Pointer to an **OH_Drawing_Canvas** object.    |
6776| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. |
6777
6778
6779### OH_Drawing_CanvasDrawShadow()
6780
6781```
6782void 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 )
6783```
6784
6785**Description**
6786
6787Draws a spot shadow and uses a given path to outline the ambient shadow.
6788
6789Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6790
6791If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6792
6793If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6794
6795If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6796
6797**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6798
6799**Since**: 12
6800
6801**Parameters**
6802
6803| Name              | Description                                                  |
6804| ----------------- | ------------------------------------------------------------ |
6805| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6806| OH_Drawing_Path   | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, which is used to generate the shadow. |
6807| planeParams       | Value of the function that returns the Z axis of the occluding object from the canvas based on the X axis and Y axis. |
6808| devLightPos       | Position of the light relative to the canvas.                |
6809| lightRadius       | Radius of the light.                                         |
6810| ambientColor      | Color of the ambient shadow.                                 |
6811| spotColor         | Color of the spot shadow.                                    |
6812| flag              | Shadow flag. For details about the available options, see [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags). |
6813
6814
6815### OH_Drawing_CanvasDrawTextBlob()
6816
6817```
6818void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y )
6819```
6820
6821**Description**
6822
6823Draws a text blob. If the typeface used to construct **OH_Drawing_TextBlob** does not support a character, that character will not be drawn.
6824
6825Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6826
6827If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6828
6829If either **OH_Drawing_Canvas** or **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6830
6831**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6832
6833**Since**: 11
6834
6835**Parameters**
6836
6837| Name                | Description                                             |
6838| ------------------- | ------------------------------------------------------- |
6839| OH_Drawing_Canvas   | Pointer to an **OH_Drawing_Canvas** object.             |
6840| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object.           |
6841| x                   | X coordinate of the lower left corner of the text blob. |
6842| y                   | Y coordinate of the lower left corner of the text blob. |
6843
6844
6845### OH_Drawing_CanvasDrawVertices()
6846
6847```
6848void 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 )
6849```
6850
6851**Description**
6852
6853Draws a triangular grid described by a vertex array.
6854
6855Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6856
6857If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6858
6859If 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.
6860
6861If either **vertexMmode** or **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
6862
6863**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6864
6865**Since**: 12
6866
6867**Parameters**
6868
6869| Name              | Description                                                  |
6870| ----------------- | ------------------------------------------------------------ |
6871| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
6872| vertexMmode       | Vertex drawing mode. For details about the available options, see [OH_Drawing_VertexMode](#oh_drawing_vertexmode). |
6873| vertexCount       | Number of elements in the vertex array. The value must be greater than or equal to 3. |
6874| 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**. |
6875| 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**. |
6876| 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**. |
6877| indexCount        | Number of indexes. The value can be 0 or a value greater than or equal to 3. |
6878| 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**. |
6879| mode              | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
6880
6881
6882### OH_Drawing_CanvasGetHeight()
6883
6884```
6885int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* )
6886```
6887
6888**Description**
6889
6890Obtains the canvas height.
6891
6892Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6893
6894If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6895
6896If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6897
6898**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6899
6900**Since**: 12
6901
6902**Parameters**
6903
6904| Name              | Description                                                  |
6905| ----------------- | ------------------------------------------------------------ |
6906| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6907
6908**Returns**
6909
6910Returns the canvas height, in pixels.
6911
6912
6913### OH_Drawing_CanvasGetLocalClipBounds()
6914
6915```
6916void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect*  )
6917```
6918
6919**Description**
6920
6921Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases.
6922
6923Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6924
6925If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6926
6927If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6928
6929**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6930
6931**Since**: 12
6932
6933**Parameters**
6934
6935| Name              | Description                                                  |
6936| ----------------- | ------------------------------------------------------------ |
6937| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6938| OH_Drawing_Rect   | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). |
6939
6940
6941### OH_Drawing_CanvasGetSaveCount()
6942
6943```
6944uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* )
6945```
6946
6947**Description**
6948
6949Obtains the number of canvas statuses (canvas matrices) saved in the stack.
6950
6951Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6952
6953If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6954
6955If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6956
6957**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6958
6959**Since**: 11
6960
6961**Parameters**
6962
6963| Name              | Description                                 |
6964| ----------------- | ------------------------------------------- |
6965| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
6966
6967**Returns**
6968
6969Returns a 32-bit value that describes the number of canvas statuses (canvas matrices). The initial number is **1**.
6970
6971
6972### OH_Drawing_CanvasGetTotalMatrix()
6973
6974```
6975void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
6976```
6977
6978**Description**
6979
6980Obtains the 3x3 matrix of a canvas.
6981
6982Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
6983
6984If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
6985
6986If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
6987
6988**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
6989
6990**Since**: 12
6991
6992**Parameters**
6993
6994| Name              | Description                                                  |
6995| ----------------- | ------------------------------------------------------------ |
6996| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
6997| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). |
6998
6999
7000### OH_Drawing_CanvasGetWidth()
7001
7002```
7003int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* )
7004```
7005
7006**Description**
7007
7008Obtains the canvas width.
7009
7010Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7011
7012If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7013
7014If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7015
7016**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7017
7018**Since**: 12
7019
7020**Parameters**
7021
7022| Name              | Description                                                  |
7023| ----------------- | ------------------------------------------------------------ |
7024| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7025
7026**Returns**
7027
7028Returns the canvas width, in px.
7029
7030
7031### OH_Drawing_CanvasReadPixels()
7032
7033```
7034bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY )
7035```
7036
7037**Description**
7038
7039Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases.
7040
7041Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7042
7043If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7044
7045If any of **OH_Drawing_Canvas**, **OH_Drawing_Image_Info**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7046
7047**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7048
7049**Since**: 12
7050
7051**Parameters**
7052
7053| Name                                                      | Description                                                  |
7054| --------------------------------------------------------- | ------------------------------------------------------------ |
7055| OH_Drawing_Canvas                                         | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7056| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. |
7057| dstPixels                                                 | Pointer to the start address for storing the pixel data.     |
7058| dstRowBytes                                               | Size of pixels per row.                                      |
7059| srcX                                                      | X offset of the pixels on the canvas, in px.                 |
7060| srcY                                                      | Y offset of the pixels on the canvas, in px.                 |
7061
7062**Returns**
7063
7064Returns **true** if the pixel data is copied to the start address of the storage; returns **false** otherwise.
7065
7066
7067### OH_Drawing_CanvasReadPixelsToBitmap()
7068
7069```
7070bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY )
7071```
7072
7073**Description**
7074
7075Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases.
7076
7077Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7078
7079If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7080
7081If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7082
7083**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7084
7085**Since**: 12
7086
7087**Parameters**
7088
7089| Name              | Description                                                  |
7090| ----------------- | ------------------------------------------------------------ |
7091| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7092| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
7093| srcX              | X offset of the pixels on the canvas, in px.                 |
7094| srcY              | Y offset of the pixels on the canvas, in px.                 |
7095
7096**Returns**
7097
7098Returns **true** if the pixel data is copied to the image; returns **false** otherwise.
7099
7100
7101### OH_Drawing_CanvasResetMatrix()
7102
7103```
7104void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* )
7105```
7106
7107**Description**
7108
7109Resets the matrix of a canvas to an identity matrix.
7110
7111Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7112
7113If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7114
7115If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7116
7117**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7118
7119**Since**: 12
7120
7121**Parameters**
7122
7123| Name              | Description                                                  |
7124| ----------------- | ------------------------------------------------------------ |
7125| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7126
7127
7128### OH_Drawing_CanvasRestore()
7129
7130```
7131void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* )
7132```
7133
7134**Description**
7135
7136Restores the canvas status (canvas matrix) saved on the top of the stack.
7137
7138Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7139
7140If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7141
7142If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7143
7144**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7145
7146**Since**: 8
7147
7148**Parameters**
7149
7150| Name              | Description                                 |
7151| ----------------- | ------------------------------------------- |
7152| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
7153
7154
7155### OH_Drawing_CanvasRestoreToCount()
7156
7157```
7158void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount )
7159```
7160
7161**Description**
7162
7163Restores to a given number of canvas statuses (canvas matrices).
7164
7165Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7166
7167If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7168
7169If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7170
7171**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7172
7173**Since**: 11
7174
7175**Parameters**
7176
7177| Name              | Description                                                  |
7178| ----------------- | ------------------------------------------------------------ |
7179| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
7180| 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. |
7181
7182
7183### OH_Drawing_CanvasRotate()
7184
7185```
7186void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py )
7187```
7188
7189**Description**
7190
7191Rotates a canvas by a given angle. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation.
7192
7193Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7194
7195If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7196
7197If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7198
7199**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7200
7201**Since**: 11
7202
7203**Parameters**
7204
7205| Name              | Description                                 |
7206| ----------------- | ------------------------------------------- |
7207| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
7208| degrees           | Angle to rotate.                            |
7209| px                | X coordinate of the rotation point.         |
7210| py                | Y coordinate of the rotation point.         |
7211
7212
7213### OH_Drawing_CanvasSave()
7214
7215```
7216void OH_Drawing_CanvasSave (OH_Drawing_Canvas* )
7217```
7218
7219**Description**
7220
7221Saves the current canvas status (canvas matrix) to the top of the stack.
7222
7223Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7224
7225If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7226
7227If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7228
7229**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7230
7231**Since**: 8
7232
7233**Parameters**
7234
7235| Name              | Description                                 |
7236| ----------------- | ------------------------------------------- |
7237| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
7238
7239
7240### OH_Drawing_CanvasSaveLayer()
7241
7242```
7243void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush*  )
7244```
7245
7246**Description**
7247
7248Saves 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.
7249
7250Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7251
7252If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7253
7254If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7255
7256**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7257
7258**Since**: 12
7259
7260**Parameters**
7261
7262| Name              | Description                                                  |
7263| ----------------- | ------------------------------------------------------------ |
7264| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7265| 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. |
7266| 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. |
7267
7268
7269### OH_Drawing_CanvasScale()
7270
7271```
7272void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy )
7273```
7274
7275**Description**
7276
7277Scales a canvas.
7278
7279Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7280
7281If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7282
7283If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7284
7285**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7286
7287**Since**: 11
7288
7289**Parameters**
7290
7291| Name              | Description                                 |
7292| ----------------- | ------------------------------------------- |
7293| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
7294| sx                | Scale ratio on the X axis.                  |
7295| sy                | Scale ratio on the Y axis.                  |
7296
7297
7298### OH_Drawing_CanvasSetMatrix()
7299
7300```
7301void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix*  )
7302```
7303
7304**Description**
7305
7306Sets the matrix status for a canvas.
7307
7308Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7309
7310If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7311
7312If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7313
7314**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7315
7316**Since**: 12
7317
7318**Parameters**
7319
7320| Name              | Description                                                  |
7321| ----------------- | ------------------------------------------------------------ |
7322| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. |
7323| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). |
7324
7325
7326### OH_Drawing_CanvasSkew()
7327
7328```
7329void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy )
7330```
7331
7332**Description**
7333
7334Skews 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\|
7335
7336Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7337
7338If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7339
7340If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7341
7342**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7343
7344**Since**: 12
7345
7346**Parameters**
7347
7348| Name              | Description                                                  |
7349| ----------------- | ------------------------------------------------------------ |
7350| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object.                  |
7351| 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. |
7352| 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. |
7353
7354
7355### OH_Drawing_CanvasTranslate()
7356
7357```
7358void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy )
7359```
7360
7361**Description**
7362
7363Translates a canvas by a given distance.
7364
7365Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7366
7367If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7368
7369If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7370
7371**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7372
7373**Since**: 11
7374
7375**Parameters**
7376
7377| Name              | Description                                 |
7378| ----------------- | ------------------------------------------- |
7379| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. |
7380| dx                | Distance to translate on the X axis.        |
7381| dy                | Distance to translate on the Y axis.        |
7382
7383
7384### OH_Drawing_ColorFilterCreateBlendMode()
7385
7386```
7387OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode  )
7388```
7389
7390**Description**
7391
7392Creates an **OH_Drawing_ColorFilter** object with a given blend mode.
7393
7394**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7395
7396**Since**: 11
7397
7398**Parameters**
7399
7400| Name                 | Description                                                  |
7401| -------------------- | ------------------------------------------------------------ |
7402| color                | Color, which is a 32-bit (ARGB) variable.                    |
7403| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
7404
7405**Returns**
7406
7407Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7408
7409
7410### OH_Drawing_ColorFilterCreateCompose()
7411
7412```
7413OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 )
7414```
7415
7416**Description**
7417
7418Creates an **OH_Drawing_ColorFilter** object by combining another two color filters.
7419
7420Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7421
7422If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7423
7424If either **colorFilter1** or **colorFilter2** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7425
7426**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7427
7428**Since**: 11
7429
7430**Parameters**
7431
7432| Name         | Description                         |
7433| ------------ | ----------------------------------- |
7434| colorFilter1 | Pointer to the first color filter.  |
7435| colorFilter2 | Pointer to the second color filter. |
7436
7437**Returns**
7438
7439Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7440
7441
7442### OH_Drawing_ColorFilterCreateLinearToSrgbGamma()
7443
7444```
7445OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void )
7446```
7447
7448**Description**
7449
7450Creates an **OH_Drawing_ColorFilter** object that applies the sRGB gamma curve to the RGB channels.
7451
7452**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7453
7454**Since**: 11
7455
7456**Returns**
7457
7458Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7459
7460
7461### OH_Drawing_ColorFilterCreateLuma()
7462
7463```
7464OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void )
7465```
7466
7467**Description**
7468
7469Creates an **OH_Drawing_ColorFilter** object that multiplies the passed-in luma into the alpha channel and sets the RGB channels to zero.
7470
7471**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7472
7473**Since**: 11
7474
7475**Returns**
7476
7477Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7478
7479
7480### OH_Drawing_ColorFilterCreateMatrix()
7481
7482```
7483OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20])
7484```
7485
7486**Description**
7487
7488Creates an **OH_Drawing_ColorFilter** object with a given 5x4 color matrix.
7489
7490Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7491
7492If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7493
7494If **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7495
7496**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7497
7498**Since**: 11
7499
7500**Parameters**
7501
7502| Name   | Description                                                  |
7503| ------ | ------------------------------------------------------------ |
7504| matrix | Matrix, which is represented by a floating-point array with a length of 20. |
7505
7506**Returns**
7507
7508Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7509
7510
7511### OH_Drawing_ColorFilterCreateSrgbGammaToLinear()
7512
7513```
7514OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void )
7515```
7516
7517**Description**
7518
7519Creates an **OH_Drawing_ColorFilter** object that applies the RGB channels to the sRGB gamma curve.
7520
7521**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7522
7523**Since**: 11
7524
7525**Returns**
7526
7527Returns the pointer to the **OH_Drawing_ColorFilter** object created.
7528
7529
7530### OH_Drawing_ColorFilterDestroy()
7531
7532```
7533void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* )
7534```
7535
7536**Description**
7537
7538Destroys an **OH_Drawing_ColorFilter** object and reclaims the memory occupied by the object.
7539
7540**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7541
7542**Since**: 11
7543
7544**Parameters**
7545
7546| Name                   | Description                                      |
7547| ---------------------- | ------------------------------------------------ |
7548| OH_Drawing_ColorFilter | Pointer to an **OH_Drawing_ColorFilter** object. |
7549
7550
7551### OH_Drawing_ColorSetArgb()
7552
7553```
7554uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue )
7555```
7556
7557**Description**
7558
7559Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
7560
7561**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7562
7563**Since**: 8
7564
7565**Parameters**
7566
7567| Name  | Description                                           |
7568| ----- | ----------------------------------------------------- |
7569| alpha | Alpha, which is a variable ranging from 0x00 to 0xFF. |
7570| red   | Read, which is a variable ranging from 0x00 to 0xFF.  |
7571| green | Green, which is a variable ranging from 0x00 to 0xFF. |
7572| blue  | Blue, which is a variable ranging from 0x00 to 0xFF.  |
7573
7574**Returns**
7575
7576Returns a 32-bit (ARGB) variable that describes the color.
7577
7578
7579### OH_Drawing_ColorSpaceCreateSrgb()
7580
7581```
7582OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void )
7583```
7584
7585**Description**
7586
7587Creates an sRGB color space.
7588
7589**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7590
7591**Since**: 12
7592
7593**Returns**
7594
7595Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created.
7596
7597
7598### OH_Drawing_ColorSpaceCreateSrgbLinear()
7599
7600```
7601OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void )
7602```
7603
7604**Description**
7605
7606Creates an sRGB linear (Gamma 1.0) color space.
7607
7608**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7609
7610**Since**: 12
7611
7612**Returns**
7613
7614Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created.
7615
7616
7617### OH_Drawing_ColorSpaceDestroy()
7618
7619```
7620void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* )
7621```
7622
7623**Description**
7624
7625Destroys an **OH_Drawing_ColorSpace** object and reclaims the memory occupied by the object.
7626
7627**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7628
7629**Since**: 12
7630
7631**Parameters**
7632
7633| Name                  | Description                                                  |
7634| --------------------- | ------------------------------------------------------------ |
7635| OH_Drawing_ColorSpace | Pointer to an [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object. |
7636
7637
7638### OH_Drawing_CreateDashPathEffect()
7639
7640```
7641OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase )
7642```
7643
7644**Description**
7645
7646Creates an **OH_Drawing_PathEffect** object with a dashed line effect. The dashed line effect is determined by a group of "on" and "off" intervals.
7647
7648Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
7649
7650If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
7651
7652If **intervals** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
7653
7654**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7655
7656**Since**: 12
7657
7658**Parameters**
7659
7660| Name      | Description                                                  |
7661| --------- | ------------------------------------------------------------ |
7662| 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. |
7663| count     | Number of entries in the dashed line interval array. The value must be an even number greater than 0. |
7664| phase     | Offset in the dashed line interval array.                    |
7665
7666**Returns**
7667
7668Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created.
7669
7670
7671### OH_Drawing_CreateFontCollection()
7672
7673```
7674OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void )
7675```
7676
7677**Description**
7678
7679Creates 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.
7680
7681**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7682
7683**Since**: 8
7684
7685**Returns**
7686
7687Returns the pointer to the **OH_Drawing_FontCollection** object created.
7688
7689
7690### OH_Drawing_CreateFontDescriptor()
7691
7692```
7693OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void )
7694```
7695
7696**Description**
7697
7698Creates an **OH_Drawing_FontDescriptor** object to describe the detailed information about a system font.
7699
7700**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7701
7702**Since**: 12
7703
7704**Returns**
7705
7706Returns the pointer to the [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object created.
7707
7708
7709### OH_Drawing_CreateFontParser()
7710
7711```
7712OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void )
7713```
7714
7715**Description**
7716
7717Creates an **OH_Drawing_FontParser** object to parse a system font.
7718
7719**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7720
7721**Since**: 12
7722
7723**Returns**
7724
7725Returns the pointer to the [OH_Drawing_FontParser](#oh_drawing_fontparser) object created.
7726
7727
7728### OH_Drawing_CreateSharedFontCollection()
7729
7730```
7731OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void )
7732```
7733
7734**Description**
7735
7736Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object that is shareable.
7737
7738**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7739
7740**Since**: 12
7741
7742**Returns**
7743
7744Returns the pointer to the **OH_Drawing_FontCollection** object created.
7745
7746### OH_Drawing_ClearFontCaches()
7747
7748```
7749void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* )
7750```
7751
7752**Description**
7753
7754Clears 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.)
7755
7756**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7757
7758**Since**: 12
7759
7760**Parameters**
7761
7762| Name                      | Description                                                  |
7763| ------------------------- | ------------------------------------------------------------ |
7764| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
7765
7766### OH_Drawing_CreateTextShadow()
7767
7768```
7769OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void )
7770```
7771
7772**Description**
7773
7774Creates an **OH_Drawing_TextShadow** object.
7775
7776**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7777
7778**Since**: 12
7779
7780**Returns**
7781
7782Returns the pointer to the **OH_Drawing_TextShadow** object created.
7783
7784
7785### OH_Drawing_CreateTextStyle()
7786
7787```
7788OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void )
7789```
7790
7791**Description**
7792
7793Creates an **OH_Drawing_TextStyle** object.
7794
7795**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7796
7797**Since**: 8
7798
7799**Returns**
7800
7801Returns the pointer to the **OH_Drawing_TextStyle** object created.
7802
7803
7804### OH_Drawing_CreateTypography()
7805
7806```
7807OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* )
7808```
7809
7810**Description**
7811
7812Creates an **OH_Drawing_Typography** object.
7813
7814**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7815
7816**Since**: 8
7817
7818**Parameters**
7819
7820| Name                        | Description                                                  |
7821| --------------------------- | ------------------------------------------------------------ |
7822| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
7823
7824**Returns**
7825
7826Returns the pointer to the **OH_Drawing_Typography** object created.
7827
7828
7829### OH_Drawing_CreateTypographyHandler()
7830
7831```
7832OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection*  )
7833```
7834
7835**Description**
7836
7837Creates an **OH_Drawing_TypographyCreate** object.
7838
7839**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7840
7841**Since**: 8
7842
7843**Parameters**
7844
7845| Name                       | Description                                                  |
7846| -------------------------- | ------------------------------------------------------------ |
7847| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
7848| OH_Drawing_FontCollection  | Pointer to an **OH_Drawing_FontCollection** object, which is obtained by calling [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) or [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (recommended). |
7849
7850**Returns**
7851
7852Returns the pointer to the **OH_Drawing_TypographyCreate** object created.
7853
7854
7855### OH_Drawing_CreateTypographyStyle()
7856
7857```
7858OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void )
7859```
7860
7861**Description**
7862
7863Creates an **OH_Drawing_TypographyStyle** object.
7864
7865**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7866
7867**Since**: 8
7868
7869**Returns**
7870
7871Returns the pointer to the **OH_Drawing_TypographyStyle** object created.
7872
7873
7874### OH_Drawing_DestroyFontCollection()
7875
7876```
7877void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* )
7878```
7879
7880**Description**
7881
7882Destroys an **OH_Drawing_FontCollection** object and reclaims the memory occupied by the object.
7883
7884**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7885
7886**Since**: 8
7887
7888**Parameters**
7889
7890| Name                      | Description                                         |
7891| ------------------------- | --------------------------------------------------- |
7892| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
7893
7894
7895### OH_Drawing_DestroyFontDescriptor()
7896
7897```
7898void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* )
7899```
7900
7901**Description**
7902
7903Destroys an **OH_Drawing_FontDescriptor** object and reclaims the memory occupied by the object.
7904
7905**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7906
7907**Since**: 12
7908
7909**Parameters**
7910
7911| Name                                                         | Description                                                  |
7912| ------------------------------------------------------------ | ------------------------------------------------------------ |
7913| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Pointer to an [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object, which is obtained by calling [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor). |
7914
7915
7916### OH_Drawing_DestroyFontParser()
7917
7918```
7919void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* )
7920```
7921
7922**Description**
7923
7924Destroys an **OH_Drawing_FontParser** object and reclaims the memory occupied by the object.
7925
7926**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7927
7928**Since**: 12
7929
7930**Parameters**
7931
7932| Name                  | Description                                                  |
7933| --------------------- | ------------------------------------------------------------ |
7934| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
7935
7936
7937### OH_Drawing_DestroyLineMetrics()
7938
7939```
7940void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* )
7941```
7942
7943**Description**
7944
7945Destroys an **OH_Drawing_LineMetrics** object and reclaims the memory occupied by the object.
7946
7947**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7948
7949**Since**: 12
7950
7951**Parameters**
7952
7953| Name                   | Description                                                  |
7954| ---------------------- | ------------------------------------------------------------ |
7955| 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). |
7956
7957
7958### OH_Drawing_DestroySystemFontConfigInfo()
7959
7960```
7961void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* )
7962```
7963
7964**Description**
7965
7966Reclaims the memory occupied by the system font configuration.
7967
7968**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7969
7970**Since**: 12
7971
7972**Parameters**
7973
7974| Name                      | Description                                                  |
7975| ------------------------- | ------------------------------------------------------------ |
7976| 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). |
7977
7978
7979### OH_Drawing_DestroySystemFontList()
7980
7981```
7982void OH_Drawing_DestroySystemFontList (char** , size_t  )
7983```
7984
7985**Description**
7986
7987Reclaims the memory occupied by the system font list.
7988
7989**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
7990
7991**Since**: 12
7992
7993**Parameters**
7994
7995| Name     | Description                                      |
7996| -------- | ------------------------------------------------ |
7997| char\*\* | Double pointer to the list of system font names. |
7998| size_t\* | Number of system font names.                     |
7999
8000
8001### OH_Drawing_DestroyTextShadow()
8002
8003```
8004void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* )
8005```
8006
8007**Description**
8008
8009Destroys an **OH_Drawing_TextShadow** object and reclaims the memory occupied by the object.
8010
8011**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8012
8013**Since**: 12
8014
8015**Parameters**
8016
8017| Name                  | Description                                                  |
8018| --------------------- | ------------------------------------------------------------ |
8019| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
8020
8021
8022### OH_Drawing_DestroyTextShadows()
8023
8024```
8025void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* )
8026```
8027
8028**Description**
8029
8030Reclaims the memory occupied by the vector consisting of the **OH_Drawing_TextShadow** objects.
8031
8032**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8033
8034**Since**: 12
8035
8036**Parameters**
8037
8038| Name                  | Description                                                  |
8039| --------------------- | ------------------------------------------------------------ |
8040| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
8041
8042
8043### OH_Drawing_DestroyTextStyle()
8044
8045```
8046void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* )
8047```
8048
8049**Description**
8050
8051Destroys an **OH_Drawing_TextStyle** object and reclaims the memory occupied by the object.
8052
8053**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8054
8055**Since**: 8
8056
8057**Parameters**
8058
8059| Name                 | Description                                                  |
8060| -------------------- | ------------------------------------------------------------ |
8061| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
8062
8063
8064### OH_Drawing_DestroyTypography()
8065
8066```
8067void OH_Drawing_DestroyTypography (OH_Drawing_Typography* )
8068```
8069
8070**Description**
8071
8072Destroys an **OH_Drawing_Typography** object and reclaims the memory occupied by the object.
8073
8074**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8075
8076**Since**: 8
8077
8078**Parameters**
8079
8080| Name                  | Description                                                  |
8081| --------------------- | ------------------------------------------------------------ |
8082| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
8083
8084
8085### OH_Drawing_DestroyTypographyHandler()
8086
8087```
8088void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* )
8089```
8090
8091**Description**
8092
8093Destroys an **OH_Drawing_TypographyCreate** object and reclaims the memory occupied by the object.
8094
8095**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8096
8097**Since**: 8
8098
8099**Parameters**
8100
8101| Name                        | Description                                                  |
8102| --------------------------- | ------------------------------------------------------------ |
8103| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
8104
8105
8106### OH_Drawing_DestroyTypographyStyle()
8107
8108```
8109void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* )
8110```
8111
8112**Description**
8113
8114Destroys an **OH_Drawing_TypographyStyle** object and reclaims the memory occupied by the object.
8115
8116**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8117
8118**Since**: 8
8119
8120**Parameters**
8121
8122| Name                       | Description                                                  |
8123| -------------------------- | ------------------------------------------------------------ |
8124| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
8125
8126
8127### OH_Drawing_DisableFontCollectionFallback()
8128
8129```
8130void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection)
8131```
8132
8133**Description**
8134
8135Disables the alternate fonts.
8136
8137**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8138
8139**Since**: 12
8140
8141**Parameters**
8142
8143| Name                      | Description                                                  |
8144| ------------------------- | ------------------------------------------------------------ |
8145| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
8146
8147
8148### OH_Drawing_DisableFontCollectionSystemFont()
8149
8150```
8151void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection)
8152```
8153
8154**Description**
8155
8156Disables the system fonts.
8157
8158**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8159
8160**Since**: 12
8161
8162**Parameters**
8163
8164| Name                      | Description                                                  |
8165| ------------------------- | ------------------------------------------------------------ |
8166| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. |
8167
8168
8169### OH_Drawing_FilterCreate()
8170
8171```
8172OH_Drawing_Filter* OH_Drawing_FilterCreate (void )
8173```
8174
8175**Description**
8176
8177Creates an **OH_Drawing_Filter** object.
8178
8179**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8180
8181**Since**: 11
8182
8183**Returns**
8184
8185Returns the pointer to the **OH_Drawing_Filter** object created.
8186
8187
8188### OH_Drawing_FilterDestroy()
8189
8190```
8191void OH_Drawing_FilterDestroy (OH_Drawing_Filter* )
8192```
8193
8194**Description**
8195
8196Destroys an **OH_Drawing_Filter** object and reclaims the memory occupied by the object.
8197
8198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8199
8200**Since**: 11
8201
8202**Parameters**
8203
8204| Name              | Description                                 |
8205| ----------------- | ------------------------------------------- |
8206| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. |
8207
8208
8209### OH_Drawing_FilterGetColorFilter()
8210
8211```
8212void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
8213```
8214
8215**Description**
8216
8217Obtains an **OH_Drawing_ColorFilter** object from an **OH_Drawing_Filter** object.
8218
8219Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8220
8221If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8222
8223If either **OH_Drawing_Filter** or **OH_Drawing_ColorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8224
8225**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8226
8227**Since**: 12
8228
8229**Parameters**
8230
8231| Name                   | Description                                                  |
8232| ---------------------- | ------------------------------------------------------------ |
8233| OH_Drawing_Filter      | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. |
8234| OH_Drawing_ColorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object. |
8235
8236
8237### OH_Drawing_FilterSetColorFilter()
8238
8239```
8240void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter*  )
8241```
8242
8243**Description**
8244
8245Sets an **OH_Drawing_ColorFilter** object for an **OH_Drawing_Filter** object.
8246
8247Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8248
8249If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8250
8251If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8252
8253**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8254
8255**Since**: 11
8256
8257**Parameters**
8258
8259| Name                   | Description                                                  |
8260| ---------------------- | ------------------------------------------------------------ |
8261| OH_Drawing_Filter      | Pointer to an **OH_Drawing_Filter** object.                  |
8262| 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. |
8263
8264
8265### OH_Drawing_FilterSetMaskFilter()
8266
8267```
8268void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter*  )
8269```
8270
8271**Description**
8272
8273Sets an **OH_Drawing_MaskFilter** object for an **OH_Drawing_Filter** object.
8274
8275Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8276
8277If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8278
8279If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8280
8281**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8282
8283**Since**: 11
8284
8285**Parameters**
8286
8287| Name                  | Description                                                  |
8288| --------------------- | ------------------------------------------------------------ |
8289| OH_Drawing_Filter     | Pointer to an **OH_Drawing_Filter** object.                  |
8290| 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. |
8291
8292
8293### OH_Drawing_FontCountText()
8294
8295```
8296int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding )
8297```
8298
8299**Description**
8300
8301Obtains the number of glyphs represented by text.
8302
8303Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8304
8305If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8306
8307If either **OH_Drawing_Font** or **text** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8308
8309**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8310
8311**Since**: 12
8312
8313**Parameters**
8314
8315| Name            | Description                                                  |
8316| --------------- | ------------------------------------------------------------ |
8317| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
8318| text            | Pointer to the start address of the storage.                 |
8319| byteLength      | Text length, in bytes.                                       |
8320| encoding        | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
8321
8322
8323### OH_Drawing_FontCreate()
8324
8325```
8326OH_Drawing_Font* OH_Drawing_FontCreate (void )
8327```
8328
8329**Description**
8330
8331Creates an **OH_Drawing_Font** object.
8332
8333**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8334
8335**Since**: 11
8336
8337**Returns**
8338
8339Returns the pointer to the **OH_Drawing_Font** object created.
8340
8341
8342### OH_Drawing_FontDestroy()
8343
8344```
8345void OH_Drawing_FontDestroy (OH_Drawing_Font* )
8346```
8347
8348**Description**
8349
8350Destroys an **OH_Drawing_Font** object and reclaims the memory occupied by the object.
8351
8352**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8353
8354**Since**: 11
8355
8356**Parameters**
8357
8358| Name            | Description                               |
8359| --------------- | ----------------------------------------- |
8360| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. |
8361
8362
8363### OH_Drawing_FontGetMetrics()
8364
8365```
8366float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics*  )
8367```
8368
8369**Description**
8370
8371Obtains the measurement information about a font.
8372
8373Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8374
8375If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8376
8377If either **OH_Drawing_Font** or **OH_Drawing_Font_Metrics** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8378
8379**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8380
8381**Since**: 12
8382
8383**Parameters**
8384
8385| Name                    | Description                                                  |
8386| ----------------------- | ------------------------------------------------------------ |
8387| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
8388| OH_Drawing_Font_Metrics | Pointer to an [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) object. |
8389
8390**Returns**
8391
8392Returns a floating-point variable that indicates the recommended interline spacing.
8393
8394
8395### OH_Drawing_FontGetTypeface()
8396
8397```
8398OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* )
8399```
8400
8401**Description**
8402
8403Obtains the typeface of a font.
8404
8405Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8406
8407If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8408
8409If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8410
8411**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8412
8413**Since**: 12
8414
8415**Parameters**
8416
8417| Name            | Description                                               |
8418| --------------- | --------------------------------------------------------- |
8419| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. |
8420
8421**Returns**
8422
8423Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object.
8424
8425
8426### OH_Drawing_FontMgrCreate()
8427
8428```
8429OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void )
8430```
8431
8432**Description**
8433
8434Creates an **OH_Drawing_FontMgr** object.
8435
8436**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8437
8438**Since**: 12
8439
8440**Returns**
8441
8442Returns the pointer to the [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object created.
8443
8444
8445### OH_Drawing_FontMgrCreateFontStyleSet()
8446
8447```
8448OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index )
8449```
8450
8451**Description**
8452
8453Creates a font style set from an **OH_Drawing_FontMgr** object.
8454
8455**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8456
8457**Since**: 12
8458
8459**Parameters**
8460
8461| Name               | Description                                                  |
8462| ------------------ | ------------------------------------------------------------ |
8463| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8464| index              | Index of the font style set.                                 |
8465
8466**Returns**
8467
8468Returns the pointer to the [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object created.
8469
8470
8471### OH_Drawing_FontMgrDestroy()
8472
8473```
8474void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* )
8475```
8476
8477**Description**
8478
8479Destroys an **OH_Drawing_FontMgr** object and reclaims the memory occupied by the object.
8480
8481**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8482
8483**Since**: 12
8484
8485**Parameters**
8486
8487| Name               | Description                                                  |
8488| ------------------ | ------------------------------------------------------------ |
8489| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8490
8491
8492### OH_Drawing_FontMgrDestroyFamilyName()
8493
8494```
8495void OH_Drawing_FontMgrDestroyFamilyName (char* familyName)
8496```
8497
8498**Description**
8499
8500Reclaims the memory occupied by a font family name.
8501
8502**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8503
8504**Since**: 12
8505
8506**Parameters**
8507
8508| Name       | Description                    |
8509| ---------- | ------------------------------ |
8510| familyName | Pointer to a font family name. |
8511
8512
8513### OH_Drawing_FontMgrDestroyFontStyleSet()
8514
8515```
8516void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* )
8517```
8518
8519**Description**
8520
8521Reclaims the memory occupied by a font style set.
8522
8523**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8524
8525**Since**: 12
8526
8527**Parameters**
8528
8529| Name                    | Description                                                  |
8530| ----------------------- | ------------------------------------------------------------ |
8531| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
8532
8533
8534### OH_Drawing_FontMgrGetFamilyCount()
8535
8536```
8537int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* )
8538```
8539
8540**Description**
8541
8542Obtains the number of font families.
8543
8544**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8545
8546**Since**: 12
8547
8548**Parameters**
8549
8550| Name               | Description                                                  |
8551| ------------------ | ------------------------------------------------------------ |
8552| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8553
8554**Returns**
8555
8556Returns the number of font families.
8557
8558
8559### OH_Drawing_FontMgrGetFamilyName()
8560
8561```
8562char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index )
8563```
8564
8565**Description**
8566
8567Obtains the font family name based on an index.
8568
8569**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8570
8571**Since**: 12
8572
8573**Parameters**
8574
8575| Name               | Description                                                  |
8576| ------------------ | ------------------------------------------------------------ |
8577| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8578| index              | Index of the font family name.                               |
8579
8580**Returns**
8581
8582Returns the font family name.
8583
8584
8585### OH_Drawing_FontMgrMatchFamily()
8586
8587```
8588OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName )
8589```
8590
8591**Description**
8592
8593Obtains a font style set based on a font family name.
8594
8595**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8596
8597**Since**: 12
8598
8599**Parameters**
8600
8601| Name               | Description                                                  |
8602| ------------------ | ------------------------------------------------------------ |
8603| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8604| familyName         | Pointer to a font family name.                               |
8605
8606**Returns**
8607
8608Returns the pointer to the [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object obtained.
8609
8610
8611### OH_Drawing_FontMgrMatchFamilyStyle()
8612
8613```
8614OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct  )
8615```
8616
8617**Description**
8618
8619Obtains a typeface based on the font style information and font family name.
8620
8621**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8622
8623**Since**: 12
8624
8625**Parameters**
8626
8627| Name                                                         | Description                                                  |
8628| ------------------------------------------------------------ | ------------------------------------------------------------ |
8629| OH_Drawing_FontMgr                                           | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8630| familyName                                                   | Pointer to a font family name.                               |
8631| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
8632
8633**Returns**
8634
8635Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained.
8636
8637
8638### OH_Drawing_FontMgrMatchFamilyStyleCharacter()
8639
8640```
8641OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character )
8642```
8643
8644**Description**
8645
8646Obtains a typeface for the specified character.
8647
8648**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8649
8650**Since**: 12
8651
8652**Parameters**
8653
8654| Name                                                         | Description                                                  |
8655| ------------------------------------------------------------ | ------------------------------------------------------------ |
8656| OH_Drawing_FontMgr                                           | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). |
8657| familyName                                                   | Pointer to a font family name.                               |
8658| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
8659| bcp47                                                        | Pointer to the character language code array, which is a combination of ISO 639, 15924, and 3166-1 language codes. |
8660| bcp47Count                                                   | Size of the character language code array.                   |
8661| character                                                    | UTF8 character used for matching.                            |
8662
8663**Returns**
8664
8665Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained.
8666
8667
8668### OH_Drawing_FontParserGetFontByName()
8669
8670```
8671OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char*  )
8672```
8673
8674**Description**
8675
8676Obtains the descriptor of a system font based on the font name.
8677
8678**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8679
8680**Since**: 12
8681
8682**Parameters**
8683
8684| Name                  | Description                                                  |
8685| --------------------- | ------------------------------------------------------------ |
8686| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
8687| char\*                | Pointer to the system font name.                             |
8688
8689**Returns**
8690
8691Returns the system font.
8692
8693
8694### OH_Drawing_FontParserGetSystemFontList()
8695
8696```
8697char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t*  )
8698```
8699
8700**Description**
8701
8702Obtains the list of system fonts. This function can be used only on 2-in-1 devices.
8703
8704**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8705
8706**Since**: 12
8707
8708**Parameters**
8709
8710| Name                  | Description                                                  |
8711| --------------------- | ------------------------------------------------------------ |
8712| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). |
8713| size_t                | Pointer to the number of system font names.                  |
8714
8715**Returns**
8716
8717Returns the system font list.
8718
8719
8720### OH_Drawing_FontSetFakeBoldText()
8721
8722```
8723void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText )
8724```
8725
8726**Description**
8727
8728Sets fake bold for a font by increasing the stroke width.
8729
8730Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8731
8732If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8733
8734If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8735
8736**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8737
8738**Since**: 11
8739
8740**Parameters**
8741
8742| Name            | Description                                                  |
8743| --------------- | ------------------------------------------------------------ |
8744| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.                    |
8745| isFakeBoldText  | Whether to set fake bold. The value **true** means to set fake bold, and **false** means the opposite. |
8746
8747
8748### OH_Drawing_FontSetLinearText()
8749
8750```
8751void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText )
8752```
8753
8754**Description**
8755
8756Sets linear scaling for a font.
8757
8758Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8759
8760If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8761
8762If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8763
8764**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8765
8766**Since**: 11
8767
8768**Parameters**
8769
8770| Name            | Description                                                  |
8771| --------------- | ------------------------------------------------------------ |
8772| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.                    |
8773| isLinearText    | Whether to enable linear scaling. The value **true** means to enable linear scaling, and **false** means the opposite. |
8774
8775
8776### OH_Drawing_FontSetTextSize()
8777
8778```
8779void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize )
8780```
8781
8782**Description**
8783
8784Sets the font size.
8785
8786Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8787
8788If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8789
8790If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8791
8792**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8793
8794**Since**: 11
8795
8796**Parameters**
8797
8798| Name            | Description                               |
8799| --------------- | ----------------------------------------- |
8800| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. |
8801| textSize        | Font size.                                |
8802
8803
8804### OH_Drawing_FontSetTextSkewX()
8805
8806```
8807void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX )
8808```
8809
8810**Description**
8811
8812Sets a horizontal skew factor for a font.
8813
8814Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8815
8816If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8817
8818If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8819
8820**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8821
8822**Since**: 11
8823
8824**Parameters**
8825
8826| Name            | Description                                |
8827| --------------- | ------------------------------------------ |
8828| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object.  |
8829| skewX           | Skew of the X axis relative to the Y axis. |
8830
8831
8832### OH_Drawing_FontSetTypeface()
8833
8834```
8835void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface*  )
8836```
8837
8838**Description**
8839
8840Sets the typeface for a font.
8841
8842Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
8843
8844If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
8845
8846If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
8847
8848**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8849
8850**Since**: 11
8851
8852**Parameters**
8853
8854| Name                | Description                                                  |
8855| ------------------- | ------------------------------------------------------------ |
8856| OH_Drawing_Font     | Pointer to an **OH_Drawing_Font** object.                    |
8857| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. If NULL is passed in, the default **OH_Drawing_Typeface** object is used. |
8858
8859
8860### OH_Drawing_FontStyleSetCount()
8861
8862```
8863int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* )
8864```
8865
8866**Description**
8867
8868Obtains the number of fonts in the font style set.
8869
8870**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8871
8872**Since**: 12
8873
8874**Parameters**
8875
8876| Name                    | Description                                                  |
8877| ----------------------- | ------------------------------------------------------------ |
8878| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
8879
8880**Returns**
8881
8882Returns the number of fonts.
8883
8884
8885### OH_Drawing_FontStyleSetCreateTypeface()
8886
8887```
8888OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index )
8889```
8890
8891**Description**
8892
8893Creates a typeface for the specified index.
8894
8895**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8896
8897**Since**: 12
8898
8899**Parameters**
8900
8901| Name                    | Description                                                  |
8902| ----------------------- | ------------------------------------------------------------ |
8903| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
8904| index                   | Index of the typeface.                                       |
8905
8906**Returns**
8907
8908Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created if the operation is successful; returns a null pointer otherwise.
8909
8910
8911### OH_Drawing_FontStyleSetFreeStyleName()
8912
8913```
8914void OH_Drawing_FontStyleSetFreeStyleName (char** styleName)
8915```
8916
8917**Description**
8918
8919Reclaims the memory occupied by a font style.
8920
8921**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8922
8923**Since**: 12
8924
8925**Parameters**
8926
8927| Name      | Description                                                  |
8928| --------- | ------------------------------------------------------------ |
8929| styleName | Double pointer to the string that specifies the font style name. |
8930
8931
8932### OH_Drawing_FontStyleSetGetStyle()
8933
8934```
8935OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName )
8936```
8937
8938**Description**
8939
8940Obtains the font style.
8941
8942**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8943
8944**Since**: 12
8945
8946**Parameters**
8947
8948| Name                    | Description                                                  |
8949| ----------------------- | ------------------------------------------------------------ |
8950| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
8951| index                   | Index of the font style.                                     |
8952| styleName               | Double pointer to the string that specifies the font style name. |
8953
8954**Returns**
8955
8956Returns the font style.
8957
8958
8959### OH_Drawing_FontStyleSetMatchStyle()
8960
8961```
8962OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct )
8963```
8964
8965**Description**
8966
8967Obtains the typeface closest to the font style.
8968
8969**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8970
8971**Since**: 12
8972
8973**Parameters**
8974
8975| Name                    | Description                                                  |
8976| ----------------------- | ------------------------------------------------------------ |
8977| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. |
8978| fontStyleStruct         | Font style, including the font weight, width, and slant.     |
8979
8980**Returns**
8981
8982Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained.
8983
8984
8985### OH_Drawing_GetAffinityFromPositionAndAffinity()
8986
8987```
8988int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
8989```
8990
8991**Description**
8992
8993Obtains the affinity attribute of an **OH_Drawing_PositionAndAffinity** object. The affinity determines whether the font is close to the front text or rear text.
8994
8995**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
8996
8997**Since**: 11
8998
8999**Parameters**
9000
9001| Name                           | Description                                                  |
9002| ------------------------------ | ------------------------------------------------------------ |
9003| 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). |
9004
9005**Returns**
9006
9007Returns the affinity attribute.
9008
9009
9010### OH_Drawing_GetBottomFromTextBox()
9011
9012```
9013float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int  )
9014```
9015
9016**Description**
9017
9018Obtains the bottom position of a text box.
9019
9020**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9021
9022**Since**: 11
9023
9024**Parameters**
9025
9026| Name               | Description                                                  |
9027| ------------------ | ------------------------------------------------------------ |
9028| 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). |
9029| int                | Index of the text box.                                       |
9030
9031**Returns**
9032
9033Returns the bottom position.
9034
9035
9036### OH_Drawing_GetEndFromRange()
9037
9038```
9039size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* )
9040```
9041
9042**Description**
9043
9044Obtains the end position of an **OH_Drawing_Range** object.
9045
9046**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9047
9048**Since**: 11
9049
9050**Parameters**
9051
9052| Name             | Description                                                  |
9053| ---------------- | ------------------------------------------------------------ |
9054| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by calling [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). |
9055
9056**Returns**
9057
9058Returns the end position.
9059
9060
9061### OH_Drawing_GetLeftFromTextBox()
9062
9063```
9064float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int  )
9065```
9066
9067**Description**
9068
9069Obtains the left position of a text box.
9070
9071**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9072
9073**Since**: 11
9074
9075**Parameters**
9076
9077| Name               | Description                                                  |
9078| ------------------ | ------------------------------------------------------------ |
9079| 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). |
9080| int                | Index of the text box.                                       |
9081
9082**Returns**
9083
9084Returns the left position.
9085
9086
9087### OH_Drawing_GetPositionFromPositionAndAffinity()
9088
9089```
9090size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* )
9091```
9092
9093**Description**
9094
9095Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object.
9096
9097**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9098
9099**Since**: 11
9100
9101**Parameters**
9102
9103| Name                           | Description                                                  |
9104| ------------------------------ | ------------------------------------------------------------ |
9105| 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). |
9106
9107**Returns**
9108
9109Returns the position attribute.
9110
9111
9112### OH_Drawing_GetRightFromTextBox()
9113
9114```
9115float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int  )
9116```
9117
9118**Description**
9119
9120Obtains the right position of a text box.
9121
9122**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9123
9124**Since**: 11
9125
9126**Parameters**
9127
9128| Name               | Description                                                  |
9129| ------------------ | ------------------------------------------------------------ |
9130| 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). |
9131| int                | Index of the text box.                                       |
9132
9133**Returns**
9134
9135Returns the right position.
9136
9137
9138### OH_Drawing_GetSizeOfTextBox()
9139
9140```
9141size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* )
9142```
9143
9144**Description**
9145
9146Obtains the number of text boxes.
9147
9148**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9149
9150**Since**: 11
9151
9152**Parameters**
9153
9154| Name               | Description                                                  |
9155| ------------------ | ------------------------------------------------------------ |
9156| 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). |
9157
9158**Returns**
9159
9160Returns the number of text boxes.
9161
9162
9163### OH_Drawing_GetStartFromRange()
9164
9165```
9166size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* )
9167```
9168
9169**Description**
9170
9171Obtains the start position of an **OH_Drawing_Range** object.
9172
9173**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9174
9175**Since**: 11
9176
9177**Parameters**
9178
9179| Name             | Description                                                  |
9180| ---------------- | ------------------------------------------------------------ |
9181| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by calling [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). |
9182
9183**Returns**
9184
9185Returns the start position.
9186
9187
9188### OH_Drawing_GetSystemFontConfigInfo()
9189
9190```
9191OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* )
9192```
9193
9194**Description**
9195
9196Obtains the system font configuration.
9197
9198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9199
9200**Since**: 12
9201
9202**Parameters**
9203
9204| Name                              | Description                                                  |
9205| --------------------------------- | ------------------------------------------------------------ |
9206| OH_Drawing_FontConfigJsonInfoCode | Pointer to the error code. For details about the available options, see [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode). |
9207
9208**Returns**
9209
9210Returns the pointer to the system font configuration.
9211
9212
9213### OH_Drawing_GetTextDirectionFromTextBox()
9214
9215```
9216int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int  )
9217```
9218
9219**Description**
9220
9221Obtains the text direction of a text box.
9222
9223**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9224
9225**Since**: 11
9226
9227**Parameters**
9228
9229| Name               | Description                                                  |
9230| ------------------ | ------------------------------------------------------------ |
9231| 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). |
9232| int                | Index of the text box.                                       |
9233
9234**Returns**
9235
9236Returns the text direction.
9237
9238
9239### OH_Drawing_GetTopFromTextBox()
9240
9241```
9242float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int  )
9243```
9244
9245**Description**
9246
9247Obtains the top position of a text box.
9248
9249**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9250
9251**Since**: 11
9252
9253**Parameters**
9254
9255| Name               | Description                                                  |
9256| ------------------ | ------------------------------------------------------------ |
9257| 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). |
9258| int                | Index of the text box.                                       |
9259
9260**Returns**
9261
9262Returns the top position.
9263
9264
9265### OH_Drawing_GpuContextCreateFromGL()
9266
9267```
9268OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions )
9269```
9270
9271**Description**
9272
9273Creates an **OH_Drawing_GpuContext** object that uses OpenGL as the backend interface.
9274
9275**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9276
9277**Since**: 12
9278
9279**Parameters**
9280
9281| Name                         | Description                                                  |
9282| ---------------------------- | ------------------------------------------------------------ |
9283| OH_Drawing_GpuContextOptions | GPU context option, which is an [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) object. |
9284
9285**Returns**
9286
9287Returns the pointer to the [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object created.
9288
9289
9290### OH_Drawing_GpuContextDestroy()
9291
9292```
9293void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* )
9294```
9295
9296**Description**
9297
9298Destroys an **OH_Drawing_GpuContext** object and reclaims the memory occupied by the object.
9299
9300**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9301
9302**Since**: 12
9303
9304**Parameters**
9305
9306| Name                  | Description                                                  |
9307| --------------------- | ------------------------------------------------------------ |
9308| OH_Drawing_GpuContext | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. |
9309
9310
9311### OH_Drawing_ImageBuildFromBitmap()
9312
9313```
9314bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap*  )
9315```
9316
9317**Description**
9318
9319Builds 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.
9320
9321Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9322
9323If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9324
9325If either **OH_Drawing_Image** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9326
9327**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9328
9329**Since**: 12
9330
9331**Parameters**
9332
9333| Name              | Description                                                  |
9334| ----------------- | ------------------------------------------------------------ |
9335| OH_Drawing_Image  | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
9336| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. |
9337
9338**Returns**
9339
9340Returns **true** if the image is built; returns **false** otherwise.
9341
9342
9343### OH_Drawing_ImageCreate()
9344
9345```
9346OH_Drawing_Image* OH_Drawing_ImageCreate (void )
9347```
9348
9349**Description**
9350
9351Creates an **OH_Drawing_Image** object that describes an array of two-dimensional pixels to draw.
9352
9353**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9354
9355**Since**: 12
9356
9357**Returns**
9358
9359Returns the pointer to the [OH_Drawing_Image](#oh_drawing_image) object created.
9360
9361
9362### OH_Drawing_ImageDestroy()
9363
9364```
9365void OH_Drawing_ImageDestroy (OH_Drawing_Image* )
9366```
9367
9368**Description**
9369
9370Destroys an **OH_Drawing_Image** object and reclaims the memory occupied by the object.
9371
9372**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9373
9374**Since**: 12
9375
9376**Parameters**
9377
9378| Name             | Description                                                 |
9379| ---------------- | ----------------------------------------------------------- |
9380| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
9381
9382
9383### OH_Drawing_ImageGetHeight()
9384
9385```
9386int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* )
9387```
9388
9389**Description**
9390
9391Obtains the image height, that is, the number of pixel lines.
9392
9393Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9394
9395If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9396
9397If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9398
9399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9400
9401**Since**: 12
9402
9403**Parameters**
9404
9405| Name             | Description                                                 |
9406| ---------------- | ----------------------------------------------------------- |
9407| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
9408
9409**Returns**
9410
9411Returns the height.
9412
9413
9414### OH_Drawing_ImageGetImageInfo()
9415
9416```
9417void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info*  )
9418```
9419
9420**Description**
9421
9422Obtains the image information. After this function is called, the passed-in image information object is filled.
9423
9424Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9425
9426If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9427
9428If either **OH_Drawing_Image** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9429
9430**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9431
9432**Since**: 12
9433
9434**Parameters**
9435
9436| Name                  | Description                                                  |
9437| --------------------- | ------------------------------------------------------------ |
9438| OH_Drawing_Image      | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
9439| 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). |
9440
9441
9442### OH_Drawing_ImageGetWidth()
9443
9444```
9445int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* )
9446```
9447
9448**Description**
9449
9450Obtains the image width, that is, the number of pixels in each line.
9451
9452Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9453
9454If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9455
9456If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9457
9458**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9459
9460**Since**: 12
9461
9462**Parameters**
9463
9464| Name             | Description                                                 |
9465| ---------------- | ----------------------------------------------------------- |
9466| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. |
9467
9468**Returns**
9469
9470Returns the width.
9471
9472
9473### OH_Drawing_LineMetricsGetSize()
9474
9475```
9476size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* )
9477```
9478
9479**Description**
9480
9481Obtains the number of lines.
9482
9483**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9484
9485**Since**: 12
9486
9487**Parameters**
9488
9489| Name                                                       | Description                                                  |
9490| ---------------------------------------------------------- | ------------------------------------------------------------ |
9491| [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). |
9492
9493**Returns**
9494
9495Returns the number of lines.
9496
9497
9498### OH_Drawing_MaskFilterCreateBlur()
9499
9500```
9501OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM )
9502```
9503
9504**Description**
9505
9506Creates an **OH_Drawing_MaskFilter** object with a given blur type.
9507
9508**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9509
9510**Since**: 11
9511
9512**Parameters**
9513
9514| Name       | Description                                                  |
9515| ---------- | ------------------------------------------------------------ |
9516| blurType   | Blur type.                                                   |
9517| sigma      | Standard deviation of the Gaussian blur to apply. The value must be greater than 0. |
9518| respectCTM | Whether the blur's sigma is modified by the CTM. The default value is **true**. |
9519
9520**Returns**
9521
9522Returns the pointer to the **OH_Drawing_MaskFilter** object created.
9523
9524
9525### OH_Drawing_MaskFilterDestroy()
9526
9527```
9528void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* )
9529```
9530
9531**Description**
9532
9533Destroys an **OH_Drawing_MaskFilter** object and reclaims the memory occupied by the object.
9534
9535**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9536
9537**Since**: 11
9538
9539**Parameters**
9540
9541| Name                  | Description                                     |
9542| --------------------- | ----------------------------------------------- |
9543| OH_Drawing_MaskFilter | Pointer to an **OH_Drawing_MaskFilter** object. |
9544
9545
9546### OH_Drawing_MatrixConcat()
9547
9548```
9549void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b )
9550```
9551
9552**Description**
9553
9554Multiplies two matrices to produce a new matrix.
9555
9556Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9557
9558If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9559
9560If any of **total**, **a**, and **b** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9561
9562**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9563
9564**Since**: 12
9565
9566**Parameters**
9567
9568| Name  | Description                                                  |
9569| ----- | ------------------------------------------------------------ |
9570| total | Pointer to the new matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9571| a     | Pointer to the first matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9572| b     | Pointer to the second matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9573
9574
9575### OH_Drawing_MatrixCreate()
9576
9577```
9578OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void )
9579```
9580
9581**Description**
9582
9583Creates an **OH_Drawing_Matrix** object.
9584
9585**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9586
9587**Since**: 11
9588
9589**Returns**
9590
9591Returns the pointer to the **OH_Drawing_Matrix** object created.
9592
9593
9594### OH_Drawing_MatrixCreateRotation()
9595
9596```
9597OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y )
9598```
9599
9600**Description**
9601
9602Creates 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).
9603
9604**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9605
9606**Since**: 12
9607
9608**Parameters**
9609
9610| Name | Description                                                  |
9611| ---- | ------------------------------------------------------------ |
9612| deg  | Angle to rotate, in degrees. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation. |
9613| x    | Coordinate point on the X axis.                              |
9614| y    | Coordinate point on the Y axis.                              |
9615
9616**Returns**
9617
9618Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
9619
9620
9621### OH_Drawing_MatrixCreateScale()
9622
9623```
9624OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py )
9625```
9626
9627**Description**
9628
9629Creates 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).
9630
9631**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9632
9633**Since**: 12
9634
9635**Parameters**
9636
9637| Name | Description                     |
9638| ---- | ------------------------------- |
9639| sx   | Scale factor on the X axis.     |
9640| sy   | Scale factor on the Y axis.     |
9641| px   | Coordinate point on the X axis. |
9642| py   | Coordinate point on the Y axis. |
9643
9644**Returns**
9645
9646Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
9647
9648
9649### OH_Drawing_MatrixCreateTranslation()
9650
9651```
9652OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy )
9653```
9654
9655**Description**
9656
9657Creates an **OH_Drawing_Matrix** with the translation attribute. The matrix is obtained by translating the identity matrix by the distance (dx, dy).
9658
9659**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9660
9661**Since**: 12
9662
9663**Parameters**
9664
9665| Name | Description                          |
9666| ---- | ------------------------------------ |
9667| dx   | Distance to translate on the X axis. |
9668| dy   | Distance to translate on the Y axis. |
9669
9670**Returns**
9671
9672Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created.
9673
9674
9675### OH_Drawing_MatrixDestroy()
9676
9677```
9678void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* )
9679```
9680
9681**Description**
9682
9683Destroys an **OH_Drawing_Matrix** object and reclaims the memory occupied by the object.
9684
9685**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9686
9687**Since**: 11
9688
9689**Parameters**
9690
9691| Name              | Description                               |
9692| ----------------- | ----------------------------------------- |
9693| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Font** object. |
9694
9695
9696### OH_Drawing_MatrixGetValue()
9697
9698```
9699float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index )
9700```
9701
9702**Description**
9703
9704Obtains a matrix value of a given index, which ranges from 0 to 8.
9705
9706Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9707
9708If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9709
9710If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9711
9712If **index** is less than 0 or greater than 8, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
9713
9714**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9715
9716**Since**: 12
9717
9718**Parameters**
9719
9720| Name              | Description                                                  |
9721| ----------------- | ------------------------------------------------------------ |
9722| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9723| index             | Index, which ranges from 0 to 8.                             |
9724
9725**Returns**
9726
9727Returns the matrix value.
9728
9729
9730### OH_Drawing_MatrixInvert()
9731
9732```
9733bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse )
9734```
9735
9736**Description**
9737
9738Inverts a matrix and returns the result.
9739
9740Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9741
9742If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9743
9744If either **OH_Drawing_Matrix** or **inverse** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9745
9746**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9747
9748**Since**: 12
9749
9750**Parameters**
9751
9752| Name              | Description                                                  |
9753| ----------------- | ------------------------------------------------------------ |
9754| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9755| 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). |
9756
9757**Returns**
9758
9759Returns **true** if the matrix is reversible and the passed-in **inverse** is inverted; returns **false** otherwise.
9760
9761
9762### OH_Drawing_MatrixIsEqual()
9763
9764```
9765bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other )
9766```
9767
9768**Description**
9769
9770Checks whether two **OH_Drawing_Matrix** objects are equal.
9771
9772Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9773
9774If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9775
9776If either **OH_Drawing_Matrix** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9777
9778**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9779
9780**Since**: 12
9781
9782**Parameters**
9783
9784| Name              | Description                                                  |
9785| ----------------- | ------------------------------------------------------------ |
9786| OH_Drawing_Matrix | Pointer to a matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9787| other             | Pointer to the other matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9788
9789**Returns**
9790
9791Returns **true** if the two matrices are equal; returns **false** otherwise.
9792
9793
9794### OH_Drawing_MatrixIsIdentity()
9795
9796```
9797bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* )
9798```
9799
9800**Description**
9801
9802Checks whether an **OH_Drawing_Matrix** object is an identity matrix.
9803
9804Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9805
9806If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9807
9808If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9809
9810**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9811
9812**Since**: 12
9813
9814**Parameters**
9815
9816| Name              | Description                                                  |
9817| ----------------- | ------------------------------------------------------------ |
9818| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9819
9820**Returns**
9821
9822Returns **true** if the matrix is an identity matrix; returns **false** otherwise.
9823
9824
9825### OH_Drawing_MatrixPostRotate()
9826
9827```
9828void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py )
9829```
9830
9831**Description**
9832
9833Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py).
9834
9835Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9836
9837If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9838
9839If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9840
9841**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9842
9843**Since**: 12
9844
9845**Parameters**
9846
9847| Name              | Description                                                  |
9848| ----------------- | ------------------------------------------------------------ |
9849| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9850| degree            | Angle to rotate, in degrees. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation. |
9851| px                | X coordinate of the rotation point.                          |
9852| py                | Y coordinate of the rotation point.                          |
9853
9854
9855### OH_Drawing_MatrixPostScale()
9856
9857```
9858void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
9859```
9860
9861**Description**
9862
9863Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
9864
9865Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9866
9867If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9868
9869If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9870
9871
9872**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9873
9874**Since**: 12
9875
9876**Parameters**
9877
9878| Name              | Description                                                  |
9879| ----------------- | ------------------------------------------------------------ |
9880| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9881| sx                | Scale factor on the X axis.                                  |
9882| sy                | Scale factor on the Y axis.                                  |
9883| px                | X coordinate of the scale point.                             |
9884| py                | Y coordinate of the scale point.                             |
9885
9886
9887### OH_Drawing_MatrixPostTranslate()
9888
9889```
9890void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy )
9891```
9892
9893**Description**
9894
9895Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
9896
9897Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9898
9899If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9900
9901If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9902
9903
9904**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9905
9906**Since**: 12
9907
9908**Parameters**
9909
9910| Name              | Description                                                  |
9911| ----------------- | ------------------------------------------------------------ |
9912| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9913| dx                | Distance to translate on the X axis.                         |
9914| dy                | Distance to translate on the Y axis.                         |
9915
9916
9917### OH_Drawing_MatrixPreRotate()
9918
9919```
9920void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py )
9921```
9922
9923**Description**
9924
9925Premultiplies a matrix by an identity matrix that rotates by a given degree around the rotation point (px, py).
9926
9927Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9928
9929If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9930
9931If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9932
9933
9934**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9935
9936**Since**: 12
9937
9938**Parameters**
9939
9940| Name              | Description                                                  |
9941| ----------------- | ------------------------------------------------------------ |
9942| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9943| degree            | Angle to rotate, in degrees. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation. |
9944| px                | X coordinate of the rotation point.                          |
9945| py                | Y coordinate of the rotation point.                          |
9946
9947
9948### OH_Drawing_MatrixPreScale()
9949
9950```
9951void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
9952```
9953
9954**Description**
9955
9956Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py).
9957
9958Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9959
9960If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9961
9962If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9963
9964
9965**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9966
9967**Since**: 12
9968
9969**Parameters**
9970
9971| Name              | Description                                                  |
9972| ----------------- | ------------------------------------------------------------ |
9973| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
9974| sx                | Scale factor on the X axis.                                  |
9975| sy                | Scale factor on the Y axis.                                  |
9976| px                | X coordinate of the scale point.                             |
9977| py                | Y coordinate of the scale point.                             |
9978
9979
9980### OH_Drawing_MatrixPreTranslate()
9981
9982```
9983void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy )
9984```
9985
9986**Description**
9987
9988Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy).
9989
9990Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
9991
9992If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
9993
9994If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
9995
9996**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
9997
9998**Since**: 12
9999
10000**Parameters**
10001
10002| Name              | Description                                                  |
10003| ----------------- | ------------------------------------------------------------ |
10004| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10005| dx                | Distance to translate on the X axis.                         |
10006| dy                | Distance to translate on the Y axis.                         |
10007
10008
10009### OH_Drawing_MatrixReset()
10010
10011```
10012void OH_Drawing_MatrixReset (OH_Drawing_Matrix* )
10013```
10014
10015**Description**
10016
10017Resets a matrix to an identity matrix: | 1 0 0 | | 0 1 0 | | 0 0 0 1 |.
10018
10019Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10020
10021If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10022
10023If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10024
10025**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10026
10027**Since**: 12
10028
10029**Parameters**
10030
10031| Name              | Description                                                  |
10032| ----------------- | ------------------------------------------------------------ |
10033| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10034
10035
10036### OH_Drawing_MatrixRotate()
10037
10038```
10039void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py )
10040```
10041
10042**Description**
10043
10044Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py).
10045
10046Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10047
10048If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10049
10050If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10051
10052**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10053
10054**Since**: 12
10055
10056**Parameters**
10057
10058| Name              | Description                                                  |
10059| ----------------- | ------------------------------------------------------------ |
10060| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10061| degree            | Angle to rotate, in degrees. A positive value indicates a clockwise rotation, and a negative value indicates a counterclockwise rotation. |
10062| px                | Coordinate point on the X axis.                              |
10063| py                | Coordinate point on the Y axis.                              |
10064
10065
10066### OH_Drawing_MatrixScale()
10067
10068```
10069void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py )
10070```
10071
10072**Description**
10073
10074Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py).
10075
10076Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10077
10078If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10079
10080If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10081
10082**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10083
10084**Since**: 12
10085
10086**Parameters**
10087
10088| Name              | Description                                                  |
10089| ----------------- | ------------------------------------------------------------ |
10090| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10091| sx                | Scale factor on the X axis.                                  |
10092| sy                | Scale factor on the Y axis.                                  |
10093| px                | Coordinate point on the X axis.                              |
10094| py                | Coordinate point on the Y axis.                              |
10095
10096
10097### OH_Drawing_MatrixSetMatrix()
10098
10099```
10100void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 )
10101```
10102
10103**Description**
10104
10105Sets matrix parameters for an **OH_Drawing_Matrix** object.
10106
10107Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10108
10109If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10110
10111If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10112
10113**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10114
10115**Since**: 11
10116
10117**Parameters**
10118
10119| Name              | Description                                 |
10120| ----------------- | ------------------------------------------- |
10121| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Matrix** object. |
10122| scaleX            | Scale factor on the X axis.                 |
10123| skewX             | Skew factor on the X axis.                  |
10124| transX            | Translation coefficient on the X axis.      |
10125| skewY             | Skew factor on the Y axis.                  |
10126| scaleY            | Scale factor on the Y axis.                 |
10127| transY            | Translation coefficient on the Y axis.      |
10128| persp0            | Perspective coefficient of the X axis.      |
10129| persp1            | Perspective coefficient of the Y axis.      |
10130| persp2            | Perspective scale coefficient.              |
10131
10132
10133### OH_Drawing_MatrixSetPolyToPoly()
10134
10135```
10136bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count )
10137```
10138
10139**Description**
10140
10141Generates 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].
10142
10143Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10144
10145If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10146
10147If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10148
10149If **count** is less than 0 or greater than 4, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10150
10151**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10152
10153**Since**: 12
10154
10155**Parameters**
10156
10157| Name              | Description                                                  |
10158| ----------------- | ------------------------------------------------------------ |
10159| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10160| src               | Array of source points. If NULL is passed in, **count** must be 0. |
10161| 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. |
10162| count             | Number of source points or destination points. If 0 is passed in, the matrix is set to an identity matrix. |
10163
10164**Returns**
10165
10166Returns **true** if the matrix is generated; returns **false** otherwise.
10167
10168
10169### OH_Drawing_MatrixSetRectToRect()
10170
10171```
10172bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf )
10173```
10174
10175**Description**
10176
10177Scales a matrix to map a source rectangle to a destination rectangle.
10178
10179Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10180
10181If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10182
10183If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned.
10184
10185**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10186
10187**Since**: 12
10188
10189**Parameters**
10190
10191| Name              | Description                                                  |
10192| ----------------- | ------------------------------------------------------------ |
10193| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10194| src               | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
10195| dst               | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. |
10196| stf               | Scaling mode. For details about the available options, see [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit). |
10197
10198**Returns**
10199
10200Returns **true** if the operation is successful; returns **false** if the operation fails; returns **true** and sets the matrix to |0 0 0| |0 0 0| |0 0 1| if the passed-in matrix is empty.
10201
10202### OH_Drawing_MatrixTranslate()
10203
10204```
10205void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy )
10206```
10207
10208**Description**
10209
10210Sets a matrix as an identity matrix and translates it by a given distance (dx, dy).
10211
10212Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10213
10214If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10215
10216If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10217
10218**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10219
10220**Since**: 12
10221
10222**Parameters**
10223
10224| Name              | Description                                                  |
10225| ----------------- | ------------------------------------------------------------ |
10226| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
10227| dx                | Distance to translate on the X axis.                         |
10228| dy                | Distance to translate on the Y axis.                         |
10229
10230
10231### OH_Drawing_MemoryStreamCreate()
10232
10233```
10234OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData )
10235```
10236
10237**Description**
10238
10239Creates an **OH_Drawing_MemoryStream** object.
10240
10241Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10242
10243If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10244
10245If **data** is NULL or **length** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10246
10247**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10248
10249**Since**: 12
10250
10251**Parameters**
10252
10253| Name     | Description                                                  |
10254| -------- | ------------------------------------------------------------ |
10255| data     | Pointer to the data.                                         |
10256| length   | Length of the data.                                          |
10257| 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. |
10258
10259**Returns**
10260
10261Returns the pointer to the [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object created.
10262
10263
10264### OH_Drawing_MemoryStreamDestroy()
10265
10266```
10267void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* )
10268```
10269
10270**Description**
10271
10272Destroys an **OH_Drawing_MemoryStream** object and reclaims the memory occupied by the object.
10273
10274**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10275
10276**Since**: 12
10277
10278**Parameters**
10279
10280| Name                    | Description                                                  |
10281| ----------------------- | ------------------------------------------------------------ |
10282| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. |
10283
10284
10285### OH_Drawing_PathAddArc()
10286
10287```
10288void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle )
10289```
10290
10291**Description**
10292
10293Adds 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.
10294
10295Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10296
10297If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10298
10299If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10300
10301**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10302
10303**Since**: 12
10304
10305**Parameters**
10306
10307| Name            | Description                                                  |
10308| --------------- | ------------------------------------------------------------ |
10309| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10310| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
10311| startAngle      | Start angle of the arc, in degrees.                          |
10312| 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. |
10313
10314### OH_Drawing_PathAddOval()
10315
10316```
10317void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection  )
10318```
10319
10320**Description**
10321
10322Adds an oval to a path in the specified direction.
10323
10324Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10325
10326If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10327
10328If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10329
10330If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10331
10332**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10333
10334**Since**: 12
10335
10336**Parameters**
10337
10338| Name                     | Description                                                  |
10339| ------------------------ | ------------------------------------------------------------ |
10340| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10341| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
10342| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
10343
10344### OH_Drawing_PathAddOvalWithInitialPoint()
10345
10346```
10347void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection  )
10348```
10349
10350**Description**
10351
10352Adds 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.
10353
10354Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10355
10356If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10357
10358If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10359
10360If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10361
10362**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10363
10364**Since**: 12
10365
10366**Parameters**
10367
10368| Name                     | Description                                                  |
10369| ------------------------ | ------------------------------------------------------------ |
10370| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10371| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
10372| start                    | Start point of the oval.                                     |
10373| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
10374
10375
10376### OH_Drawing_PathAddPath()
10377
10378```
10379void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix*  )
10380```
10381
10382**Description**
10383
10384Transforms the points in a **src** path by a matrix and adds the new one to the current path.
10385
10386Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10387
10388If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10389
10390If either **OH_Drawing_Path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10391
10392**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10393
10394**Since**: 12
10395
10396**Parameters**
10397
10398| Name              | Description                                                  |
10399| ----------------- | ------------------------------------------------------------ |
10400| OH_Drawing_Path   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10401| src               | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10402| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. |
10403
10404
10405### OH_Drawing_PathAddPathWithMatrixAndMode()
10406
10407```
10408void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode  )
10409```
10410
10411**Description**
10412
10413Transforms the points in a **src** path by a matrix and adds the new one to the current path with the specified adding mode.
10414
10415Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10416
10417If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10418
10419If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10420
10421If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10422
10423**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10424
10425**Since**: 12
10426
10427**Parameters**
10428
10429| Name                   | Description                                                  |
10430| ---------------------- | ------------------------------------------------------------ |
10431| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10432| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10433| OH_Drawing_Matrix      | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. |
10434| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
10435
10436
10437### OH_Drawing_PathAddPathWithMode()
10438
10439```
10440void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode  )
10441```
10442
10443**Description**
10444
10445Adds a **src** path to the current path with the specified adding mode.
10446
10447Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10448
10449If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10450
10451If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10452
10453If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10454
10455**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10456
10457**Since**: 12
10458
10459**Parameters**
10460
10461| Name                   | Description                                                  |
10462| ---------------------- | ------------------------------------------------------------ |
10463| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10464| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10465| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
10466
10467
10468### OH_Drawing_PathAddPathWithOffsetAndMode()
10469
10470```
10471void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode  )
10472```
10473
10474**Description**
10475
10476Translates a **src** path by an offset and adds the new one to the current path with the specified adding mode.
10477
10478Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10479
10480If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10481
10482If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10483
10484If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10485
10486**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10487
10488**Since**: 12
10489
10490**Parameters**
10491
10492| Name                   | Description                                                  |
10493| ---------------------- | ------------------------------------------------------------ |
10494| path                   | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10495| src                    | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10496| dx                     | X offset.                                                    |
10497| dy                     | Y offset.                                                    |
10498| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). |
10499
10500
10501### OH_Drawing_PathAddRect()
10502
10503```
10504void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection  )
10505```
10506
10507**Description**
10508
10509Adds a rectangle contour to a path in the specified direction.
10510
10511Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10512
10513If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10514
10515If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10516
10517If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10518
10519**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10520
10521**Since**: 12
10522
10523**Parameters**
10524
10525| Name                     | Description                                                  |
10526| ------------------------ | ------------------------------------------------------------ |
10527| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10528| left                     | X coordinate of the upper left corner of the rectangle.      |
10529| top                      | Y coordinate of the upper left corner of the rectangle.      |
10530| right                    | X coordinate of the lower right corner of the rectangle.     |
10531| bottom                   | Y coordinate of the lower right corner of the rectangle.     |
10532| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
10533
10534
10535### OH_Drawing_PathAddRectWithInitialCorner()
10536
10537```
10538void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start )
10539```
10540
10541**Description**
10542
10543Adds a rectangle contour to a path in the specified direction.
10544
10545Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10546
10547If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10548
10549If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10550
10551If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10552
10553**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10554
10555**Since**: 12
10556
10557**Parameters**
10558
10559| Name                     | Description                                                  |
10560| ------------------------ | ------------------------------------------------------------ |
10561| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10562| OH_Drawing_Rect          | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.    |
10563| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
10564| 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. |
10565
10566
10567### OH_Drawing_PathAddRoundRect()
10568
10569```
10570void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection  )
10571```
10572
10573**Description**
10574
10575Adds a rounded rectangle to a path in the specified direction.
10576
10577Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10578
10579If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10580
10581If either **OH_Drawing_Path** or **roundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10582
10583If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
10584
10585**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10586
10587**Since**: 12
10588
10589**Parameters**
10590
10591| Name                     | Description                                                  |
10592| ------------------------ | ------------------------------------------------------------ |
10593| OH_Drawing_Path          | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10594| roundRect                | Pointer to an [OH_Drawing_RoundRect](#oh_drawing_roundrect) object. |
10595| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). |
10596
10597
10598### OH_Drawing_PathArcTo()
10599
10600```
10601void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg )
10602```
10603
10604**Description**
10605
10606Draws 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.
10607
10608Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10609
10610If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10611
10612If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10613
10614**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10615
10616**Since**: 8
10617
10618**Parameters**
10619
10620| Name            | Description                                                  |
10621| --------------- | ------------------------------------------------------------ |
10622| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object.                    |
10623| x1              | X coordinate of the upper left corner of the rectangle.      |
10624| y1              | Y coordinate of the upper left corner of the rectangle.      |
10625| x2              | X coordinate of the lower right corner of the rectangle.     |
10626| y2              | Y coordinate of the lower right corner of the rectangle.     |
10627| startDeg        | Start angle. The start direction (0°) of the angle is the positive direction of the X axis. |
10628| 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. |
10629
10630
10631### OH_Drawing_PathClose()
10632
10633```
10634void OH_Drawing_PathClose (OH_Drawing_Path* )
10635```
10636
10637**Description**
10638
10639Closes a path by drawing a line segment from the current point to the start point of the path.
10640
10641Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10642
10643If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10644
10645If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10646
10647**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10648
10649**Since**: 8
10650
10651**Parameters**
10652
10653| Name            | Description                               |
10654| --------------- | ----------------------------------------- |
10655| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10656
10657
10658### OH_Drawing_PathConicTo()
10659
10660```
10661void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
10662```
10663
10664**Description**
10665
10666Draws 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.
10667
10668Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10669
10670If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10671
10672If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10673
10674**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10675
10676**Since**: 12
10677
10678**Parameters**
10679
10680| Name            | Description                                                  |
10681| --------------- | ------------------------------------------------------------ |
10682| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10683| ctrlX           | X coordinate of the control point.                           |
10684| ctrlY           | Y coordinate of the control point.                           |
10685| endX            | X coordinate of the target point.                            |
10686| endY            | Y coordinate of the target point.                            |
10687| 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). |
10688
10689
10690### OH_Drawing_PathContains()
10691
10692```
10693bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y )
10694```
10695
10696**Description**
10697
10698Checks whether a coordinate point is included in this path. For details, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1).
10699
10700Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10701
10702If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10703
10704If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10705
10706**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10707
10708**Since**: 12
10709
10710**Parameters**
10711
10712| Name            | Description                                               |
10713| --------------- | --------------------------------------------------------- |
10714| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
10715| x               | Coordinate point on the X axis.                           |
10716| y               | Coordinate point on the Y axis.                           |
10717
10718**Returns**
10719
10720Returns **true** if the coordinate point is included in the path; returns **false** otherwise.
10721
10722
10723### OH_Drawing_PathCopy()
10724
10725```
10726OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* )
10727```
10728
10729**Description**
10730
10731Copies an existing [OH_Drawing_Path](#oh_drawing_path) object to create a new one.
10732
10733Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10734
10735If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10736
10737If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10738
10739**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10740
10741**Since**: 12
10742
10743**Parameters**
10744
10745| Name            | Description                                               |
10746| --------------- | --------------------------------------------------------- |
10747| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. |
10748
10749**Returns**
10750
10751Returns the pointer to the [OH_Drawing_Path](#oh_drawing_path) object created.
10752
10753
10754### OH_Drawing_PathCreate()
10755
10756```
10757OH_Drawing_Path* OH_Drawing_PathCreate (void )
10758```
10759
10760**Description**
10761
10762Creates an **OH_Drawing_Path** object.
10763
10764**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10765
10766**Since**: 8
10767
10768**Returns**
10769
10770Returns the pointer to the **OH_Drawing_Path** object created.
10771
10772
10773### OH_Drawing_PathCubicTo()
10774
10775```
10776void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
10777```
10778
10779**Description**
10780
10781Draws 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.
10782
10783Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10784
10785If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10786
10787If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10788
10789**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10790
10791**Since**: 8
10792
10793**Parameters**
10794
10795| Name            | Description                               |
10796| --------------- | ----------------------------------------- |
10797| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10798| ctrlX1          | X coordinate of the first control point.  |
10799| ctrlY1          | Y coordinate of the first control point.  |
10800| ctrlX2          | X coordinate of the second control point. |
10801| ctrlY2          | Y coordinate of the second control point. |
10802| endX            | X coordinate of the target point.         |
10803| endY            | Y coordinate of the target point.         |
10804
10805
10806### OH_Drawing_PathDestroy()
10807
10808```
10809void OH_Drawing_PathDestroy (OH_Drawing_Path* )
10810```
10811
10812**Description**
10813
10814Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object.
10815
10816**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10817
10818**Since**: 8
10819
10820**Parameters**
10821
10822| Name            | Description                               |
10823| --------------- | ----------------------------------------- |
10824| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10825
10826
10827### OH_Drawing_PathEffectDestroy()
10828
10829```
10830void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* )
10831```
10832
10833**Description**
10834
10835Destroys an **OH_Drawing_PathEffect** object and reclaims the memory occupied by the object.
10836
10837**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10838
10839**Since**: 12
10840
10841**Parameters**
10842
10843| Name                  | Description                                                  |
10844| --------------------- | ------------------------------------------------------------ |
10845| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. |
10846
10847
10848### OH_Drawing_PathGetLength()
10849
10850```
10851float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed )
10852```
10853
10854**Description**
10855
10856Obtains the length of a path.
10857
10858Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10859
10860If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10861
10862If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10863
10864**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10865
10866**Since**: 12
10867
10868**Parameters**
10869
10870| Name            | Description                                                  |
10871| --------------- | ------------------------------------------------------------ |
10872| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
10873| forceClosed     | Whether the path can be modified or deleted freely after the function is called. The value **true** means that the path can be modified or deleted freely, and **false** means the opposite. |
10874
10875**Returns**
10876
10877Returns the length of the path.
10878
10879
10880### OH_Drawing_PathLineTo()
10881
10882```
10883void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y )
10884```
10885
10886**Description**
10887
10888Draws 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.
10889
10890Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10891
10892If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10893
10894If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10895
10896**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10897
10898**Since**: 8
10899
10900**Parameters**
10901
10902| Name            | Description                               |
10903| --------------- | ----------------------------------------- |
10904| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10905| x               | X coordinate of the target point.         |
10906| y               | Y coordinate of the target point.         |
10907
10908
10909### OH_Drawing_PathMoveTo()
10910
10911```
10912void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y )
10913```
10914
10915**Description**
10916
10917Sets the start point of a path.
10918
10919Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10920
10921If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10922
10923If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10924
10925**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10926
10927**Since**: 8
10928
10929**Parameters**
10930
10931| Name            | Description                               |
10932| --------------- | ----------------------------------------- |
10933| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10934| x               | X coordinate of the start point.          |
10935| y               | Y coordinate of the start point.          |
10936
10937
10938### OH_Drawing_PathOffset()
10939
10940```
10941void OH_Drawing_PathOffset (OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy )
10942```
10943
10944**Description**
10945
10946Translates a path by an offset along the X axis and Y axis and adds the new one to the **dst** path.
10947
10948Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10949
10950If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10951
10952If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10953
10954**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10955
10956**Since**: 12
10957
10958**Parameters**
10959
10960| Name | Description                                                  |
10961| ---- | ------------------------------------------------------------ |
10962| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
10963| 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. |
10964| dx   | X offset.                                                    |
10965| dy   | Y offset.                                                    |
10966
10967
10968### OH_Drawing_PathQuadTo()
10969
10970```
10971void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
10972```
10973
10974**Description**
10975
10976Draws 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.
10977
10978Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
10979
10980If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
10981
10982If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
10983
10984**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
10985
10986**Since**: 8
10987
10988**Parameters**
10989
10990| Name            | Description                               |
10991| --------------- | ----------------------------------------- |
10992| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
10993| ctrlX           | X coordinate of the control point.        |
10994| ctrlY           | Y coordinate of the control point.        |
10995| endX            | X coordinate of the target point.         |
10996| endY            | Y coordinate of the target point.         |
10997
10998
10999### OH_Drawing_PathRConicTo()
11000
11001```
11002void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight )
11003```
11004
11005**Description**
11006
11007Draws 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.
11008
11009Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11010
11011If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11012
11013If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11014
11015**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11016
11017**Since**: 12
11018
11019**Parameters**
11020
11021| Name            | Description                                                  |
11022| --------------- | ------------------------------------------------------------ |
11023| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11024| ctrlX           | X offset relative to the last point, which is used to specify the X coordinate of the control point. |
11025| ctrlY           | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. |
11026| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
11027| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
11028| 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). |
11029
11030
11031### OH_Drawing_PathRCubicTo()
11032
11033```
11034void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY )
11035```
11036
11037**Description**
11038
11039Draws 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.
11040
11041Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11042
11043If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11044
11045If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11046
11047**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11048
11049**Since**: 12
11050
11051**Parameters**
11052
11053| Name            | Description                                                  |
11054| --------------- | ------------------------------------------------------------ |
11055| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11056| ctrlX1          | X offset relative to the last point, which is used to specify the X coordinate of the first control point. |
11057| ctrlY1          | Y offset relative to the last point, which is used to specify the Y coordinate of the first control point. |
11058| ctrlX2          | X offset relative to the last point, which is used to specify the X coordinate of the second control point. |
11059| ctrlY2          | Y offset relative to the last point, which is used to specify the Y coordinate of the second control point. |
11060| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
11061| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
11062
11063
11064### OH_Drawing_PathReset()
11065
11066```
11067void OH_Drawing_PathReset (OH_Drawing_Path* )
11068```
11069
11070**Description**
11071
11072Resets path data.
11073
11074Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11075
11076If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11077
11078If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11079
11080**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11081
11082**Since**: 8
11083
11084**Parameters**
11085
11086| Name            | Description                               |
11087| --------------- | ----------------------------------------- |
11088| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. |
11089
11090
11091### OH_Drawing_PathRLineTo()
11092
11093```
11094void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y )
11095```
11096
11097**Description**
11098
11099Draws 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.
11100
11101Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11102
11103If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11104
11105If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11106
11107**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11108
11109**Since**: 12
11110
11111**Parameters**
11112
11113| Name            | Description                                                  |
11114| --------------- | ------------------------------------------------------------ |
11115| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11116| x               | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
11117| y               | Y offset relative to the last point, which is used to specify the X coordinate of the target point. |
11118
11119
11120### OH_Drawing_PathRMoveTo()
11121
11122```
11123void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y )
11124```
11125
11126**Description**
11127
11128Sets the start position relative to the last point of a path. If the path is empty, the start point (0, 0) is used.
11129
11130Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11131
11132If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11133
11134If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11135
11136**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11137
11138**Since**: 12
11139
11140**Parameters**
11141
11142| Name            | Description                                                  |
11143| --------------- | ------------------------------------------------------------ |
11144| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11145| x               | X offset relative to the last point, which is used to specify the X coordinate of the start point. |
11146| y               | Y offset relative to the last point, which is used to specify the Y coordinate of the start point. |
11147
11148
11149### OH_Drawing_PathRQuadTo()
11150
11151```
11152void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY )
11153```
11154
11155**Description**
11156
11157Draws 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.
11158
11159Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11160
11161If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11162
11163If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11164
11165**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11166
11167**Since**: 12
11168
11169**Parameters**
11170
11171| Name            | Description                                                  |
11172| --------------- | ------------------------------------------------------------ |
11173| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11174| ctrlX           | X offset relative to the last point, which is used to specify the X coordinate of the control point. |
11175| ctrlY           | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. |
11176| endX            | X offset relative to the last point, which is used to specify the X coordinate of the target point. |
11177| endY            | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. |
11178
11179
11180### OH_Drawing_PathSetFillType()
11181
11182```
11183void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType  )
11184```
11185
11186**Description**
11187
11188Sets the fill type for a path.
11189
11190Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11191
11192If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11193
11194If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11195
11196If **OH_Drawing_PathFillType** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
11197
11198**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11199
11200**Since**: 12
11201
11202**Parameters**
11203
11204| Name                    | Description                                                  |
11205| ----------------------- | ------------------------------------------------------------ |
11206| OH_Drawing_Path         | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11207| OH_Drawing_PathFillType | Fill type of the path. For details about the available options, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype). |
11208
11209
11210### OH_Drawing_PathTransform()
11211
11212```
11213void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix*  )
11214```
11215
11216**Description**
11217
11218Transforms the points in a path by a matrix.
11219
11220Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11221
11222If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11223
11224If either **OH_Drawing_Path** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11225
11226**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11227
11228**Since**: 12
11229
11230**Parameters**
11231
11232| Name              | Description                                                  |
11233| ----------------- | ------------------------------------------------------------ |
11234| OH_Drawing_Path   | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11235| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11236
11237
11238### OH_Drawing_PathTransformWithPerspectiveClip()
11239
11240```
11241void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip )
11242```
11243
11244**Description**
11245
11246Transforms 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.
11247
11248Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11249
11250If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11251
11252If either **src** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11253
11254**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11255
11256**Since**: 12
11257
11258**Parameters**
11259
11260| Name                 | Description                                                  |
11261| -------------------- | ------------------------------------------------------------ |
11262| src                  | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.    |
11263| OH_Drawing_Matrix    | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. |
11264| dst                  | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object. |
11265| applyPerspectiveClip | Whether to apply perspective cropping to the new path. The value **true** means to apply perspective cropping, and **false** means the opposite. |
11266
11267
11268### OH_Drawing_PenCreate()
11269
11270```
11271OH_Drawing_Pen* OH_Drawing_PenCreate (void )
11272```
11273
11274**Description**
11275
11276Creates an **OH_Drawing_Pen** object.
11277
11278**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11279
11280**Since**: 8
11281
11282**Returns**
11283
11284Returns the pointer to the **OH_Drawing_Pen** object created.
11285
11286
11287### OH_Drawing_PenDestroy()
11288
11289```
11290void OH_Drawing_PenDestroy (OH_Drawing_Pen* )
11291```
11292
11293**Description**
11294
11295Destroys an **OH_Drawing_Pen** object and reclaims the memory occupied by the object.
11296
11297**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11298
11299**Since**: 8
11300
11301**Parameters**
11302
11303| Name           | Description                              |
11304| -------------- | ---------------------------------------- |
11305| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11306
11307
11308### OH_Drawing_PenGetAlpha()
11309
11310```
11311uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* )
11312```
11313
11314**Description**
11315
11316Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape.
11317
11318Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11319
11320If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11321
11322If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11323
11324**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11325
11326**Since**: 11
11327
11328**Parameters**
11329
11330| Name           | Description                              |
11331| -------------- | ---------------------------------------- |
11332| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11333
11334**Returns**
11335
11336Returns an 8-bit variable that describes the alpha value.
11337
11338
11339### OH_Drawing_PenGetCap()
11340
11341```
11342OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* )
11343```
11344
11345**Description**
11346
11347Obtains the line cap style of a pen.
11348
11349Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11350
11351If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11352
11353If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11354
11355**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11356
11357**Since**: 8
11358
11359**Parameters**
11360
11361| Name           | Description                              |
11362| -------------- | ---------------------------------------- |
11363| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11364
11365**Returns**
11366
11367Returns the line cap style.
11368
11369
11370### OH_Drawing_PenGetColor()
11371
11372```
11373uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* )
11374```
11375
11376**Description**
11377
11378Obtains the color of a pen. The color is used by the pen to outline a shape.
11379
11380Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11381
11382If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11383
11384If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11385
11386**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11387
11388**Since**: 8
11389
11390**Parameters**
11391
11392| Name           | Description                              |
11393| -------------- | ---------------------------------------- |
11394| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11395
11396**Returns**
11397
11398Returns a 32-bit (ARGB) variable that describes the color.
11399
11400
11401### OH_Drawing_PenGetFilter()
11402
11403```
11404void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
11405```
11406
11407**Description**
11408
11409Obtains the filter of a pen. The filter is a container that holds a mask filter and color filter.
11410
11411Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11412
11413If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11414
11415If either **OH_Drawing_Pen** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11416
11417**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11418
11419**Since**: 12
11420
11421**Parameters**
11422
11423| Name              | Description                                                  |
11424| ----------------- | ------------------------------------------------------------ |
11425| OH_Drawing_Pen    | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
11426| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. |
11427
11428
11429### OH_Drawing_PenGetJoin()
11430
11431```
11432OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* )
11433```
11434
11435**Description**
11436
11437Obtains the line join style of a pen.
11438
11439Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11440
11441If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11442
11443If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11444
11445**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11446
11447**Since**: 8
11448
11449**Parameters**
11450
11451| Name           | Description                              |
11452| -------------- | ---------------------------------------- |
11453| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11454
11455**Returns**
11456
11457Returns the line join style.
11458
11459### OH_Drawing_PenGetMiterLimit()
11460
11461```
11462float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* )
11463```
11464
11465**Description**
11466
11467Obtains 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.
11468
11469Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11470
11471If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11472
11473If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11474
11475**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11476
11477**Since**: 8
11478
11479**Parameters**
11480
11481| Name           | Description                              |
11482| -------------- | ---------------------------------------- |
11483| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11484
11485**Returns**
11486
11487Returns the miter limit.
11488
11489
11490### OH_Drawing_PenGetWidth()
11491
11492```
11493float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* )
11494```
11495
11496**Description**
11497
11498Obtains the width of a pen. The width describes the thickness of the outline of a shape.
11499
11500Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11501
11502If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11503
11504If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11505
11506**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11507
11508**Since**: 8
11509
11510**Parameters**
11511
11512| Name           | Description                              |
11513| -------------- | ---------------------------------------- |
11514| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11515
11516**Returns**
11517
11518Returns the width of the pen.
11519
11520
11521### OH_Drawing_PenIsAntiAlias()
11522
11523```
11524bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* )
11525```
11526
11527**Description**
11528
11529Checks whether anti-aliasing is enabled for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
11530
11531Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11532
11533If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11534
11535If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11536
11537**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11538
11539**Since**: 8
11540
11541**Parameters**
11542
11543| Name           | Description                              |
11544| -------------- | ---------------------------------------- |
11545| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11546
11547**Returns**
11548
11549Returns **true** if anti-aliasing is enabled; returns **false** otherwise.
11550
11551
11552### OH_Drawing_PenReset()
11553
11554```
11555void OH_Drawing_PenReset (OH_Drawing_Pen* )
11556```
11557
11558**Description**
11559
11560Resets a pen to the initial state.
11561
11562Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11563
11564If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11565
11566If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11567
11568**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11569
11570**Since**: 12
11571
11572**Parameters**
11573
11574| Name           | Description                                             |
11575| -------------- | ------------------------------------------------------- |
11576| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. |
11577
11578
11579### OH_Drawing_PenSetAlpha()
11580
11581```
11582void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha )
11583```
11584
11585**Description**
11586
11587Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape.
11588
11589Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11590
11591If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11592
11593If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11594
11595**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11596
11597**Since**: 11
11598
11599**Parameters**
11600
11601| Name           | Description                              |
11602| -------------- | ---------------------------------------- |
11603| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11604| alpha          | Alpha value, which is an 8-bit variable. |
11605
11606
11607### OH_Drawing_PenSetAntiAlias()
11608
11609```
11610void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool  )
11611```
11612
11613**Description**
11614
11615Enables or disables anti-aliasing for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent.
11616
11617Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11618
11619If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11620
11621If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11622
11623**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11624
11625**Since**: 8
11626
11627**Parameters**
11628
11629| Name           | Description                                                  |
11630| -------------- | ------------------------------------------------------------ |
11631| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object.                     |
11632| bool           | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. |
11633
11634
11635### OH_Drawing_PenSetBlendMode()
11636
11637```
11638void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode  )
11639```
11640
11641**Description**
11642
11643Sets a blender for a pen. The blender implements the specified blend mode.
11644
11645Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11646
11647If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11648
11649If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11650
11651If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
11652
11653**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11654
11655**Since**: 12
11656
11657**Parameters**
11658
11659| Name                 | Description                                                  |
11660| -------------------- | ------------------------------------------------------------ |
11661| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
11662| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). |
11663
11664
11665### OH_Drawing_PenSetCap()
11666
11667```
11668void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle  )
11669```
11670
11671**Description**
11672
11673Sets the line cap style for a pen.
11674
11675Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11676
11677If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11678
11679If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11680
11681If **OH_Drawing_PenLineCapStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
11682
11683**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11684
11685**Since**: 8
11686
11687**Parameters**
11688
11689| Name                       | Description                              |
11690| -------------------------- | ---------------------------------------- |
11691| OH_Drawing_Pen             | Pointer to an **OH_Drawing_Pen** object. |
11692| OH_Drawing_PenLineCapStyle | Line cap style, which is a variable.     |
11693
11694
11695### OH_Drawing_PenSetColor()
11696
11697```
11698void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color )
11699```
11700
11701**Description**
11702
11703Sets the color for a pen. The color is used by the pen to outline a shape.
11704
11705Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11706
11707If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11708
11709If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11710
11711**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11712
11713**Since**: 8
11714
11715**Parameters**
11716
11717| Name           | Description                               |
11718| -------------- | ----------------------------------------- |
11719| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object.  |
11720| color          | Color, which is a 32-bit (ARGB) variable. |
11721
11722
11723### OH_Drawing_PenSetFilter()
11724
11725```
11726void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter*  )
11727```
11728
11729**Description**
11730
11731Sets a filter for a pen.
11732
11733Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11734
11735If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11736
11737If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11738
11739**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11740
11741**Since**: 11
11742
11743**Parameters**
11744
11745| Name              | Description                                                  |
11746| ----------------- | ------------------------------------------------------------ |
11747| OH_Drawing_Pen    | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
11748| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. If NULL is passed in, the filter will be cleared. |
11749
11750
11751### OH_Drawing_PenSetJoin()
11752
11753```
11754void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle  )
11755```
11756
11757**Description**
11758
11759Sets the line join style for a pen.
11760
11761Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11762
11763If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11764
11765If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11766
11767If **OH_Drawing_PenLineJoinStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
11768
11769**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11770
11771**Since**: 8
11772
11773**Parameters**
11774
11775| Name                        | Description                              |
11776| --------------------------- | ---------------------------------------- |
11777| OH_Drawing_Pen              | Pointer to an **OH_Drawing_Pen** object. |
11778| OH_Drawing_PenLineJoinStyle | Line join style.                         |
11779
11780
11781### OH_Drawing_PenSetMiterLimit()
11782
11783```
11784void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter )
11785```
11786
11787**Description**
11788
11789Sets 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.
11790
11791Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11792
11793If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11794
11795If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11796
11797**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11798
11799**Since**: 8
11800
11801**Parameters**
11802
11803| Name           | Description                              |
11804| -------------- | ---------------------------------------- |
11805| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11806| miter          | Stroke miter limit, which is a variable. |
11807
11808
11809### OH_Drawing_PenSetPathEffect()
11810
11811```
11812void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect*  )
11813```
11814
11815**Description**
11816
11817Sets the path effect for a pen.
11818
11819Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11820
11821If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11822
11823If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11824
11825**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11826
11827**Since**: 12
11828
11829**Parameters**
11830
11831| Name                  | Description                                                  |
11832| --------------------- | ------------------------------------------------------------ |
11833| OH_Drawing_Pen        | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
11834| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. If NULL is passed in, the path effect will be cleared. |
11835
11836
11837### OH_Drawing_PenSetShaderEffect()
11838
11839```
11840void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect*  )
11841```
11842
11843**Description**
11844
11845Sets the shader effect for a pen.
11846
11847Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11848
11849If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11850
11851If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11852
11853**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11854
11855**Since**: 11
11856
11857**Parameters**
11858
11859| Name                    | Description                                                  |
11860| ----------------------- | ------------------------------------------------------------ |
11861| OH_Drawing_Pen          | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.      |
11862| OH_Drawing_ShaderEffect | Pointer to an [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object. If NULL is passed in, the shader effect will be cleared. |
11863
11864
11865### OH_Drawing_PenSetWidth()
11866
11867```
11868void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width )
11869```
11870
11871**Description**
11872
11873Sets 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.
11874
11875Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11876
11877If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11878
11879If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11880
11881**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11882
11883**Since**: 8
11884
11885**Parameters**
11886
11887| Name           | Description                              |
11888| -------------- | ---------------------------------------- |
11889| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. |
11890| width          | Width, which is a variable.              |
11891
11892
11893### OH_Drawing_PointCreate()
11894
11895```
11896OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y )
11897```
11898
11899**Description**
11900
11901Creates an **OH_Drawing_Point** object.
11902
11903**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11904
11905**Since**: 11
11906
11907**Parameters**
11908
11909| Name | Description                |
11910| ---- | -------------------------- |
11911| x    | X coordinate of the point. |
11912| y    | Y coordinate of the point. |
11913
11914**Returns**
11915
11916Returns the pointer to the **OH_Drawing_Point** object created.
11917
11918
11919### OH_Drawing_PointDestroy()
11920
11921```
11922void OH_Drawing_PointDestroy (OH_Drawing_Point* )
11923```
11924
11925**Description**
11926
11927Destroys an **OH_Drawing_Point** object and reclaims the memory occupied by the object.
11928
11929**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11930
11931**Since**: 11
11932
11933**Parameters**
11934
11935| Name             | Description                                |
11936| ---------------- | ------------------------------------------ |
11937| OH_Drawing_Point | Pointer to an **OH_Drawing_Point** object. |
11938
11939
11940### OH_Drawing_RectCopy()
11941
11942```
11943void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect )
11944```
11945
11946**Description**
11947
11948Copies a source rectangle to create a new one.
11949
11950Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
11951
11952If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
11953
11954If either **sRect** or **dRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
11955
11956**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11957
11958**Since**: 12
11959
11960**Parameters**
11961
11962| Name  | Description                                                  |
11963| ----- | ------------------------------------------------------------ |
11964| sRect | Pointer to a source rectangle, which is an **OH_Drawing_Rect** object. |
11965| dRect | Pointer to a destination rectangle, which is an **OH_Drawing_Rect** object. |
11966
11967
11968### OH_Drawing_RectCreate()
11969
11970```
11971OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom )
11972```
11973
11974**Description**
11975
11976Creates 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.
11977
11978**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
11979
11980**Since**: 11
11981
11982**Parameters**
11983
11984| Name   | Description                                              |
11985| ------ | -------------------------------------------------------- |
11986| left   | X coordinate of the upper left corner of the rectangle.  |
11987| top    | Y coordinate of the upper left corner of the rectangle.  |
11988| right  | X coordinate of the lower right corner of the rectangle. |
11989| bottom | Y coordinate of the lower right corner of the rectangle. |
11990
11991**Returns**
11992
11993Returns the pointer to the **OH_Drawing_Rect** object created.
11994
11995
11996### OH_Drawing_RectDestroy()
11997
11998```
11999void OH_Drawing_RectDestroy (OH_Drawing_Rect* )
12000```
12001
12002**Description**
12003
12004Destroys an **OH_Drawing_Rect** object and reclaims the memory occupied by the object.
12005
12006**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12007
12008**Since**: 11
12009
12010**Parameters**
12011
12012| Name            | Description                               |
12013| --------------- | ----------------------------------------- |
12014| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12015
12016
12017### OH_Drawing_RectGetBottom()
12018
12019```
12020float OH_Drawing_RectGetBottom (OH_Drawing_Rect* )
12021```
12022
12023**Description**
12024
12025Obtains the Y coordinate of the lower right corner of a rectangle.
12026
12027Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12028
12029If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12030
12031If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12032
12033**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12034
12035**Since**: 12
12036
12037**Parameters**
12038
12039| Name            | Description                               |
12040| --------------- | ----------------------------------------- |
12041| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12042
12043**Returns**
12044
12045Returns the Y coordinate of the lower right corner of the rectangle.
12046
12047
12048### OH_Drawing_RectGetHeight()
12049
12050```
12051float OH_Drawing_RectGetHeight (OH_Drawing_Rect* )
12052```
12053
12054**Description**
12055
12056Obtains 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.
12057
12058Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12059
12060If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12061
12062If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12063
12064**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12065
12066**Since**: 12
12067
12068**Parameters**
12069
12070| Name            | Description                               |
12071| --------------- | ----------------------------------------- |
12072| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12073
12074**Returns**
12075
12076Returns the height.
12077
12078
12079### OH_Drawing_RectGetLeft()
12080
12081```
12082float OH_Drawing_RectGetLeft (OH_Drawing_Rect* )
12083```
12084
12085**Description**
12086
12087Obtains the X coordinate of the upper left corner of a rectangle.
12088
12089Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12090
12091If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12092
12093If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12094
12095**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12096
12097**Since**: 12
12098
12099**Parameters**
12100
12101| Name            | Description                               |
12102| --------------- | ----------------------------------------- |
12103| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12104
12105**Returns**
12106
12107Returns the X coordinate of the upper left corner of the rectangle.
12108
12109
12110### OH_Drawing_RectGetRight()
12111
12112```
12113float OH_Drawing_RectGetRight (OH_Drawing_Rect* )
12114```
12115
12116**Description**
12117
12118Obtains the X coordinate of the lower right corner of a rectangle.
12119
12120Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12121
12122If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12123
12124If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12125
12126**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12127
12128**Since**: 12
12129
12130**Parameters**
12131
12132| Name            | Description                               |
12133| --------------- | ----------------------------------------- |
12134| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12135
12136**Returns**
12137
12138Returns the X coordinate of the lower right corner of the rectangle.
12139
12140
12141### OH_Drawing_RectGetTop()
12142
12143```
12144float OH_Drawing_RectGetTop (OH_Drawing_Rect* )
12145```
12146
12147**Description**
12148
12149Obtains the Y coordinate of the upper left corner of a rectangle.
12150
12151Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12152
12153If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12154
12155If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12156
12157**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12158
12159**Since**: 12
12160
12161**Parameters**
12162
12163| Name            | Description                               |
12164| --------------- | ----------------------------------------- |
12165| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12166
12167**Returns**
12168
12169Returns the Y coordinate of the upper left corner of the rectangle.
12170
12171
12172### OH_Drawing_RectGetWidth()
12173
12174```
12175float OH_Drawing_RectGetWidth (OH_Drawing_Rect* )
12176```
12177
12178**Description**
12179
12180Obtains 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.
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 the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12185
12186If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12187
12188**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12189
12190**Since**: 12
12191
12192**Parameters**
12193
12194| Name            | Description                               |
12195| --------------- | ----------------------------------------- |
12196| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. |
12197
12198**Returns**
12199
12200Returns the width.
12201
12202
12203### OH_Drawing_RectIntersect()
12204
12205```
12206bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other )
12207```
12208
12209**Description**
12210
12211Checks whether two rectangles intersect and if yes, sets **rect** to the area of intersection.
12212
12213Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12214
12215If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12216
12217If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12218
12219**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12220
12221**Since**: 12
12222
12223**Parameters**
12224
12225| Name  | Description                                                  |
12226| ----- | ------------------------------------------------------------ |
12227| rect  | Pointer to the first rectangle, which is an **OH_Drawing_Rect** object. |
12228| other | Pointer to the second rectangle, which is an **OH_Drawing_Rect** object. |
12229
12230**Returns**
12231
12232Returns **true** if they intersect (**rect** is set to the intersection area); returns **false** otherwise (**rect** remains unchanged).
12233
12234
12235### OH_Drawing_RectSetBottom()
12236
12237```
12238void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom )
12239```
12240
12241**Description**
12242
12243Sets the vertical coordinate of the lower right corner of a rectangle.
12244
12245Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12246
12247If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12248
12249If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12250
12251**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12252
12253**Since**: 12
12254
12255**Parameters**
12256
12257| Name   | Description                                              |
12258| ------ | -------------------------------------------------------- |
12259| rect   | Pointer to an **OH_Drawing_Rect** object.                |
12260| bottom | Y coordinate of the lower right corner of the rectangle. |
12261
12262
12263### OH_Drawing_RectSetLeft()
12264
12265```
12266void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left )
12267```
12268
12269**Description**
12270
12271Sets the horizontal coordinate of the upper left corner of a rectangle.
12272
12273Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12274
12275If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12276
12277If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12278
12279**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12280
12281**Since**: 12
12282
12283**Parameters**
12284
12285| Name | Description                                             |
12286| ---- | ------------------------------------------------------- |
12287| rect | Pointer to an **OH_Drawing_Rect** object.               |
12288| left | X coordinate of the upper left corner of the rectangle. |
12289
12290
12291### OH_Drawing_RectSetRight()
12292
12293```
12294void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right )
12295```
12296
12297**Description**
12298
12299Sets the horizontal coordinate of the lower right corner of a rectangle.
12300
12301Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12302
12303If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12304
12305If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12306
12307**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12308
12309**Since**: 12
12310
12311**Parameters**
12312
12313| Name  | Description                                              |
12314| ----- | -------------------------------------------------------- |
12315| rect  | Pointer to an **OH_Drawing_Rect** object.                |
12316| right | X coordinate of the lower right corner of the rectangle. |
12317
12318
12319### OH_Drawing_RectSetTop()
12320
12321```
12322void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top )
12323```
12324
12325**Description**
12326
12327Sets the vertical coordinate of the upper left corner of a rectangle.
12328
12329Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12330
12331If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12332
12333If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12334
12335**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12336
12337**Since**: 12
12338
12339**Parameters**
12340
12341| Name | Description                                             |
12342| ---- | ------------------------------------------------------- |
12343| rect | Pointer to an **OH_Drawing_Rect** object.               |
12344| top  | Y coordinate of the upper left corner of the rectangle. |
12345
12346
12347### OH_Drawing_RegionCreate()
12348
12349```
12350OH_Drawing_Region* OH_Drawing_RegionCreate (void )
12351```
12352
12353**Description**
12354
12355Creates an **OH_Drawing_Region** object for more accurate graphical control.
12356
12357**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12358
12359**Since**: 12
12360
12361**Returns**
12362
12363Returns the pointer to the **OH_Drawing_Region** object created.
12364
12365
12366### OH_Drawing_RegionDestroy()
12367
12368```
12369void OH_Drawing_RegionDestroy (OH_Drawing_Region* )
12370```
12371
12372**Description**
12373
12374Destroys an **OH_Drawing_Region** object and reclaims the memory occupied by the object.
12375
12376**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12377
12378**Since**: 12
12379
12380**Parameters**
12381
12382| Name              | Description                                 |
12383| ----------------- | ------------------------------------------- |
12384| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. |
12385
12386
12387### OH_Drawing_RegionSetRect()
12388
12389```
12390bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect )
12391```
12392
12393**Description**
12394
12395Sets the boundary for an **OH_Drawing_Region** object.
12396
12397Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12398
12399If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12400
12401If either **region** or **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12402
12403**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12404
12405**Since**: 12
12406
12407**Parameters**
12408
12409| Name   | Description                                 |
12410| ------ | ------------------------------------------- |
12411| region | Pointer to an **OH_Drawing_Region** object. |
12412| rect   | Pointer to an **OH_Drawing_Rect** object.   |
12413
12414**Returns**
12415
12416Returns **true** if the setting is successful; returns **false** otherwise.
12417
12418
12419### OH_Drawing_RegisterFont()
12420
12421```
12422uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc )
12423```
12424
12425**Description**
12426
12427Registers a custom font with the font manager. The supported font file formats are .ttf and .otf.
12428
12429**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12430
12431**Since**: 11
12432
12433**Parameters**
12434
12435| Name                      | Description                                         |
12436| ------------------------- | --------------------------------------------------- |
12437| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
12438| fontFamily                | Pointer to the family name of the font to register. |
12439| familySrc                 | Pointer to the path of the font file.               |
12440
12441**Returns**
12442
12443Returns **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.
12444
12445
12446### OH_Drawing_RegisterFontBuffer()
12447
12448```
12449uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length )
12450```
12451
12452**Description**
12453
12454Registers a font buffer with the font manager.
12455
12456**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12457
12458**Since**: 11
12459
12460**Parameters**
12461
12462| Name                      | Description                                         |
12463| ------------------------- | --------------------------------------------------- |
12464| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. |
12465| fontFamily                | Pointer to the family name of the font to register. |
12466| fontBuffer                | Pointer to the buffer of the font file.             |
12467| length                    | Length of the font file.                            |
12468
12469**Returns**
12470
12471Returns **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.
12472
12473
12474### OH_Drawing_RoundRectCreate()
12475
12476```
12477OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad )
12478```
12479
12480**Description**
12481
12482Creates an **OH_Drawing_RoundRect** object.
12483
12484Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12485
12486If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12487
12488If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12489
12490**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12491
12492**Since**: 11
12493
12494**Parameters**
12495
12496| Name            | Description                                 |
12497| --------------- | ------------------------------------------- |
12498| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object.   |
12499| xRad            | Radius of the rounded corner on the X axis. |
12500| yRad            | Radius of the rounded corner on the Y axis. |
12501
12502**Returns**
12503
12504Returns the pointer to the **OH_Drawing_RoundRect** object created.
12505
12506
12507### OH_Drawing_RoundRectDestroy()
12508
12509```
12510void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* )
12511```
12512
12513**Description**
12514
12515Destroys an **OH_Drawing_RoundRect** object and reclaims the memory occupied by the object.
12516
12517**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12518
12519**Since**: 11
12520
12521**Parameters**
12522
12523| Name                 | Description                                    |
12524| -------------------- | ---------------------------------------------- |
12525| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. |
12526
12527
12528### OH_Drawing_RoundRectGetCorner()
12529
12530```
12531OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos )
12532```
12533
12534**Description**
12535
12536Obtains the radii of the specified rounded corner in a rounded rectangle.
12537
12538Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12539
12540If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12541
12542If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12543
12544**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12545
12546**Since**: 12
12547
12548**Parameters**
12549
12550| Name                 | Description                                                  |
12551| -------------------- | ------------------------------------------------------------ |
12552| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object.               |
12553| pos                  | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). |
12554
12555**Returns**
12556
12557Returns an [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis.
12558
12559
12560### OH_Drawing_RoundRectSetCorner()
12561
12562```
12563void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii  )
12564```
12565
12566**Description**
12567
12568Sets the radii of the specified rounded corner in a rounded rectangle.
12569
12570Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12571
12572If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12573
12574If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
12575
12576**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12577
12578**Since**: 12
12579
12580**Parameters**
12581
12582| Name                    | Description                                                  |
12583| ----------------------- | ------------------------------------------------------------ |
12584| OH_Drawing_RoundRect    | Pointer to an **OH_Drawing_RoundRect** object.               |
12585| pos                     | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). |
12586| OH_Drawing_Corner_Radii | [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis. |
12587
12588
12589### OH_Drawing_SamplingOptionsCreate()
12590
12591```
12592OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode  )
12593```
12594
12595**Description**
12596
12597Creates an **OH_Drawing_SamplingOptions** object.
12598
12599Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
12600
12601If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
12602
12603If **OH_Drawing_MipmapMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
12604
12605**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12606
12607**Since**: 12
12608
12609**Parameters**
12610
12611| Name                  | Description                                                  |
12612| --------------------- | ------------------------------------------------------------ |
12613| OH_Drawing_FilterMode | Filter mode. For details about the available options, see [OH_Drawing_FilterMode](#oh_drawing_filtermode). |
12614| OH_Drawing_MipmapMode | Mipmap mode. For details about the available options, see [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode). |
12615
12616**Returns**
12617
12618Returns the pointer to the [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object created.
12619
12620
12621### OH_Drawing_SamplingOptionsDestroy()
12622
12623```
12624void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* )
12625```
12626
12627**Description**
12628
12629Destroys an **OH_Drawing_SamplingOptions** object and reclaims the memory occupied by the object.
12630
12631**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12632
12633**Since**: 12
12634
12635**Parameters**
12636
12637| Name                       | Description                                                  |
12638| -------------------------- | ------------------------------------------------------------ |
12639| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. |
12640
12641
12642### OH_Drawing_SetTextStyleBackgroundBrush()
12643
12644```
12645void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
12646```
12647
12648**Description**
12649
12650Sets the background brush for a text style.
12651
12652**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12653
12654**Since**: 12
12655
12656**Parameters**
12657
12658| Name                 | Description                                                  |
12659| -------------------- | ------------------------------------------------------------ |
12660| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12661| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
12662
12663
12664### OH_Drawing_SetTextStyleBackgroundPen()
12665
12666```
12667void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
12668```
12669
12670**Description**
12671
12672Sets the background pen for a text style.
12673
12674**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12675
12676**Since**: 12
12677
12678**Parameters**
12679
12680| Name                 | Description                                                  |
12681| -------------------- | ------------------------------------------------------------ |
12682| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12683| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
12684
12685
12686### OH_Drawing_SetTextStyleBaseLine()
12687
12688```
12689void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int  )
12690```
12691
12692**Description**
12693
12694Sets the baseline for a text style.
12695
12696**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12697
12698**Since**: 8
12699
12700**Parameters**
12701
12702| Name                 | Description                                                  |
12703| -------------------- | ------------------------------------------------------------ |
12704| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12705| int                  | Text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline). |
12706
12707
12708### OH_Drawing_SetTextStyleColor()
12709
12710```
12711void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t  )
12712```
12713
12714**Description**
12715
12716Sets the color for a text style.
12717
12718**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12719
12720**Since**: 8
12721
12722**Parameters**
12723
12724| Name                 | Description                                                  |
12725| -------------------- | ------------------------------------------------------------ |
12726| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12727| uint32_t             | Color.                                                       |
12728
12729
12730### OH_Drawing_SetTextStyleDecoration()
12731
12732```
12733void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int  )
12734```
12735
12736**Description**
12737
12738Sets the decoration for a text style.
12739
12740**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12741
12742**Since**: 8
12743
12744**Parameters**
12745
12746| Name                 | Description                                                  |
12747| -------------------- | ------------------------------------------------------------ |
12748| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12749| int                  | Text decoration. For details about the available options, see [OH_Drawing_TextDecoration](#oh_drawing_textdecoration). |
12750
12751
12752### OH_Drawing_SetTextStyleDecorationColor()
12753
12754```
12755void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t  )
12756```
12757
12758**Description**
12759
12760Sets the decoration color for a text style.
12761
12762**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12763
12764**Since**: 8
12765
12766**Parameters**
12767
12768| Name                 | Description                                                  |
12769| -------------------- | ------------------------------------------------------------ |
12770| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12771| uint32_t             | Color.                                                       |
12772
12773
12774### OH_Drawing_SetTextStyleDecorationStyle()
12775
12776```
12777void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int  )
12778```
12779
12780**Description**
12781
12782Sets the decoration style for a text style.
12783
12784**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12785
12786**Since**: 11
12787
12788**Parameters**
12789
12790| Name                 | Description                                                  |
12791| -------------------- | ------------------------------------------------------------ |
12792| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12793| int                  | Text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle). |
12794
12795
12796### OH_Drawing_SetTextStyleDecorationThicknessScale()
12797
12798```
12799void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double  )
12800```
12801
12802**Description**
12803
12804Sets the thickness scale factor for the decoration style of a text style.
12805
12806**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12807
12808**Since**: 11
12809
12810**Parameters**
12811
12812| Name                 | Description                                                  |
12813| -------------------- | ------------------------------------------------------------ |
12814| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12815| double               | Scale factor.                                                |
12816
12817
12818### OH_Drawing_SetTextStyleEllipsis()
12819
12820```
12821void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char*  )
12822```
12823
12824**Description**
12825
12826Sets the ellipsis content for a text style.
12827
12828**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12829
12830**Since**: 11
12831
12832**Parameters**
12833
12834| Name                 | Description                                                  |
12835| -------------------- | ------------------------------------------------------------ |
12836| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12837| char\*               | Pointer to the ellipsis content. The data type is a pointer pointing to char. |
12838
12839
12840### OH_Drawing_SetTextStyleEllipsisModal()
12841
12842```
12843void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int  )
12844```
12845
12846**Description**
12847
12848Sets the ellipsis style for a text style.
12849
12850**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12851
12852**Since**: 11
12853
12854**Parameters**
12855
12856| Name                 | Description                                                  |
12857| -------------------- | ------------------------------------------------------------ |
12858| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12859| int                  | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). |
12860
12861
12862### OH_Drawing_SetTextStyleFontFamilies()
12863
12864```
12865void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] )
12866```
12867
12868**Description**
12869
12870Sets the font families for a text style.
12871
12872**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12873
12874**Since**: 8
12875
12876**Parameters**
12877
12878| Name                 | Description                                                  |
12879| -------------------- | ------------------------------------------------------------ |
12880| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12881| int                  | Number of font families.                                     |
12882| char                 | Pointer to the font families.                                |
12883
12884
12885### OH_Drawing_SetTextStyleFontHeight()
12886
12887```
12888void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double  )
12889```
12890
12891**Description**
12892
12893Sets the line height based on the multiple of the font size.
12894
12895**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12896
12897**Since**: 8
12898
12899**Parameters**
12900
12901| Name                 | Description                                                  |
12902| -------------------- | ------------------------------------------------------------ |
12903| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12904| double               | Multiple of the font size.                                   |
12905
12906
12907### OH_Drawing_SetTextStyleFontSize()
12908
12909```
12910void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double  )
12911```
12912
12913**Description**
12914
12915Sets the font size for a text style.
12916
12917**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12918
12919**Since**: 8
12920
12921**Parameters**
12922
12923| Name                 | Description                                                  |
12924| -------------------- | ------------------------------------------------------------ |
12925| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12926| double               | Font size.                                                   |
12927
12928
12929### OH_Drawing_SetTextStyleFontStyle()
12930
12931```
12932void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int  )
12933```
12934
12935**Description**
12936
12937Sets the font style for a text style.
12938
12939**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12940
12941**Since**: 8
12942
12943**Parameters**
12944
12945| Name                 | Description                                                  |
12946| -------------------- | ------------------------------------------------------------ |
12947| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12948| int                  | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
12949
12950
12951### OH_Drawing_SetTextStyleFontStyleStruct()
12952
12953```
12954void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle )
12955```
12956
12957**Description**
12958
12959Sets the font style, including the font weight, width, and slant, for a text style.
12960
12961**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12962
12963**Since**: 12
12964
12965**Parameters**
12966
12967| Name                                                         | Description                                                  |
12968| ------------------------------------------------------------ | ------------------------------------------------------------ |
12969| OH_Drawing_TextStyle                                         | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12970| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
12971
12972
12973### OH_Drawing_SetTextStyleFontWeight()
12974
12975```
12976void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int  )
12977```
12978
12979**Description**
12980
12981Sets the font weight for a text style.
12982
12983**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
12984
12985**Since**: 8
12986
12987**Parameters**
12988
12989| Name                 | Description                                                  |
12990| -------------------- | ------------------------------------------------------------ |
12991| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
12992| int                  | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
12993
12994
12995### OH_Drawing_SetTextStyleForegroundBrush()
12996
12997```
12998void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
12999```
13000
13001**Description**
13002
13003Sets the foreground brush for a text style.
13004
13005**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13006
13007**Since**: 12
13008
13009**Parameters**
13010
13011| Name                 | Description                                                  |
13012| -------------------- | ------------------------------------------------------------ |
13013| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13014| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
13015
13016
13017### OH_Drawing_SetTextStyleForegroundPen()
13018
13019```
13020void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
13021```
13022
13023**Description**
13024
13025Sets the foreground pen for a text style.
13026
13027**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13028
13029**Since**: 12
13030
13031**Parameters**
13032
13033| Name                 | Description                                                  |
13034| -------------------- | ------------------------------------------------------------ |
13035| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13036| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
13037
13038
13039### OH_Drawing_SetTextStyleHalfLeading()
13040
13041```
13042void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool  )
13043```
13044
13045**Description**
13046
13047Sets whether to enable half leading for a text style.
13048
13049**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13050
13051**Since**: 11
13052
13053**Parameters**
13054
13055| Name                 | Description                                                  |
13056| -------------------- | ------------------------------------------------------------ |
13057| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13058| bool                 | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
13059
13060
13061### OH_Drawing_SetTextStyleLetterSpacing()
13062
13063```
13064void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double  )
13065```
13066
13067**Description**
13068
13069Sets the letter spacing for a text style.
13070
13071**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13072
13073**Since**: 11
13074
13075**Parameters**
13076
13077| Name                 | Description                                                  |
13078| -------------------- | ------------------------------------------------------------ |
13079| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13080| double               | Letter spacing.                                              |
13081
13082
13083### OH_Drawing_SetTextStyleLocale()
13084
13085```
13086void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char*  )
13087```
13088
13089**Description**
13090
13091Sets the locale for a text style.
13092
13093**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13094
13095**Since**: 8
13096
13097**Parameters**
13098
13099| Name                 | Description                                                  |
13100| -------------------- | ------------------------------------------------------------ |
13101| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13102| char                 | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. |
13103
13104
13105### OH_Drawing_SetTextStyleWordSpacing()
13106
13107```
13108void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double  )
13109```
13110
13111**Description**
13112
13113Sets the word spacing for a text style.
13114
13115**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13116
13117**Since**: 11
13118
13119**Parameters**
13120
13121| Name                 | Description                                                  |
13122| -------------------- | ------------------------------------------------------------ |
13123| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13124| double               | Letter spacing.                                              |
13125
13126
13127### OH_Drawing_SetTypographyStyleFontStyleStruct()
13128
13129```
13130void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle )
13131```
13132
13133**Description**
13134
13135Sets the font style, including the font weight, width, and slant, for a typography style.
13136
13137**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13138
13139**Since**: 12
13140
13141**Parameters**
13142
13143| Name                                                         | Description                                                  |
13144| ------------------------------------------------------------ | ------------------------------------------------------------ |
13145| OH_Drawing_TypographyStyle                                   | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13146| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant.     |
13147
13148
13149### OH_Drawing_SetTypographyStyleTextStrutStyle()
13150
13151```
13152void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle*  )
13153```
13154
13155**Description**
13156
13157Sets the strut style for a typography style.
13158
13159**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13160
13161**Since**: 12
13162
13163**Parameters**
13164
13165| Name                                                     | Description                                                  |
13166| -------------------------------------------------------- | ------------------------------------------------------------ |
13167| OH_Drawing_TypographyStyle                               | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13168| [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). |
13169
13170
13171### OH_Drawing_SetTypographyTextAlign()
13172
13173```
13174void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int  )
13175```
13176
13177**Description**
13178
13179Sets the text alignment mode.
13180
13181**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13182
13183**Since**: 8
13184
13185**Parameters**
13186
13187| Name                       | Description                                                  |
13188| -------------------------- | ------------------------------------------------------------ |
13189| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13190| int                        | Text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign). |
13191
13192
13193### OH_Drawing_SetTypographyTextBreakStrategy()
13194
13195```
13196void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int  )
13197```
13198
13199**Description**
13200
13201Sets the text break strategy.
13202
13203**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13204
13205**Since**: 11
13206
13207**Parameters**
13208
13209| Name                       | Description                                                  |
13210| -------------------------- | ------------------------------------------------------------ |
13211| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13212| int                        | Text break strategy. For details about the available options, see [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy). |
13213
13214
13215### OH_Drawing_SetTypographyTextDirection()
13216
13217```
13218void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int  )
13219```
13220
13221**Description**
13222
13223Sets the text direction.
13224
13225**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13226
13227**Since**: 8
13228
13229**Parameters**
13230
13231| Name                       | Description                                                  |
13232| -------------------------- | ------------------------------------------------------------ |
13233| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13234| int                        | Text direction. For details about the available options, see [OH_Drawing_TextDirection](#oh_drawing_textdirection). |
13235
13236
13237### OH_Drawing_SetTypographyTextEllipsis()
13238
13239```
13240void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis )
13241```
13242
13243**Description**
13244
13245Sets the text ellipsis content.
13246
13247**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13248
13249**Since**: 12
13250
13251**Parameters**
13252
13253| Name                       | Description                                                  |
13254| -------------------------- | ------------------------------------------------------------ |
13255| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13256| char                       | Pinter to the ellipsis content.                              |
13257
13258
13259### OH_Drawing_SetTypographyTextEllipsisModal()
13260
13261```
13262void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int  )
13263```
13264
13265**Description**
13266
13267Sets the text ellipsis style.
13268
13269**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13270
13271**Since**: 11
13272
13273**Parameters**
13274
13275| Name                       | Description                                                  |
13276| -------------------------- | ------------------------------------------------------------ |
13277| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13278| int                        | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). |
13279
13280
13281### OH_Drawing_SetTypographyTextFontFamily()
13282
13283```
13284void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char*  )
13285```
13286
13287**Description**
13288
13289Sets the font family name for text.
13290
13291**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13292
13293**Since**: 12
13294
13295**Parameters**
13296
13297| Name                       | Description                                                  |
13298| -------------------------- | ------------------------------------------------------------ |
13299| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13300| char                       | Pointer to the name of the font family.                      |
13301
13302
13303### OH_Drawing_SetTypographyTextFontHeight()
13304
13305```
13306void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double  )
13307```
13308
13309**Description**
13310
13311Sets the font height for text.
13312
13313**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13314
13315**Since**: 12
13316
13317**Parameters**
13318
13319| Name                       | Description                                                  |
13320| -------------------------- | ------------------------------------------------------------ |
13321| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13322| double                     | Font height.                                                 |
13323
13324
13325### OH_Drawing_SetTypographyTextFontSize()
13326
13327```
13328void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double  )
13329```
13330
13331**Description**
13332
13333Sets the font size for text.
13334
13335**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13336
13337**Since**: 12
13338
13339**Parameters**
13340
13341| Name                       | Description                                                  |
13342| -------------------------- | ------------------------------------------------------------ |
13343| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13344| double                     | Font size, which must be greater than 0.                     |
13345
13346
13347### OH_Drawing_SetTypographyTextFontStyle()
13348
13349```
13350void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int  )
13351```
13352
13353**Description**
13354
13355Sets the font style for text.
13356
13357**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13358
13359**Since**: 12
13360
13361**Parameters**
13362
13363| Name                       | Description                                                  |
13364| -------------------------- | ------------------------------------------------------------ |
13365| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13366| int                        | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
13367
13368
13369### OH_Drawing_SetTypographyTextFontWeight()
13370
13371```
13372void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int  )
13373```
13374
13375**Description**
13376
13377Sets the font weight for text.
13378
13379**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13380
13381**Since**: 12
13382
13383**Parameters**
13384
13385| Name                       | Description                                                  |
13386| -------------------------- | ------------------------------------------------------------ |
13387| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13388| int                        | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
13389
13390
13391### OH_Drawing_SetTypographyTextHalfLeading()
13392
13393```
13394void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool  )
13395```
13396
13397**Description**
13398
13399Sets whether to enable half leading for text.
13400
13401**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13402
13403**Since**: 12
13404
13405**Parameters**
13406
13407| Name                       | Description                                                  |
13408| -------------------------- | ------------------------------------------------------------ |
13409| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13410| bool                       | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
13411
13412
13413### OH_Drawing_SetTypographyTextLineStyleFontFamilies()
13414
13415```
13416void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] )
13417```
13418
13419**Description**
13420
13421Sets the font families for a text line style.
13422
13423**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13424
13425**Since**: 12
13426
13427**Parameters**
13428
13429| Name                       | Description                                                  |
13430| -------------------------- | ------------------------------------------------------------ |
13431| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13432| int                        | Number of font families.                                     |
13433| char                       | Pointer to the font families.                                |
13434
13435
13436### OH_Drawing_SetTypographyTextLineStyleFontHeight()
13437
13438```
13439void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double  )
13440```
13441
13442**Description**
13443
13444Sets the font height for a text line style.
13445
13446**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13447
13448**Since**: 12
13449
13450**Parameters**
13451
13452| Name                       | Description                                                  |
13453| -------------------------- | ------------------------------------------------------------ |
13454| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13455| double                     | Font height.                                                 |
13456
13457
13458### OH_Drawing_SetTypographyTextLineStyleFontSize()
13459
13460```
13461void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double  )
13462```
13463
13464**Description**
13465
13466Sets the font size for a text line style.
13467
13468**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13469
13470**Since**: 12
13471
13472**Parameters**
13473
13474| Name                       | Description                                                  |
13475| -------------------------- | ------------------------------------------------------------ |
13476| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13477| double                     | Font size, which must be greater than 0.                     |
13478
13479
13480### OH_Drawing_SetTypographyTextLineStyleFontStyle()
13481
13482```
13483void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int  )
13484```
13485
13486**Description**
13487
13488Sets the font style for a text line style.
13489
13490**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13491
13492**Since**: 12
13493
13494**Parameters**
13495
13496| Name                       | Description                                                  |
13497| -------------------------- | ------------------------------------------------------------ |
13498| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13499| int                        | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). |
13500
13501
13502### OH_Drawing_SetTypographyTextLineStyleFontWeight()
13503
13504```
13505void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int  )
13506```
13507
13508**Description**
13509
13510Sets the font weight for a text line style.
13511
13512**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13513
13514**Since**: 12
13515
13516**Parameters**
13517
13518| Name                       | Description                                                  |
13519| -------------------------- | ------------------------------------------------------------ |
13520| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13521| int                        | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). |
13522
13523
13524### OH_Drawing_SetTypographyTextLineStyleHalfLeading()
13525
13526```
13527void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool  )
13528```
13529
13530**Description**
13531
13532Sets whether to enable half leading for a text line style.
13533
13534**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13535
13536**Since**: 12
13537
13538**Parameters**
13539
13540| Name                       | Description                                                  |
13541| -------------------------- | ------------------------------------------------------------ |
13542| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13543| bool                       | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. |
13544
13545
13546### OH_Drawing_SetTypographyTextLineStyleOnly()
13547
13548```
13549void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool  )
13550```
13551
13552**Description**
13553
13554Sets whether to enable the text line style only.
13555
13556**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13557
13558**Since**: 12
13559
13560**Parameters**
13561
13562| Name                       | Description                                                  |
13563| -------------------------- | ------------------------------------------------------------ |
13564| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13565| 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. |
13566
13567
13568### OH_Drawing_SetTypographyTextLineStyleSpacingScale()
13569
13570```
13571void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double  )
13572```
13573
13574**Description**
13575
13576Sets the spacing scale factor for a text line style.
13577
13578**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13579
13580**Since**: 12
13581
13582**Parameters**
13583
13584| Name                       | Description                                                  |
13585| -------------------------- | ------------------------------------------------------------ |
13586| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13587| double                     | Spacing ratio.                                               |
13588
13589
13590### OH_Drawing_SetTypographyTextLocale()
13591
13592```
13593void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale )
13594```
13595
13596**Description**
13597
13598Sets the locale for text.
13599
13600**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13601
13602**Since**: 12
13603
13604**Parameters**
13605
13606| Name                       | Description                                                  |
13607| -------------------------- | ------------------------------------------------------------ |
13608| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13609| char                       | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. |
13610
13611
13612### OH_Drawing_SetTypographyTextMaxLines()
13613
13614```
13615void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int  )
13616```
13617
13618**Description**
13619
13620Sets the maximum number of lines in the text.
13621
13622**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13623
13624**Since**: 8
13625
13626**Parameters**
13627
13628| Name                       | Description                                                  |
13629| -------------------------- | ------------------------------------------------------------ |
13630| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13631| int                        | Maximum number of lines.                                     |
13632
13633### OH_Drawing_SetTypographyTextSplitRatio()
13634
13635```
13636void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio )
13637```
13638
13639**Description**
13640
13641Sets the text split ratio.
13642
13643**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13644
13645**Since**: 12
13646
13647**Parameters**
13648
13649| Name                       | Description                                                  |
13650| -------------------------- | ------------------------------------------------------------ |
13651| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13652| float                      | Text split ratio.                                            |
13653
13654
13655### OH_Drawing_SetTypographyTextStyle()
13656
13657```
13658void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle*  )
13659```
13660
13661**Description**
13662
13663Sets a text style.
13664
13665**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13666
13667**Since**: 12
13668
13669**Parameters**
13670
13671| Name                       | Description                                                  |
13672| -------------------------- | ------------------------------------------------------------ |
13673| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13674| OH_Drawing_TextStyle       | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
13675
13676
13677### OH_Drawing_SetTypographyTextUseLineStyle()
13678
13679```
13680void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool  )
13681```
13682
13683**Description**
13684
13685Sets whether to enable the text line style.
13686
13687**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13688
13689**Since**: 12
13690
13691**Parameters**
13692
13693| Name                       | Description                                                  |
13694| -------------------------- | ------------------------------------------------------------ |
13695| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13696| bool                       | Whether to enable the text line style. The value **true** means to enable the text line style, and **false** means the opposite. |
13697
13698
13699### OH_Drawing_SetTypographyTextWordBreakType()
13700
13701```
13702void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int  )
13703```
13704
13705**Description**
13706
13707Sets the word break type.
13708
13709**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13710
13711**Since**: 11
13712
13713**Parameters**
13714
13715| Name                       | Description                                                  |
13716| -------------------------- | ------------------------------------------------------------ |
13717| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
13718| int                        | Word break type. For details about the available options, see [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype). |
13719
13720
13721### OH_Drawing_ShaderEffectCreateImageShader()
13722
13723```
13724OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix*  )
13725```
13726
13727**Description**
13728
13729Creates 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.
13730
13731Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13732
13733If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13734
13735If either **OH_Drawing_Image** or **OH_Drawing_SamplingOptions** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13736
13737If either **tileX** or **tileY** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13738
13739**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13740
13741**Since**: 12
13742
13743**Parameters**
13744
13745| Name                       | Description                                                  |
13746| -------------------------- | ------------------------------------------------------------ |
13747| OH_Drawing_Image           | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object.  |
13748| 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). |
13749| 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). |
13750| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. |
13751| 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. |
13752
13753**Returns**
13754
13755Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
13756
13757
13758### OH_Drawing_ShaderEffectCreateLinearGradient()
13759
13760```
13761OH_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  )
13762```
13763
13764**Description**
13765
13766Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points.
13767
13768Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13769
13770If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13771
13772If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13773
13774If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13775
13776**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13777
13778**Since**: 11
13779
13780**Parameters**
13781
13782| Name                | Description                                                  |
13783| ------------------- | ------------------------------------------------------------ |
13784| startPt             | Start point.                                                 |
13785| endPt               | End point.                                                   |
13786| colors              | Colors to distribute.                                        |
13787| 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. |
13788| size                | Number of colors and positions (if **pos** is not NULL).     |
13789| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
13790
13791**Returns**
13792
13793Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
13794
13795
13796### OH_Drawing_ShaderEffectCreateRadialGradient()
13797
13798```
13799OH_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  )
13800```
13801
13802**Description**
13803
13804Creates 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.
13805
13806Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13807
13808If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13809
13810If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER**} is returned.
13811
13812If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13813
13814**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13815
13816**Since**: 11
13817
13818**Parameters**
13819
13820| Name                | Description                                                  |
13821| ------------------- | ------------------------------------------------------------ |
13822| centerPt            | Center of the circle.                                        |
13823| radius              | Radius of the circle.                                        |
13824| colors              | Colors to distribute in the radial direction.                |
13825| pos                 | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction. |
13826| size                | Number of colors and positions (if **pos** is not NULL).     |
13827| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
13828
13829**Returns**
13830
13831Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
13832
13833
13834### OH_Drawing_ShaderEffectCreateSweepGradient()
13835
13836```
13837OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode  )
13838```
13839
13840**Description**
13841
13842Creates 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°.
13843
13844Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13845
13846If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13847
13848If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER**} is returned.
13849
13850If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
13851
13852**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13853
13854**Since**: 11
13855
13856**Parameters**
13857
13858| Name                | Description                                                  |
13859| ------------------- | ------------------------------------------------------------ |
13860| centerPt            | Center of the circle.                                        |
13861| colors              | Colors to distribute.                                        |
13862| 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°). |
13863| size                | Number of colors and positions (if **pos** is not NULL).     |
13864| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). |
13865
13866**Returns**
13867
13868Returns the pointer to the **OH_Drawing_ShaderEffect** object created.
13869
13870
13871### OH_Drawing_ShaderEffectDestroy()
13872
13873```
13874void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* )
13875```
13876
13877**Description**
13878
13879Destroys an **OH_Drawing_ShaderEffect** object and reclaims the memory occupied by the object.
13880
13881**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13882
13883**Since**: 11
13884
13885**Parameters**
13886
13887| Name                    | Description                                       |
13888| ----------------------- | ------------------------------------------------- |
13889| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. |
13890
13891
13892### OH_Drawing_SurfaceCreateFromGpuContext()
13893
13894```
13895OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info  )
13896```
13897
13898**Description**
13899
13900Creates an **OH_Drawing_Surface** object using the GPU context to manage the content drawn on the canvas.
13901
13902Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13903
13904If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13905
13906If **OH_Drawing_GpuContext** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13907
13908**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13909
13910**Since**: 12
13911
13912**Parameters**
13913
13914| Name                                                      | Description                                                  |
13915| --------------------------------------------------------- | ------------------------------------------------------------ |
13916| OH_Drawing_GpuContext                                     | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. |
13917| 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. |
13918| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. |
13919
13920**Returns**
13921
13922Returns the pointer to the [OH_Drawing_Surface](#oh_drawing_surface) object created.
13923
13924
13925### OH_Drawing_SurfaceDestroy()
13926
13927```
13928void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* )
13929```
13930
13931**Description**
13932
13933Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied.
13934
13935**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13936
13937**Since**: 12
13938
13939**Parameters**
13940
13941| Name               | Description                                  |
13942| ------------------ | -------------------------------------------- |
13943| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. |
13944
13945
13946### OH_Drawing_SurfaceGetCanvas()
13947
13948```
13949OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* )
13950```
13951
13952**Description**
13953
13954Obtains a canvas from an **OH_Drawing_Surface** object.
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 the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13959
13960If **OH_Drawing_Surface** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
13961
13962**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13963
13964**Since**: 12
13965
13966**Parameters**
13967
13968| Name               | Description                                  |
13969| ------------------ | -------------------------------------------- |
13970| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. |
13971
13972**Returns**
13973
13974Returns the pointer to the [OH_Drawing_Canvas](#oh_drawing_canvas) object created. The pointer returned does not need to be managed by the caller.
13975
13976
13977### OH_Drawing_TextBlobBuilderAllocRunPos()
13978
13979```
13980const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect*  )
13981```
13982
13983**Description**
13984
13985Allocates 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.
13986
13987Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
13988
13989If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
13990
13991If 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.
13992
13993**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
13994
13995**Since**: 11
13996
13997**Parameters**
13998
13999| Name                       | Description                                                  |
14000| -------------------------- | ------------------------------------------------------------ |
14001| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object.         |
14002| OH_Drawing_Font            | Pointer to an **OH_Drawing_Font** object.                    |
14003| count                      | Number of text blobs.                                        |
14004| OH_Drawing_Rect            | Rectangle of the text blob. The value NULL means that no rectangle is set. |
14005
14006
14007### OH_Drawing_TextBlobBuilderCreate()
14008
14009```
14010OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void )
14011```
14012
14013**Description**
14014
14015Creates an **OH_Drawing_TextBlobBuilder** object.
14016
14017**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14018
14019**Since**: 11
14020
14021**Returns**
14022
14023Returns the pointer to the **OH_Drawing_TextBlobBuilder** object created.
14024
14025
14026### OH_Drawing_TextBlobBuilderDestroy()
14027
14028```
14029void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* )
14030```
14031
14032**Description**
14033
14034Destroys an **OH_Drawing_TextBlobBuilder** object and reclaims the memory occupied by the object.
14035
14036**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14037
14038**Since**: 11
14039
14040**Parameters**
14041
14042| Name                       | Description                                          |
14043| -------------------------- | ---------------------------------------------------- |
14044| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. |
14045
14046
14047### OH_Drawing_TextBlobBuilderMake()
14048
14049```
14050OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* )
14051```
14052
14053**Description**
14054
14055Makes an **OH_Drawing_TextBlob** object from an **OH_Drawing_TextBlobBuilder**.
14056
14057Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14058
14059If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
14060
14061If **OH_Drawing_TextBlobBuilder** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14062
14063**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14064
14065**Since**: 11
14066
14067**Parameters**
14068
14069| Name                       | Description                                          |
14070| -------------------------- | ---------------------------------------------------- |
14071| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. |
14072
14073**Returns**
14074
14075Returns the pointer to the **OH_Drawing_TextBlob** object created.
14076
14077
14078### OH_Drawing_TextBlobCreateFromPosText()
14079
14080```
14081OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
14082```
14083
14084**Description**
14085
14086Creates 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.
14087
14088Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14089
14090If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
14091
14092If any of **text**, **OH_Drawing_Point2D**, and **OH_Drawing_Font** is NULL or **byteLength** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14093
14094If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
14095
14096**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14097
14098**Since**: 12
14099
14100**Parameters**
14101
14102| Name                                               | Description                                                  |
14103| -------------------------------------------------- | ------------------------------------------------------------ |
14104| text                                               | Pointer to the text.                                         |
14105| byteLength                                         | Length of the text, in bytes.                                |
14106| [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). |
14107| OH_Drawing_Font                                    | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
14108| OH_Drawing_TextEncoding                            | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
14109
14110**Returns**
14111
14112Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
14113
14114
14115### OH_Drawing_TextBlobCreateFromString()
14116
14117```
14118OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
14119```
14120
14121**Description**
14122
14123Creates an **OH_Drawing_TextBlob** object from a string.
14124
14125Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14126
14127If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
14128
14129If either **str** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14130
14131If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
14132
14133**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14134
14135**Since**: 12
14136
14137**Parameters**
14138
14139| Name                    | Description                                                  |
14140| ----------------------- | ------------------------------------------------------------ |
14141| str                     | Pointer to a string.                                         |
14142| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
14143| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
14144
14145**Returns**
14146
14147Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
14148
14149
14150### OH_Drawing_TextBlobCreateFromText()
14151
14152```
14153OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding  )
14154```
14155
14156**Description**
14157
14158Creates an **OH_Drawing_TextBlob** object from the text.
14159
14160Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14161
14162If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
14163
14164If either **text** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14165
14166If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned.
14167
14168**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14169
14170**Since**: 12
14171
14172**Parameters**
14173
14174| Name                    | Description                                                  |
14175| ----------------------- | ------------------------------------------------------------ |
14176| text                    | Pointer to the text.                                         |
14177| byteLength              | Length of the text, in bytes.                                |
14178| OH_Drawing_Font         | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.    |
14179| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). |
14180
14181**Returns**
14182
14183Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created.
14184
14185
14186### OH_Drawing_TextBlobDestroy()
14187
14188```
14189void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* )
14190```
14191
14192**Description**
14193
14194Destroys an **OH_Drawing_TextBlob** object and reclaims the memory occupied by the object.
14195
14196**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14197
14198**Since**: 11
14199
14200**Parameters**
14201
14202| Name                | Description                                   |
14203| ------------------- | --------------------------------------------- |
14204| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object. |
14205
14206
14207### OH_Drawing_TextBlobGetBounds()
14208
14209```
14210void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect*  )
14211```
14212
14213**Description**
14214
14215Obtains the bounds of an **OH_Drawing_TextBlob** object.
14216
14217Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
14218
14219If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
14220
14221If either **OH_Drawing_TextBlob** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
14222
14223**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14224
14225**Since**: 12
14226
14227**Parameters**
14228
14229| Name                | Description                                                  |
14230| ------------------- | ------------------------------------------------------------ |
14231| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object. |
14232| OH_Drawing_Rect     | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). |
14233
14234
14235### OH_Drawing_TextStyleAddFontFeature()
14236
14237```
14238void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value )
14239```
14240
14241**Description**
14242
14243Adds a font feature for a text style.
14244
14245**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14246
14247**Since**: 12
14248
14249**Parameters**
14250
14251| Name                 | Description                                                  |
14252| -------------------- | ------------------------------------------------------------ |
14253| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14254| char                 | Pointer to the string identified by the keyword in the font feature key-value pair. |
14255| int                  | Value of the font feature key-value pair.                    |
14256
14257
14258### OH_Drawing_TextStyleAddFontVariation()
14259
14260```
14261void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* axis, int value )
14262```
14263
14264**Description**
14265
14266Adds 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.
14267
14268**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14269
14270**Since**: 12
14271
14272**Parameters**
14273
14274| Name                 | Description                                                  |
14275| -------------------- | ------------------------------------------------------------ |
14276| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14277| char                 | Pointer to the key in the font variation key-value pair. Currently, only **'wght'** is supported, indicating the font weight. |
14278| int                  | Value of the font variation key-value pair. Currently, the value range of **'wght'** for the default font is \[0,900\]. |
14279
14280
14281### OH_Drawing_TextStyleAddShadow()
14282
14283```
14284void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow*  )
14285```
14286
14287**Description**
14288
14289Adds a shadow to a text shadow container.
14290
14291**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14292
14293**Since**: 12
14294
14295**Parameters**
14296
14297| Name                  | Description                                                  |
14298| --------------------- | ------------------------------------------------------------ |
14299| OH_Drawing_TextStyle  | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14300| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). |
14301
14302
14303### OH_Drawing_TextStyleClearFontFeature()
14304
14305```
14306void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* )
14307```
14308
14309**Description**
14310
14311Clears all the contents in a font feature map container.
14312
14313**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14314
14315**Since**: 12
14316
14317**Parameters**
14318
14319| Name                 | Description                                                  |
14320| -------------------- | ------------------------------------------------------------ |
14321| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14322
14323
14324### OH_Drawing_TextStyleClearShadows()
14325
14326```
14327void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* )
14328```
14329
14330**Description**
14331
14332Clears all shadows in a text shadow container.
14333
14334**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14335
14336**Since**: 12
14337
14338**Parameters**
14339
14340| Name                 | Description                                                  |
14341| -------------------- | ------------------------------------------------------------ |
14342| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14343
14344
14345### OH_Drawing_TextStyleDestroyFontFamilies()
14346
14347```
14348void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num )
14349```
14350
14351**Description**
14352
14353Reclaims the memory occupied by the font families.
14354
14355**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14356
14357**Since**: 12
14358
14359**Parameters**
14360
14361| Name     | Description                          |
14362| -------- | ------------------------------------ |
14363| char\*\* | Double pointer to the font families. |
14364| size_t   | Number of font families.             |
14365
14366
14367### OH_Drawing_TextStyleDestroyFontFeatures()
14368
14369```
14370void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize )
14371```
14372
14373**Description**
14374
14375Reclaims the memory occupied by the struct array that holds all the font features.
14376
14377**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14378
14379**Since**: 12
14380
14381**Parameters**
14382
14383| Name                                                       | Description                                                  |
14384| ---------------------------------------------------------- | ------------------------------------------------------------ |
14385| [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). |
14386| fontFeatureSize                                            | Size of the struct array that holds all the font features.   |
14387
14388
14389### OH_Drawing_TextStyleGetBackgroundBrush()
14390
14391```
14392void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14393```
14394
14395**Description**
14396
14397Obtains the background brush of a text style.
14398
14399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14400
14401**Since**: 12
14402
14403**Parameters**
14404
14405| Name                 | Description                                                  |
14406| -------------------- | ------------------------------------------------------------ |
14407| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14408| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
14409
14410
14411### OH_Drawing_TextStyleGetBackgroundPen()
14412
14413```
14414void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14415```
14416
14417**Description**
14418
14419Obtains the background pen of a text style.
14420
14421**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14422
14423**Since**: 12
14424
14425**Parameters**
14426
14427| Name                 | Description                                                  |
14428| -------------------- | ------------------------------------------------------------ |
14429| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14430| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
14431
14432
14433### OH_Drawing_TextStyleGetBaseline()
14434
14435```
14436OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* )
14437```
14438
14439**Description**
14440
14441Obtains the baseline of a text style.
14442
14443**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14444
14445**Since**: 12
14446
14447**Parameters**
14448
14449| Name                 | Description                                                  |
14450| -------------------- | ------------------------------------------------------------ |
14451| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14452
14453**Returns**
14454
14455Returns the text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline).
14456
14457
14458### OH_Drawing_TextStyleGetBaselineShift()
14459
14460```
14461double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle* )
14462```
14463
14464**Description**
14465
14466Obtains the baseline drift of a text style.
14467
14468**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14469
14470**Since**: 12
14471
14472**Parameters**
14473
14474| Name                 | Description                                                  |
14475| -------------------- | ------------------------------------------------------------ |
14476| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14477
14478**Returns**
14479
14480Returns the baseline drift.
14481
14482
14483### OH_Drawing_TextStyleGetColor()
14484
14485```
14486uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* )
14487```
14488
14489**Description**
14490
14491Obtains the color of a text style.
14492
14493**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14494
14495**Since**: 12
14496
14497**Parameters**
14498
14499| Name                 | Description                                                  |
14500| -------------------- | ------------------------------------------------------------ |
14501| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14502
14503**Returns**
14504
14505Returns the text color.
14506
14507
14508### OH_Drawing_TextStyleGetDecorationStyle()
14509
14510```
14511OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* )
14512```
14513
14514**Description**
14515
14516Obtains the decoration style of a text style.
14517
14518**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14519
14520**Since**: 12
14521
14522**Parameters**
14523
14524| Name                 | Description                                                  |
14525| -------------------- | ------------------------------------------------------------ |
14526| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14527
14528**Returns**
14529
14530Returns the text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle).
14531
14532
14533### OH_Drawing_TextStyleGetFontFamilies()
14534
14535```
14536char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num )
14537```
14538
14539**Description**
14540
14541Obtains the font families of a text style.
14542
14543**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14544
14545**Since**: 12
14546
14547**Parameters**
14548
14549| Name                 | Description                                                  |
14550| -------------------- | ------------------------------------------------------------ |
14551| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14552| size_t               | Pointer to the number of font families.                      |
14553
14554**Returns**
14555
14556Returns the font families.
14557
14558
14559### OH_Drawing_TextStyleGetFontFeatures()
14560
14561```
14562OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* )
14563```
14564
14565**Description**
14566
14567Obtains all the contents in a font feature map container.
14568
14569**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14570
14571**Since**: 12
14572
14573**Parameters**
14574
14575| Name                 | Description                                                  |
14576| -------------------- | ------------------------------------------------------------ |
14577| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14578
14579**Returns**
14580
14581Returns the pointer to the [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) struct, which stores all the contents obtained.
14582
14583
14584### OH_Drawing_TextStyleGetFontFeatureSize()
14585
14586```
14587size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* )
14588```
14589
14590**Description**
14591
14592Obtains the size of a font feature map container.
14593
14594**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14595
14596**Since**: 12
14597
14598**Parameters**
14599
14600| Name                 | Description                                                  |
14601| -------------------- | ------------------------------------------------------------ |
14602| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14603
14604**Returns**
14605
14606Returns the size.
14607
14608
14609### OH_Drawing_TextStyleGetFontHeight()
14610
14611```
14612double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* )
14613```
14614
14615**Description**
14616
14617Obtains the font height of a text style.
14618
14619**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14620
14621**Since**: 12
14622
14623**Parameters**
14624
14625| Name                 | Description                                                  |
14626| -------------------- | ------------------------------------------------------------ |
14627| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14628
14629**Returns**
14630
14631Returns the font height.
14632
14633
14634### OH_Drawing_TextStyleGetFontMetrics()
14635
14636```
14637bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics*  )
14638```
14639
14640**Description**
14641
14642Obtains the font metrics of a text style.
14643
14644**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14645
14646**Since**: 12
14647
14648**Parameters**
14649
14650| Name                    | Description                                                  |
14651| ----------------------- | ------------------------------------------------------------ |
14652| OH_Drawing_Typography   | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
14653| OH_Drawing_TextStyle    | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14654| 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). |
14655
14656**Returns**
14657
14658Returns **true** if the font metrics are obtained; returns **false** otherwise.
14659
14660
14661### OH_Drawing_TextStyleGetFontSize()
14662
14663```
14664double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle* )
14665```
14666
14667**Description**
14668
14669Obtains the font size of a text style.
14670
14671**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14672
14673**Since**: 12
14674
14675**Parameters**
14676
14677| Name                 | Description                                                  |
14678| -------------------- | ------------------------------------------------------------ |
14679| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14680
14681**Returns**
14682
14683Returns the font size.
14684
14685
14686### OH_Drawing_TextStyleGetFontStyle()
14687
14688```
14689OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* )
14690```
14691
14692**Description**
14693
14694Obtains the font style of a text style.
14695
14696**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14697
14698**Since**: 12
14699
14700**Parameters**
14701
14702| Name                 | Description                                                  |
14703| -------------------- | ------------------------------------------------------------ |
14704| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14705
14706**Returns**
14707
14708Returns the font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle).
14709
14710
14711### OH_Drawing_TextStyleGetFontStyleStruct()
14712
14713```
14714OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle)
14715```
14716
14717**Description**
14718
14719Obtains the font style, including the font weight, width, and slant, of a text style.
14720
14721**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14722
14723**Since**: 12
14724
14725**Parameters**
14726
14727| Name                 | Description                                                  |
14728| -------------------- | ------------------------------------------------------------ |
14729| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14730
14731**Returns**
14732
14733Returns the font style, including the font weight, width, and slant.
14734
14735
14736### OH_Drawing_TextStyleGetFontWeight()
14737
14738```
14739OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle* )
14740```
14741
14742**Description**
14743
14744Obtains the font weight of a text style.
14745
14746**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14747
14748**Since**: 12
14749
14750**Parameters**
14751
14752| Name                 | Description                                                  |
14753| -------------------- | ------------------------------------------------------------ |
14754| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14755
14756**Returns**
14757
14758Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight).
14759
14760
14761### OH_Drawing_TextStyleGetForegroundBrush()
14762
14763```
14764void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush*  )
14765```
14766
14767**Description**
14768
14769Obtains the foreground brush of a text style.
14770
14771**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14772
14773**Since**: 12
14774
14775**Parameters**
14776
14777| Name                 | Description                                                  |
14778| -------------------- | ------------------------------------------------------------ |
14779| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14780| OH_Drawing_Brush     | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). |
14781
14782
14783### OH_Drawing_TextStyleGetForegroundPen()
14784
14785```
14786void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen*  )
14787```
14788
14789**Description**
14790
14791Obtains the foreground pen of a text style.
14792
14793**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14794
14795**Since**: 12
14796
14797**Parameters**
14798
14799| Name                 | Description                                                  |
14800| -------------------- | ------------------------------------------------------------ |
14801| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14802| OH_Drawing_Pen       | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). |
14803
14804
14805### OH_Drawing_TextStyleGetHalfLeading()
14806
14807```
14808bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle* )
14809```
14810
14811**Description**
14812
14813Checks whether half leading is enabled for a text style.
14814
14815**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14816
14817**Since**: 12
14818
14819**Parameters**
14820
14821| Name                 | Description                                                  |
14822| -------------------- | ------------------------------------------------------------ |
14823| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14824
14825**Returns**
14826
14827Returns **true** if half leading is enabled; returns **false** otherwise.
14828
14829
14830### OH_Drawing_TextStyleGetLetterSpacing()
14831
14832```
14833double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle* )
14834```
14835
14836**Description**
14837
14838Obtains the letter spacing of a text style.
14839
14840**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14841
14842**Since**: 12
14843
14844**Parameters**
14845
14846| Name                 | Description                                                  |
14847| -------------------- | ------------------------------------------------------------ |
14848| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14849
14850**Returns**
14851
14852Returns the letter spacing.
14853
14854
14855### OH_Drawing_TextStyleGetLocale()
14856
14857```
14858const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle* )
14859```
14860
14861**Description**
14862
14863Obtains the locale of a text style.
14864
14865**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14866
14867**Since**: 12
14868
14869**Parameters**
14870
14871| Name                 | Description                                                  |
14872| -------------------- | ------------------------------------------------------------ |
14873| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14874
14875**Returns**
14876
14877Returns 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.
14878
14879
14880### OH_Drawing_TextStyleGetShadowCount()
14881
14882```
14883int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* )
14884```
14885
14886**Description**
14887
14888Obtains the size of a text shadow container.
14889
14890**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14891
14892**Since**: 12
14893
14894**Parameters**
14895
14896| Name                 | Description                                                  |
14897| -------------------- | ------------------------------------------------------------ |
14898| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14899
14900**Returns**
14901
14902Returns the size.
14903
14904
14905### OH_Drawing_TextStyleGetShadows()
14906
14907```
14908OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* )
14909```
14910
14911**Description**
14912
14913Obtains a text shadow container.
14914
14915**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14916
14917**Since**: 12
14918
14919**Parameters**
14920
14921| Name                 | Description                                                  |
14922| -------------------- | ------------------------------------------------------------ |
14923| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14924
14925**Returns**
14926
14927Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object.
14928
14929
14930### OH_Drawing_TextStyleGetShadowWithIndex()
14931
14932```
14933OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int  )
14934```
14935
14936**Description**
14937
14938Obtains a shadow with a given index in a text shadow container.
14939
14940**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14941
14942**Since**: 12
14943
14944**Parameters**
14945
14946| Name                 | Description                                                  |
14947| -------------------- | ------------------------------------------------------------ |
14948| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14949| int                  | Index.                                                       |
14950
14951**Returns**
14952
14953Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object.
14954
14955
14956### OH_Drawing_TextStyleGetWordSpacing()
14957
14958```
14959double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle* )
14960```
14961
14962**Description**
14963
14964Obtains the word spacing of a text style.
14965
14966**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14967
14968**Since**: 12
14969
14970**Parameters**
14971
14972| Name                 | Description                                                  |
14973| -------------------- | ------------------------------------------------------------ |
14974| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
14975
14976**Returns**
14977
14978Returns the word spacing.
14979
14980
14981### OH_Drawing_TextStyleIsAttributeMatched()
14982
14983```
14984bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType )
14985```
14986
14987**Description**
14988
14989Checks whether two text styles have the same text style type.
14990
14991**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
14992
14993**Since**: 12
14994
14995**Parameters**
14996
14997| Name          | Description                                                  |
14998| ------------- | ------------------------------------------------------------ |
14999| style         | Pointer to the first text style.                             |
15000| comparedStyle | Pointer to the second text style.                            |
15001| textStyleType | Text style type. For details about the available options, see [OH_Drawing_TextStyleType](#oh_drawing_textstyletype). |
15002
15003**Returns**
15004
15005Returns **true** if the two are the same; returns **false** otherwise.
15006
15007
15008### OH_Drawing_TextStyleIsEqual()
15009
15010```
15011bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
15012```
15013
15014**Description**
15015
15016Checks whether two text styles are equal.
15017
15018**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15019
15020**Since**: 12
15021
15022**Parameters**
15023
15024| Name          | Description                       |
15025| ------------- | --------------------------------- |
15026| style         | Pointer to the first text style.  |
15027| comparedStyle | Pointer to the second text style. |
15028
15029**Returns**
15030
15031Returns **true** if the two are equal; returns **false** otherwise.
15032
15033
15034### OH_Drawing_TextStyleIsEqualByFont()
15035
15036```
15037bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle )
15038```
15039
15040**Description**
15041
15042Checks whether the font style properties of two text styles are equal.
15043
15044**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15045
15046**Since**: 12
15047
15048**Parameters**
15049
15050| Name          | Description                       |
15051| ------------- | --------------------------------- |
15052| style         | Pointer to the first text style.  |
15053| comparedStyle | Pointer to the second text style. |
15054
15055**Returns**
15056
15057Returns **true** if the two are equal; returns **false** otherwise.
15058
15059
15060### OH_Drawing_TextStyleIsPlaceholder()
15061
15062```
15063bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style)
15064```
15065
15066**Description**
15067
15068Checks whether a placeholder is set for a text style.
15069
15070**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15071
15072**Since**: 12
15073
15074**Parameters**
15075
15076| Name                 | Description                                                  |
15077| -------------------- | ------------------------------------------------------------ |
15078| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15079
15080**Returns**
15081
15082Returns **true** if a placeholder is set; returns **false** otherwise.
15083
15084
15085### OH_Drawing_TextStyleSetBackgroundRect()
15086
15087```
15088void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId )
15089```
15090
15091**Description**
15092
15093Sets a background rectangle and style ID for a text style. The style ID is valid only when the background box is a rounded rectangle.
15094
15095**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15096
15097**Since**: 12
15098
15099**Parameters**
15100
15101| Name                                                         | Description                                                  |
15102| ------------------------------------------------------------ | ------------------------------------------------------------ |
15103| OH_Drawing_TextStyle                                         | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15104| [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. |
15105| 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. |
15106
15107
15108### OH_Drawing_TextStyleSetBaselineShift()
15109
15110```
15111void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle* , double lineShift )
15112```
15113
15114**Description**
15115
15116Sets a baseline drift for a text style.
15117
15118**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15119
15120**Since**: 12
15121
15122**Parameters**
15123
15124| Name                 | Description                                                  |
15125| -------------------- | ------------------------------------------------------------ |
15126| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15127| double               | Baseline drift of the text style.                            |
15128
15129
15130### OH_Drawing_TextStyleSetPlaceholder()
15131
15132```
15133void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style)
15134```
15135
15136**Description**
15137
15138Sets a placeholder for a text style.
15139
15140**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15141
15142**Since**: 12
15143
15144**Parameters**
15145
15146| Name                 | Description                                                  |
15147| -------------------- | ------------------------------------------------------------ |
15148| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
15149
15150
15151### OH_Drawing_TypefaceCreateDefault()
15152
15153```
15154OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void )
15155```
15156
15157**Description**
15158
15159Creates a default **OH_Drawing_Typeface** object.
15160
15161**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15162
15163**Since**: 11
15164
15165**Returns**
15166
15167Returns the pointer to the **OH_Drawing_Typeface** object created.
15168
15169
15170### OH_Drawing_TypefaceCreateFromFile()
15171
15172```
15173OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index )
15174```
15175
15176**Description**
15177
15178Creates an **OH_Drawing_Typeface** object through a file.
15179
15180Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15181
15182If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
15183
15184If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15185
15186**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15187
15188**Since**: 12
15189
15190**Parameters**
15191
15192| Name  | Description               |
15193| ----- | ------------------------- |
15194| path  | Pointer to the file path. |
15195| index | File index.               |
15196
15197**Returns**
15198
15199Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created.
15200
15201
15202### OH_Drawing_TypefaceCreateFromStream()
15203
15204```
15205OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index )
15206```
15207
15208**Description**
15209
15210Creates 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.
15211
15212Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget).
15213
15214If the operation is successful, **OH_DRAWING_SUCCESS** is returned.
15215
15216If **OH_Drawing_MemoryStream** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned.
15217
15218**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15219
15220**Since**: 12
15221
15222**Parameters**
15223
15224| Name                    | Description                                                  |
15225| ----------------------- | ------------------------------------------------------------ |
15226| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. |
15227| index                   | Index of the memory stream.                                  |
15228
15229**Returns**
15230
15231Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created.
15232
15233
15234### OH_Drawing_TypefaceDestroy()
15235
15236```
15237void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* )
15238```
15239
15240**Description**
15241
15242Destroys an **OH_Drawing_Typeface** object and reclaims the memory occupied by the object.
15243
15244**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15245
15246**Since**: 11
15247
15248**Parameters**
15249
15250| Name                | Description                                   |
15251| ------------------- | --------------------------------------------- |
15252| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. |
15253
15254
15255### OH_Drawing_TypographyDestroyEllipsis()
15256
15257```
15258void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis)
15259```
15260
15261**Description**
15262
15263Reclaims the memory occupied by the text ellipsis names.
15264
15265**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15266
15267**Since**: 12
15268
15269**Parameters**
15270
15271| Name     | Description                         |
15272| -------- | ----------------------------------- |
15273| ellipsis | Pointer to the text ellipsis names. |
15274
15275
15276### OH_Drawing_TypographyDestroyLineFontMetrics()
15277
15278```
15279void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* )
15280```
15281
15282**Description**
15283
15284Reclaims the memory occupied by the struct array that holds all the font metrics of a given line.
15285
15286**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15287
15288**Since**: 12
15289
15290**Parameters**
15291
15292| Name                                                         | Description                                       |
15293| ------------------------------------------------------------ | ------------------------------------------------- |
15294| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Pointer to the first address of the struct array. |
15295
15296
15297### OH_Drawing_TypographyDidExceedMaxLines()
15298
15299```
15300bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* )
15301```
15302
15303**Description**
15304
15305Checks whether the maximum number of lines is exceeded.
15306
15307**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15308
15309**Since**: 11
15310
15311**Parameters**
15312
15313| Name                  | Description                                                  |
15314| --------------------- | ------------------------------------------------------------ |
15315| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15316
15317**Returns**
15318
15319Returns **true** if the maximum number of lines is exceeded; returns **false** otherwise.
15320
15321
15322### OH_Drawing_TypographyGetAlphabeticBaseline()
15323
15324```
15325double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* )
15326```
15327
15328**Description**
15329
15330Obtains the alphabetic baseline.
15331
15332**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15333
15334**Since**: 9
15335
15336**Parameters**
15337
15338| Name                  | Description                                                  |
15339| --------------------- | ------------------------------------------------------------ |
15340| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15341
15342**Returns**
15343
15344Returns the alphabetic baseline.
15345
15346
15347### OH_Drawing_TypographyGetEffectiveAlignment()
15348
15349```
15350int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
15351```
15352
15353**Description**
15354
15355Obtains the text alignment mode.
15356
15357**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15358
15359**Since**: 12
15360
15361**Parameters**
15362
15363| Name                       | Description                                                  |
15364| -------------------------- | ------------------------------------------------------------ |
15365| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15366
15367**Returns**
15368
15369Returns the text alignment mode.
15370
15371
15372### OH_Drawing_TypographyGetGlyphPositionAtCoordinate()
15373
15374```
15375OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double  )
15376```
15377
15378**Description**
15379
15380Obtains the position and affinity of the glyph at the given coordinates.
15381
15382**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15383
15384**Since**: 11
15385
15386**Parameters**
15387
15388| Name                  | Description                                                  |
15389| --------------------- | ------------------------------------------------------------ |
15390| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15391| double                | X coordinate.                                                |
15392| double                | Y coordinate.                                                |
15393
15394**Returns**
15395
15396Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph.
15397
15398
15399### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster()
15400
15401```
15402OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double  )
15403```
15404
15405**Description**
15406
15407Obtains 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.
15408
15409**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15410
15411**Since**: 11
15412
15413**Parameters**
15414
15415| Name                  | Description                                                  |
15416| --------------------- | ------------------------------------------------------------ |
15417| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15418| double                | X coordinate.                                                |
15419| double                | Y coordinate.                                                |
15420
15421**Returns**
15422
15423Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph cluster.
15424
15425
15426### OH_Drawing_TypographyGetHeight()
15427
15428```
15429double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* )
15430```
15431
15432**Description**
15433
15434Obtains the height.
15435
15436**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15437
15438**Since**: 9
15439
15440**Parameters**
15441
15442| Name                  | Description                                                  |
15443| --------------------- | ------------------------------------------------------------ |
15444| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15445
15446**Returns**
15447
15448Returns the height.
15449
15450
15451### OH_Drawing_TypographyGetIdeographicBaseline()
15452
15453```
15454double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* )
15455```
15456
15457**Description**
15458
15459Obtains the ideographic baseline.
15460
15461**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15462
15463**Since**: 9
15464
15465**Parameters**
15466
15467| Name                  | Description                                                  |
15468| --------------------- | ------------------------------------------------------------ |
15469| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15470
15471**Returns**
15472
15473Returns the ideographic baseline.
15474
15475
15476### OH_Drawing_TypographyGetIndentsWithIndex()
15477
15478```
15479float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int  )
15480```
15481
15482**Description**
15483
15484Obtains indents with a given index.
15485
15486**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15487
15488**Since**: 12
15489
15490**Parameters**
15491
15492| Name                  | Description                                                  |
15493| --------------------- | ------------------------------------------------------------ |
15494| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15495| int                   | Index.                                                       |
15496
15497**Returns**
15498
15499Returns the indents.
15500
15501
15502### OH_Drawing_TypographyGetLineCount()
15503
15504```
15505size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* )
15506```
15507
15508**Description**
15509
15510Obtains the number of lines.
15511
15512**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15513
15514**Since**: 11
15515
15516**Parameters**
15517
15518| Name                  | Description                                                  |
15519| --------------------- | ------------------------------------------------------------ |
15520| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15521
15522**Returns**
15523
15524Returns the number of lines.
15525
15526
15527### OH_Drawing_TypographyGetLineFontMetrics()
15528
15529```
15530OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize )
15531```
15532
15533**Description**
15534
15535Obtains all font metrics from a given line.
15536
15537**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15538
15539**Since**: 12
15540
15541**Parameters**
15542
15543| Name                  | Description                                                  |
15544| --------------------- | ------------------------------------------------------------ |
15545| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15546| 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. |
15547| fontMetricsSize       | Pointer to the size of the struct.                           |
15548
15549**Returns**
15550
15551Returns all the font metrics.
15552
15553
15554### OH_Drawing_TypographyGetLineHeight()
15555
15556```
15557double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int  )
15558```
15559
15560**Description**
15561
15562Obtains the line height.
15563
15564**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15565
15566**Since**: 11
15567
15568**Parameters**
15569
15570| Name                  | Description                                                  |
15571| --------------------- | ------------------------------------------------------------ |
15572| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15573| int                   | Target line.                                                 |
15574
15575**Returns**
15576
15577Returns the height.
15578
15579
15580### OH_Drawing_TypographyGetLineInfo()
15581
15582```
15583bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics*  )
15584```
15585
15586**Description**
15587
15588Obtains the metrics of a given line or the metrics of the first character in a given line.
15589
15590**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15591
15592**Since**: 12
15593
15594**Parameters**
15595
15596| Name                   | Description                                                  |
15597| ---------------------- | ------------------------------------------------------------ |
15598| OH_Drawing_Typography  | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15599| int                    | Row No.                                                      |
15600| 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. |
15601| bool                   | Whether whitespace characters are included in the text width. The value **true** means that whitespace characters are not included, **false** means the opposite. |
15602| 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). |
15603
15604**Returns**
15605
15606Returns **true** if the metrics of the given line or the metrics of the first character in the given line is obtained; returns **false** otherwise.
15607
15608
15609### OH_Drawing_TypographyGetLineMetrics()
15610
15611```
15612OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* )
15613```
15614
15615**Description**
15616
15617Obtains the line metrics.
15618
15619**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15620
15621**Since**: 12
15622
15623**Parameters**
15624
15625| Name                  | Description                                                  |
15626| --------------------- | ------------------------------------------------------------ |
15627| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15628
15629**Returns**
15630
15631Returns the pointer to the [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object.
15632
15633
15634### OH_Drawing_TypographyGetLineMetricsAt()
15635
15636```
15637bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics*  )
15638```
15639
15640**Description**
15641
15642Obtains the metrics of a given line.
15643
15644**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15645
15646**Since**: 12
15647
15648**Parameters**
15649
15650| Name                                                       | Description                                                  |
15651| ---------------------------------------------------------- | ------------------------------------------------------------ |
15652| OH_Drawing_Typography                                      | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15653| int                                                        | Line No.                                                     |
15654| [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). |
15655
15656**Returns**
15657
15658Returns **true** if the metrics of the given line are obtained; returns **false** otherwise.
15659
15660
15661### OH_Drawing_TypographyGetLineTextRange()
15662
15663```
15664OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool  )
15665```
15666
15667**Description**
15668
15669Obtains the line bounds.
15670
15671**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15672
15673**Since**: 12
15674
15675**Parameters**
15676
15677| Name                  | Description                                                  |
15678| --------------------- | ------------------------------------------------------------ |
15679| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15680| int                   | Row index.                                                   |
15681| bool                  | Whether the returned bounds contain spaces. The value **true** means that the bounds contain spaces, and **false** means the opposite. |
15682
15683**Returns**
15684
15685Returns the pointer to the [OH_Drawing_Range](#oh_drawing_range) object.
15686
15687
15688### OH_Drawing_TypographyGetLineWidth()
15689
15690```
15691double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int  )
15692```
15693
15694**Description**
15695
15696Obtains the line width.
15697
15698**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15699
15700**Since**: 11
15701
15702**Parameters**
15703
15704| Name                  | Description                                                  |
15705| --------------------- | ------------------------------------------------------------ |
15706| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15707| int                   | Target line.                                                 |
15708
15709**Returns**
15710
15711Returns the width.
15712
15713
15714### OH_Drawing_TypographyGetLongestLine()
15715
15716```
15717double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* )
15718```
15719
15720**Description**
15721
15722Obtains the width of the longest line. You are advised to round up the return value in actual use. When the text content is empty, the minimum float value, that is, -340282346638528859811704183484516925440.000000, is returned.
15723
15724**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15725
15726**Since**: 9
15727
15728**Parameters**
15729
15730| Name                  | Description                                                  |
15731| --------------------- | ------------------------------------------------------------ |
15732| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15733
15734**Returns**
15735
15736Returns the width of the longest line.
15737
15738
15739### OH_Drawing_TypographyGetMaxIntrinsicWidth()
15740
15741```
15742double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* )
15743```
15744
15745**Description**
15746
15747Obtains the maximum intrinsic width.
15748
15749**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15750
15751**Since**: 9
15752
15753**Parameters**
15754
15755| Name                  | Description                                                  |
15756| --------------------- | ------------------------------------------------------------ |
15757| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15758
15759**Returns**
15760
15761Returns the maximum intrinsic width.
15762
15763
15764### OH_Drawing_TypographyGetMaxWidth()
15765
15766```
15767double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* )
15768```
15769
15770**Description**
15771
15772Obtains the maximum width.
15773
15774**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15775
15776**Since**: 9
15777
15778**Parameters**
15779
15780| Name                  | Description                                                  |
15781| --------------------- | ------------------------------------------------------------ |
15782| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15783
15784**Returns**
15785
15786Returns the maximum width.
15787
15788
15789### OH_Drawing_TypographyGetMinIntrinsicWidth()
15790
15791```
15792double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* )
15793```
15794
15795**Description**
15796
15797Obtains the minimum intrinsic width.
15798
15799**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15800
15801**Since**: 9
15802
15803**Parameters**
15804
15805| Name                  | Description                                                  |
15806| --------------------- | ------------------------------------------------------------ |
15807| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15808
15809**Returns**
15810
15811Returns the minimum intrinsic width.
15812
15813
15814### OH_Drawing_TypographyGetRectsForPlaceholders()
15815
15816```
15817OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* )
15818```
15819
15820**Description**
15821
15822Obtains text boxes for placeholders.
15823
15824**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15825
15826**Since**: 11
15827
15828**Parameters**
15829
15830| Name                  | Description                                                  |
15831| --------------------- | ------------------------------------------------------------ |
15832| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15833
15834**Returns**
15835
15836Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes.
15837
15838### OH_Drawing_TypographyGetRectsForRange()
15839
15840```
15841OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle  )
15842```
15843
15844**Description**
15845
15846Obtains text boxes in a given range.
15847
15848**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15849
15850**Since**: 11
15851
15852**Parameters**
15853
15854| Name                       | Description                                                  |
15855| -------------------------- | ------------------------------------------------------------ |
15856| OH_Drawing_Typography      | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
15857| size_t                     | Start position.                                              |
15858| size_t                     | End position.                                                |
15859| OH_Drawing_RectHeightStyle | Height style. For details about the available options, see [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle). |
15860| OH_Drawing_RectWidthStyle  | Width style. For details about the available options, see [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle). |
15861
15862**Returns**
15863
15864Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes.
15865
15866
15867### OH_Drawing_TypographyGetTextAlign()
15868
15869```
15870OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* )
15871```
15872
15873**Description**
15874
15875Obtains the text alignment mode.
15876
15877**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15878
15879**Since**: 12
15880
15881**Parameters**
15882
15883| Name                       | Description                                                  |
15884| -------------------------- | ------------------------------------------------------------ |
15885| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15886
15887**Returns**
15888
15889Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign).
15890
15891
15892### OH_Drawing_TypographyGetTextDirection()
15893
15894```
15895OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* )
15896```
15897
15898**Description**
15899
15900Obtains the text direction.
15901
15902**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15903
15904**Since**: 12
15905
15906**Parameters**
15907
15908| Name                       | Description                                                  |
15909| -------------------------- | ------------------------------------------------------------ |
15910| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15911
15912**Returns**
15913
15914Returns the text direction. For details about the available options, see [OH_Drawing_TextDirection](#oh_drawing_textdirection).
15915
15916
15917### OH_Drawing_TypographyGetTextEllipsis()
15918
15919```
15920char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* )
15921```
15922
15923**Description**
15924
15925Obtains the text ellipsis content.
15926
15927**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15928
15929**Since**: 12
15930
15931**Parameters**
15932
15933| Name                       | Description                                                  |
15934| -------------------------- | ------------------------------------------------------------ |
15935| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15936
15937**Returns**
15938
15939Returns the pointer to the text ellipsis content obtained.
15940
15941
15942### OH_Drawing_TypographyGetTextMaxLines()
15943
15944```
15945size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* )
15946```
15947
15948**Description**
15949
15950Obtains the maximum number of lines.
15951
15952**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15953
15954**Since**: 12
15955
15956**Parameters**
15957
15958| Name                       | Description                                                  |
15959| -------------------------- | ------------------------------------------------------------ |
15960| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15961
15962**Returns**
15963
15964Returns the maximum number of lines.
15965
15966
15967### OH_Drawing_TypographyGetTextStyle()
15968
15969```
15970OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style)
15971```
15972
15973**Description**
15974
15975Obtains the text style of a typography style.
15976
15977**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
15978
15979**Since**: 12
15980
15981**Parameters**
15982
15983| Name                       | Description                                                  |
15984| -------------------------- | ------------------------------------------------------------ |
15985| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
15986
15987**Returns**
15988
15989Returns the pointer to the [OH_Drawing_TextStyle](#oh_drawing_textstyle) object.
15990
15991
15992### OH_Drawing_TypographyGetUnresolvedGlyphsCount()
15993
15994```
15995int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* )
15996```
15997
15998**Description**
15999
16000Obtains the number of unresolved glyphs in a typography object.
16001
16002**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16003
16004**Since**: 12
16005
16006**Parameters**
16007
16008| Name                  | Description                                                  |
16009| --------------------- | ------------------------------------------------------------ |
16010| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16011
16012**Returns**
16013
16014Returns the number of unresolved glyphs.
16015
16016
16017### OH_Drawing_TypographyGetWordBoundary()
16018
16019```
16020OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t  )
16021```
16022
16023**Description**
16024
16025Obtains the word boundary.
16026
16027**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16028
16029**Since**: 11
16030
16031**Parameters**
16032
16033| Name                  | Description                                                  |
16034| --------------------- | ------------------------------------------------------------ |
16035| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16036| size_t                | Index of the word.                                           |
16037
16038**Returns**
16039
16040Returns the [OH_Drawing_Range](#oh_drawing_range) struct that holds the word boundary.
16041
16042
16043### OH_Drawing_TypographyHandlerAddPlaceholder()
16044
16045```
16046void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan*  )
16047```
16048
16049**Description**
16050
16051Adds a placeholder.
16052
16053**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16054
16055**Since**: 11
16056
16057**Parameters**
16058
16059| Name                                                         | Description                                                  |
16060| ------------------------------------------------------------ | ------------------------------------------------------------ |
16061| OH_Drawing_TypographyCreate                                  | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
16062| [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | Pointer to an **OH_Drawing_PlaceholderSpan** object.         |
16063
16064
16065### OH_Drawing_TypographyHandlerAddSymbol()
16066
16067```
16068void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol )
16069```
16070
16071**Description**
16072
16073Adds the symbol to use in the typography creation process.
16074
16075**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16076
16077**Since**: 12
16078
16079**Parameters**
16080
16081| Name                        | Description                                                  |
16082| --------------------------- | ------------------------------------------------------------ |
16083| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
16084| uint32_t                    | Symbol. For details about the supported symbols, see the value in the JSON file. [https://gitee.com/openharmony/global_system_resources/blob/master/systemres/main/resources/base/element/symbol.json](https://gitee.com/openharmony/global_system_resources/blob/master/systemres/main/resources/base/element/symbol.json) |
16085
16086
16087### OH_Drawing_TypographyHandlerAddText()
16088
16089```
16090void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char*  )
16091```
16092
16093**Description**
16094
16095Adds text.
16096
16097**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16098
16099**Since**: 8
16100
16101**Parameters**
16102
16103| Name                        | Description                                                  |
16104| --------------------------- | ------------------------------------------------------------ |
16105| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
16106| char                        | Pointer to the text content.                                 |
16107
16108
16109### OH_Drawing_TypographyHandlerPopTextStyle()
16110
16111```
16112void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* )
16113```
16114
16115**Description**
16116
16117Removes the topmost text style in the stack, leaving the remaining styles in effect.
16118
16119**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16120
16121**Since**: 8
16122
16123**Parameters**
16124
16125| Name                        | Description                                                  |
16126| --------------------------- | ------------------------------------------------------------ |
16127| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
16128
16129
16130### OH_Drawing_TypographyHandlerPushTextStyle()
16131
16132```
16133void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle*  )
16134```
16135
16136**Description**
16137
16138Pushes the text style.
16139
16140**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16141
16142**Since**: 8
16143
16144**Parameters**
16145
16146| Name                        | Description                                                  |
16147| --------------------------- | ------------------------------------------------------------ |
16148| OH_Drawing_TypographyCreate | Pointer to an **OH_Drawing_TypographyCreate** object. The pointer is obtained by [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). |
16149| OH_Drawing_TextStyle        | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). |
16150
16151
16152### OH_Drawing_TypographyIsEllipsized()
16153
16154```
16155bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style)
16156```
16157
16158**Description**
16159
16160Checks whether the text has an ellipsis.
16161
16162**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16163
16164**Since**: 12
16165
16166**Parameters**
16167
16168| Name                       | Description                                                  |
16169| -------------------------- | ------------------------------------------------------------ |
16170| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16171
16172**Returns**
16173
16174Returns **true** if the text has an ellipsis; returns **false** otherwise.
16175
16176
16177### OH_Drawing_TypographyIsLineUnlimited()
16178
16179```
16180bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style)
16181```
16182
16183**Description**
16184
16185Checks whether the maximum number of lines is limited for text.
16186
16187**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16188
16189**Since**: 12
16190
16191**Parameters**
16192
16193| Name                       | Description                                                  |
16194| -------------------------- | ------------------------------------------------------------ |
16195| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16196
16197**Returns**
16198
16199Returns **true** if that the maximum number of lines is limited; returns **false** otherwise.
16200
16201
16202### OH_Drawing_TypographyLayout()
16203
16204```
16205void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double  )
16206```
16207
16208**Description**
16209
16210Lays out the typography.
16211
16212**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16213
16214**Since**: 8
16215
16216**Parameters**
16217
16218| Name                  | Description                                                  |
16219| --------------------- | ------------------------------------------------------------ |
16220| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16221| double                | Maximum text width.                                          |
16222
16223
16224### OH_Drawing_TypographyMarkDirty()
16225
16226```
16227void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* )
16228```
16229
16230**Description**
16231
16232Marks a typography object as dirty data. This function is used to initialize the typography state.
16233
16234**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16235
16236**Since**: 12
16237
16238**Parameters**
16239
16240| Name                  | Description                                                  |
16241| --------------------- | ------------------------------------------------------------ |
16242| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16243
16244
16245### OH_Drawing_TypographyPaint()
16246
16247```
16248void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double  )
16249```
16250
16251**Description**
16252
16253Paints text on the canvas.
16254
16255**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16256
16257**Since**: 8
16258
16259**Parameters**
16260
16261| Name                  | Description                                                  |
16262| --------------------- | ------------------------------------------------------------ |
16263| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16264| OH_Drawing_Canvas     | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling **OH_Drawing_CanvasCreate()**. |
16265| double                | X coordinate.                                                |
16266| double                | Y coordinate.                                                |
16267
16268
16269### OH_Drawing_TypographySetIndents()
16270
16271```
16272void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] )
16273```
16274
16275**Description**
16276
16277Sets the indents for typography.
16278
16279**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16280
16281**Since**: 12
16282
16283**Parameters**
16284
16285| Name                  | Description                                                  |
16286| --------------------- | ------------------------------------------------------------ |
16287| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16288| int                   | Number of indents.                                           |
16289| float                 | Array holding the indents.                                   |
16290
16291
16292### OH_Drawing_TypographyStyleDestroyStrutStyle()
16293
16294```
16295void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* )
16296```
16297
16298**Description**
16299
16300Reclaims the memory occupied by a strut style.
16301
16302**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16303
16304**Since**: 12
16305
16306**Parameters**
16307
16308| Name                                                     | Description                                                  |
16309| -------------------------------------------------------- | ------------------------------------------------------------ |
16310| [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). |
16311
16312
16313### OH_Drawing_TypographyStyleEquals()
16314
16315```
16316bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to )
16317```
16318
16319**Description**
16320
16321Checks whether two typography styles are the same.
16322
16323**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16324
16325**Since**: 12
16326
16327**Parameters**
16328
16329| Name | Description                             |
16330| ---- | --------------------------------------- |
16331| from | Pointer to the first typography style.  |
16332| to   | Pointer to the second typography style. |
16333
16334**Returns**
16335
16336Returns **true** if the two are the same; returns **false** otherwise.
16337
16338
16339### OH_Drawing_TypographyStyleGetEffectiveAlignment()
16340
16341```
16342OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style)
16343```
16344
16345**Description**
16346
16347Obtains the text alignment mode.
16348
16349**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16350
16351**Since**: 12
16352
16353**Parameters**
16354
16355| Name                       | Description                                                  |
16356| -------------------------- | ------------------------------------------------------------ |
16357| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16358
16359**Returns**
16360
16361Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign).
16362
16363
16364### OH_Drawing_TypographyStyleGetFontStyleStruct()
16365
16366```
16367OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle)
16368```
16369
16370**Description**
16371
16372Obtains the font style, including the font weight, width, and slant, of a typography style.
16373
16374**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16375
16376**Since**: 12
16377
16378**Parameters**
16379
16380| Name                       | Description                                                  |
16381| -------------------------- | ------------------------------------------------------------ |
16382| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16383
16384**Returns**
16385
16386Returns the font style, including the font weight, width, and slant.
16387
16388
16389### OH_Drawing_TypographyStyleGetStrutStyle()
16390
16391```
16392OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* )
16393```
16394
16395**Description**
16396
16397Obtains the strut style of a typography style.
16398
16399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16400
16401**Since**: 12
16402
16403**Parameters**
16404
16405| Name                       | Description                                                  |
16406| -------------------------- | ------------------------------------------------------------ |
16407| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16408
16409**Returns**
16410
16411Returns the pointer to the strut style, which is an [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) object.
16412
16413
16414### OH_Drawing_TypographyStyleIsHintEnabled()
16415
16416```
16417bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style)
16418```
16419
16420**Description**
16421
16422Checks 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.
16423
16424**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16425
16426**Since**: 12
16427
16428**Parameters**
16429
16430| Name                       | Description                                                  |
16431| -------------------------- | ------------------------------------------------------------ |
16432| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16433
16434**Returns**
16435
16436Returns **true** if font hinting is enabled; returns **false** otherwise.
16437
16438
16439### OH_Drawing_TypographyStyleSetHintsEnabled()
16440
16441```
16442void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled )
16443```
16444
16445**Description**
16446
16447Sets 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.
16448
16449**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16450
16451**Since**: 12
16452
16453**Parameters**
16454
16455| Name                       | Description                                                  |
16456| -------------------------- | ------------------------------------------------------------ |
16457| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16458| hintsEnabled               | Whether to enable font hinting. The value **true** means to enable font hinting, and **false** means the opposite. |
16459
16460
16461### OH_Drawing_TypographyStyleStrutStyleEquals()
16462
16463```
16464bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to )
16465```
16466
16467**Description**
16468
16469Checks whether two strut styles are equal.
16470
16471**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16472
16473**Since**: 12
16474
16475**Parameters**
16476
16477| Name | Description                        |
16478| ---- | ---------------------------------- |
16479| from | Pointer to the first strut style.  |
16480| to   | Pointer to the second strut style. |
16481
16482**Returns**
16483
16484Returns **true** if the two strut styles are the same; returns **false** otherwise.
16485
16486### OH_Drawing_TypographyTextGetHeightBehavior()
16487
16488```
16489OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* )
16490```
16491
16492**Description**
16493
16494Obtains the text height modifier pattern.
16495
16496**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16497
16498**Since**: 12
16499
16500**Parameters**
16501
16502| Name                       | Description                                                  |
16503| -------------------------- | ------------------------------------------------------------ |
16504| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16505
16506**Returns**
16507
16508Returns the text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior).
16509
16510
16511### OH_Drawing_TypographyTextGetLineStyle()
16512
16513```
16514bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* )
16515```
16516
16517**Description**
16518
16519Checks whether the text line style is enabled for a typography style.
16520
16521**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16522
16523**Since**: 12
16524
16525**Parameters**
16526
16527| Name                       | Description                                                  |
16528| -------------------------- | ------------------------------------------------------------ |
16529| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16530
16531**Returns**
16532
16533Returns **true** if the text line style is enabled; returns **false** otherwise.
16534
16535
16536### OH_Drawing_TypographyTextlineGetStyleOnly()
16537
16538```
16539bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* )
16540```
16541
16542**Description**
16543
16544Checks whether only the text line style is enabled for a typography style.
16545
16546**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16547
16548**Since**: 12
16549
16550**Parameters**
16551
16552| Name                       | Description                                                  |
16553| -------------------------- | ------------------------------------------------------------ |
16554| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16555
16556**Returns**
16557
16558Returns **true** if only the text line style is enabled; returns **false** otherwise.
16559
16560
16561### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies()
16562
16563```
16564void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum )
16565```
16566
16567**Description**
16568
16569Reclaims the memory occupied by the font families.
16570
16571**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16572
16573**Since**: 12
16574
16575**Parameters**
16576
16577| Name            | Description                          |
16578| --------------- | ------------------------------------ |
16579| fontFamilies    | Double pointer to the font families. |
16580| fontFamiliesNum | Number of font families.             |
16581
16582
16583### OH_Drawing_TypographyTextlineStyleGetFontFamilies()
16584
16585```
16586char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* )
16587```
16588
16589**Description**
16590
16591Obtains the font families of a text line style.
16592
16593**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16594
16595**Since**: 12
16596
16597**Parameters**
16598
16599| Name                       | Description                                                  |
16600| -------------------------- | ------------------------------------------------------------ |
16601| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16602
16603**Returns**
16604
16605Returns the font families.
16606
16607
16608### OH_Drawing_TypographyTextlineStyleGetFontSize()
16609
16610```
16611double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* )
16612```
16613
16614**Description**
16615
16616Obtains the font size of a text line style.
16617
16618**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16619
16620**Since**: 12
16621
16622**Parameters**
16623
16624| Name                       | Description                                                  |
16625| -------------------------- | ------------------------------------------------------------ |
16626| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16627
16628**Returns**
16629
16630Returns the font size.
16631
16632
16633### OH_Drawing_TypographyTextlineStyleGetFontStyle()
16634
16635```
16636OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* )
16637```
16638
16639**Description**
16640
16641Obtains the font style of a text line style.
16642
16643**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16644
16645**Since**: 12
16646
16647**Parameters**
16648
16649| Name                       | Description                                                  |
16650| -------------------------- | ------------------------------------------------------------ |
16651| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16652
16653**Returns**
16654
16655Returns the font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle).
16656
16657
16658### OH_Drawing_TypographyTextlineStyleGetFontWeight()
16659
16660```
16661OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle* )
16662```
16663
16664**Description**
16665
16666Obtains the font weight of a text line style.
16667
16668**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16669
16670**Since**: 12
16671
16672**Parameters**
16673
16674| Name                       | Description                                                  |
16675| -------------------------- | ------------------------------------------------------------ |
16676| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16677
16678**Returns**
16679
16680Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight).
16681
16682
16683### OH_Drawing_TypographyTextlineStyleGetHalfLeading()
16684
16685```
16686bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* )
16687```
16688
16689**Description**
16690
16691Checks whether half leading is enabled for a text line style.
16692
16693**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16694
16695**Since**: 12
16696
16697**Parameters**
16698
16699| Name                       | Description                                                  |
16700| -------------------------- | ------------------------------------------------------------ |
16701| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16702
16703**Returns**
16704
16705Returns **true** if half leading is enabled; returns **false** otherwise.
16706
16707
16708### OH_Drawing_TypographyTextlineStyleGetHeightOnly()
16709
16710```
16711bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* )
16712```
16713
16714**Description**
16715
16716Checks whether only the font height is used for a text line style.
16717
16718**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16719
16720**Since**: 12
16721
16722**Parameters**
16723
16724| Name                       | Description                                                  |
16725| -------------------------- | ------------------------------------------------------------ |
16726| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16727
16728**Returns**
16729
16730Returns **true** if only the font height is used; returns false otherwise.
16731
16732
16733### OH_Drawing_TypographyTextlineStyleGetHeightScale()
16734
16735```
16736double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* )
16737```
16738
16739**Description**
16740
16741Obtains the height scale factor of a text line style.
16742
16743**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16744
16745**Since**: 12
16746
16747**Parameters**
16748
16749| Name                       | Description                                                  |
16750| -------------------------- | ------------------------------------------------------------ |
16751| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16752
16753**Returns**
16754
16755Returns the font height scale factor.
16756
16757
16758### OH_Drawing_TypographyTextlineStyleGetSpacingScale()
16759
16760```
16761double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* )
16762```
16763
16764**Description**
16765
16766Obtains the spacing scale factor of a text line style.
16767
16768**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16769
16770**Since**: 12
16771
16772**Parameters**
16773
16774| Name                       | Description                                                  |
16775| -------------------------- | ------------------------------------------------------------ |
16776| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16777
16778**Returns**
16779
16780Returns the spacing scale factor.
16781
16782
16783### OH_Drawing_TypographyTextSetHeightBehavior()
16784
16785```
16786void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode )
16787```
16788
16789**Description**
16790
16791Sets a text height modifier pattern.
16792
16793**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16794
16795**Since**: 12
16796
16797**Parameters**
16798
16799| Name                       | Description                                                  |
16800| -------------------------- | ------------------------------------------------------------ |
16801| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). |
16802| heightMode                 | Text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior). |
16803
16804
16805### OH_Drawing_TypographyUpdateFontSize()
16806
16807```
16808void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize )
16809```
16810
16811**Description**
16812
16813Updates the font size in a typography object.
16814
16815**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing
16816
16817**Since**: 12
16818
16819**Parameters**
16820
16821| Name                  | Description                                                  |
16822| --------------------- | ------------------------------------------------------------ |
16823| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). |
16824| from                  | Original font size.                                          |
16825| to                    | New font size.                                               |
16826| fontSize              | Font size.                                                   |