1# Drawing 2 3 4## Overview 5 6The Drawing module provides the functions for 2D graphics rendering, text drawing, and image display. It uses the physical pixel unit, px. The module operates under a single-threaded model. The caller needs to manage thread safety and context state transitions. 7 8**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9 10**Since**: 8 11 12 13## Summary 14 15 16### Files 17 18| Name| Description| 19| -------- | -------- | 20| [drawing_bitmap.h](drawing__bitmap_8h.md) | Declares the functions related to the bitmap in the drawing module.| 21| [drawing_brush.h](drawing__brush_8h.md) | Declares the functions related to the brush in the drawing module.| 22| [drawing_canvas.h](drawing__canvas_8h.md) | Declares the functions related to the canvas in the drawing module. By default, the canvas has a black brush with anti-aliasing enabled but no any other style. This default brush takes effect only when no brush or pen is proactively set in the canvas. Canvases that are not set for recording will immediately draw the commands onto the bound bitmap, whereas canvases designated for recording will store the drawing commands for future replay.| 23| [drawing_color.h](drawing__color_8h.md) | Declares the functions related to the color in the drawing module.| 24| [drawing_color_filter.h](drawing__color__filter_8h.md) | Declares the functions related to the color filter in the drawing module.| 25| [drawing_error_code.h](drawing__error__code_8h.md) | Declares the functions related to the error code in the drawing module.| 26| [drawing_color_space.h](drawing__color__space_8h.md) | Declares the functions related to the color space in the drawing module.| 27| [drawing_filter.h](drawing__filter_8h.md) | Declares the functions related to the filter in the drawing module.| 28| [drawing_font.h](drawing__font_8h.md) | Declares the functions related to the font in the drawing module.| 29| [drawing_font_collection.h](drawing__font__collection_8h.md) | Declares the functions related to the font collection in the drawing module.| 30| [drawing_font_mgr.h](drawing__font__mgr_8h.md) | Declares the functions related to font management in the drawing module. The functions can be used to load fonts and match available fonts in the system.| 31| [drawing_gpu_context.h](drawing__gpu__context_8h.md) | Declares the functions related to the GPU context in the drawing module.| 32| [drawing_image.h](drawing__image_8h.md) | Declares the functions related to the image in the drawing module.| 33| [drawing_image_filter.h](drawing__image__filter_8h.md) | Declares the functions related to the image filter in the drawing module.| 34| [drawing_mask_filter.h](drawing__mask__filter_8h.md) | Declares the functions related to the mask filter in the drawing module.| 35| [drawing_matrix.h](drawing__matrix_8h.md) | Declares the functions related to the matrix in the drawing module.| 36| [drawing_memory_stream.h](drawing__memory__stream_8h.md) | Declares the functions related to the memory stream in the drawing module.| 37| [drawing_path.h](drawing__path_8h.md) | Declares the functions related to the path in the drawing module.| 38| [drawing_path_effect.h](drawing__path__effect_8h.md) | Declares the functions related to the bitmap in the drawing module.| 39| [drawing_pen.h](drawing__pen_8h.md) | Declares the functions related to the pen in the drawing module.| 40| [drawing_pixel_map.h](drawing__pixel__map_8h.md) | Declares the functions related to the pixel map in the drawing module.| 41| [drawing_point.h](drawing__point_8h.md) | Declares the functions related to the coordinate point in the drawing module.| 42| [drawing_record_cmd.h](drawing__record__cmd_8h.md) | Declares the functions related to a recording command object.| 43| [drawing_rect.h](drawing__rect_8h.md) | Declares the functions related to the rectangle in the drawing module.| 44| [drawing_region.h](drawing__region_8h.md) | Declares the functions related to the region in the drawing module, including creating a region, setting the boundary, and destroying a region.| 45| [drawing_register_font.h](drawing__register__font_8h.md) | Declares the functions related to the font manager in the drawing module.| 46| [drawing_round_rect.h](drawing__round__rect_8h.md) | Declares the functions related to the rounded rectangle in the drawing module.| 47| [drawing_sampling_options.h](drawing__sampling__options_8h.md) | Declares the functions related to the sampling options in the drawing module. It is used for image or texture sampling.| 48| [drawing_shader_effect.h](drawing__shader__effect_8h.md) | Declares the functions related to the shader effect in the drawing module.| 49| [drawing_shadow_layer.h](drawing__shadow__layer_8h.md) | Declares the functions related to the shadow in the drawing module.| 50| [drawing_surface.h](drawing__surface_8h.md) | Declares the functions related to the surface in the drawing module, including creating, destroying, and using the surface.| 51| [drawing_text_blob.h](drawing__text__blob_8h.md) | Declares the functions related to the text blob in the drawing module.| 52| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | Declares the structs related to text in 2D drawing.| 53| [drawing_text_font_descriptor.h](drawing__text__font__descriptor_8h.md) | Declares the capabilities of font information, such as obtaining font information and searching for a font.| 54| [drawing_text_typography.h](drawing__text__typography_8h.md) | Declares the functions related to typography in the drawing module.| 55| [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.| 56| [drawing_types.h](drawing__types_8h.md) | Declares the data types of the canvas, brush, pen, bitmap, and path used to draw 2D graphics.| 57 58 59### Structs 60 61| Name| Description| 62| -------- | -------- | 63| struct [OH_Drawing_String](_o_h___drawing___string.md) | Describes a string of characters encoded in UTF-16.| 64| struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | Describes the pixel format of a bitmap, including the color type and alpha type.| 65| struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Describes the measurement information about a font.| 66| struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | Describes the options about the GPU context.| 67| struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | Describes a run, which provides storage for glyphs and positions.| 68| struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | Describes the placeholder that acts as a span.| 69| struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Describes the detailed information about a system font.| 70| struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | Describes the measurement information about a line of text.| 71| struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | Describes the information about a font fallback.| 72| struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | Describes the information about a font fallback group.| 73| struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | Describes the information about a font weight mapping.| 74| struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | Describes the information about a font alias.| 75| struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | Describes the information about generic fonts supported by the system.| 76| struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | Describes the information about a system font configuration.| 77| struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Describes a font style.| 78| struct [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | Describes a font feature.| 79| 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.| 80| struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Describes a two-dimensional coordinate point.| 81| struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | Describes a three-dimensional coordinate point.| 82| struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Describes the image information.| 83| struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | Describes the style of a rectangle.| 84 85 86### Types 87 88| Name| Description| 89| -------- | -------- | 90| typedef struct [OH_Drawing_String](_o_h___drawing___string.md) [OH_Drawing_String](#oh_drawing_string) | Defines a struct for a string of characters encoded in UTF-16.| 91| typedef enum [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) | Defines an enum for the system font types.| 92| typedef struct [OH_Drawing_Array](#oh_drawing_array) [OH_Drawing_Array](#oh_drawing_array) | Defines a struct for an array object, which is used to store multiple objects of the same type.| 93| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | Defines a struct for font arguments.| 94| 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.| 95| 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.| 96| 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.| 97| 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.| 98| 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.| 99| 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.| 100| 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.| 101| 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.| 102| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | Defines a struct that describes the pixel format of a bitmap, including the color type and alpha type.| 103| 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.| 104| 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.| 105| 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.| 106| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | Defines an enum for the canvas clipping modes.| 107| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontEdging](#oh_drawing_fontedging) | Defines an enum for the font edging types.| 108| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | Defines an enum for the font hinting types.| 109| 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.| 110| 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.| 111| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype) [OH_Drawing_BlurType](#oh_drawing_blurtype) | Defines an enum for the blur types.| 112| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | Defines an enum for the matrix scaling modes.| 113| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection) [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | Defines an enum for the directions of a closed contour.| 114| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | Defines an enum for the fill types of a path.| 115| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | Defines an enum for the path adding modes.| 116| 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.| 117| 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.| 118| 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.| 119| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode) [OH_Drawing_FilterMode](#oh_drawing_filtermode) | Defines an enum for the filter modes.| 120| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | Defines an enum for the mipmap modes.| 121| 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.| 122| 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.| 123| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection) [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | Defines a struct used to load fonts.| 124| 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.| 125| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle) [OH_Drawing_TextStyle](#oh_drawing_textstyle) | Defines a struct used to manage text colors and decorations.| 126| 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.| 127| 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.| 128| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox) [OH_Drawing_TextBox](#oh_drawing_textbox) | Defines a struct used to receive the rectangle size, direction, and quantity of text boxes.| 129| 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 font.| 130| typedef struct [OH_Drawing_Range](#oh_drawing_range) [OH_Drawing_Range](#oh_drawing_range) | Defines a struct used to receive the start position and end position of a font.| 131| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow) [OH_Drawing_TextShadow](#oh_drawing_textshadow) | Defines a struct used to manage text shadows.| 132| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser) [OH_Drawing_FontParser](#oh_drawing_fontparser) | Defines a struct used to parse system font files.| 133| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | Defines an enum for vertical alignment modes of placeholders.| 134| 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.| 135| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | Defines an enum for text decoration styles.| 136| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | Defines an enum for ellipsis styles.| 137| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | Defines an enum for text break strategies.| 138| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | Defines an enum for word break types.| 139| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | Defines an enum for rectangle height styles.| 140| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | Defines an enum for rectangle width styles.| 141| 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.| 142| 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.| 143| 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.| 144| 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.| 145| 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.| 146| 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.| 147| 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.| 148| 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.| 149| 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.| 150| 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.| 151| 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.| 152| 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.| 153| 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.| 154| 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.| 155| 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.| 156| 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.| 157| 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.| 158| typedef struct [OH_Drawing_Point](#oh_drawing_point) [OH_Drawing_Point](#oh_drawing_point) | Defines a struct for a coordinate point.| 159| 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.| 160| 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.| 161| 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.| 162| 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.| 163| 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.| 164| typedef struct [OH_Drawing_Rect](#oh_drawing_rect) [OH_Drawing_Rect](#oh_drawing_rect) | Defines a struct for a rectangle.| 165| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect) [OH_Drawing_RoundRect](#oh_drawing_roundrect) | Defines a struct for a rounded rectangle.| 166| 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.| 167| 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.| 168| 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.| 169| 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.| 170| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | Defines a struct for a mask filter.| 171| 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.| 172| typedef struct [OH_Drawing_Font](#oh_drawing_font) [OH_Drawing_Font](#oh_drawing_font) | Defines a struct for a font.| 173| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream) [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | Defines a struct for a memory stream.| 174| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface) [OH_Drawing_Typeface](#oh_drawing_typeface) | Defines a struct for a typeface.| 175| 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.| 176| 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.| 177| 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.| 178| 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.| 179| 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.| 180| 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.| 181| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | Defines an enum for the storage formats of bitmap pixels.| 182| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | Defines an enum for the alpha formats of bitmap pixels.| 183| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode) [OH_Drawing_BlendMode](#oh_drawing_blendmode) | Defines an enum for the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule).| 184| 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.| 185| 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.| 186| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding) [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | Defines an enum for the text encoding types.| 187| 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.| 188| 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.| 189| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | Defines an enum for the shadow flags.| 190 191### Enums 192 193| Name| Description| 194| -------- | -------- | 195| [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype-1) { ALL = 1 << 0, GENERIC = 1 << 1, STYLISH = 1 << 2, INSTALLED = 1 << 3 } | Enumerates the system font types.| 196| [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.| 197| [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.| 198| [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.| 199| [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.| 200| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | Enumerates the constraint types of the source rectangle.| 201| [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.| 202| [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.| 203| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | Enumerates the canvas clipping modes.| 204| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | Enumerates the font edging types.| 205| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | Enumerates the font hinting types.| 206| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | Enumerates the blur types.| 207| [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.| 208| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | Enumerates the directions of a closed contour.| 209| [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.| 210| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | Enumerates the path adding modes.| 211| [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.| 212| [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.| 213| [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.| 214| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | Enumerates the filter modes.| 215| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | Enumerates the mipmap modes.| 216| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | Enumerates the tile modes of the shader effect.| 217| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | Enumerates the text directions.| 218| [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.| 219| [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.| 220| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | Enumerates the text baselines.| 221| [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.| 222| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | Enumerates the font styles.| 223| [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.| 224| [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.| 225| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | Enumerates the ellipsis styles.| 226| [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.| 227| [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.| 228| [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.| 229| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | Enumerates the rectangle width styles.| 230| [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.| 231| [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.| 232| [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.| 233| [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.| 234| [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.| 235| [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.| 236| [OH_Drawing_BlendMode](#oh_drawing_blendmode-1) {<br>BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST, BLEND_MODE_SRC_OVER,<br>BLEND_MODE_DST_OVER, BLEND_MODE_SRC_IN, BLEND_MODE_DST_IN, BLEND_MODE_SRC_OUT,<br>BLEND_MODE_DST_OUT, BLEND_MODE_SRC_ATOP, BLEND_MODE_DST_ATOP, BLEND_MODE_XOR,<br>BLEND_MODE_PLUS, BLEND_MODE_MODULATE, BLEND_MODE_SCREEN, BLEND_MODE_OVERLAY,<br>BLEND_MODE_DARKEN, BLEND_MODE_LIGHTEN, BLEND_MODE_COLOR_DODGE, BLEND_MODE_COLOR_BURN,<br>BLEND_MODE_HARD_LIGHT, BLEND_MODE_SOFT_LIGHT, BLEND_MODE_DIFFERENCE, BLEND_MODE_EXCLUSION,<br>BLEND_MODE_MULTIPLY, BLEND_MODE_HUE, BLEND_MODE_SATURATION, BLEND_MODE_COLOR,<br>BLEND_MODE_LUMINOSITY<br>} | Enumerates the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule).| 237| [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.| 238| [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.| 239 240### Functions 241 242| Name| Description| 243| -------- | -------- | 244| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontSetThemeFontFollowed](#oh_drawing_fontsetthemefontfollowed) ([OH_Drawing_Font](#oh_drawing_font) \*font, bool followed) | Sets whether to follow the theme font. When **followed** is set to **true**, the theme font is used if it is enabled by the system and no typeface is set.| 245| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontIsThemeFontFollowed](#oh_drawing_fontisthemefontfollowed) (const [OH_Drawing_Font](#oh_drawing_font) \*font, bool \*followed) | Checks whether the font follows the theme font. By default, the theme font is not followed.| 246| OH_Drawing_FontCollection \* [OH_Drawing_GetFontCollectionGlobalInstance](#oh_drawing_getfontcollectionglobalinstance) (void) | Obtains the global **OH_Drawing_FontCollection** object, which can be used to sense the theme font information. Do not release the object. | 247| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | Creates an **OH_Drawing_Bitmap** object.| 248| 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.| 249| [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.| 250| 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.| 251| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the width of a bitmap.| 252| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | Obtains the height of a bitmap.| 253| [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.| 254| [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.| 255| 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.| 256| 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.| 257| 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.| 258| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | Creates an **OH_Drawing_Brush** object.| 259| [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.| 260| 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.| 261| 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.| 262| 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.| 263| 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.| 264| 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.| 265| 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.| 266| 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.| 267| 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.| 268| 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.| 269| 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.| 270| 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.| 271| 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.| 272| 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.| 273| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | Creates an **OH_Drawing_Canvas** object.| 274| 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.| 275| 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.)| 276| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Attaches a pen to a canvas so that the canvas can use the style and color of the pen to outline a shape. If the pen effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.| 277| 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.| 278| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | Attaches a brush to a canvas so that the canvas can use the style and color of the brush to fill in a shape. If the brush effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing.| 279| 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.| 280| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Saves the current canvas status (canvas matrix) to the top of the stack. This function must be used in pair with [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore).| 281| 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.| 282| 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.| 283| 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.| 284| 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).| 285| 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.| 286| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | Draws a path.| 287| 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.| 288| 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.| 289| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | Draws a region.| 290| [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.| 291| 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.| 292| 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).| 293| 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.| 294| 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.| 295| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Resets the matrix of this canvas to an identity matrix.| 296| 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.| 297| 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.| 298| 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.| 299| 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.| 300| 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.| 301| [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.| 302| [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.| 303| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws a rectangle.| 304| 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.| 305| [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.| 306| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | Draws an oval.| 307| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | Draws an arc. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn.| 308| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | Draws a rounded rectangle.| 309| [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.| 310| 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.| 311| 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.| 312| [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.| 313| [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.| 314| [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.| 315| [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.| 316| [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.| 317| [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.| 318| 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.| 319| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | Creates an sRGB color space.| 320| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | Creates an sRGB linear (Gamma 1.0) color space.| 321| 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.| 322| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | Obtains the error code of the module.| 323| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | Creates an **OH_Drawing_Filter** object.| 324| 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.| 325| 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.| 326| 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.| 327| 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.| 328| 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.| 329| 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.| 330| 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.| 331| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | Sets a font edging effect.| 332| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font edging effect.| 333| 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.| 334| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether auto hinting is forcibly used.| 335| 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.| 336| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether sub-pixel rendering is used for a font.| 337| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | Creates an **OH_Drawing_Font** object.| 338| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | Sets a typeface for a font.| 339| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the typeface of a font.| 340| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | Sets the text size for a font.| 341| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the text size.| 342| 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.| 343| 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.| 344| 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.| 345| [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.| 346| [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.| 347| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | Sets linear scaling for a font.| 348| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether linear scaling is used for a font.| 349| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | Sets a horizontal skew factor for a font.| 350| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal skew factor of a font.| 351| 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.| 352| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether fake bold is used for a font.| 353| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | Sets a horizontal scale factor for a font.| 354| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the horizontal scale factor of a font.| 355| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | Sets a font hinting effect.| 356| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Obtains the font hinting effect.| 357| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | Sets whether to use bitmaps in a font.| 358| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | Checks whether bitmaps are used in a font.| 359| 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.| 360| 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.| 361| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object.| 362| 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.| 363| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the alternate fonts.| 364| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | Disables the system fonts.| 365| [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.| 366| 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.)| 367| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | Creates an **OH_Drawing_FontMgr** object.| 368| 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.| 369| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | Obtains the number of font families.| 370| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | Obtains the font family name based on an index.| 371| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | Reclaims the memory occupied by a font family name.| 372| [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.| 373| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Reclaims the memory occupied by a font style set.| 374| [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.| 375| [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.| 376| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontMgrMatchFamilyStyleCharacter](#oh_drawing_fontmgrmatchfamilystylecharacter) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md), const char \*bcp47[], int bcp47Count, int32_t character) | Obtains a typeface for the specified character. A null pointer is returned only when no typeface corresponding to the input UTF-8 character is found in the **OH_Drawing_FontMgr** object.| 377| [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.| 378| [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.| 379| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | Reclaims the memory occupied by a font style.| 380| [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.| 381| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | Obtains the number of fonts in the font style set.| 382| [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.| 383| 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.| 384| [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.| 385| 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.| 386| 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.| 387| 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.| 388| 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.| 389| 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.| 390| [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.| 391| [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.| 392| 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.| 393| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | Creates an **OH_Drawing_MaskFilter** object with a blur type.| 394| 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.| 395| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | Creates an **OH_Drawing_Matrix** object.| 396| [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).| 397| [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).| 398| [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).| 399| 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.| 400| 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.| 401| 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).| 402| 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).| 403| 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).| 404| 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).| 405| 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).| 406| 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).| 407| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Resets a matrix to an identity matrix.| 408| void [OH_Drawing_MatrixConcat](#oh_drawing_matrixconcat) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*total, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*a, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*b) | Multiplies two matrices to produce a new matrix. For example, if a given matrix a and a given matrix b are shown as follows:\| A B C \| \| J K L \| a = \| D E F \|, b = \| M N O \| \| G H I \| \| P Q R \| then the final matrix total is as follows:\| A B C \| \| J K L \| \| AJ+BM+CP AK+BN+CQ AL+BO+CR \| total = a \* b = \| D E F \| \* \| M N O \| = \| DJ+EM+FP DK+EN+FQ DL+EO+FR \| \| G H I \| \| P Q R \| \| GJ+HM+IP GK+HN+IQ GL+HO+IR \| | 409| [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.| 410| 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.| 411| 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).| 412| 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).| 413| 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).| 414| 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.| 415| 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].| 416| 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.| 417| 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.| 418| 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.| 419| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | Checks whether an **OH_Drawing_Matrix** object is an identity matrix.| 420| 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.| 421| [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.| 422| 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.| 423| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | Creates an **OH_Drawing_Path** object.| 424| [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.| 425| 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.| 426| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | Sets the start point of a path.| 427| 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.| 428| 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.| 429| 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.| 430| 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.| 431| 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.| 432| 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.| 433| 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.| 434| 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.| 435| 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.| 436| 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.| 437| void [OH_Drawing_PathAddRect](#oh_drawing_pathaddrect) ([OH_Drawing_Path](#oh_drawing_path) \*, float left, float top, float right, float bottom, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds a rectangle to this path in the specified direction. The start point is the upper left corner of the rectangle.| 438| 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.| 439| void [OH_Drawing_PathAddRoundRect](#oh_drawing_pathaddroundrect) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*roundRect, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | Adds a rounded rectangle to a path in the specified direction. When the path direction is clockwise, the start point is at the intersection of the rounded rectangle's left boundary and its lower left corner. When the path direction is counterclockwise, the start point is at the intersection point between the left boundary and the upper left corner.| 440| 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.| 441| 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.| 442| 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.| 443| 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.| 444| 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.| 445| 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.| 446| 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.| 447| 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.| 448| 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.| 449| 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.| 450| 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).| 451| 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.| 452| 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 path by a matrix. uses the new one to replace the **dst** path. If **dst** is NULL, the **src** path is replaced.| 453| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | Sets the fill type of this path. The fill type determines how "inside" of the path is drawn.| 454| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | Obtains the length of a path.| 455| 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.| 456| 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.| 457| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | Checks whether a path is closed.| 458| 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.| 459| 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.| 460| 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.| 461| 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.| 462| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | Resets path data.| 463| [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.| 464| 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.| 465| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | Creates an **OH_Drawing_Pen** object.| 466| [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.| 467| 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.| 468| 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.| 469| 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.| 470| 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.| 471| 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.| 472| 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.| 473| 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.| 474| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | Obtains the thickness of a pen. This thickness determines the width of the outline of a shape.| 475| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | Sets the thickness for a pen. This thickness determines the width of the outline of a shape.| 476| 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.| 477| 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.| 478| [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.| 479| 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.| 480| [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.| 481| 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.| 482| 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.| 483| 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.| 484| 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.| 485| 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.| 486| 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.| 487| 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.| 488| 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.| 489| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | Resets a pen to the initial state.| 490| [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.| 491| [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.| 492| 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).| 493| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | Creates an **OH_Drawing_Point** object.| 494| [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.| 495| [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.| 496| [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.| 497| 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.| 498| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | Creates an **OH_Drawing_RecordCmdUtils** object.| 499| [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.| 500| [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.| 501| [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.| 502| [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.| 503| [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.| 504| 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.| 505| 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.| 506| 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.| 507| 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.| 508| 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.| 509| 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.| 510| 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.| 511| 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.| 512| 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.| 513| 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.| 514| 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.| 515| 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.| 516| 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.| 517| 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.| 518| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | Creates an **OH_Drawing_Region** object for more accurate graphical control.| 519| 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.| 520| 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.| 521| 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.| 522| 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.| 523| 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.| 524| 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.| 525| 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.| 526| [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.| 527| 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.| 528| [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.| 529| 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.| 530| [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.| 531| [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.| 532| 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.| 533| [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.| 534| [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.| 535| [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.| 536| [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.| 537| [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.| 538| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateSweepGradient](#oh_drawing_shadereffectcreatesweepgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | Creates an **OH_Drawing_ShaderEffect** object that generates a sweep gradient based on the center. A sweep gradient paints a gradient in a sweeping arc ranging from 0° to 360°.| 539| [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.| 540| [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.| 541| 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.| 542| [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.| 543| 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.| 544| [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.| 545| [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.| 546| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied.| 547| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | Creates an **OH_Drawing_TextBlobBuilder** object.| 548| [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.| 549| [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.| 550| [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.| 551| 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.| 552| 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.| 553| 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.| 554| [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**.| 555| 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.| 556| 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.| 557| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_GetFontDescriptorByFullName](#oh_drawing_getfontdescriptorbyfullname) (const [OH_Drawing_String](_o_h___drawing___string.md) \*, [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | Obtains a font descriptor based on the font name and type. System fonts, style fonts, and user-installed fonts are supported. A font descriptor is a data structure that describes font features. It contains details of the font appearance and properties.| 558| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetSystemFontFullNamesByType](#oh_drawing_getsystemfontfullnamesbytype) ([OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | Obtains an array of font names by font type.| 559| const [OH_Drawing_String](_o_h___drawing___string.md) \* [OH_Drawing_GetSystemFontFullNameByIndex](#oh_drawing_getsystemfontfullnamebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*, size_t) | Obtains the font name with the specified index in the font name array.| 560| void [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) ([OH_Drawing_Array](#oh_drawing_array) \*) | Releases the memory occupied by the font name array obtained by font type.| 561| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | Creates an **OH_Drawing_TypographyStyle** object. When [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) is no longer required, call [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) to release the pointer to the object.| 562| 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.| 563| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text direction in a typography style.| 564| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text alignment mode.| 565| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.| 566| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the maximum number of lines in the text.| 567| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | Creates an **OH_Drawing_TextStyle** object.| 568| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the default text style of a typography style.| 569| 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.| 570| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the color for a text style.| 571| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the font size for a text style.| 572| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font weight for a text style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.| 573| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the baseline for a text style.| 574| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration for a text style.| 575| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | Sets the decoration color for a text style.| 576| 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.| 577| 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.| 578| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the font style for a text style.| 579| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the locale for a text style.| 580| 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.| 581| 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.| 582| 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.| 583| 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.| 584| 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.| 585| 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.| 586| 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.| 587| 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.| 588| [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. | 589| 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.| 590| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Pushes the text style.| 591| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | Adds text.| 592| 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.| 593| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | Creates an **OH_Drawing_Typography** object. | 594| 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.| 595| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | Lays out the typography.| 596| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | Draws text from the upper left corner at a specified position. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.| 597| 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.| 598| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the typography width set by the user. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 599| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the overall height of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 600| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.| 601| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the width of the longest line of a typography object, including its indentation. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned.| 602| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the minimum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 603| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the maximum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 604| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the alphabetic baseline in a typography object.| 605| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the ideographic baseline in a typography object.| 606| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | Sets a placeholder for a text style.| 607| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Checks whether the maximum number of lines of a typography object is exceeded. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. If the maximum number of lines is not set by calling [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines), **false** is returned.| 608| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t, size_t, [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle), [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)) | Obtains text boxes in a given range of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.| 609| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains text boxes for placeholders in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object.| 610| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the left position of a text box.| 611| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the right position of a text box.| 612| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the top position of a text box.| 613| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the bottom position of a text box.| 614| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | Obtains the text direction of a text box.| 615| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Obtains the number of text boxes.| 616| [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.| 617| [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.| 618| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object.| 619| 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.| 620| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | Obtains the word boundary in a typography object.| 621| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the start position of an **OH_Drawing_Range** object.| 622| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | Obtains the end position of an **OH_Drawing_Range** object.| 623| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of lines in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 624| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the decoration style for a text style.| 625| 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.| 626| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the letter spacing for a text style.| 627| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | Sets the word spacing for a text style.| 628| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | Sets whether to enable half leading for a text style.| 629| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | Sets the ellipsis content for a text style.| 630| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | Sets the ellipsis style for a text style.| 631| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text break strategy.| 632| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the word break type.| 633| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text ellipsis style for a typography style.| 634| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | Sets the ellipsis text for a typography style.| 635| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line height in a typography object. This function must be called after [OH_Drawing_TypographyLayout](_drawing.md#oh_drawing_typographylayout) is called.| 636| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains the line width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 637| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | Sets the text split ratio.| 638| 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.| 639| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Checks whether an ellipsis is configured for a typography style.| 640| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) | Sets the locale for a typography style.| 641| 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.| 642| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Sets a text style.| 643| [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.| 644| 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.| 645| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | Creates an **OH_Drawing_FontParser** object to parse a system font.| 646| 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.| 647| 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.| 648| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | Reclaims the memory occupied by the system font list.| 649| [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.| 650| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \* [OH_Drawing_TypographyGetLineMetrics](#oh_drawing_typographygetlinemetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the line metrics in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) is no longer required, call [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) to release the pointer to the object.| 651| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the number of lines.| 652| 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.| 653| bool [OH_Drawing_TypographyGetLineMetricsAt](#oh_drawing_typographygetlinemetricsat) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the metrics of a given line in a typography object. For details, see [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 654| bool [OH_Drawing_TypographyGetLineInfo](#oh_drawing_typographygetlineinfo) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool, bool, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | Obtains the metrics of a given line or the metrics of the first character in a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called.| 655| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the default font weight for a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.| 656| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the default font style for a typography style.| 657| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | Sets the font family name for text.| 658| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for text.| 659| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for text.| 660| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for text.| 661| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style.| 662| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the text font weight of the strut style in a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.| 663| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | Sets the font style of the strut style in a typography style.| 664| 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.| 665| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font size for a text line style.| 666| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the font height for a text line style.| 667| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable half leading for the strut style in a typography style.| 668| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | Sets the spacing scale factor for a text line style.| 669| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | Sets whether to enable the text line style only.| 670| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | Creates an **OH_Drawing_TextShadow** object. | 671| 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.| 672| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains a text shadow container. | 673| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a text shadow container.| 674| 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.| 675| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all shadows in a text shadow container.| 676| [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.| 677| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | Sets indents for typography. If this function is not called, texts will have no indentation applied.| 678| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | Obtains indents with a given index in a typography object. The line index starts from 0.| 679| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | Obtains the line bounds in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. This function can only be used to obtain the bounds of existing lines. That is, the line index must start from 0, and the maximum index is [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1.| 680| 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.| 681| [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.| 682| 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.| 683| 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.| 684| [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.| 685| void [OH_Drawing_SetTypographyStyleFontStyleStruct](#oh_drawing_settypographystylefontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyle) | Sets the font style, including the font weight, width, and slant, for the default text style of a typography style.| 686| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | Obtains the font style, including the font weight, width, and slant, of the default text style of a typography style.| 687| 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.| 688| 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.| 689| 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.| 690| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*, const float) | Adds a font variation. This function takes effect only when the corresponding font file (.ttf file) supports variable adjustment. Otherwise, calling this function does not take effect.| 691| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains all the contents in a font feature map container of a text style.| 692| 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.| 693| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the size of a font feature map container in a text style.| 694| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Clears all the contents in a font feature map container of a text style.| 695| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the baseline drift of a text style.| 696| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | Sets a baseline drift for a text style.| 697| 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.| 698| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text height modifier pattern.| 699| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \* [OH_Drawing_TypographyGetLineFontMetrics](#oh_drawing_typographygetlinefontmetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t lineNumber, size_t \*fontMetricsSize) | Obtains all font metrics from a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. Otherwise, a null pointer is returned. When [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) is no longer required, call [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) to release the pointer to the object.| 700| 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.| 701| 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. | 702| 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.| 703| 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.| 704| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Sets a placeholder for a text style.| 705| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | Checks whether a placeholder is set for a text style.| 706| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | Obtains the text alignment mode.| 707| 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.| 708| 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.| 709| [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.| 710| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | Reclaims the memory occupied by a strut style.| 711| 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.| 712| 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.| 713| 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.| 714| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | Obtains the number of unresolved glyphs in a typography object. This function can be called only after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied.| 715| 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.| 716| 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.| 717| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font weight of the strut style in a typography style.| 718| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font style of the strut style in the typography style.| 719| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font families of the strut style in the typography style.| 720| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | Reclaims the memory occupied by the font families.| 721| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the font size of a text line style.| 722| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the height scale factor of a text line style.| 723| 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.| 724| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Checks whether half leading is enabled for a text line style.| 725| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the spacing scale factor of a text line style.| 726| 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.| 727| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text alignment mode.| 728| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text direction of a typography style.| 729| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the maximum number of lines.| 730| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | Obtains the text ellipsis content of a typography style.| 731| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | Reclaims the memory occupied by the text ellipsis names.| 732| bool [OH_Drawing_TypographyStyleEquals](#oh_drawing_typographystyleequals) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*from, [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*to) | Checks whether two typography styles are the same. The text height modifier mode [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) is not involved in the comparison.| 733| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the color of a text style.| 734| [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.| 735| [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.| 736| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font style of a text style.| 737| [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.| 738| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | Obtains the font families of a text style.| 739| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | Reclaims the memory occupied by the font families| 740| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font size of a text style.| 741| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the letter spacing of a text style.| 742| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the word spacing of a text style.| 743| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the font height of a text style.| 744| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Checks whether half leading is enabled for a text style.| 745| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | Obtains the locale of a text style.| 746| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | Releases the memory occupied by a text box.| 747| 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.| 748| size_t [OH_Drawing_GetDrawingArraySize](#oh_drawing_getdrawingarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*drawingArray) | Obtains the number of objects in an [OH_Drawing_Array](#oh_drawing_array).| 749| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | Creates a default **OH_Drawing_Typeface** object.| 750| [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.| 751| [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).| 752| [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.| 753| [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.| 754| 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.| 755| [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.| 756| [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.| 757| [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.| 758| enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | Defines an enum for the shadow flags.| 759| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | Defines an enum for the shadow flags.| 760| 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.| 761| 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.| 762| 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.| 763| [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.| 764| 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.| 765| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | Translates a canvas by a given distance.| 766| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | Scales a canvas.| 767| 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\| | 768| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | Clears a canvas by using a given color.| 769| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas width.| 770| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | Obtains the canvas height.| 771| 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.| 772| 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.| 773| 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.| 774| 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.| 775| [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.| 776 777## Type Description 778 779 780### OH_Drawing_Array 781 782``` 783typedef struct OH_Drawing_Array OH_Drawing_Array 784``` 785 786**Description** 787 788Defines a struct for an array object, which is used to store multiple objects of the same type. 789 790**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 791 792**Since**: 14 793 794### OH_Drawing_String 795 796``` 797typedef struct OH_Drawing_String OH_Drawing_String 798``` 799 800**Description** 801 802Defines a struct for a string of characters encoded in UTF-16. 803 804**Since**: 14 805 806 807### OH_Drawing_SystemFontType 808 809``` 810typedef enum OH_Drawing_SystemFontType OH_Drawing_SystemFontType 811``` 812 813**Description** 814 815Defines an enum for the system font types. 816 817**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 818 819**Since**: 14 820 821 822### OH_Drawing_FontArguments 823 824``` 825typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments 826``` 827 828**Description** 829 830Defines a struct for font arguments. 831 832**Since**: 13 833 834### OH_Drawing_RecordCmd 835 836``` 837typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd 838``` 839 840**Description** 841 842Defines the recording command class, which is used to store the set of recording commands. 843 844**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 845 846**Since**: 13 847 848 849### OH_Drawing_RecordCmdUtils 850 851``` 852typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils 853``` 854 855**Description** 856 857Defines the recording command tool, which is used to generate recording commands. 858 859**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 860 861**Since**: 13 862 863 864### OH_Drawing_ErrorCode 865 866``` 867typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode 868``` 869 870 871**Description** 872 873Defines an enum for the error codes that may be generated by the module. 874 875**Since**: 12 876 877 878### OH_Drawing_PathOpMode 879 880``` 881typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode 882``` 883 884**Description** 885 886Defines an enum for the operation modes available for a path. 887 888**Since**: 12 889 890 891### OH_Drawing_PathMeasureMatrixFlags 892 893``` 894typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags 895``` 896 897**Description** 898 899Defines an enum for the types of matrix information obtained during path measurement. 900 901**Since**: 12 902 903 904### OH_Drawing_RegionOpMode 905 906``` 907typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode 908``` 909 910**Description** 911 912Defines an enum for the operation modes available for a region. 913 914**Since**: 12 915 916 917### OH_Drawing_ImageFilter 918 919``` 920typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter 921``` 922 923**Description** 924 925Defines a struct for an image filter, which is used to operate all color bits that make up image pixels. 926 927**Since**: 12 928 929 930### OH_Drawing_Filter 931 932``` 933typedef struct OH_Drawing_Filter OH_Drawing_Filter 934``` 935 936**Description** 937 938Defines a struct for a filter, which consists of a color filter, mask filter, and image filter. 939 940**Since**: 11 941 942### OH_Drawing_AlphaFormat 943 944``` 945typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat 946``` 947 948**Description** 949 950Defines an enum for the alpha formats of bitmap pixels. 951 952**Since**: 8 953 954 955### OH_Drawing_Bitmap 956 957``` 958typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap 959``` 960 961**Description** 962 963Defines a struct for a bitmap, which is a memory area that contains the pixel data of a shape. 964 965**Since**: 8 966 967 968### OH_Drawing_BitmapFormat 969 970``` 971typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat 972``` 973 974**Description** 975 976Defines a struct for the pixel format of a bitmap, including the color type and alpha type. 977 978**Since**: 8 979 980 981### OH_Drawing_BlendMode 982 983``` 984typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode 985``` 986 987**Description** 988 989Defines an enum for the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule). The operations for the alpha channel are used as examples. 990 991For brevity, the following abbreviations are used: 992 993**s**: source. 994 995**d**: destination. 996 997**sa**: source alpha. 998 999**da**: destination alpha. 1000 1001The following abbreviations are used in the calculation result: 1002 1003**r**: The calculation methods of the four channels are the same. 1004 1005**ra**: Only the alpha channel is manipulated. 1006 1007**rc**: The other three color channels are manipulated. 1008 1009**Since**: 11 1010 1011 1012### OH_Drawing_BlurType 1013 1014``` 1015typedef enum OH_Drawing_BlurType OH_Drawing_BlurType 1016``` 1017 1018**Description** 1019 1020Defines an enum for the blur types. 1021 1022**Since**: 11 1023 1024 1025### OH_Drawing_BreakStrategy 1026 1027``` 1028typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy 1029``` 1030 1031**Description** 1032 1033Defines an enum for the text break strategies. 1034 1035**Since**: 11 1036 1037 1038### OH_Drawing_Brush 1039 1040``` 1041typedef struct OH_Drawing_Brush OH_Drawing_Brush 1042``` 1043 1044**Description** 1045 1046Defines a struct for a brush, which is used to describe the style and color to fill in a shape. 1047 1048**Since**: 8 1049 1050 1051### OH_Drawing_Canvas 1052 1053``` 1054typedef struct OH_Drawing_Canvas OH_Drawing_Canvas 1055``` 1056 1057**Description** 1058 1059Defines a struct for a rectangular canvas, on which various shapes, images, and texts can be drawn by using the brush and pen. 1060 1061**Since**: 8 1062 1063 1064### OH_Drawing_CanvasClipOp 1065 1066``` 1067typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp 1068``` 1069 1070**Description** 1071 1072Defines an enum for the canvas clipping modes. 1073 1074**Since**: 11 1075 1076 1077### OH_Drawing_CanvasShadowFlags 1078 1079``` 1080typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags 1081``` 1082 1083**Description** 1084 1085Defines an enum for the shadow flags. 1086 1087**Since**: 12 1088 1089 1090### OH_Drawing_ColorFilter 1091 1092``` 1093typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter 1094``` 1095 1096**Description** 1097 1098Defines a struct for a color filter, which is used to convert a color into a new one. 1099 1100**Since**: 11 1101 1102 1103### OH_Drawing_ColorFormat 1104 1105``` 1106typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat 1107``` 1108 1109**Description** 1110 1111Defines an enum for the storage formats of bitmap pixels. 1112 1113**Since**: 8 1114 1115 1116### OH_Drawing_ColorSpace 1117 1118``` 1119typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace 1120``` 1121 1122**Description** 1123 1124Defines a struct for a color space, which is used to describe the color information. 1125 1126**Since**: 12 1127 1128 1129### OH_Drawing_Corner_Radii 1130 1131``` 1132typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii 1133``` 1134 1135**Description** 1136 1137Defines 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. 1138 1139**Since**: 12 1140 1141 1142### OH_Drawing_CornerPos 1143 1144``` 1145typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos 1146``` 1147 1148**Description** 1149 1150Defines an enum for the corner positions of a rounded rectangle. 1151 1152**Since**: 12 1153 1154 1155### OH_Drawing_EllipsisModal 1156 1157``` 1158typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal 1159``` 1160 1161**Description** 1162 1163Defines an enum for the text ellipsis styles. 1164 1165**Since**: 11 1166 1167 1168### OH_Drawing_FilterMode 1169 1170``` 1171typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode 1172``` 1173 1174**Description** 1175 1176Defines an enum for the filter modes. 1177 1178**Since**: 12 1179 1180 1181### OH_Drawing_Font 1182 1183``` 1184typedef struct OH_Drawing_Font OH_Drawing_Font 1185``` 1186 1187**Description** 1188 1189Defines a struct for a font. 1190 1191**Since**: 11 1192 1193 1194### OH_Drawing_Font_Metrics 1195 1196``` 1197typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics 1198``` 1199 1200**Description** 1201 1202Defines a struct for the measurement information about a font. 1203 1204**Since**: 12 1205 1206 1207### OH_Drawing_FontAdjustInfo 1208 1209``` 1210typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo 1211``` 1212 1213**Description** 1214 1215Defines a struct for the information about a font weight mapping. 1216 1217**Since**: 12 1218 1219 1220### OH_Drawing_FontAliasInfo 1221 1222``` 1223typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo 1224``` 1225 1226**Description** 1227 1228Defines a struct for the information about a font alias. 1229 1230**Since**: 12 1231 1232 1233### OH_Drawing_FontCollection 1234 1235``` 1236typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection 1237``` 1238 1239**Description** 1240 1241Defines a struct used to load fonts. 1242 1243**Since**: 8 1244 1245 1246### OH_Drawing_FontConfigInfo 1247 1248``` 1249typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo 1250``` 1251 1252**Description** 1253 1254Defines a struct for the information about a system font configuration. 1255 1256**Since**: 12 1257 1258 1259### OH_Drawing_FontDescriptor 1260 1261``` 1262typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor 1263``` 1264 1265**Description** 1266 1267Defines a struct for the detailed information about a system font. 1268 1269**Since**: 12 1270 1271 1272### OH_Drawing_FontEdging 1273 1274``` 1275typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging 1276``` 1277 1278**Description** 1279 1280Defines an enum for the font edging types. 1281 1282**Since**: 12 1283 1284 1285### OH_Drawing_FontFallbackGroup 1286 1287``` 1288typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup 1289``` 1290 1291**Description** 1292 1293Defines a struct for the information about a font fallback group. 1294 1295**Since**: 12 1296 1297 1298### OH_Drawing_FontFallbackInfo 1299 1300``` 1301typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo 1302``` 1303 1304**Description** 1305 1306Defines a struct for the information about a font fallback. 1307 1308**Since**: 12 1309 1310 1311### OH_Drawing_FontGenericInfo 1312 1313``` 1314typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo 1315``` 1316 1317**Description** 1318 1319Defines a struct for the information about generic fonts supported by the system. 1320 1321**Since**: 12 1322 1323 1324### OH_Drawing_FontHinting 1325 1326``` 1327typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting 1328``` 1329 1330**Description** 1331 1332Defines an enum for the font hinting types. 1333 1334**Since**: 12 1335 1336 1337### OH_Drawing_FontMgr 1338 1339``` 1340typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr 1341``` 1342 1343**Description** 1344 1345Defines a struct for the font manager, which is used for font management. 1346 1347**Since**: 12 1348 1349 1350### OH_Drawing_FontParser 1351 1352``` 1353typedef struct OH_Drawing_FontParser OH_Drawing_FontParser 1354``` 1355 1356**Description** 1357 1358Defines a struct used to parse system font files. 1359 1360**Since**: 12 1361 1362 1363### OH_Drawing_FontStyleSet 1364 1365``` 1366typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet 1367``` 1368 1369**Description** 1370 1371Defines a struct for a font style set, which is used for font style family matching. 1372 1373**Since**: 12 1374 1375 1376### OH_Drawing_FontStyleStruct 1377 1378``` 1379typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct 1380``` 1381 1382**Description** 1383 1384Defines a struct for a font style. 1385 1386**Since**: 12 1387 1388 1389### OH_Drawing_GpuContext 1390 1391``` 1392typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext 1393``` 1394 1395**Description** 1396 1397Defines a struct for the GPU context, which is used to describe the GPU backend context. 1398 1399**Since**: 12 1400 1401 1402### OH_Drawing_GpuContextOptions 1403 1404``` 1405typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions 1406``` 1407 1408**Description** 1409 1410Defines a struct for the options about the GPU context. 1411 1412**Since**: 12 1413 1414 1415### OH_Drawing_Image 1416 1417``` 1418typedef struct OH_Drawing_Image OH_Drawing_Image 1419``` 1420 1421**Description** 1422 1423Defines a struct for an image that describes a two-dimensional pixel array. 1424 1425**Since**: 12 1426 1427 1428### OH_Drawing_Image_Info 1429 1430``` 1431typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info 1432``` 1433 1434**Description** 1435 1436Defines a struct for the image information. 1437 1438**Since**: 12 1439 1440 1441### OH_Drawing_LineMetrics 1442 1443``` 1444typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics 1445``` 1446 1447**Description** 1448 1449Defines a struct for the measurement information about a line of text. 1450 1451**Since**: 12 1452 1453 1454### OH_Drawing_MaskFilter 1455 1456``` 1457typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter 1458``` 1459 1460**Description** 1461 1462Defines a struct for a mask filter, which is used to convert a mask into a new one. 1463 1464**Since**: 11 1465 1466 1467### OH_Drawing_Matrix 1468 1469``` 1470typedef struct OH_Drawing_Matrix OH_Drawing_Matrix 1471``` 1472 1473**Description** 1474 1475Defines a struct for a matrix, which is used to describe coordinate transformation. 1476 1477**Since**: 11 1478 1479 1480### OH_Drawing_MemoryStream 1481 1482``` 1483typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream 1484``` 1485 1486**Description** 1487 1488Defines a struct for a memory stream. 1489 1490**Since**: 12 1491 1492 1493### OH_Drawing_MipmapMode 1494 1495``` 1496typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode 1497``` 1498 1499**Description** 1500 1501Defines an enum for the mipmap modes. 1502 1503**Since**: 12 1504 1505 1506### OH_Drawing_Path 1507 1508``` 1509typedef struct OH_Drawing_Path OH_Drawing_Path 1510``` 1511 1512**Description** 1513 1514Defines a struct for a path, which is used to customize various shapes. 1515 1516**Since**: 8 1517 1518 1519### OH_Drawing_PathAddMode 1520 1521``` 1522typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode 1523``` 1524 1525**Description** 1526 1527Defines an enum for the path adding modes. 1528 1529**Since**: 12 1530 1531 1532### OH_Drawing_PathDirection 1533 1534``` 1535typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection 1536``` 1537 1538**Description** 1539 1540Defines an enum for the directions of a closed contour. 1541 1542**Since**: 12 1543 1544 1545### OH_Drawing_PathEffect 1546 1547``` 1548typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect 1549``` 1550 1551**Description** 1552 1553Defines a struct for a path effect that affects the stroke. 1554 1555**Since**: 12 1556 1557 1558### OH_Drawing_PathFillType 1559 1560``` 1561typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType 1562``` 1563 1564**Description** 1565 1566Defines an enum for the fill types of a path. 1567 1568**Since**: 12 1569 1570 1571### OH_Drawing_Pen 1572 1573``` 1574typedef struct OH_Drawing_Pen OH_Drawing_Pen 1575``` 1576 1577**Description** 1578 1579Defines a struct for a pen, which is used to describe the style and color to outline a shape. 1580 1581**Since**: 8 1582 1583 1584### OH_Drawing_PenLineCapStyle 1585 1586``` 1587typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle 1588``` 1589 1590**Description** 1591 1592Defines 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. 1593 1594**Since**: 8 1595 1596 1597### OH_Drawing_PenLineJoinStyle 1598 1599``` 1600typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle 1601``` 1602 1603**Description** 1604 1605Defines 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. 1606 1607**Since**: 8 1608 1609 1610### OH_Drawing_PixelMap 1611 1612``` 1613typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap 1614``` 1615 1616**Description** 1617 1618Defines a struct for a pixel map, which is used to wrap the real pixel map supported by the image framework. 1619 1620**Since**: 12 1621 1622 1623### OH_Drawing_PlaceholderSpan 1624 1625``` 1626typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan 1627``` 1628 1629**Description** 1630 1631Defines a struct for the placeholder that acts as a span. 1632 1633**Since**: 11 1634 1635 1636### OH_Drawing_PlaceholderVerticalAlignment 1637 1638``` 1639typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment 1640``` 1641 1642**Description** 1643 1644Defines an enum for the vertical alignment modes of placeholders. 1645 1646**Since**: 11 1647 1648 1649### OH_Drawing_Point 1650 1651``` 1652typedef struct OH_Drawing_Point OH_Drawing_Point 1653``` 1654 1655**Description** 1656 1657Defines a struct for a coordinate point. 1658 1659**Since**: 11 1660 1661 1662### OH_Drawing_Point2D 1663 1664``` 1665typedef struct OH_Drawing_Point2D OH_Drawing_Point2D 1666``` 1667 1668**Description** 1669 1670Defines a struct for a two-dimensional coordinate point. 1671 1672**Since**: 12 1673 1674 1675### OH_Drawing_Point3D 1676 1677``` 1678typedef struct OH_Drawing_Point3D OH_Drawing_Point3D 1679``` 1680 1681**Description** 1682 1683Defines a struct for a three-dimensional coordinate point. 1684 1685**Since**: 12 1686 1687 1688### OH_Drawing_PointMode 1689 1690``` 1691typedef enum OH_Drawing_PointMode OH_Drawing_PointMode 1692``` 1693 1694**Description** 1695 1696Defines an enum for the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons. 1697 1698**Since**: 12 1699 1700 1701### OH_Drawing_PositionAndAffinity 1702 1703``` 1704typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity 1705``` 1706 1707**Description** 1708 1709Defines a struct used to receive the position and affinity of a glyph. 1710 1711**Since**: 11 1712 1713 1714### OH_Drawing_Range 1715 1716``` 1717typedef struct OH_Drawing_Range OH_Drawing_Range 1718``` 1719 1720**Description** 1721 1722Defines a struct for a range, which is used to receive the start position and end position of a glyph. 1723 1724**Since**: 11 1725 1726 1727### OH_Drawing_Rect 1728 1729``` 1730typedef struct OH_Drawing_Rect OH_Drawing_Rect 1731``` 1732 1733**Description** 1734 1735Defines a struct for a rectangle. 1736 1737**Since**: 11 1738 1739 1740### OH_Drawing_RectHeightStyle 1741 1742``` 1743typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle 1744``` 1745 1746**Description** 1747 1748Defines an enum for the rectangle height styles. 1749 1750**Since**: 11 1751 1752 1753### OH_Drawing_RectStyle_Info 1754 1755``` 1756typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info 1757``` 1758 1759**Description** 1760 1761Defines a struct for the style of a rectangle. 1762 1763**Since**: 12 1764 1765 1766### OH_Drawing_RectWidthStyle 1767 1768``` 1769typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle 1770``` 1771 1772**Description** 1773 1774Defines an enum for the rectangle width styles. 1775 1776**Since**: 11 1777 1778 1779### OH_Drawing_Region 1780 1781``` 1782typedef struct OH_Drawing_Region OH_Drawing_Region 1783``` 1784 1785**Description** 1786 1787Defines a struct for a region, which represents a closed area on the canvas for more accurate graphic control. 1788 1789**Since**: 12 1790 1791 1792### OH_Drawing_RoundRect 1793 1794``` 1795typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect 1796``` 1797 1798**Description** 1799 1800Defines a struct for a rounded rectangle. 1801 1802**Since**: 11 1803 1804 1805### OH_Drawing_RunBuffer 1806 1807``` 1808typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer 1809``` 1810 1811**Description** 1812 1813Defines a struct for a run, which provides storage for glyphs and positions. 1814 1815**Since**: 11 1816 1817 1818### OH_Drawing_SamplingOptions 1819 1820``` 1821typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions 1822``` 1823 1824**Description** 1825 1826Defines a struct for sampling options, which describe the sampling methods for images and bitmaps. 1827 1828**Since**: 12 1829 1830 1831### OH_Drawing_ScaleToFit 1832 1833``` 1834typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit 1835``` 1836 1837**Description** 1838 1839Defines an enum for the matrix scaling modes. 1840 1841**Since**: 12 1842 1843 1844### OH_Drawing_ShaderEffect 1845 1846``` 1847typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect 1848``` 1849 1850**Description** 1851 1852Defines a struct for a shader effect, which is used to describe the source color of the drawn content. 1853 1854**Since**: 11 1855 1856 1857### OH_Drawing_ShadowLayer 1858 1859``` 1860typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer 1861``` 1862 1863**Description** 1864 1865Defines a struct for a shadow, which is used to describe the shadow layer of the drawn content. 1866 1867**Since**: 12 1868 1869 1870### OH_Drawing_SrcRectConstraint 1871 1872``` 1873typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint 1874``` 1875 1876**Description** 1877 1878Defines an enum for the constraint types of the source rectangle. 1879 1880**Since**: 12 1881 1882 1883### OH_Drawing_StrutStyle 1884 1885``` 1886typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle 1887``` 1888 1889**Description** 1890 1891Defines 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. 1892 1893**Since**: 12 1894 1895 1896### OH_Drawing_Surface 1897 1898``` 1899typedef struct OH_Drawing_Surface OH_Drawing_Surface 1900``` 1901 1902**Description** 1903 1904Defines a struct for a surface, which is used to manage the content drawn on the canvas. 1905 1906**Since**: 12 1907 1908 1909### OH_Drawing_TextBlob 1910 1911``` 1912typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob 1913``` 1914 1915**Description** 1916 1917Defines a struct for a text blob, an immutable container that holds multiple texts. Each text blob consists of glyphs and position. 1918 1919**Since**: 11 1920 1921 1922### OH_Drawing_TextBlobBuilder 1923 1924``` 1925typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder 1926``` 1927 1928**Description** 1929 1930Defines a struct for a text blob builder, which is used to build a text blob. 1931 1932**Since**: 11 1933 1934 1935### OH_Drawing_TextBox 1936 1937``` 1938typedef struct OH_Drawing_TextBox OH_Drawing_TextBox 1939``` 1940 1941**Description** 1942 1943Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity. 1944 1945**Since**: 11 1946 1947 1948### OH_Drawing_TextDecorationStyle 1949 1950``` 1951typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle 1952``` 1953 1954**Description** 1955 1956Defines an enum for the text decoration styles. 1957 1958**Since**: 11 1959 1960 1961### OH_Drawing_TextEncoding 1962 1963``` 1964typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding 1965``` 1966 1967**Description** 1968 1969Defines an enum for the text encoding types. 1970 1971**Since**: 12 1972 1973 1974### OH_Drawing_TextShadow 1975 1976``` 1977typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow 1978``` 1979 1980**Description** 1981 1982Defines a struct used to manage text shadows. 1983 1984**Since**: 12 1985 1986 1987### OH_Drawing_TextStyle 1988 1989``` 1990typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle 1991``` 1992 1993**Description** 1994 1995Defines a struct used to manage text colors and decorations. 1996 1997**Since**: 8 1998 1999 2000### OH_Drawing_TileMode 2001 2002``` 2003typedef enum OH_Drawing_TileMode OH_Drawing_TileMode 2004``` 2005 2006**Description** 2007 2008Defines an enum for the tile modes of the shader effect. 2009 2010**Since**: 11 2011 2012 2013### OH_Drawing_Typeface 2014 2015``` 2016typedef struct OH_Drawing_Typeface OH_Drawing_Typeface 2017``` 2018 2019**Description** 2020 2021Defines a struct for a typeface. 2022 2023**Since**: 11 2024 2025 2026### OH_Drawing_Typography 2027 2028``` 2029typedef struct OH_Drawing_Typography OH_Drawing_Typography 2030``` 2031 2032**Description** 2033 2034Defines a struct used to manage the typography layout and display. 2035 2036**Since**: 8 2037 2038 2039### OH_Drawing_TypographyCreate 2040 2041``` 2042typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate 2043``` 2044 2045**Description** 2046 2047Defines a struct used to create an [OH_Drawing_Typography](#oh_drawing_typography) object. 2048 2049**Since**: 8 2050 2051 2052### OH_Drawing_TypographyStyle 2053 2054``` 2055typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle 2056``` 2057 2058**Description** 2059 2060Defines a struct used to manage the typography style, such as the text direction. 2061 2062**Since**: 8 2063 2064 2065### OH_Drawing_VertexMode 2066 2067``` 2068typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode 2069``` 2070 2071**Description** 2072 2073Defines an enum for the modes of interpreting the geometry of a given vertex. 2074 2075**Since**: 12 2076 2077 2078### OH_Drawing_WordBreakType 2079 2080``` 2081typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType 2082``` 2083 2084**Description** 2085 2086Defines an enum for the word break types. 2087 2088**Since**: 11 2089 2090 2091## Enum Description 2092 2093### OH_Drawing_SystemFontType 2094 2095``` 2096enum OH_Drawing_SystemFontType 2097``` 2098 2099**Description** 2100 2101Enumerates the system font types. 2102 2103**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 2104 2105**Since**: 14 2106 2107| Value| Description| 2108| -------- | -------- | 2109| ALL | All font types.| 2110| GENERIC | System font type.| 2111| STYLISH | Style font type.| 2112| INSTALLED | User-installed font type.| 2113 2114### OH_Drawing_ErrorCode 2115 2116``` 2117enum OH_Drawing_ErrorCode 2118``` 2119 2120**Description** 2121 2122Enumerates the error codes that may be generated by the module. 2123 2124**Since**: 12 2125 2126| Value| Description| 2127| -------- | -------- | 2128| OH_DRAWING_SUCCESS | Operation successful.| 2129| OH_DRAWING_ERROR_NO_PERMISSION | Permission verification fails.| 2130| OH_DRAWING_ERROR_INVALID_PARAMETER | Invalid input parameter. For example, NULL is passed in.| 2131| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | The input parameter is not in the valid range.| 2132| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | Failed to allocate memory.| 2133 2134### OH_Drawing_PathMeasureMatrixFlags 2135 2136``` 2137enum OH_Drawing_PathMeasureMatrixFlags 2138``` 2139 2140**Description** 2141 2142Enumerates the types of matrix information obtained during path measurement. 2143 2144**Since**: 12 2145 2146| Value| Description| 2147| -------- | -------- | 2148| GET_POSITION_MATRIX | Obtains the matrix corresponding to the location information.| 2149| GET_TANGENT_MATRIX | Obtains the matrix corresponding to the tangent information.| 2150| GET_POSITION_AND_TANGENT_MATRIX | Obtains the matrix corresponding to the location and tangent information.| 2151 2152 2153### OH_Drawing_PathOpMode 2154 2155``` 2156enum OH_Drawing_PathOpMode 2157``` 2158 2159**Description** 2160 2161Enumerates the operation modes available for a path. 2162 2163**Since**: 12 2164 2165| Value| Description| 2166| -------- | -------- | 2167| PATH_OP_MODE_DIFFERENCE | Difference operation.| 2168| PATH_OP_MODE_INTERSECT | Intersection operation.| 2169| PATH_OP_MODE_UNION | Union operation.| 2170| PATH_OP_MODE_XOR | XOR operation.| 2171| PATH_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.| 2172 2173 2174### OH_Drawing_RegionOpMode 2175 2176``` 2177enum OH_Drawing_RegionOpMode 2178``` 2179 2180**Description** 2181 2182Enumerates the operation modes available for a region. 2183 2184**Since**: 12 2185 2186| Value| Description| 2187| -------- | -------- | 2188| REGION_OP_MODE_DIFFERENCE | Difference operation.| 2189| REGION_OP_MODE_INTERSECT | Intersection operation.| 2190| REGION_OP_MODE_UNION | Union operation.| 2191| REGION_OP_MODE_XOR | XOR operation.| 2192| REGION_OP_MODE_REVERSE_DIFFERENCE | Reverse difference operation.| 2193| REGION_OP_MODE_REPLACE | Replacement operation.| 2194 2195 2196### OH_Drawing_AlphaFormat 2197 2198``` 2199enum OH_Drawing_AlphaFormat 2200``` 2201 2202**Description** 2203 2204Enumerates the alpha formats of bitmap pixels. 2205 2206**Since**: 8 2207 2208| Value| Description| 2209| -------- | -------- | 2210| ALPHA_FORMAT_UNKNOWN | Unknown format.| 2211| ALPHA_FORMAT_OPAQUE | The bitmap does not have the alpha component.| 2212| ALPHA_FORMAT_PREMUL | The color component of each pixel is premultiplied by the alpha component.| 2213| ALPHA_FORMAT_UNPREMUL | The color component of each pixel is not premultiplied by the alpha component.| 2214 2215 2216### OH_Drawing_BlendMode 2217 2218``` 2219enum OH_Drawing_BlendMode 2220``` 2221 2222**Description** 2223 2224Enumerates the blend modes. In blend mode, each operation generates a new color from two colors (source color and target color). These operations are the same for the red, green, and blue color channels (the alpha channel follows a different rule). The operations for the alpha channel are used as examples. 2225 2226For brevity, the following abbreviations are used: 2227 2228**s**: source. 2229 2230**d**: destination. 2231 2232**sa**: source alpha. 2233 2234**da**: destination alpha. 2235 2236The following abbreviations are used in the calculation result: 2237 2238**r**: The calculation methods of the four channels are the same. 2239 2240**ra**: Only the alpha channel is manipulated. 2241 2242**rc**: The other three color channels are manipulated. 2243 2244**Since**: 11 2245 2246| Value| Description| 2247| -------- | -------- | 2248| BLEND_MODE_CLEAR | Clear mode. r = 0.| 2249| 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.)| 2250| 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.)| 2251| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. | 2252| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. | 2253| BLEND_MODE_SRC_IN | r = s \* da. | 2254| BLEND_MODE_DST_IN | r = d \* sa. | 2255| BLEND_MODE_SRC_OUT | r = s \* (1 - da). | 2256| BLEND_MODE_DST_OUT | r = d \* (1 - sa). | 2257| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). | 2258| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). | 2259| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). | 2260| BLEND_MODE_PLUS | r = min(s + d, 1). | 2261| BLEND_MODE_MODULATE | r = s \* d. | 2262| BLEND_MODE_SCREEN | Screen mode. r = s + d - s \* d| 2263| BLEND_MODE_OVERLAY | Overlay mode.| 2264| BLEND_MODE_DARKEN | Darken mode. rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d| 2265| BLEND_MODE_LIGHTEN | Lighten mode. rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d| 2266| BLEND_MODE_COLOR_DODGE | Color dodge mode.| 2267| BLEND_MODE_COLOR_BURN | Color burn mode.| 2268| BLEND_MODE_HARD_LIGHT | Hard light mode.| 2269| BLEND_MODE_SOFT_LIGHT | Soft light mode.| 2270| BLEND_MODE_DIFFERENCE | Difference mode. rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d| 2271| BLEND_MODE_EXCLUSION | Exclusion mode. rc = s + d - two(s \* d), ra = s + (1 - sa) \* d| 2272| BLEND_MODE_MULTIPLY | Multiply mode. r = s \* (1 - da) + d \* (1 - sa) + s \* d| 2273| BLEND_MODE_HUE | Hue mode.| 2274| BLEND_MODE_SATURATION | Saturation mode.| 2275| BLEND_MODE_COLOR | Color mode.| 2276| BLEND_MODE_LUMINOSITY | Light mode.| 2277 2278 2279### OH_Drawing_BlurType 2280 2281``` 2282enum OH_Drawing_BlurType 2283``` 2284 2285**Description** 2286 2287Enumerates the blur types. 2288 2289**Since**: 11 2290 2291| Value| Description| 2292| -------- | -------- | 2293| NORMAL | Blurs both inside and outside the original border.| 2294| SOLID | Draws solid inside the border, and blurs outside.| 2295| OUTER | Draws nothing inside the border, and blurs outside.| 2296| INNER | Blurs inside the border, and draws nothing outside.| 2297 2298 2299### OH_Drawing_BreakStrategy 2300 2301``` 2302enum OH_Drawing_BreakStrategy 2303``` 2304 2305**Description** 2306 2307Enumerates the text break strategies. 2308 2309**Since**: 11 2310 2311| Value| Description| 2312| -------- | -------- | 2313| BREAK_STRATEGY_GREEDY | Each line is filled as much as possible during line break.| 2314| BREAK_STRATEGY_HIGH_QUALITY | Text continuity is preferentially considered during line break.| 2315| BREAK_STRATEGY_BALANCED | Line breaks are performed at the word boundary.| 2316 2317 2318### OH_Drawing_CanvasClipOp 2319 2320``` 2321enum OH_Drawing_CanvasClipOp 2322``` 2323 2324**Description** 2325 2326Enumerates the canvas clipping modes. 2327 2328**Since**: 11 2329 2330| Value| Description| 2331| -------- | -------- | 2332| DIFFERENCE | Clips a specified area. That is, the difference set is obtained.| 2333| INTERSECT | Retains a specified area. That is, the intersection is obtained.| 2334 2335 2336### OH_Drawing_CanvasShadowFlags 2337 2338``` 2339enum OH_Drawing_CanvasShadowFlags 2340``` 2341 2342**Description** 2343 2344Enumerates the shadow flags. 2345 2346**Since**: 12 2347 2348| Value| Description| 2349| -------- | -------- | 2350| SHADOW_FLAGS_NONE | There is no shadow flag.| 2351| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | The occluding object is transparent.| 2352| SHADOW_FLAGS_GEOMETRIC_ONLY | No analysis on the shadows is required.| 2353| SHADOW_FLAGS_ALL | All the preceding shadow flags are used.| 2354 2355 2356### OH_Drawing_ColorFormat 2357 2358``` 2359enum OH_Drawing_ColorFormat 2360``` 2361 2362**Description** 2363 2364Enumerates the storage formats of bitmap pixels. 2365 2366**Since**: 8 2367 2368| Value| Description| 2369| -------- | -------- | 2370| COLOR_FORMAT_UNKNOWN | Unknown format.| 2371| COLOR_FORMAT_ALPHA_8 | Each pixel is represented by 8 bits, which together indicate alpha.| 2372| 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.| 2373| 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.| 2374| 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.| 2375| 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.| 2376 2377 2378### OH_Drawing_CornerPos 2379 2380``` 2381enum OH_Drawing_CornerPos 2382``` 2383 2384**Description** 2385 2386Enumerates the corner positions of a rounded rectangle. 2387 2388**Since**: 12 2389 2390| Value| Description| 2391| -------- | -------- | 2392| CORNER_POS_TOP_LEFT | Top left corner of the rounded rectangle.| 2393| CORNER_POS_TOP_RIGHT | Top right corner of the rounded rectangle.| 2394| CORNER_POS_BOTTOM_RIGHT | Bottom right corner of the rounded rectangle.| 2395| CORNER_POS_BOTTOM_LEFT | Bottom left corner of the rounded rectangle.| 2396 2397 2398### OH_Drawing_EllipsisModal 2399 2400``` 2401enum OH_Drawing_EllipsisModal 2402``` 2403 2404**Description** 2405 2406Enumerates the text ellipsis styles. 2407 2408**Since**: 11 2409 2410| Value| Description| 2411| -------- | -------- | 2412| ELLIPSIS_MODAL_HEAD | Places the ellipsis in the text header.| 2413| ELLIPSIS_MODAL_MIDDLE | Places the ellipsis in the middle of the text.| 2414| ELLIPSIS_MODAL_TAIL | Places the ellipsis at the end of the text.| 2415 2416 2417### OH_Drawing_FilterMode 2418 2419``` 2420enum OH_Drawing_FilterMode 2421``` 2422 2423**Description** 2424 2425Enumerates the filter modes. 2426 2427**Since**: 12 2428 2429| Value| Description| 2430| -------- | -------- | 2431| FILTER_MODE_NEAREST | Nearest filter mode.| 2432| FILTER_MODE_LINEAR | Linear filter mode.| 2433 2434 2435### OH_Drawing_FontConfigInfoErrorCode 2436 2437``` 2438enum OH_Drawing_FontConfigInfoErrorCode 2439``` 2440 2441**Description** 2442 2443Enumerates the error codes that may be used during the obtaining of system font configurations. 2444 2445**Since**: 12 2446 2447| Value| Description| 2448| -------- | -------- | 2449| SUCCESS_FONT_CONFIG_INFO | Operation successful.| 2450| ERROR_FONT_CONFIG_INFO_UNKNOWN | Unknown error.| 2451| ERROR_FONT_CONFIG_INFO_PARSE_FILE | Failed to parse the system configuration file.| 2452| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | Failed to apply for a buffer.| 2453| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | Failed to copy the string data.| 2454 2455 2456### OH_Drawing_FontEdging 2457 2458``` 2459enum OH_Drawing_FontEdging 2460``` 2461 2462**Description** 2463 2464Enumerates the font edging types. 2465 2466**Since**: 12 2467 2468| Value| Description| 2469| -------- | -------- | 2470| FONT_EDGING_ALIAS | No anti-aliasing processing is used.| 2471| FONT_EDGING_ANTI_ALIAS | Uses anti-aliasing to smooth the jagged edges.| 2472| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | Uses sub-pixel anti-aliasing to provide a smoother effect for jagged edges.| 2473 2474 2475### OH_Drawing_FontHinting 2476 2477``` 2478enum OH_Drawing_FontHinting 2479``` 2480 2481**Description** 2482 2483Enumerates the font hinting types. 2484 2485**Since**: 12 2486 2487| Value| Description| 2488| -------- | -------- | 2489| FONT_HINTING_NONE | No font hinting is used.| 2490| FONT_HINTING_SLIGHT | Slight font hinting is used to improve contrast.| 2491| FONT_HINTING_NORMAL | Normal font hinting is used to improve contrast.| 2492| FONT_HINTING_FULL | Full font hinting is used to improve contrast.| 2493 2494 2495### OH_Drawing_FontStyle 2496 2497``` 2498enum OH_Drawing_FontStyle 2499``` 2500 2501**Description** 2502 2503Enumerates the font styles. 2504 2505| Value| Description| 2506| -------- | -------- | 2507| FONT_STYLE_NORMAL | Normal style.| 2508| FONT_STYLE_ITALIC | Italic.| 2509| FONT_STYLE_OBLIQUE | Oblique.<br>Since:<br>12 | 2510 2511 2512### OH_Drawing_FontWeight 2513 2514``` 2515enum OH_Drawing_FontWeight 2516``` 2517 2518**Description** 2519 2520Enumerates the font weights. 2521 2522| Value| Description| 2523| -------- | -------- | 2524| FONT_WEIGHT_100 | Thin.| 2525| FONT_WEIGHT_200 | Extra-light.| 2526| FONT_WEIGHT_300 | Light.| 2527| FONT_WEIGHT_400 | Normal/Regular.| 2528| FONT_WEIGHT_500 | Medium.| 2529| FONT_WEIGHT_600 | Semi-bold.| 2530| FONT_WEIGHT_700 | Bold.| 2531| FONT_WEIGHT_800 | Extra-bold.| 2532| FONT_WEIGHT_900 | Black.| 2533 2534 2535### OH_Drawing_FontWidth 2536 2537``` 2538enum OH_Drawing_FontWidth 2539``` 2540 2541**Description** 2542 2543Enumerates the font widths. 2544 2545**Since**: 12 2546 2547 2548### OH_Drawing_MipmapMode 2549 2550``` 2551enum OH_Drawing_MipmapMode 2552``` 2553 2554**Description** 2555 2556Enumerates the mipmap modes. 2557 2558**Since**: 12 2559 2560| Value| Description| 2561| -------- | -------- | 2562| MIPMAP_MODE_NONE | Mipmap level ignored.| 2563| MIPMAP_MODE_NEAREST | Nearest sampling from two adjacent mipmap levels.| 2564| MIPMAP_MODE_LINEAR | Linear interpolation sampling between two adjacent mipmap levels.| 2565 2566 2567### OH_Drawing_PathAddMode 2568 2569``` 2570enum OH_Drawing_PathAddMode 2571``` 2572 2573**Description** 2574 2575Enumerates the path adding modes. 2576 2577**Since**: 12 2578 2579| Value| Description| 2580| -------- | -------- | 2581| PATH_ADD_MODE_APPEND | Adds a path in append mode.| 2582| PATH_ADD_MODE_EXTEND | Adds a line segment to close the path if the previous path is not closed.| 2583 2584 2585### OH_Drawing_PathDirection 2586 2587``` 2588enum OH_Drawing_PathDirection 2589``` 2590 2591**Description** 2592 2593Enumerates the directions of a closed contour. 2594 2595**Since**: 12 2596 2597| Value| Description| 2598| -------- | -------- | 2599| PATH_DIRECTION_CW | Adds a closed contour clockwise.| 2600| PATH_DIRECTION_CCW | Adds a closed contour counterclockwise.| 2601 2602 2603### OH_Drawing_PathFillType 2604 2605``` 2606enum OH_Drawing_PathFillType 2607``` 2608 2609**Description** 2610 2611Enumerates the fill types of a path. 2612 2613**Since**: 12 2614 2615| Value| Description| 2616| -------- | -------- | 2617| 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.| 2618| 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.| 2619| PATH_FILL_TYPE_INVERSE_WINDING | Same as **PATH_FILL_TYPE_WINDING**, but draws outside of the path, rather than inside.| 2620| PATH_FILL_TYPE_INVERSE_EVEN_ODD | Same as **PATH_FILL_TYPE_EVEN_ODD**, but draws outside of the path, rather than inside.| 2621 2622 2623### OH_Drawing_PenLineCapStyle 2624 2625``` 2626enum OH_Drawing_PenLineCapStyle 2627``` 2628 2629**Description** 2630 2631Enumerates 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. 2632 2633**Since**: 8 2634 2635| Value| Description| 2636| -------- | -------- | 2637| LINE_FLAT_CAP | There is no cap style. Both ends of the line segment are cut off square.| 2638| 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.| 2639| 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.| 2640 2641 2642### OH_Drawing_PenLineJoinStyle 2643 2644``` 2645enum OH_Drawing_PenLineJoinStyle 2646``` 2647 2648**Description** 2649 2650Enumerates 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. 2651 2652**Since**: 8 2653 2654| Value| Description| 2655| -------- | -------- | 2656| 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.| 2657| LINE_ROUND_JOIN | Round corner.| 2658| LINE_BEVEL_JOIN | Beveled corner.| 2659 2660 2661### OH_Drawing_PlaceholderVerticalAlignment 2662 2663``` 2664enum OH_Drawing_PlaceholderVerticalAlignment 2665``` 2666 2667**Description** 2668 2669Enumerates the vertical alignment modes of placeholders. 2670 2671**Since**: 11 2672 2673| Value| Description| 2674| -------- | -------- | 2675| ALIGNMENT_OFFSET_AT_BASELINE | Aligned to the baseline.| 2676| ALIGNMENT_ABOVE_BASELINE | Aligned above the baseline.| 2677| ALIGNMENT_BELOW_BASELINE | Aligned below the baseline.| 2678| ALIGNMENT_TOP_OF_ROW_BOX | Aligned to the top of the row box.| 2679| ALIGNMENT_BOTTOM_OF_ROW_BOX | Aligned to the bottom of the row box.| 2680| ALIGNMENT_CENTER_OF_ROW_BOX | Aligned to the center of the row box.| 2681 2682 2683### OH_Drawing_PointMode 2684 2685``` 2686enum OH_Drawing_PointMode 2687``` 2688 2689**Description** 2690 2691Enumerates the modes of drawing multiple points. The modes include discrete points, line segments, and open polygons. 2692 2693**Since**: 12 2694 2695| Value| Description| 2696| -------- | -------- | 2697| POINT_MODE_POINTS | Draws each point separately.| 2698| POINT_MODE_LINES | Draws every two points as a line segment.| 2699| POINT_MODE_POLYGON | Draws an array of points as an open polygon.| 2700 2701 2702### OH_Drawing_RectHeightStyle 2703 2704``` 2705enum OH_Drawing_RectHeightStyle 2706``` 2707 2708**Description** 2709 2710Enumerates the rectangle height styles. 2711 2712**Since**: 11 2713 2714| Value| Description| 2715| -------- | -------- | 2716| RECT_HEIGHT_STYLE_TIGHT | Tight style.| 2717| RECT_HEIGHT_STYLE_MAX | Maximum style.| 2718| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | Middle style that includes the line spacing.| 2719| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | Top style that includes the line spacing.| 2720| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | Bottom style that includes the line spacing.| 2721| RECT_HEIGHT_STYLE_STRUCT | Structure style.| 2722 2723 2724### OH_Drawing_RectWidthStyle 2725 2726``` 2727enum OH_Drawing_RectWidthStyle 2728``` 2729 2730**Description** 2731 2732Enumerates the rectangle width styles. 2733 2734**Since**: 11 2735 2736| Value| Description| 2737| -------- | -------- | 2738| RECT_WIDTH_STYLE_TIGHT | Tight style.| 2739| RECT_WIDTH_STYLE_MAX | Maximum style.| 2740 2741 2742### OH_Drawing_ScaleToFit 2743 2744``` 2745enum OH_Drawing_ScaleToFit 2746``` 2747 2748**Description** 2749 2750Enumerates the matrix scaling modes. 2751 2752**Since**: 12 2753 2754| Value| Description| 2755| -------- | -------- | 2756| SCALE_TO_FIT_FILL | Scales the source rectangle both horizontally and vertically to exactly match the destination rectangle.| 2757| SCALE_TO_FIT_START | Scales the source rectangle and aligns it to the left and top edges of the destination rectangle.| 2758| SCALE_TO_FIT_CENTER | Scales the source rectangle and aligns it to the center of the destination rectangle.| 2759| SCALE_TO_FIT_END | Scales the source rectangle and aligns it to the right and bottom edges of the destination rectangle.| 2760 2761 2762### OH_Drawing_SrcRectConstraint 2763 2764``` 2765enum OH_Drawing_SrcRectConstraint 2766``` 2767 2768**Description** 2769 2770Enumerates the constraint types of the source rectangle. 2771 2772**Since**: 12 2773 2774| Value| Description| 2775| -------- | -------- | 2776| STRICT_SRC_RECT_CONSTRAINT | The source rectangle must be completely contained in the image.| 2777| FAST_SRC_RECT_CONSTRAINT | The source rectangle can be partly outside the image.| 2778 2779 2780### OH_Drawing_TextAlign 2781 2782``` 2783enum OH_Drawing_TextAlign 2784``` 2785 2786**Description** 2787 2788Enumerates the text alignment modes. 2789 2790| Value| Description| 2791| -------- | -------- | 2792| TEXT_ALIGN_LEFT | Left-aligned.| 2793| TEXT_ALIGN_RIGHT | Right-aligned.| 2794| TEXT_ALIGN_CENTER | Center-aligned.| 2795| 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.| 2796| 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**.| 2797| 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**.| 2798 2799 2800### OH_Drawing_TextBaseline 2801 2802``` 2803enum OH_Drawing_TextBaseline 2804``` 2805 2806**Description** 2807 2808Enumerates the text baselines. 2809 2810| Value| Description| 2811| -------- | -------- | 2812| TEXT_BASELINE_ALPHABETIC | Alphabetic, where the letters in alphabets like English sit on.| 2813| TEXT_BASELINE_IDEOGRAPHIC | Ideographic, where the baseline is at the bottom of the text area.| 2814 2815 2816### OH_Drawing_TextDecoration 2817 2818``` 2819enum OH_Drawing_TextDecoration 2820``` 2821 2822**Description** 2823 2824Enumerates the text decorations. 2825 2826| Value| Description| 2827| -------- | -------- | 2828| TEXT_DECORATION_NONE | No decoration.| 2829| TEXT_DECORATION_UNDERLINE | An underline is used for decoration.| 2830| TEXT_DECORATION_OVERLINE | An overline is used for decoration.| 2831| TEXT_DECORATION_LINE_THROUGH | A strikethrough is used for decoration.| 2832 2833 2834### OH_Drawing_TextDecorationStyle 2835 2836``` 2837enum OH_Drawing_TextDecorationStyle 2838``` 2839 2840**Description** 2841 2842Enumerates the text decoration styles. 2843 2844**Since**: 11 2845 2846| Value| Description| 2847| -------- | -------- | 2848| TEXT_DECORATION_STYLE_SOLID | Solid style.| 2849| TEXT_DECORATION_STYLE_DOUBLE | Double style.| 2850| TEXT_DECORATION_STYLE_DOTTED | Dotted style.| 2851| TEXT_DECORATION_STYLE_DASHED | Dashed style.| 2852| TEXT_DECORATION_STYLE_WAVY | Wavy style.| 2853 2854 2855### OH_Drawing_TextDirection 2856 2857``` 2858enum OH_Drawing_TextDirection 2859``` 2860 2861**Description** 2862 2863Enumerates the text directions. 2864 2865| Value| Description| 2866| -------- | -------- | 2867| TEXT_DIRECTION_RTL | Right to left (RTL).| 2868| TEXT_DIRECTION_LTR | Left to right (LTR).| 2869 2870 2871### OH_Drawing_TextEncoding 2872 2873``` 2874enum OH_Drawing_TextEncoding 2875``` 2876 2877**Description** 2878 2879Enumerates the text encoding types. 2880 2881**Since**: 12 2882 2883| Value| Description| 2884| -------- | -------- | 2885| TEXT_ENCODING_UTF8 | One byte used to indicate UTF-8 or ASCII characters.| 2886| TEXT_ENCODING_UTF16 | Two bytes used to indicate most Unicode characters.| 2887| TEXT_ENCODING_UTF32 | Four bytes used to indicate all Unicode characters.| 2888| TEXT_ENCODING_GLYPH_ID | Two bytes used to indicate the glyph index.| 2889 2890 2891### OH_Drawing_TextHeightBehavior 2892 2893``` 2894enum OH_Drawing_TextHeightBehavior 2895``` 2896 2897**Description** 2898 2899Enumerates the text height modifier patterns. 2900 2901**Since**: 12 2902 2903| Value| Description| 2904| -------- | -------- | 2905| TEXT_HEIGHT_ALL | The height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the top of the first line and the bottom of the last line in a paragraph are applied.| 2906| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | The height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the top of the first line in a paragraph is ignored.| 2907| TEXT_HEIGHT_DISABLE_LAST_ASCENT | The height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for the bottom of the last line in a paragraph is ignored.| 2908| TEXT_HEIGHT_DISABLE_ALL | The height set by calling [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) for both the top of the first line and the bottom of the last line in a paragraph are ignored.| 2909 2910 2911### OH_Drawing_TextStyleType 2912 2913``` 2914enum OH_Drawing_TextStyleType 2915``` 2916 2917**Description** 2918 2919Enumerates the text style types. 2920 2921**Since**: 12 2922 2923| Value| Description| 2924| -------- | -------- | 2925| TEXT_STYLE_NONE | No text style.| 2926| TEXT_STYLE_ALL_ATTRIBUTES | All text styles.| 2927| TEXT_STYLE_FONT | Font style.| 2928| TEXT_STYLE_FOREGROUND | Text foreground style.| 2929| TEXT_STYLE_BACKGROUND | Text background style.| 2930| TEXT_STYLE_SHADOW | Text shadow style.| 2931| TEXT_STYLE_DECORATIONS | Text decoration style.| 2932| TEXT_STYLE_LETTER_SPACING | Text letter spacing style.| 2933| TEXT_STYLE_WORD_SPACING | Text word spacing style.| 2934 2935 2936### OH_Drawing_TileMode 2937 2938``` 2939enum OH_Drawing_TileMode 2940``` 2941 2942**Description** 2943 2944Enumerates the tile modes of the shader effect. 2945 2946**Since**: 11 2947 2948| Value| Description| 2949| -------- | -------- | 2950| CLAMP | Replicates the edge color if the shader effect draws outside of its original boundary.| 2951| REPEAT | Repeats the shader effect's image in both horizontal and vertical directions.| 2952| MIRROR | Repeats the shader effect's image in both horizontal and vertical directions, alternating mirror images.| 2953| DECAL | Renders the shader effect's image only within the original boundary, and returns transparent black elsewhere.| 2954 2955 2956### OH_Drawing_VertexMode 2957 2958``` 2959enum OH_Drawing_VertexMode 2960``` 2961 2962**Description** 2963 2964Enumerates the modes of interpreting the geometry of a given vertex. 2965 2966**Since**: 12 2967 2968| Value| Description| 2969| -------- | -------- | 2970| 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. | 2971| 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.| 2972| 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).| 2973 2974 2975### OH_Drawing_WordBreakType 2976 2977``` 2978enum OH_Drawing_WordBreakType 2979``` 2980 2981**Description** 2982 2983Enumerates the word break types. 2984 2985**Since**: 11 2986 2987| Value| Description| 2988| -------- | -------- | 2989| WORD_BREAK_TYPE_NORMAL | Normal mode.| 2990| WORD_BREAK_TYPE_BREAK_ALL | Breaks the words at any character to prevent overflow.| 2991| WORD_BREAK_TYPE_BREAK_WORD | Breaks the words at arbitrary points to prevent overflow.| 2992 2993 2994 2995## Function Description 2996 2997### OH_Drawing_FontSetThemeFontFollowed() 2998 2999``` 3000OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed (OH_Drawing_Font* font, bool followed ) 3001``` 3002 3003**Description** 3004 3005Sets whether to follow the theme font. When **followed** is set to **true**, the theme font is used if it is enabled by the system and no typeface is set. 3006 3007**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3008 3009**Since**: 15 3010 3011**Parameters** 3012 3013| Name| Description| 3014| -------- | -------- | 3015| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 3016| followed | Whether to follow the theme font. The value **true** means to follow the theme font, and **false** means the opposite.| 3017 3018**Returns** 3019 3020Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **font** is NULL. 3021 3022### OH_Drawing_FontIsThemeFontFollowed() 3023 3024``` 3025OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed (const OH_Drawing_Font* font, bool* followed ) 3026``` 3027 3028**Description** 3029 3030Checks whether the font follows the theme font. By default, the theme font is not followed. 3031 3032**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3033 3034**Since**: 15 3035 3036**Parameters** 3037 3038| Name| Description| 3039| -------- | -------- | 3040| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 3041| followed | Check result. The value **true** means that the theme font is followed, and **false** means the opposite. | 3042 3043**Returns** 3044 3045Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **font** or **followed** is NULL. 3046 3047### OH_Drawing_GetFontCollectionGlobalInstance() 3048 3049``` 3050OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance (void ) 3051``` 3052**Description** 3053 3054Obtains the global **OH_Drawing_FontCollection** object, which can be used to sense the theme font information. Do not release the object. 3055 3056**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3057 3058**Since**: 14 3059 3060**Returns** 3061 3062Returns the pointer to the global {@link OH_Drawing_FontCollection} object obtained. 3063 3064### OH_Drawing_GetDrawingArraySize() 3065 3066``` 3067size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array* drawingArray) 3068``` 3069 3070**Description** 3071 3072Obtains the number of objects in an [OH_Drawing_Array](#oh_drawing_array). 3073 3074**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3075 3076**Since**: 14 3077 3078**Parameters** 3079 3080| Name| Description| 3081| -------- | -------- | 3082| drawingArray | Pointer to an [OH_Drawing_Array](#oh_drawing_array) object.| 3083 3084**Returns** 3085 3086Returns the number of objects in the array. 3087 3088 3089### OH_Drawing_DestroySystemFontFullNames() 3090 3091``` 3092void OH_Drawing_DestroySystemFontFullNames (OH_Drawing_Array* ) 3093``` 3094 3095**Description** 3096 3097Releases the memory occupied by the font name array obtained by font type. 3098 3099**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3100 3101**Since**: 14 3102 3103**Parameters** 3104 3105| Name| Description| 3106| -------- | -------- | 3107| OH_Drawing_Array | Pointer to an [OH_Drawing_Array](#oh_drawing_array) that holds the font names.| 3108 3109### OH_Drawing_GetSystemFontFullNameByIndex() 3110 3111``` 3112const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex (OH_Drawing_Array* , size_t ) 3113``` 3114 3115**Description** 3116 3117Obtains the font name with the specified index in the font name array. 3118 3119**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3120 3121**Since**: 14 3122 3123**Parameters** 3124 3125| Name| Description| 3126| -------- | -------- | 3127| OH_Drawing_Array | Pointer to an [OH_Drawing_Array](#oh_drawing_array) that holds the font names.| 3128| size_t | Index of the font in the array.| 3129 3130**Returns** 3131 3132Returns the pointer to the font name, which is an [OH_Drawing_String](_o_h___drawing___string.md) object. 3133 3134### OH_Drawing_GetSystemFontFullNamesByType() 3135 3136``` 3137OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType (OH_Drawing_SystemFontType ) 3138``` 3139 3140**Description** 3141 3142Obtains an array of font names by font type. 3143 3144**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3145 3146**Since**: 14 3147 3148**Parameters** 3149 3150| Name| Description| 3151| -------- | -------- | 3152| OH_Drawing_SystemFontType | Font type, which is defined in [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype).| 3153 3154**Returns** 3155 3156Returns the pointer to an [OH_Drawing_Array](#oh_drawing_array), which holds the font names. 3157 3158### OH_Drawing_GetFontDescriptorByFullName() 3159 3160``` 3161OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName (const OH_Drawing_String* , OH_Drawing_SystemFontType ) 3162``` 3163 3164**Description** 3165 3166Obtains a font descriptor based on the font name and type. System fonts, style fonts, and user-installed fonts are supported. A font descriptor is a data structure that describes font features. It contains details of the font appearance and properties. 3167 3168**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3169 3170**Since**: 14 3171 3172**Parameters** 3173 3174| Name| Description| 3175| -------- | -------- | 3176| [OH_Drawing_String](_o_h___drawing___string.md) | Pointer to the font name, which is [OH_Drawing_String](_o_h___drawing___string.md).| 3177| OH_Drawing_SystemFontType | Font type, which is defined in [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype).| 3178 3179**Returns** 3180 3181Returns the pointer to an [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object. 3182 3183### OH_Drawing_TypefaceCreateFromFileWithArguments() 3184 3185``` 3186OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments ) 3187``` 3188 3189**Description** 3190 3191Creates 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). 3192 3193**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3194 3195**Since**: 13 3196 3197**Parameters** 3198 3199| Name| Description| 3200| -------- | -------- | 3201| path | Pointer to the file path.| 3202| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.| 3203 3204**Returns** 3205 3206Returns 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. 3207 3208 3209### OH_Drawing_TypefaceCreateFromCurrent() 3210 3211``` 3212OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments ) 3213``` 3214 3215**Description** 3216 3217Creates an **OH_Drawing_Typeface** object with font arguments based on an existing **OH_Drawing_Typeface** object. 3218 3219**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3220 3221**Since**: 13 3222 3223**Parameters** 3224 3225| Name| Description| 3226| -------- | -------- | 3227| current | Pointer to an [OH_Drawing_Typeface](#oh_drawing_typeface) object.| 3228| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.| 3229 3230**Returns** 3231 3232Returns 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. 3233 3234 3235### OH_Drawing_FontArgumentsAddVariation() 3236 3237``` 3238OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value ) 3239``` 3240 3241**Description** 3242 3243Adds a variation to an **OH_Drawing_FontArguments** object. 3244 3245**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3246 3247**Since**: 13 3248 3249**Parameters** 3250 3251| Name| Description| 3252| -------- | -------- | 3253| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.| 3254| 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.| 3255| value | Value of the variation label.| 3256 3257**Returns** 3258 3259Returns one 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. 3260 3261 3262### OH_Drawing_FontArgumentsCreate() 3263 3264``` 3265OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void) 3266``` 3267 3268**Description** 3269 3270Creates an **OH_Drawing_FontArguments** object. The font arguments are used to create an **OH_Drawing_Typeface** object with custom attributes. 3271 3272**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3273 3274**Since**: 13 3275 3276**Returns** 3277 3278Returns the pointer to the **OH_Drawing_FontArguments** object created. 3279 3280 3281### OH_Drawing_FontArgumentsDestroy() 3282 3283``` 3284OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments) 3285``` 3286 3287**Description** 3288 3289Destroys an **OH_Drawing_FontArguments** object. 3290 3291**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3292 3293**Since**: 13 3294 3295**Parameters** 3296 3297| Name| Description| 3298| -------- | -------- | 3299| fontArguments | Pointer to an [OH_Drawing_FontArguments](#oh_drawing_fontarguments) object.| 3300 3301**Returns** 3302 3303Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **fontArguments** is NULL. 3304 3305 3306### OH_Drawing_TypographyGetLongestLineWithIndent() 3307 3308``` 3309double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* ) 3310``` 3311 3312**Description** 3313 3314Obtains the width of the longest line of a typography object, including its indentation. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned. 3315 3316**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3317 3318**Since**: 13 3319 3320**Parameters** 3321 3322| Name| Description| 3323| -------- | -------- | 3324| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).| 3325 3326**Returns** 3327 3328Returns the width of the longest line, including its indentation, in px. 3329 3330 3331 3332### OH_Drawing_RecordCmdDestroy() 3333 3334``` 3335OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd) 3336``` 3337 3338**Description** 3339 3340Destroys an **OH_Drawing_RecordCmd** object and reclaims the memory occupied by the object. 3341 3342**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3343 3344**Since**: 13 3345 3346**Parameters** 3347 3348| Name| Description| 3349| -------- | -------- | 3350| recordCmd | Pointer to an [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.| 3351 3352**Returns** 3353 3354Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmd** is NULL. 3355 3356 3357### OH_Drawing_RecordCmdUtilsBeginRecording() 3358 3359``` 3360OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas ) 3361``` 3362 3363**Description** 3364 3365Starts recording. This function must be used in pair with [OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording). 3366 3367The **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. 3368 3369**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3370 3371**Since**: 13 3372 3373**Parameters** 3374 3375| Name| Description| 3376| -------- | -------- | 3377| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.| 3378| width | Width of the canvas.| 3379| height | Height of the canvas.| 3380| 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).| 3381 3382**Returns** 3383 3384Returns one 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. 3385 3386 3387### OH_Drawing_RecordCmdUtilsCreate() 3388 3389``` 3390OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void ) 3391``` 3392 3393**Description** 3394 3395Creates an **OH_Drawing_RecordCmdUtils** object. 3396 3397**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3398 3399**Since**: 13 3400 3401**Returns** 3402 3403Returns the pointer to the **OH_Drawing_RecordCmdUtils** object created. 3404 3405 3406### OH_Drawing_RecordCmdUtilsDestroy() 3407 3408``` 3409OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils) 3410``` 3411 3412**Description** 3413 3414Destroys an **OH_Drawing_RecordCmdUtils** object and reclaims the memory occupied by the object. 3415 3416**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3417 3418**Since**: 13 3419 3420**Parameters** 3421 3422| Name| Description| 3423| -------- | -------- | 3424| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.| 3425 3426**Returns** 3427 3428Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **recordCmdUtils** is NULL. 3429 3430 3431### OH_Drawing_RecordCmdUtilsFinishRecording() 3432 3433``` 3434OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd ) 3435``` 3436 3437**Description** 3438 3439Ends recording. This function must be called after [OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording). 3440 3441The **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. 3442 3443**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3444 3445**Since**: 13 3446 3447**Parameters** 3448 3449| Name| Description| 3450| -------- | -------- | 3451| recordCmdUtils | Pointer to an [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) object.| 3452| 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.| 3453 3454**Returns** 3455 3456Returns one 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. 3457 3458 3459### OH_Drawing_CanvasDrawRecordCmd() 3460 3461``` 3462OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd ) 3463``` 3464 3465**Description** 3466 3467Draws an **OH_Drawing_RecordCmd** object. 3468 3469**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3470 3471**Since**: 13 3472 3473**Parameters** 3474 3475| Name| Description| 3476| -------- | -------- | 3477| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. Only a canvas of the recording type is supported.| 3478| recordCmd | Pointer to the [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) object.| 3479 3480**Returns** 3481 3482Returns one 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. 3483 3484 3485 3486### OH_Drawing_TypographyDestroyTextBox() 3487 3488``` 3489void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* ) 3490``` 3491 3492**Description** 3493 3494Releases the memory occupied by a text box. 3495 3496**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3497 3498**Since**: 12 3499 3500**Parameters** 3501 3502| Name| Description| 3503| -------- | -------- | 3504| OH_Drawing_TextBox | Pointer to an [OH_Drawing_TextBox](#oh_drawing_textbox) object.| 3505 3506 3507### OH_Drawing_SetTextShadow() 3508 3509``` 3510void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius ) 3511``` 3512 3513**Description** 3514 3515Sets a text shadow. 3516 3517**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3518 3519**Since**: 12 3520 3521**Parameters** 3522 3523| Name| Description| 3524| -------- | -------- | 3525| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow).| 3526| 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.| 3527| 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.| 3528| 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.| 3529 3530 3531 3532### OH_Drawing_CanvasDrawSingleCharacter() 3533 3534``` 3535OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y ) 3536``` 3537 3538**Description** 3539 3540Draws 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. 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| 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.| 3552| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 3553| x | X coordinate of the left point of the character baseline.| 3554| y | Y coordinate of the left point of the character baseline.| 3555 3556**Returns** 3557 3558Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **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**. 3559 3560 3561 3562### OH_Drawing_FontMeasureSingleCharacter() 3563 3564``` 3565OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth ) 3566``` 3567 3568**Description** 3569 3570Measures 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. 3571 3572**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3573 3574**Since**: 12 3575 3576**Parameters** 3577 3578| Name| Description| 3579| -------- | -------- | 3580| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 3581| 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.| 3582| textWidth | Pointer to the character width obtained.| 3583 3584**Returns** 3585 3586Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **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**. 3587 3588 3589 3590### OH_Drawing_TypographyPaintOnPath() 3591 3592``` 3593void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* , OH_Drawing_Canvas* , OH_Drawing_Path* , double , double ) 3594``` 3595 3596**Description** 3597 3598Draws text along a path. 3599 3600**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3601 3602**Since**: 12 3603 3604**Parameters** 3605 3606| Name| Description| 3607| -------- | -------- | 3608| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography).| 3609| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate).| 3610| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object, which is obtained by calling [OH_Drawing_PathCreate](#oh_drawing_pathcreate).| 3611| 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.| 3612| 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.| 3613 3614 3615### OH_Drawing_RoundRectOffset() 3616 3617``` 3618OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy ) 3619``` 3620 3621**Description** 3622 3623Translates a rounded rectangle by an offset along the X axis and Y axis. 3624 3625**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3626 3627**Since**: 12 3628 3629**Parameters** 3630 3631| Name| Description| 3632| -------- | -------- | 3633| roundRect | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.| 3634| dx | X offset.| 3635| dy | Y offset.| 3636 3637**Returns** 3638 3639Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **roundRect** is NULL. 3640 3641 3642### OH_Drawing_PointGetX() 3643 3644``` 3645OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x ) 3646``` 3647 3648**Description** 3649 3650Obtains the X coordinate of a point. 3651 3652**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3653 3654**Since**: 12 3655 3656**Parameters** 3657 3658| Name| Description| 3659| -------- | -------- | 3660| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.| 3661| x | Pointer to the X coordinate.| 3662 3663**Returns** 3664 3665Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **x** is NULL. 3666 3667 3668### OH_Drawing_PointGetY() 3669 3670``` 3671OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y ) 3672``` 3673 3674**Description** 3675 3676Obtains the Y coordinate of a point. 3677 3678**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3679 3680**Since**: 12 3681 3682**Parameters** 3683 3684| Name| Description| 3685| -------- | -------- | 3686| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.| 3687| y | Pointer to the Y coordinate.| 3688 3689**Returns** 3690 3691Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **point** or **y** is NULL. 3692 3693 3694### OH_Drawing_PointSet() 3695 3696``` 3697OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y ) 3698``` 3699 3700**Description** 3701 3702Sets the X and Y coordinates of a point. 3703 3704**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3705 3706**Since**: 12 3707 3708**Parameters** 3709 3710| Name| Description| 3711| -------- | -------- | 3712| point | Pointer to an [OH_Drawing_Point](#oh_drawing_point) object.| 3713| x | Pointer to the X coordinate.| 3714| y | Pointer to the Y coordinate.| 3715 3716**Returns** 3717 3718Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **point** is NULL. 3719 3720 3721### OH_Drawing_FontMeasureText() 3722 3723``` 3724OH_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 ) 3725``` 3726 3727**Description** 3728 3729Obtains the text width and bounding box. 3730 3731**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3732 3733**Since**: 12 3734 3735**Parameters** 3736 3737| Name| Description| 3738| -------- | -------- | 3739| font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 3740| text | Pointer to the text.| 3741| byteLength | Length of the text, in bytes.| 3742| encoding | Encoding type of the text.| 3743| bounds | Pointer to the bounding box. The value can be NULL.| 3744| textWidth | Pointer to the text width.| 3745 3746**Returns** 3747 3748Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if at least one of the parameters **font**, **text**, and **textWidth** is NULL, or **byteLength** is **0**. 3749 3750 3751### OH_Drawing_CanvasClipRegion() 3752 3753``` 3754OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp ) 3755``` 3756 3757**Description** 3758 3759Clips a rectangle. 3760 3761**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3762 3763**Since**: 12 3764 3765**Parameters** 3766 3767| Name| Description| 3768| -------- | -------- | 3769| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.| 3770| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.| 3771| clipOp | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop).| 3772 3773**Returns** 3774 3775Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **region** is NULL. **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **clipOp** is not set to one of the enumerated values. 3776 3777 3778### OH_Drawing_CanvasDrawColor() 3779 3780``` 3781OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode ) 3782``` 3783 3784**Description** 3785 3786Fills the entire canvas with the specified color and blend mode. 3787 3788**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3789 3790**Since**: 12 3791 3792**Parameters** 3793 3794| Name| Description| 3795| -------- | -------- | 3796| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.| 3797| color | Represents a color, represented by a 32-bit (ARGB) variable.| 3798| blendMode | Blend mode.| 3799 3800**Returns** 3801 3802Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if **canvas** is NULL. **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** if **blendMode** is not set to one of the enumerated values. 3803 3804 3805### OH_Drawing_CanvasGetImageInfo() 3806 3807``` 3808OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo ) 3809``` 3810 3811**Description** 3812 3813Obtains the image information of a canvas. 3814 3815**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3816 3817**Since**: 12 3818 3819**Parameters** 3820 3821| Name| Description| 3822| -------- | -------- | 3823| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.| 3824| imageInfo | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.| 3825 3826**Returns** 3827 3828Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **imageInfo** is NULL. 3829 3830 3831### OH_Drawing_CanvasIsClipEmpty() 3832 3833``` 3834OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty ) 3835``` 3836 3837**Description** 3838 3839Checks whether the region that can be drawn is empty after cropping. 3840 3841**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3842 3843**Since**: 12 3844 3845**Parameters** 3846 3847| Name| Description| 3848| -------- | -------- | 3849| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.| 3850| 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.| 3851 3852**Returns** 3853 3854Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **isClipEmpty** is NULL. 3855 3856 3857### OH_Drawing_CanvasDrawPoint() 3858 3859``` 3860OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point ) 3861``` 3862 3863**Description** 3864 3865Draws a point. 3866 3867**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3868 3869**Since**: 12 3870 3871**Parameters** 3872 3873| Name| Description| 3874| -------- | -------- | 3875| canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object.| 3876| point | Pointer to an [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) object.| 3877 3878**Returns** 3879 3880Returns one of the following result codes: **OH_DRAWING_SUCCESS** if the operation is successful. **OH_DRAWING_ERROR_INVALID_PARAMETER** if either **canvas** or **point** is NULL. 3881 3882 3883### OH_Drawing_MatrixGetAll() 3884 3885``` 3886OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] ) 3887``` 3888 3889**Description** 3890 3891Obtains all element values of a matrix. 3892 3893**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3894 3895**Since**: 12 3896 3897**Parameters** 3898 3899| Name| Description| 3900| -------- | -------- | 3901| matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.| 3902| value | Array used to store the obtained element values.| 3903 3904**Returns** 3905 3906Returns one of the following result codes: **OH_DRAWING_SUCCESS** if all element values of the matrix are successfully obtained. **OH_DRAWING_ERROR_INVALID_PARAMETER** if the matrix element values fail to be obtained. The failure cause is that **matrix** or **value** is NULL. 3907 3908 3909 3910### OH_Drawing_ErrorCodeGet() 3911 3912``` 3913OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet () 3914``` 3915 3916**Description** 3917 3918Obtains the latest error code of the module. After the function is successfully executed, the error code returned by this function will not be modified. 3919 3920**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3921 3922**Since**: 12 3923 3924**Returns** 3925 3926Returns the enumerated values of the error code. 3927 3928### OH_Drawing_BrushCopy() 3929 3930``` 3931OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush) 3932``` 3933 3934**Description** 3935 3936Copies an existing [OH_Drawing_Brush](#oh_drawing_brush) object to create a new one. 3937 3938Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 3939 3940If **brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 3941 3942**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3943 3944**Since**: 12 3945 3946**Parameters** 3947 3948| Name| Description| 3949| -------- | -------- | 3950| brush | Pointer to an **OH_Drawing_Brush** object.| 3951 3952**Returns** 3953 3954Returns 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. 3955 3956 3957 3958### OH_Drawing_FilterSetImageFilter() 3959 3960``` 3961void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* ) 3962``` 3963 3964**Description** 3965 3966Sets an **OH_Drawing_ImageFilter** object for an **OH_Drawing_Filter** object. 3967 3968Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 3969 3970If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 3971 3972**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3973 3974**Since**: 12 3975 3976**Parameters** 3977 3978| Name| Description| 3979| -------- | -------- | 3980| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object.| 3981| 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.| 3982 3983 3984### OH_Drawing_ImageFilterCreateBlur() 3985 3986``` 3987OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input ) 3988``` 3989 3990**Description** 3991 3992Creates an **OH_Drawing_ImageFilter** object with a given blur type. 3993 3994**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 3995 3996**Since**: 12 3997 3998**Parameters** 3999 4000| Name| Description| 4001| -------- | -------- | 4002| sigmaX | Standard deviation of the Gaussian blur along the X axis. The value must be greater than 0.| 4003| sigmaY | Standard deviation of the Gaussian blur along the Y axis. The value must be greater than 0.| 4004| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).| 4005| 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.| 4006 4007**Returns** 4008 4009Returns 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. 4010 4011 4012### OH_Drawing_ImageFilterCreateFromColorFilter() 4013 4014``` 4015OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input ) 4016``` 4017 4018**Description** 4019 4020Creates an **OH_Drawing_ImageFilter** object with a color filter effect. 4021 4022Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4023 4024If **colorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4025 4026**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4027 4028**Since**: 12 4029 4030**Parameters** 4031 4032| Name| Description| 4033| -------- | -------- | 4034| colorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object.| 4035| 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.| 4036 4037**Returns** 4038 4039Returns 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. 4040 4041 4042### OH_Drawing_ImageFilterDestroy() 4043 4044``` 4045void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* ) 4046``` 4047 4048**Description** 4049 4050Destroys an **OH_Drawing_ImageFilter** object and reclaims the memory occupied by the object. 4051 4052**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4053 4054**Since**: 12 4055 4056**Parameters** 4057 4058| Name| Description| 4059| -------- | -------- | 4060| OH_Drawing_ImageFilter | Pointer to an [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) object.| 4061 4062 4063### OH_Drawing_MatrixMapPoints() 4064 4065``` 4066void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count ) 4067``` 4068 4069**Description** 4070 4071Maps a source point array to a destination point array by means of matrix transformation. 4072 4073Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4074 4075If 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. 4076 4077**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4078 4079**Since**: 12 4080 4081**Parameters** 4082 4083| Name| Description| 4084| -------- | -------- | 4085| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.| 4086| src | Array of source points.| 4087| dst | Array of destination points. The number of destination points must be the same as that of source points.| 4088| count | Number of source points or destination points.| 4089 4090 4091### OH_Drawing_MatrixMapRect() 4092 4093``` 4094bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst ) 4095``` 4096 4097**Description** 4098 4099Maps a rectangle to the smallest rectangle that can enclose the vertices to which the four source vertices are mapped by means of matrix transformation. 4100 4101Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4102 4103If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned. 4104 4105**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4106 4107**Since**: 12 4108 4109**Parameters** 4110 4111| Name| Description| 4112| -------- | -------- | 4113| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object.| 4114| src | Pointer to the source rectangle.| 4115| dst | Pointer to the destination rectangle.| 4116 4117**Returns** 4118 4119Returns **true** if the source rectangle is equal to the destination rectangle; returns **false** otherwise. 4120 4121 4122### OH_Drawing_PathAddPolygon() 4123 4124``` 4125void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed ) 4126``` 4127 4128**Description** 4129 4130Adds a polygon to a path. 4131 4132Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4133 4134If either **path** or **points** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4135 4136**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4137 4138**Since**: 12 4139 4140**Parameters** 4141 4142| Name| Description| 4143| -------- | -------- | 4144| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object.| 4145| points | Pointer to an array that holds the vertex coordinates of the polygon.| 4146| count | Size of the array.| 4147| isClosed | Whether the path is closed. The value **true** means that the path is closed, and **false** means the opposite.| 4148 4149 4150### OH_Drawing_PathAddCircle() 4151 4152``` 4153void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection ) 4154``` 4155 4156**Description** 4157 4158Adds a circle to a path in the specified direction. 4159 4160Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4161 4162If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4163 4164If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4165 4166If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4167 4168**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4169 4170**Since**: 12 4171 4172**Parameters** 4173 4174| Name| Description| 4175| -------- | -------- | 4176| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4177| x | X coordinate of the circle center.| 4178| y | Y coordinate of the circle center.| 4179| radius | Radius of the circle.| 4180| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection).| 4181 4182 4183### OH_Drawing_PathBuildFromSvgString() 4184 4185``` 4186bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str ) 4187``` 4188 4189**Description** 4190 4191Parses the path represented by an SVG string. 4192 4193Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4194 4195If either **path** or **str** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4196 4197**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4198 4199**Since**: 12 4200 4201**Parameters** 4202 4203| Name| Description| 4204| -------- | -------- | 4205| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4206| str | Pointer to the SVG string.| 4207 4208**Returns** 4209 4210Returns **true** if the SVG string is parsed successfully; returns **false** otherwise. 4211 4212 4213### OH_Drawing_PathGetBounds() 4214 4215``` 4216void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect* ) 4217``` 4218 4219**Description** 4220 4221Obtains the minimum bounds that enclose a path. 4222 4223Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4224 4225If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4226 4227**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4228 4229**Since**: 12 4230 4231**Parameters** 4232 4233| Name| Description| 4234| -------- | -------- | 4235| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4236| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object.| 4237 4238 4239### OH_Drawing_PathIsClosed() 4240 4241``` 4242bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed ) 4243``` 4244 4245**Description** 4246 4247Checks whether a path is closed. 4248 4249Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4250 4251If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4252 4253**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4254 4255**Since**: 12 4256 4257**Parameters** 4258 4259| Name| Description| 4260| -------- | -------- | 4261| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4262| 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.| 4263 4264**Returns** 4265 4266Returns **true** if the path is closed; returns **false** otherwise. 4267 4268 4269### OH_Drawing_PathGetPositionTangent() 4270 4271``` 4272bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent ) 4273``` 4274 4275**Description** 4276 4277Obtains the coordinates and tangent at a distance from the start point of a path. 4278 4279Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4280 4281If any of **path**, **position**, or **tangent** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4282 4283**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4284 4285**Since**: 12 4286 4287**Parameters** 4288 4289| Name| Description| 4290| -------- | -------- | 4291| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4292| 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.| 4293| distance | Distance from the start point. If a negative number is passed in, the value **0** is used. If a value greater than the path length is passed in, the path length is used.| 4294| position | Pointer to the coordinates.| 4295| tangent | Tangent obtained, where **tangent.x** and **tangent.y** represent the cosine and sine of the tangent of the point, respectively.| 4296 4297**Returns** 4298 4299Returns **true** if the operation is successful; returns **false** otherwise. 4300 4301 4302### OH_Drawing_PathOp() 4303 4304``` 4305bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op ) 4306``` 4307 4308**Description** 4309 4310Combines two paths based on the specified operation mode. 4311 4312Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4313 4314If either **path** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4315 4316If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4317 4318**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4319 4320**Since**: 12 4321 4322**Parameters** 4323 4324| Name| Description| 4325| -------- | -------- | 4326| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, in which the resulting path is saved.| 4327| other | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4328| op | Operation mode of the path. For details about the available options, see [OH_Drawing_PathOpMode](#oh_drawing_pathopmode).| 4329 4330**Returns** 4331 4332Returns **true** if the resulting path is not empty; returns **false** otherwise. 4333 4334 4335### OH_Drawing_PathGetMatrix() 4336 4337``` 4338bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag ) 4339``` 4340 4341**Description** 4342 4343Obtains a transformation matrix at a distance from the start point of a path. 4344 4345Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4346 4347If either **path** or **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4348 4349If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4350 4351**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4352 4353**Since**: 12 4354 4355**Parameters** 4356 4357| Name| Description| 4358| -------- | -------- | 4359| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4360| 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.| 4361| distance | Distance from the start point. If a negative number is passed in, the value **0** is used. If a value greater than the path length is passed in, the path length is used.| 4362| matrix | Pointer to the transformation matrix.| 4363| flag | Type of the matrix information. For details about the available options, see [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags).| 4364 4365**Returns** 4366 4367Returns **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. 4368 4369 4370### OH_Drawing_PenGetFillPath() 4371 4372``` 4373bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix* ) 4374``` 4375 4376**Description** 4377 4378Obtains the source path outline drawn using a pen and represents it using a destination path. 4379 4380Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4381 4382If any of **OH_Drawing_Pen**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4383 4384**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4385 4386**Since**: 12 4387 4388**Parameters** 4389 4390| Name| Description| 4391| -------- | -------- | 4392| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.| 4393| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object.| 4394| dst | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object.| 4395| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. NULL is recommended.| 4396| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. NULL is recommended. The default value is an identity matrix.| 4397 4398**Returns** 4399 4400Returns **true** if the destination path is obtained; returns **false** otherwise. 4401 4402 4403### OH_Drawing_PenCopy() 4404 4405``` 4406OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen) 4407``` 4408 4409**Description** 4410 4411Copies an existing [OH_Drawing_Pen](#oh_drawing_pen) object to create a new one. 4412 4413Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4414 4415If **pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4416 4417**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4418 4419**Since**: 12 4420 4421**Parameters** 4422 4423| Name| Description| 4424| -------- | -------- | 4425| pen | Pointer to an **OH_Drawing_Pen** object.| 4426 4427**Returns** 4428 4429Returns 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. 4430 4431 4432### OH_Drawing_PixelMapGetFromNativePixelMap() 4433 4434``` 4435OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* ) 4436``` 4437 4438**Description** 4439 4440Obtains the pixel map defined by this module from a pixel map defined by the image framework. 4441 4442**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4443 4444**Since**: 12 4445 4446**Parameters** 4447 4448| Name| Description| 4449| -------- | -------- | 4450| NativePixelMap_ | Pointer to a **NativePixelMap_** object, which is the pixel map defined by the image framework.| 4451 4452**Returns** 4453 4454Returns 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. 4455 4456 4457### OH_Drawing_PixelMapGetFromOhPixelMapNative() 4458 4459``` 4460OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* ) 4461``` 4462 4463**Description** 4464 4465Obtains the pixel map defined by this module from a pixel map defined by the image framework. 4466 4467**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4468 4469**Since**: 12 4470 4471**Parameters** 4472 4473| Name| Description| 4474| -------- | -------- | 4475| OH_PixelmapNative | Pointer to an **OH_PixelmapNative** object, which is the pixel map defined by the image framework.| 4476 4477**Returns** 4478 4479Returns 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. 4480 4481 4482### OH_Drawing_PixelMapDissolve() 4483 4484``` 4485void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* ) 4486``` 4487 4488**Description** 4489 4490Removes 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). 4491 4492**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4493 4494**Since**: 12 4495 4496**Parameters** 4497 4498| Name| Description| 4499| -------- | -------- | 4500| OH_Drawing_PixelMap | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object.| 4501 4502 4503### OH_Drawing_RectJoin() 4504 4505``` 4506bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 4507``` 4508 4509**Description** 4510 4511Obtains the union of two rectangles. 4512 4513Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4514 4515If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4516 4517**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4518 4519**Since**: 12 4520 4521**Parameters** 4522 4523| Name| Description| 4524| -------- | -------- | 4525| rect | Pointer to the first rectangle, which is an **OH_Drawing_Rect** object.| 4526| other | Pointer to the second rectangle, which is an **OH_Drawing_Rect** object.| 4527 4528**Returns** 4529 4530Returns **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. 4531 4532 4533### OH_Drawing_RegionContains() 4534 4535``` 4536bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y ) 4537``` 4538 4539**Description** 4540 4541Checks whether a region contains the specified point. 4542 4543Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4544 4545If **region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4546 4547**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4548 4549**Since**: 12 4550 4551**Parameters** 4552 4553| Name| Description| 4554| -------- | -------- | 4555| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.| 4556| int32_t | X coordinate of the point.| 4557| int32_t | Y coordinate of the point.| 4558 4559**Returns** 4560 4561Returns **true** if the region contains the specified point; returns **false** otherwise. 4562 4563 4564### OH_Drawing_RegionOp() 4565 4566``` 4567bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op ) 4568``` 4569 4570**Description** 4571 4572Combines two regions based on the specified operation mode. 4573 4574Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4575 4576If either **region** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4577 4578If **op** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4579 4580**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4581 4582**Since**: 12 4583 4584**Parameters** 4585 4586| Name| Description| 4587| -------- | -------- | 4588| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object, in which the resulting region is saved.| 4589| other | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.| 4590| op | Operation mode of the region. For details about the available options, see [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode).| 4591 4592**Returns** 4593 4594Returns **true** if the resulting region is not empty; returns false otherwise. 4595 4596 4597### OH_Drawing_RegionSetPath() 4598 4599``` 4600bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip ) 4601``` 4602 4603**Description** 4604 4605Sets a region to the area described by the path. 4606 4607Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4608 4609If **region**, **path**, or **clip** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4610 4611**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4612 4613**Since**: 12 4614 4615**Parameters** 4616 4617| Name| Description| 4618| -------- | -------- | 4619| region | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.| 4620| path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object.| 4621| clip | Pointer to an [OH_Drawing_Region](#oh_drawing_region) object.| 4622 4623**Returns** 4624 4625Returns **true** if the resulting region is not empty; returns false otherwise. 4626 4627 4628### OH_Drawing_ShaderEffectCreateColorShader() 4629 4630``` 4631OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color) 4632``` 4633 4634**Description** 4635 4636Creates an **OH_Drawing_ShaderEffect** object with a single color. 4637 4638**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4639 4640**Since**: 12 4641 4642**Parameters** 4643 4644| Name| Description| 4645| -------- | -------- | 4646| color | Color in the ARGB format. The value is a 32-bit unsigned integer.| 4647 4648**Returns** 4649 4650Returns 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. 4651 4652 4653### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix() 4654 4655``` 4656OH_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* ) 4657``` 4658 4659**Description** 4660 4661Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points. 4662 4663Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4664 4665If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4666 4667If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4668 4669**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4670 4671**Since**: 12 4672 4673**Parameters** 4674 4675| Name| Description| 4676| -------- | -------- | 4677| startPt | Start point.| 4678| endPt | End point.| 4679| colors | Colors to distribute.| 4680| 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.| 4681| size | Number of colors and positions (if **pos** is not NULL).| 4682| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).| 4683| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.| 4684 4685**Returns** 4686 4687Returns 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. 4688 4689 4690### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix() 4691 4692``` 4693OH_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* ) 4694``` 4695 4696**Description** 4697 4698Creates 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. 4699 4700Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4701 4702If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4703 4704If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4705 4706**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4707 4708**Since**: 12 4709 4710**Parameters** 4711 4712| Name| Description| 4713| -------- | -------- | 4714| centerPt | Center of the circle.| 4715| radius | Radius of the gradient.| 4716| colors | Colors to distribute in the radial direction.| 4717| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction.| 4718| size | Number of colors and positions (if **pos** is not NULL).| 4719| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode).| 4720| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.| 4721 4722**Returns** 4723 4724Returns 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. 4725 4726 4727### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient() 4728 4729``` 4730OH_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* ) 4731``` 4732 4733**Description** 4734 4735Creates an **OH_Drawing_ShaderEffect** object that generates a gradient between two given circles. 4736 4737Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4738 4739If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4740 4741If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4742 4743**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4744 4745**Since**: 12 4746 4747**Parameters** 4748 4749| Name| Description| 4750| -------- | -------- | 4751| startPt | Pointer to the center of the start circle.| 4752| startRadius | Start radius of the gradient. The value should be a non-negative number.| 4753| endPt | Pointer to the center of the end circle.| 4754| endRadius | End radius of the gradient. The value should be a non-negative number.| 4755| colors | Colors to distribute between the two circles.| 4756| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed between the two circles.| 4757| size | Number of colors and positions (if **pos** is not NULL).| 4758| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1).| 4759| OH_Drawing_Matrix | Matrix applied on the shader effect. If **matrix** is NULL, an identity matrix is applied by default.| 4760 4761**Returns** 4762 4763Returns 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. 4764 4765 4766 4767### OH_Drawing_TextBlobUniqueID() 4768 4769``` 4770uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* ) 4771``` 4772 4773**Description** 4774 4775Obtains the unique identifier of a text blob. The identifier is a non-zero value. 4776 4777Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4778 4779If **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4780 4781**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4782 4783**Since**: 12 4784 4785**Parameters** 4786 4787| Name| Description| 4788| -------- | -------- | 4789| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object.| 4790 4791**Returns** 4792 4793Returns the unique identifier of the text blob. 4794 4795 4796### OH_Drawing_PenSetShadowLayer() 4797 4798``` 4799void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* ) 4800``` 4801 4802**Description** 4803 4804Sets the shadow layer for a pen. The shadow layer effect takes effect only when text is drawn. 4805 4806Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4807 4808If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4809 4810**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4811 4812**Since**: 12 4813 4814**Parameters** 4815 4816| Name| Description| 4817| -------- | -------- | 4818| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object.| 4819| 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.| 4820 4821 4822### OH_Drawing_BrushSetShadowLayer() 4823 4824``` 4825void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* ) 4826``` 4827 4828**Description** 4829 4830Sets the shadow layer for a brush. The shadow layer effect takes effect only when text is drawn. 4831 4832Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4833 4834If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4835 4836**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4837 4838**Since**: 12 4839 4840**Parameters** 4841 4842| Name| Description| 4843| -------- | -------- | 4844| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object.| 4845| 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.| 4846 4847 4848### OH_Drawing_ShadowLayerCreate() 4849 4850``` 4851OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color ) 4852``` 4853 4854**Description** 4855 4856Creates an **OH_Drawing_ShadowLayer** object. 4857 4858Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4859 4860If **blurRadius** is less than or equal to **0**, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4861 4862**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4863 4864**Since**: 12 4865 4866**Parameters** 4867 4868| Name| Description| 4869| -------- | -------- | 4870| blurRadius | Radius of the shadow layer. The value must be greater than 0.| 4871| x | Offset on the X axis.| 4872| y | Offset on the Y axis.| 4873| color | Color of the shadow.| 4874 4875**Returns** 4876 4877Returns the pointer to the **OH_Drawing_ShadowLayer** object created. 4878 4879 4880### OH_Drawing_ShadowLayerDestroy() 4881 4882``` 4883void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* ) 4884``` 4885 4886**Description** 4887 4888Destroys an **OH_Drawing_ShadowLayer** object and reclaims the memory occupied by the object. 4889 4890**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4891 4892**Since**: 12 4893 4894**Parameters** 4895 4896| Name| Description| 4897| -------- | -------- | 4898| OH_Drawing_ShadowLayer | Pointer to the shadow layer.| 4899 4900 4901### OH_Drawing_FontSetBaselineSnap() 4902 4903``` 4904void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap ) 4905``` 4906 4907**Description** 4908 4909Sets whether to request that baselines be snapped to pixels when the current canvas matrix is axis aligned. 4910 4911Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4912 4913If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4914 4915**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4916 4917**Since**: 12 4918 4919**Parameters** 4920 4921| Name| Description| 4922| -------- | -------- | 4923| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 4924| baselineSnap | Check result. The value **true** means to request that baselines be snapped to pixels, and **false** means the opposite.| 4925 4926 4927### OH_Drawing_FontIsBaselineSnap() 4928 4929``` 4930bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* ) 4931``` 4932 4933**Description** 4934 4935Checks whether baselines are requested to be snapped to pixels when the current canvas matrix is axis aligned. 4936 4937Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4938 4939If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4940 4941**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4942 4943**Since**: 12 4944 4945**Parameters** 4946 4947| Name| Description| 4948| -------- | -------- | 4949| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 4950 4951**Returns** 4952 4953Check result. The value **true** means that the baselines are requested to be snapped to pixels, and **false** means the opposite. 4954 4955 4956### OH_Drawing_FontSetEdging() 4957 4958``` 4959void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging ) 4960``` 4961 4962**Description** 4963 4964Sets a font edging effect. 4965 4966Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4967 4968If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4969 4970If **OH_Drawing_FontEdging** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 4971 4972**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4973 4974**Since**: 12 4975 4976**Parameters** 4977 4978| Name| Description| 4979| -------- | -------- | 4980| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 4981| OH_Drawing_FontEdging | Font edging effect.| 4982 4983 4984### OH_Drawing_FontGetEdging() 4985 4986``` 4987OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* ) 4988``` 4989 4990**Description** 4991 4992Obtains the font edging effect. 4993 4994Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 4995 4996If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 4997 4998**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 4999 5000**Since**: 12 5001 5002**Parameters** 5003 5004| Name| Description| 5005| -------- | -------- | 5006| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5007 5008**Returns** 5009 5010Font edging effect. 5011 5012 5013 5014### OH_Drawing_FontSetForceAutoHinting() 5015 5016``` 5017void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting ) 5018``` 5019 5020**Description** 5021 5022Sets whether to forcibly use auto hinting, that is, whether to always hint glyphs. 5023 5024Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5025 5026If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5027 5028**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5029 5030**Since**: 12 5031 5032**Parameters** 5033 5034| Name| Description| 5035| -------- | -------- | 5036| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5037| isForceAutoHinting | Check result. The value **true** means to forcibly use auto hinting, and **false** means the opposite.| 5038 5039 5040### OH_Drawing_FontIsForceAutoHinting() 5041 5042``` 5043bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* ) 5044``` 5045 5046**Description** 5047 5048Checks whether auto hinting is forcibly used. 5049 5050Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5051 5052If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5053 5054**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5055 5056**Since**: 12 5057 5058**Parameters** 5059 5060| Name| Description| 5061| -------- | -------- | 5062| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5063 5064**Returns** 5065 5066Check result. The value **true** means that auto hinting is forcibly used, and **false** means the opposite. 5067 5068 5069### OH_Drawing_FontSetSubpixel() 5070 5071``` 5072void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel ) 5073``` 5074 5075**Description** 5076 5077Sets whether to use sub-pixel rendering for a font. 5078 5079Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5080 5081If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5082 5083**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5084 5085**Since**: 12 5086 5087**Parameters** 5088 5089| Name| Description| 5090| -------- | -------- | 5091| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5092| isSubpixel | Check result. The value **true** means to use sub-pixel rendering for the font, and **false** means the opposite.| 5093 5094 5095### OH_Drawing_FontIsSubpixel() 5096 5097``` 5098bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* ) 5099``` 5100 5101**Description** 5102 5103Checks whether sub-pixel rendering is used for this font. 5104 5105Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5106 5107If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5108 5109**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5110 5111**Since**: 12 5112 5113**Parameters** 5114 5115| Name| Description| 5116| -------- | -------- | 5117| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5118 5119**Returns** 5120 5121Check result. The value **true** means to use sub-pixel rendering for the font, and **false** means the opposite. 5122 5123 5124### OH_Drawing_FontGetTextSize() 5125 5126``` 5127float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* ) 5128``` 5129 5130**Description** 5131 5132Obtains the text size. 5133 5134Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5135 5136If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5137 5138**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5139 5140**Since**: 12 5141 5142**Parameters** 5143 5144| Name| Description| 5145| -------- | -------- | 5146| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5147 5148**Returns** 5149 5150Returns a floating point number representing the text size. 5151 5152 5153### OH_Drawing_FontTextToGlyphs() 5154 5155``` 5156uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount ) 5157``` 5158 5159**Description** 5160 5161Converts text into glyph indices. 5162 5163Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5164 5165If 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. 5166 5167**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5168 5169**Since**: 12 5170 5171**Parameters** 5172 5173| Name| Description| 5174| -------- | -------- | 5175| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5176| text | Pointer to the start address of the storage.| 5177| byteLength | Text length, in bytes.| 5178| encoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding).| 5179| glyphs | Pointer to the start address for storing the glyph indices.| 5180| maxGlyphCount | Maximum number of glyphs.| 5181 5182**Returns** 5183 5184Returns the number of glyph indices. 5185 5186 5187### OH_Drawing_FontGetWidths() 5188 5189``` 5190void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths ) 5191``` 5192 5193**Description** 5194 5195Obtains the width of each glyph in a string of text. 5196 5197Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5198 5199If 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. 5200 5201**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5202 5203**Since**: 12 5204 5205**Parameters** 5206 5207| Name| Description| 5208| -------- | -------- | 5209| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5210| glyphs | Pointer to the start address for storing the glyph indices.| 5211| count | Number of glyph indices.| 5212| widths | Pointer to the start address for storing the glyph widths.| 5213 5214 5215### OH_Drawing_FontIsLinearText() 5216 5217``` 5218bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* ) 5219``` 5220 5221**Description** 5222 5223Checks whether linear scaling is used for a font. 5224 5225Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5226 5227If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5228 5229**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5230 5231**Since**: 12 5232 5233**Parameters** 5234 5235| Name| Description| 5236| -------- | -------- | 5237| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5238 5239**Returns** 5240 5241Check result. The value **true** means that linear scaling is used, and **false** means the opposite. 5242 5243 5244### OH_Drawing_FontGetTextSkewX() 5245 5246``` 5247float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* ) 5248``` 5249 5250**Description** 5251 5252Obtains the horizontal skew factor of a font. 5253 5254Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5255 5256If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5257 5258**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5259 5260**Since**: 12 5261 5262**Parameters** 5263 5264| Name| Description| 5265| -------- | -------- | 5266| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5267 5268**Returns** 5269 5270Returns a floating point number representing the horizontal skew factor. 5271 5272 5273### OH_Drawing_FontIsFakeBoldText() 5274 5275``` 5276bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* ) 5277``` 5278 5279**Description** 5280 5281Checks whether fake bold is used for a font. 5282 5283Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5284 5285If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5286 5287**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5288 5289**Since**: 12 5290 5291**Parameters** 5292 5293| Name| Description| 5294| -------- | -------- | 5295| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5296 5297**Returns** 5298 5299Returns **true** if fake bold is used; returns **false** otherwise. 5300 5301 5302### OH_Drawing_FontSetScaleX() 5303 5304``` 5305void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX ) 5306``` 5307 5308**Description** 5309 5310Sets a horizontal scale factor for this font. 5311 5312Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5313 5314If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5315 5316**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5317 5318**Since**: 12 5319 5320**Parameters** 5321 5322| Name| Description| 5323| -------- | -------- | 5324| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5325| scaleX | Horizontal scale factor.| 5326 5327 5328### OH_Drawing_FontGetScaleX() 5329 5330``` 5331float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* ) 5332``` 5333 5334**Description** 5335 5336Obtains the horizontal scale factor of a font. 5337 5338Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5339 5340If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5341 5342**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5343 5344**Since**: 12 5345 5346**Parameters** 5347 5348| Name| Description| 5349| -------- | -------- | 5350| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5351 5352**Returns** 5353 5354Returns the horizontal scale factor. 5355 5356 5357### OH_Drawing_FontSetHinting() 5358 5359``` 5360void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting ) 5361``` 5362 5363**Description** 5364 5365Sets a font hinting effect. 5366 5367Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5368 5369If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5370 5371If **OH_Drawing_FontHinting** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 5372 5373**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5374 5375**Since**: 12 5376 5377**Parameters** 5378 5379| Name| Description| 5380| -------- | -------- | 5381| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5382| OH_Drawing_FontHinting | Font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting).| 5383 5384 5385### OH_Drawing_FontGetHinting() 5386 5387``` 5388OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* ) 5389``` 5390 5391**Description** 5392 5393Obtains the font hinting effect. 5394 5395Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5396 5397If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5398 5399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5400 5401**Since**: 12 5402 5403**Parameters** 5404 5405| Name| Description| 5406| -------- | -------- | 5407| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5408 5409**Returns** 5410 5411Returns the font hinting effect. For details about the available options, see [OH_Drawing_FontHinting](#oh_drawing_fonthinting). 5412 5413 5414### OH_Drawing_FontSetEmbeddedBitmaps() 5415 5416``` 5417void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps ) 5418``` 5419 5420**Description** 5421 5422Sets whether to use bitmaps in a font. 5423 5424Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5425 5426If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5427 5428**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5429 5430**Since**: 12 5431 5432**Parameters** 5433 5434| Name| Description| 5435| -------- | -------- | 5436| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5437| isEmbeddedBitmaps | Whether to use bitmaps in the font. The value **true** means to use bitmaps in the font, and **false** means the opposite.| 5438 5439 5440### OH_Drawing_FontIsEmbeddedBitmaps() 5441 5442``` 5443bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* ) 5444``` 5445 5446**Description** 5447 5448Checks whether bitmaps are used in a font. 5449 5450Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5451 5452If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5453 5454**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5455 5456**Since**: 12 5457 5458**Parameters** 5459 5460| Name| Description| 5461| -------- | -------- | 5462| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object.| 5463 5464**Returns** 5465 5466Returns **true** if bitmaps are used; returns **false** otherwise. 5467 5468 5469### OH_Drawing_BitmapBuild() 5470 5471``` 5472void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat* ) 5473``` 5474 5475**Description** 5476 5477Initializes the width and height of a bitmap and sets the pixel format for the bitmap. 5478 5479Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5480 5481If either **OH_Drawing_Bitmap** or **OH_Drawing_BitmapFormat** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5482 5483**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5484 5485**Since**: 8 5486 5487**Parameters** 5488 5489| Name| Description| 5490| -------- | -------- | 5491| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5492| width | Width of the bitmap to be initialized.| 5493| height | Height of the bitmap to be initialized.| 5494| [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.| 5495 5496 5497### OH_Drawing_BitmapCreate() 5498 5499``` 5500OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void ) 5501``` 5502 5503**Description** 5504 5505Creates an **OH_Drawing_Bitmap** object. 5506 5507**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5508 5509**Since**: 8 5510 5511**Returns** 5512 5513Returns the pointer to the **OH_Drawing_Bitmap** object created. 5514 5515 5516### OH_Drawing_BitmapCreateFromPixels() 5517 5518``` 5519OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes ) 5520``` 5521 5522**Description** 5523 5524Creates 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. 5525 5526Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5527 5528If either **OH_Drawing_Image_Info** or **pixels** is NULL or **rowBytes** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5529 5530**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5531 5532**Since**: 12 5533 5534**Parameters** 5535 5536| Name| Description| 5537| -------- | -------- | 5538| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.| 5539| 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.| 5540| rowBytes | Pixel size of each line. The value is invalid if it is less than or equal to 0.| 5541 5542**Returns** 5543 5544Returns the pointer to the [OH_Drawing_Bitmap](#oh_drawing_bitmap) object created. 5545 5546 5547### OH_Drawing_BitmapDestroy() 5548 5549``` 5550void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* ) 5551``` 5552 5553**Description** 5554 5555Destroys an **OH_Drawing_Bitmap** object and reclaims the memory occupied by the object. 5556 5557**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5558 5559**Since**: 8 5560 5561**Parameters** 5562 5563| Name| Description| 5564| -------- | -------- | 5565| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5566 5567 5568### OH_Drawing_BitmapGetAlphaFormat() 5569 5570``` 5571OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* ) 5572``` 5573 5574**Description** 5575 5576Obtains the alpha component of a bitmap. 5577 5578Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5579 5580If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5581 5582**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5583 5584**Since**: 12 5585 5586**Parameters** 5587 5588| Name| Description| 5589| -------- | -------- | 5590| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5591 5592**Returns** 5593 5594Returns the alpha component. For details about the supported formats, see [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat). 5595 5596 5597### OH_Drawing_BitmapGetColorFormat() 5598 5599``` 5600OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* ) 5601``` 5602 5603**Description** 5604 5605Obtains the pixel format of a bitmap. 5606 5607Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5608 5609If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5610 5611**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5612 5613**Since**: 12 5614 5615**Parameters** 5616 5617| Name| Description| 5618| -------- | -------- | 5619| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5620 5621**Returns** 5622 5623Returns the pixel format. For details about the supported formats, see [OH_Drawing_ColorFormat](#oh_drawing_colorformat). 5624 5625 5626### OH_Drawing_BitmapGetHeight() 5627 5628``` 5629uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* ) 5630``` 5631 5632**Description** 5633 5634Obtains the height of a bitmap. 5635 5636Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5637 5638If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5639 5640**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5641 5642**Since**: 8 5643 5644**Parameters** 5645 5646| Name| Description| 5647| -------- | -------- | 5648| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5649 5650**Returns** 5651 5652Returns the height. 5653 5654 5655### OH_Drawing_BitmapGetImageInfo() 5656 5657``` 5658void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info* ) 5659``` 5660 5661**Description** 5662 5663Obtains the image information of a bitmap. 5664 5665Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5666 5667If either **OH_Drawing_Bitmap** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5668 5669**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5670 5671**Since**: 12 5672 5673**Parameters** 5674 5675| Name| Description| 5676| -------- | -------- | 5677| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.| 5678| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.| 5679 5680 5681### OH_Drawing_BitmapGetPixels() 5682 5683``` 5684void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* ) 5685``` 5686 5687**Description** 5688 5689Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap. 5690 5691Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5692 5693If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5694 5695**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5696 5697**Since**: 8 5698 5699**Parameters** 5700 5701| Name| Description| 5702| -------- | -------- | 5703| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5704 5705**Returns** 5706 5707Returns the pixel address. 5708 5709 5710### OH_Drawing_BitmapGetWidth() 5711 5712``` 5713uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* ) 5714``` 5715 5716**Description** 5717 5718Obtains the width of a bitmap. 5719 5720Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5721 5722If **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5723 5724**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5725 5726**Since**: 8 5727 5728**Parameters** 5729 5730| Name| Description| 5731| -------- | -------- | 5732| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object.| 5733 5734**Returns** 5735 5736Returns the width. 5737 5738### OH_Drawing_BitmapReadPixels() 5739 5740``` 5741bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY ) 5742``` 5743 5744**Description** 5745 5746Reads pixels of a rectangle in a bitmap to the specified buffer. 5747 5748Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5749 5750If any of **OH_Drawing_Bitmap**, **dstInfo**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5751 5752**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5753 5754**Since**: 12 5755 5756**Parameters** 5757 5758| Name| Description| 5759| -------- | -------- | 5760| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object.| 5761| OH_Drawing_Image_Info | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object.| 5762| dstPixels | Pointer to the buffer for storing the pixels read.| 5763| 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.| 5764| srcX | Start X coordinate of the pixel data to read from the bitmap. The value must be less than the width of the bitmap.| 5765| srcY | Start Y coordinate of the pixel data to read from the bitmap. The value must be less than the height of the bitmap.| 5766 5767**Returns** 5768 5769Returns **true** if the pixels are read; returns **false** otherwise. 5770 5771### OH_Drawing_BrushCreate() 5772 5773``` 5774OH_Drawing_Brush* OH_Drawing_BrushCreate (void ) 5775``` 5776 5777**Description** 5778 5779Creates an **OH_Drawing_Brush** object. 5780 5781**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5782 5783**Since**: 8 5784 5785**Returns** 5786 5787Returns the pointer to the **OH_Drawing_Brush** object created. 5788 5789 5790### OH_Drawing_BrushDestroy() 5791 5792``` 5793void OH_Drawing_BrushDestroy (OH_Drawing_Brush* ) 5794``` 5795 5796**Description** 5797 5798Destroys an **OH_Drawing_Brush** object and reclaims the memory occupied by the object. 5799 5800**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5801 5802**Since**: 8 5803 5804**Parameters** 5805 5806| Name | Description | 5807| ---------------- | ------------------------------------------ | 5808| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5809 5810 5811### OH_Drawing_BrushGetAlpha() 5812 5813``` 5814uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* ) 5815``` 5816 5817**Description** 5818 5819Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape. 5820 5821Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5822 5823If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5824 5825**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5826 5827**Since**: 11 5828 5829**Parameters** 5830 5831| Name | Description | 5832| ---------------- | ------------------------------------------ | 5833| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5834 5835**Returns** 5836 5837Returns an 8-bit variable that describes the alpha value. 5838 5839 5840### OH_Drawing_BrushGetColor() 5841 5842``` 5843uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* ) 5844``` 5845 5846**Description** 5847 5848Obtains the color of a brush. The color is used by the brush to fill in a shape. 5849 5850Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5851 5852If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5853 5854**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5855 5856**Since**: 8 5857 5858**Parameters** 5859 5860| Name | Description | 5861| ---------------- | ------------------------------------------ | 5862| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5863 5864**Returns** 5865 5866Returns a 32-bit (ARGB) variable that describes the color. 5867 5868 5869### OH_Drawing_BrushGetFilter() 5870 5871``` 5872void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 5873``` 5874 5875**Description** 5876 5877Obtains the filter of a brush. The filter is a container that holds a mask filter and color filter. 5878 5879Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5880 5881If either **OH_Drawing_Brush** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5882 5883**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5884 5885**Since**: 12 5886 5887**Parameters** 5888 5889| Name | Description | 5890| ----------------- | ------------------------------------------------------------ | 5891| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. | 5892| OH_Drawing_Filter | Pointer to the [OH_Drawing_Filter](#oh_drawing_filter) object obtained. | 5893 5894 5895### OH_Drawing_BrushIsAntiAlias() 5896 5897``` 5898bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* ) 5899``` 5900 5901**Description** 5902 5903Checks whether anti-aliasing is enabled for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent. 5904 5905Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5906 5907If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5908 5909**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5910 5911**Since**: 8 5912 5913**Parameters** 5914 5915| Name | Description | 5916| ---------------- | ------------------------------------------ | 5917| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5918 5919**Returns** 5920 5921Returns **true** if anti-aliasing is enabled; returns **false** otherwise. 5922 5923 5924### OH_Drawing_BrushReset() 5925 5926``` 5927void OH_Drawing_BrushReset (OH_Drawing_Brush* ) 5928``` 5929 5930**Description** 5931 5932Resets a brush to the initial state. All configured attributes are cleared. 5933 5934Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5935 5936If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5937 5938**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5939 5940**Since**: 12 5941 5942**Parameters** 5943 5944| Name | Description | 5945| ---------------- | ----------------------------------------------------------- | 5946| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. | 5947 5948 5949### OH_Drawing_BrushSetAlpha() 5950 5951``` 5952void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha ) 5953``` 5954 5955**Description** 5956 5957Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape. 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 **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5962 5963**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5964 5965**Since**: 11 5966 5967**Parameters** 5968 5969| Name | Description | 5970| ---------------- | ------------------------------------------ | 5971| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5972| alpha | Alpha value, which is an 8-bit variable. | 5973 5974 5975### OH_Drawing_BrushSetAntiAlias() 5976 5977``` 5978void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool ) 5979 5980``` 5981 5982**Description** 5983 5984Enables or disables anti-aliasing for a brush. Anti-aliasing makes the pixels around the shape edges semi-transparent. 5985 5986Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 5987 5988If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 5989 5990**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 5991 5992**Since**: 8 5993 5994**Parameters** 5995 5996| Name | Description | 5997| ---------------- | ------------------------------------------------------------ | 5998| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 5999| bool | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. | 6000 6001 6002### OH_Drawing_BrushSetBlendMode() 6003 6004``` 6005void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode ) 6006 6007``` 6008 6009**Description** 6010 6011Sets a blender for a brush. The blender implements the specified blend mode. 6012 6013Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6014 6015If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6016 6017If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6018 6019**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6020 6021**Since**: 12 6022 6023**Parameters** 6024 6025| Name | Description | 6026| -------------------- | ------------------------------------------------------------ | 6027| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object. | 6028| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). | 6029 6030 6031### OH_Drawing_BrushSetColor() 6032 6033``` 6034void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color ) 6035 6036``` 6037 6038**Description** 6039 6040Sets the color for a brush. The color is used by the brush to fill in a shape. 6041 6042Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6043 6044If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6045 6046**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6047 6048**Since**: 8 6049 6050**Parameters** 6051 6052| Name | Description | 6053| ---------------- | ------------------------------------------ | 6054| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 6055| color | Color, which is a 32-bit (ARGB) variable. | 6056 6057 6058### OH_Drawing_BrushSetFilter() 6059 6060``` 6061void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 6062 6063``` 6064 6065**Description** 6066 6067Sets a filter for a brush. The filter is a container that holds a mask filter and color filter. 6068 6069Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6070 6071If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6072 6073**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6074 6075**Since**: 11 6076 6077**Parameters** 6078 6079| Name | Description | 6080| ----------------- | ------------------------------------------------------------ | 6081| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 6082| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. If null is passed in, the filter will be cleared. | 6083 6084 6085### OH_Drawing_BrushSetShaderEffect() 6086 6087``` 6088void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect* ) 6089 6090``` 6091 6092**Description** 6093 6094Sets the shader effect for a brush. 6095 6096Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6097 6098If **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6099 6100**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6101 6102**Since**: 11 6103 6104**Parameters** 6105 6106| Name | Description | 6107| ----------------------- | ------------------------------------------------------------ | 6108| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 6109| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. If NULL is passed in, the shader effect of the brush will be cleared. | 6110 6111 6112### OH_Drawing_CanvasAttachBrush() 6113 6114``` 6115void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 6116 6117``` 6118 6119**Description** 6120 6121Attaches a brush to a canvas so that the canvas can use the style and color of the brush to fill in a shape. If the brush effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing. 6122 6123Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6124 6125If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6126 6127**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6128 6129**Since**: 8 6130 6131**Parameters** 6132 6133| Name | Description | 6134| ----------------- | ------------------------------------------- | 6135| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6136| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 6137 6138 6139### OH_Drawing_CanvasAttachPen() 6140 6141``` 6142void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen* ) 6143 6144``` 6145 6146**Description** 6147 6148Attaches a pen to a canvas so that the canvas can use the style and color of the pen to outline a shape. If the pen effect changes after this function is called, you must call the function again to use the new effect in the subsequent drawing. 6149 6150Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6151 6152If either **OH_Drawing_Canvas** or **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6153 6154**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6155 6156**Since**: 8 6157 6158**Parameters** 6159 6160| Name | Description | 6161| ----------------- | ------------------------------------------- | 6162| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6163| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 6164 6165 6166### OH_Drawing_CanvasBind() 6167 6168``` 6169void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap* ) 6170 6171``` 6172 6173**Description** 6174 6175Binds a bitmap to a canvas so that the content drawn on the canvas is output to the bitmap. (This process is called CPU rendering.) A canvas bound to a bitmap is a non-recording canvas. 6176 6177Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6178 6179If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6180 6181**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6182 6183**Since**: 8 6184 6185**Parameters** 6186 6187| Name | Description | 6188| ----------------- | ------------------------------------------- | 6189| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6190| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object. | 6191 6192 6193### OH_Drawing_CanvasClear() 6194 6195``` 6196void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color ) 6197 6198``` 6199 6200**Description** 6201 6202Clears a canvas by using a given color. 6203 6204Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6205 6206If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6207 6208**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6209 6210**Since**: 8 6211 6212**Parameters** 6213 6214| Name | Description | 6215| ----------------- | ------------------------------------------- | 6216| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6217| color | Color, which is a 32-bit (ARGB) variable. | 6218 6219 6220### OH_Drawing_CanvasClipPath() 6221 6222``` 6223void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6224 6225``` 6226 6227**Description** 6228 6229Clips a path. 6230 6231Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6232 6233If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6234 6235If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6236 6237**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6238 6239**Since**: 11 6240 6241**Parameters** 6242 6243| Name | Description | 6244| ----------------- | ------------------------------------------------------------ | 6245| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6246| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 6247| clipOp | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). | 6248| doAntiAlias | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. | 6249 6250 6251### OH_Drawing_CanvasClipRect() 6252 6253``` 6254void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6255 6256``` 6257 6258**Description** 6259 6260Clips a rectangle. 6261 6262Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6263 6264If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6265 6266If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6267 6268**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6269 6270**Since**: 11 6271 6272**Parameters** 6273 6274| Name | Description | 6275| ----------------- | ------------------------------------------------------------ | 6276| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6277| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 6278| clipOp | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). | 6279| doAntiAlias | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. | 6280 6281### OH_Drawing_CanvasClipRoundRect() 6282 6283``` 6284void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6285 6286``` 6287 6288**Description** 6289 6290Clips a rounded rectangle. 6291 6292Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6293 6294If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6295 6296If **clipOp** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6297 6298**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6299 6300**Since**: 12 6301 6302**Parameters** 6303 6304| Name | Description | 6305| -------------------- | ------------------------------------------------------------ | 6306| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6307| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. | 6308| clipOp | Clip mode. For details about the available options, see [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop). | 6309| doAntiAlias | Whether to perform anti-aliasing. The value **true** means to perform anti-aliasing, and **false** means the opposite. | 6310 6311### OH_Drawing_CanvasConcatMatrix() 6312 6313``` 6314void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 6315 6316``` 6317 6318**Description** 6319 6320Preconcats the existing matrix with the passed-in matrix. The drawing operation triggered before this function is called is not affected. 6321 6322Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6323 6324If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6325 6326**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6327 6328**Since**: 12 6329 6330**Parameters** 6331 6332| Name | Description | 6333| ----------------- | ------------------------------------------------------------ | 6334| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6335| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 6336 6337 6338### OH_Drawing_CanvasCreate() 6339 6340``` 6341OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void ) 6342 6343``` 6344 6345**Description** 6346 6347Creates an **OH_Drawing_Canvas** object. 6348 6349**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6350 6351**Since**: 8 6352 6353**Returns** 6354 6355Returns the pointer to the **OH_Drawing_Canvas** object created. 6356 6357 6358### OH_Drawing_CanvasDestroy() 6359 6360``` 6361void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* ) 6362 6363``` 6364 6365**Description** 6366 6367Destroys an **OH_Drawing_Canvas** object and reclaims the memory occupied by the object. 6368 6369**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6370 6371**Since**: 8 6372 6373**Parameters** 6374 6375| Name | Description | 6376| ----------------- | ------------------------------------------- | 6377| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6378 6379 6380### OH_Drawing_CanvasDetachBrush() 6381 6382``` 6383void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* ) 6384 6385``` 6386 6387**Description** 6388 6389Detaches the brush from a canvas so that the canvas can no longer use the previously set brush to fill in a shape. 6390 6391Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6392 6393If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6394 6395**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6396 6397**Since**: 8 6398 6399**Parameters** 6400 6401| Name | Description | 6402| ----------------- | ------------------------------------------- | 6403| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6404 6405 6406### OH_Drawing_CanvasDetachPen() 6407 6408``` 6409void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* ) 6410 6411``` 6412 6413**Description** 6414 6415Detaches the pen from a canvas so that the canvas can no longer use the style and color of the pen to outline a shape. 6416 6417Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6418 6419If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6420 6421**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6422 6423**Since**: 8 6424 6425**Parameters** 6426 6427| Name | Description | 6428| ----------------- | ------------------------------------------- | 6429| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6430 6431 6432### OH_Drawing_CanvasDrawArc() 6433 6434``` 6435void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 6436 6437``` 6438 6439**Description** 6440 6441Draws an arc. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn. 6442 6443Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6444 6445If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6446 6447**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6448 6449**Since**: 11 6450 6451**Parameters** 6452 6453| Name | Description | 6454| ----------------- | ------------------------------------------------------------ | 6455| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6456| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 6457| startAngle | Start angle. When the degree is 0, the start point is located at the right end of the oval. A positive number indicates that the start point is placed clockwise, and a negative number indicates that the start point is placed counterclockwise. | 6458| sweepAngle | Angle to sweep, in degrees. A positive number indicates a clockwise sweep, and a negative value indicates a counterclockwise swipe. The valid range is from -360 degrees to 360 degrees. If the absolute value of the sweep angle exceeds 360 degrees, an ellipse is drawn. | 6459 6460 6461### OH_Drawing_CanvasDrawBackground() 6462 6463``` 6464void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 6465 6466``` 6467 6468**Description** 6469 6470Draws a background filled with a brush. 6471 6472Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6473 6474If either **OH_Drawing_Canvas** or **OH_Drawing_Brush** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6475 6476**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6477 6478**Since**: 12 6479 6480**Parameters** 6481 6482| Name | Description | 6483| ----------------- | ------------------------------------------- | 6484| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6485| OH_Drawing_Brush | Pointer to an **OH_Drawing_Brush** object. | 6486 6487 6488### OH_Drawing_CanvasDrawBitmap() 6489 6490``` 6491void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top ) 6492 6493``` 6494 6495**Description** 6496 6497Draws 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). 6498 6499Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6500 6501If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6502 6503**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6504 6505**Since**: 11 6506 6507**Parameters** 6508 6509| Name | Description | 6510| ----------------- | ---------------------------------------------------- | 6511| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6512| OH_Drawing_Bitmap | Pointer to an **OH_Drawing_Bitmap** object. | 6513| left | X coordinate of the upper left corner of the bitmap. | 6514| top | Y coordinate of the upper left corner of the bitmap. | 6515 6516 6517### OH_Drawing_CanvasDrawBitmapRect() 6518 6519``` 6520void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6521 6522``` 6523 6524**Description** 6525 6526Draws a portion of a bitmap onto a specified area of the canvas. 6527 6528Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6529 6530If any of **OH_Drawing_Canvas**, **OH_Drawing_Bitmap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6531 6532**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6533 6534**Since**: 12 6535 6536**Parameters** 6537 6538| Name | Description | 6539| -------------------------- | ------------------------------------------------------------ | 6540| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6541| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. | 6542| src | Pointer to a rectangle on the bitmap. If NULL is passed in, it refers to the entire bitmap. | 6543| dst | Pointer to a rectangle on the canvas. | 6544| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. | 6545 6546 6547### OH_Drawing_CanvasDrawCircle() 6548 6549``` 6550void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius ) 6551 6552``` 6553 6554**Description** 6555 6556Draws a circle. 6557 6558Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6559 6560If either **OH_Drawing_Canvas** or **OH_Drawing_Point** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6561 6562If **radius** is less than or equal to 0, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6563 6564**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6565 6566**Since**: 11 6567 6568**Parameters** 6569 6570| Name | Description | 6571| ----------------- | ------------------------------------------------------------ | 6572| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6573| OH_Drawing_Point | Pointer to an **OH_Drawing_Point** object, which indicates the center of the circle. | 6574| radius | Radius of the circle. The value is invalid if it is less than or equal to 0. | 6575 6576 6577### OH_Drawing_CanvasDrawImageRect() 6578 6579``` 6580void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions* ) 6581 6582``` 6583 6584**Description** 6585 6586Draws an image onto a specified area of the canvas. 6587 6588Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6589 6590If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6591 6592**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6593 6594**Since**: 12 6595 6596**Parameters** 6597 6598| Name | Description | 6599| -------------------------- | ------------------------------------------------------------ | 6600| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6601| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 6602| dst | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. | 6603| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. | 6604 6605 6606### OH_Drawing_CanvasDrawImageRectWithSrc() 6607 6608``` 6609void 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 ) 6610 6611``` 6612 6613**Description** 6614 6615Draws 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. 6616 6617Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6618 6619If any of **OH_Drawing_Canvas**, **OH_Drawing_Image**, **src**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6620 6621**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6622 6623**Since**: 12 6624 6625**Parameters** 6626 6627| Name | Description | 6628| ---------------------------- | ------------------------------------------------------------ | 6629| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6630| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 6631| src | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. | 6632| dst | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. | 6633| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. | 6634| OH_Drawing_SrcRectConstraint | Constraint type. For details about the available options, see [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1). | 6635 6636 6637### OH_Drawing_CanvasDrawLine() 6638 6639``` 6640void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 ) 6641 6642``` 6643 6644**Description** 6645 6646Draws a line segment. 6647 6648Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6649 6650If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6651 6652**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6653 6654**Since**: 8 6655 6656**Parameters** 6657 6658| Name | Description | 6659| ----------------- | ---------------------------------------------------- | 6660| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6661| x1 | X coordinate of the start point of the line segment. | 6662| y1 | Y coordinate of the start point of the line segment. | 6663| x2 | X coordinate of the end point of the line segment. | 6664| y2 | Y coordinate of the end point of the line segment. | 6665 6666 6667### OH_Drawing_CanvasDrawOval() 6668 6669``` 6670void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6671 6672``` 6673 6674**Description** 6675 6676Draws an oval. 6677 6678Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6679 6680If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6681 6682**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6683 6684**Since**: 11 6685 6686**Parameters** 6687 6688| Name | Description | 6689| ----------------- | ------------------------------------------- | 6690| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6691| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 6692 6693 6694### OH_Drawing_CanvasDrawPath() 6695 6696``` 6697void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path* ) 6698 6699``` 6700 6701**Description** 6702 6703Draws a path. 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 either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6708 6709**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6710 6711**Since**: 8 6712 6713**Parameters** 6714 6715| Name | Description | 6716| ----------------- | ------------------------------------------- | 6717| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6718| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 6719 6720 6721### OH_Drawing_CanvasDrawPixelMapRect() 6722 6723``` 6724void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6725 6726``` 6727 6728**Description** 6729 6730Draws a portion of a pixel map onto a specified area of the canvas. 6731 6732Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6733 6734If any of **OH_Drawing_Canvas**, **OH_Drawing_PixelMap**, and **dst** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6735 6736**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6737 6738**Since**: 12 6739 6740**Parameters** 6741 6742| Name | Description | 6743| -------------------------- | ------------------------------------------------------------ | 6744| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6745| OH_Drawing_PixelMap | Pointer to an [OH_Drawing_PixelMap](#oh_drawing_pixelmap) object. | 6746| src | Pointer to a rectangle on the pixel map. If NULL is passed in, it refers to the entire pixel map. | 6747| dst | Pointer to a rectangle on the canvas. | 6748| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. If NULL is passed in, the default sampling options are used. | 6749 6750 6751### OH_Drawing_CanvasDrawPoints() 6752 6753``` 6754void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D* ) 6755 6756``` 6757 6758**Description** 6759 6760Draws multiple points. You can draw a single point, a line segment, or an open polygon. 6761 6762Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6763 6764If either **OH_Drawing_Canvas** or **OH_Drawing_Point2D** is NULL or **count** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6765 6766If **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6767 6768**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6769 6770**Since**: 12 6771 6772**Parameters** 6773 6774| Name | Description | 6775| -------------------------------------------------- | ------------------------------------------------------------ | 6776| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6777| mode | Mode of drawing multiple points. For details about the available options, see [OH_Drawing_PointMode](#oh_drawing_pointmode). | 6778| count | Number of vertices, that is, the number of vertices in the vertex array. | 6779| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | Pointer to an array holding the vertices. | 6780 6781 6782### OH_Drawing_CanvasDrawRect() 6783 6784``` 6785void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6786 6787``` 6788 6789**Description** 6790 6791Draws a rectangle. 6792 6793Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6794 6795If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6796 6797**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6798 6799**Since**: 11 6800 6801**Parameters** 6802 6803| Name | Description | 6804| ----------------- | ------------------------------------------- | 6805| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6806| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 6807 6808 6809### OH_Drawing_CanvasDrawRegion() 6810 6811``` 6812void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region* ) 6813 6814``` 6815 6816**Description** 6817 6818Draws a region. 6819 6820Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6821 6822If either **OH_Drawing_Canvas** or **OH_Drawing_Region** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6823 6824**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6825 6826**Since**: 12 6827 6828**Parameters** 6829 6830| Name | Description | 6831| ----------------- | ------------------------------------------- | 6832| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6833| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. | 6834 6835 6836### OH_Drawing_CanvasDrawRoundRect() 6837 6838``` 6839void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* ) 6840 6841``` 6842 6843**Description** 6844 6845Draws a rounded rectangle. 6846 6847Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6848 6849If either **OH_Drawing_Canvas** or **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6850 6851**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6852 6853**Since**: 11 6854 6855**Parameters** 6856 6857| Name | Description | 6858| -------------------- | ---------------------------------------------- | 6859| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6860| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. | 6861 6862 6863### OH_Drawing_CanvasDrawShadow() 6864 6865``` 6866void 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 ) 6867 6868``` 6869 6870**Description** 6871 6872Draws an offset spot shadow and uses a given path to outline the ambient shadow. 6873 6874Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6875 6876If either **OH_Drawing_Canvas** or **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6877 6878If **flag** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6879 6880**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6881 6882**Since**: 12 6883 6884**Parameters** 6885 6886| Name | Description | 6887| ----------------- | ------------------------------------------------------------ | 6888| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6889| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object, which is used to generate the shadow. | 6890| planeParams | Z-axis offset of an occluder relative to the canvas, based on its x and y coordinates. | 6891| devLightPos | Position of the light relative to the canvas. | 6892| lightRadius | Radius of the light source. The value must be greater than or equal to 0. | 6893| ambientColor | Ambient shadow color, which is a 32-bit (ARGB) variable. | 6894| spotColor | Point shadow color, which is a 32-bit (ARGB) variable. | 6895| flag | Shadow flag. For details about the available options, see [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags). | 6896 6897 6898### OH_Drawing_CanvasDrawTextBlob() 6899 6900``` 6901void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y ) 6902 6903``` 6904 6905**Description** 6906 6907Draws a text blob. If the typeface used to construct **OH_Drawing_TextBlob** does not support a character, that character will not be drawn. 6908 6909Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6910 6911If either **OH_Drawing_Canvas** or **OH_Drawing_TextBlob** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6912 6913**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6914 6915**Since**: 11 6916 6917**Parameters** 6918 6919| Name | Description | 6920| ------------------- | ------------------------------------------------------- | 6921| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6922| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object. | 6923| x | X coordinate of the lower left corner of the text blob. | 6924| y | Y coordinate of the lower left corner of the text blob. | 6925 6926 6927### OH_Drawing_CanvasDrawVertices() 6928 6929``` 6930void 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 ) 6931 6932``` 6933 6934**Description** 6935 6936Draws a triangular grid described by a vertex array. 6937 6938Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6939 6940If 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. 6941 6942If either **vertexMmode** or **mode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 6943 6944**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6945 6946**Since**: 12 6947 6948**Parameters** 6949 6950| Name | Description | 6951| ----------------- | ------------------------------------------------------------ | 6952| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 6953| vertexMmode | Vertex drawing mode. For details about the available options, see [OH_Drawing_VertexMode](#oh_drawing_vertexmode). | 6954| vertexCount | Number of elements in the vertex array. The value must be greater than or equal to 3. | 6955| 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**. | 6956| 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**. | 6957| 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**. | 6958| indexCount | Number of indexes. The value can be 0 or a value greater than or equal to 3. | 6959| 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**. | 6960| mode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). | 6961 6962 6963### OH_Drawing_CanvasGetHeight() 6964 6965``` 6966int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* ) 6967 6968``` 6969 6970**Description** 6971 6972Obtains the canvas height. 6973 6974Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 6975 6976If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 6977 6978**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 6979 6980**Since**: 12 6981 6982**Parameters** 6983 6984| Name | Description | 6985| ----------------- | ------------------------------------------------------------ | 6986| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 6987 6988**Returns** 6989 6990Returns the canvas height, in pixels. 6991 6992 6993### OH_Drawing_CanvasGetLocalClipBounds() 6994 6995``` 6996void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect* ) 6997 6998``` 6999 7000**Description** 7001 7002Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases. 7003 7004Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7005 7006If either **OH_Drawing_Canvas** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7007 7008**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7009 7010**Since**: 12 7011 7012**Parameters** 7013 7014| Name | Description | 7015| ----------------- | ------------------------------------------------------------ | 7016| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7017| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). | 7018 7019 7020### OH_Drawing_CanvasGetSaveCount() 7021 7022``` 7023uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* ) 7024 7025``` 7026 7027**Description** 7028 7029Obtains the number of canvas statuses (canvas matrices) saved in the stack. 7030 7031Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7032 7033If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7034 7035**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7036 7037**Since**: 11 7038 7039**Parameters** 7040 7041| Name | Description | 7042| ----------------- | ------------------------------------------- | 7043| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7044 7045**Returns** 7046 7047Returns a 32-bit value that describes the number of canvas statuses (canvas matrices). The initial number is **1**. 7048 7049 7050### OH_Drawing_CanvasGetTotalMatrix() 7051 7052``` 7053void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 7054 7055``` 7056 7057**Description** 7058 7059Obtains the 3x3 matrix of a canvas. 7060 7061Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7062 7063If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7064 7065**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7066 7067**Since**: 12 7068 7069**Parameters** 7070 7071| Name | Description | 7072| ----------------- | ------------------------------------------------------------ | 7073| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7074| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). | 7075 7076 7077### OH_Drawing_CanvasGetWidth() 7078 7079``` 7080int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* ) 7081 7082``` 7083 7084**Description** 7085 7086Obtains the canvas width. 7087 7088Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7089 7090If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7091 7092**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7093 7094**Since**: 12 7095 7096**Parameters** 7097 7098| Name | Description | 7099| ----------------- | ------------------------------------------------------------ | 7100| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7101 7102**Returns** 7103 7104Returns the canvas width, in px. 7105 7106 7107### OH_Drawing_CanvasReadPixels() 7108 7109``` 7110bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY ) 7111 7112``` 7113 7114**Description** 7115 7116Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases. 7117 7118Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7119 7120If any of **OH_Drawing_Canvas**, **OH_Drawing_Image_Info**, and **dstPixels** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7121 7122**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7123 7124**Since**: 12 7125 7126**Parameters** 7127 7128| Name | Description | 7129| --------------------------------------------------------- | ------------------------------------------------------------ | 7130| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7131| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | Pointer to an [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. | 7132| dstPixels | Pointer to the start address for storing the pixel data. | 7133| dstRowBytes | Size of a line of pixels. The value is invalid if it is less than or equal to 0. | 7134| srcX | X-axis offset of the pixels on the canvas, in px. | 7135| srcY | Y-axis offset of the pixels on the canvas, in px. | 7136 7137**Returns** 7138 7139Returns **true** if the pixel data is copied to the start address of the storage; returns **false** otherwise. 7140 7141 7142### OH_Drawing_CanvasReadPixelsToBitmap() 7143 7144``` 7145bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY ) 7146 7147``` 7148 7149**Description** 7150 7151Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases. 7152 7153Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7154 7155If either **OH_Drawing_Canvas** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7156 7157**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7158 7159**Since**: 12 7160 7161**Parameters** 7162 7163| Name | Description | 7164| ----------------- | ------------------------------------------------------------ | 7165| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7166| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. | 7167| srcX | X-axis offset of the pixels on the canvas, in px. | 7168| srcY | Y-axis offset of the pixels on the canvas, in px. | 7169 7170**Returns** 7171 7172Returns **true** if the pixel data is copied to the image; returns **false** otherwise. 7173 7174 7175### OH_Drawing_CanvasResetMatrix() 7176 7177``` 7178void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* ) 7179``` 7180 7181**Description** 7182 7183Resets the matrix of a canvas to an identity matrix. 7184 7185Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7186 7187If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7188 7189**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7190 7191**Since**: 12 7192 7193**Parameters** 7194 7195| Name | Description | 7196| ----------------- | ------------------------------------------------------------ | 7197| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7198 7199 7200### OH_Drawing_CanvasRestore() 7201 7202``` 7203void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* ) 7204``` 7205 7206**Description** 7207 7208Restores the canvas status (canvas matrix) saved on the top of the stack. 7209 7210Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7211 7212If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7213 7214**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7215 7216**Since**: 8 7217 7218**Parameters** 7219 7220| Name | Description | 7221| ----------------- | ------------------------------------------- | 7222| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7223 7224 7225### OH_Drawing_CanvasRestoreToCount() 7226 7227``` 7228void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount ) 7229``` 7230 7231**Description** 7232 7233Restores to a given number of canvas statuses (canvas matrices). 7234 7235Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7236 7237If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7238 7239**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7240 7241**Since**: 11 7242 7243**Parameters** 7244 7245| Name | Description | 7246| ----------------- | ------------------------------------------------------------ | 7247| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7248| 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. | 7249 7250 7251### OH_Drawing_CanvasRotate() 7252 7253``` 7254void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py ) 7255``` 7256 7257**Description** 7258 7259Rotates a canvas by a given angle. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. 7260 7261Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7262 7263If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7264 7265**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7266 7267**Since**: 11 7268 7269**Parameters** 7270 7271| Name | Description | 7272| ----------------- | ------------------------------------------- | 7273| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7274| degrees | Angle to rotate. | 7275| px | X coordinate of the rotation center. | 7276| py | Y coordinate of the rotation center. | 7277 7278 7279### OH_Drawing_CanvasSave() 7280 7281``` 7282void OH_Drawing_CanvasSave (OH_Drawing_Canvas* ) 7283 7284``` 7285 7286**Description** 7287 7288Saves the current canvas status (canvas matrix) to the top of the stack. This function must be used in pair with [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore). 7289 7290Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7291 7292If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7293 7294**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7295 7296**Since**: 8 7297 7298**Parameters** 7299 7300| Name | Description | 7301| ----------------- | ------------------------------------------- | 7302| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7303 7304 7305### OH_Drawing_CanvasSaveLayer() 7306 7307``` 7308void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush* ) 7309``` 7310 7311**Description** 7312 7313Saves 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. 7314 7315Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7316 7317If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7318 7319**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7320 7321**Since**: 12 7322 7323**Parameters** 7324 7325| Name | Description | 7326| ----------------- | ------------------------------------------------------------ | 7327| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7328| 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. | 7329| 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. | 7330 7331 7332### OH_Drawing_CanvasScale() 7333 7334``` 7335void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy ) 7336``` 7337 7338**Description** 7339 7340Scales a canvas. 7341 7342Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7343 7344If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7345 7346**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7347 7348**Since**: 11 7349 7350**Parameters** 7351 7352| Name | Description | 7353| ----------------- | ------------------------------------------- | 7354| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7355| sx | Scale ratio on the X axis. | 7356| sy | Scale ratio on the Y axis. | 7357 7358 7359### OH_Drawing_CanvasSetMatrix() 7360 7361``` 7362void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 7363``` 7364 7365**Description** 7366 7367Sets the matrix status for a canvas. 7368 7369Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7370 7371If either **OH_Drawing_Canvas** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7372 7373**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7374 7375**Since**: 12 7376 7377**Parameters** 7378 7379| Name | Description | 7380| ----------------- | ------------------------------------------------------------ | 7381| OH_Drawing_Canvas | Pointer to an [OH_Drawing_Canvas](#oh_drawing_canvas) object. | 7382| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object, which is obtained by calling [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate). | 7383 7384 7385### OH_Drawing_CanvasSkew() 7386 7387``` 7388void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy ) 7389``` 7390 7391**Description** 7392 7393Skews 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\| 7394 7395Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7396 7397If **OH_Drawing_Canvas** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7398 7399**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7400 7401**Since**: 12 7402 7403**Parameters** 7404 7405| Name | Description | 7406| ----------------- | ------------------------------------------------------------ | 7407| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7408| 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. | 7409| 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. | 7410 7411 7412### OH_Drawing_CanvasTranslate() 7413 7414``` 7415void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy ) 7416``` 7417 7418**Description** 7419 7420Translates a canvas by a given distance. 7421 7422Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7423 7424If **OH_Drawing_Canvas** 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| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object. | 7435| dx | Distance to translate on the X axis. | 7436| dy | Distance to translate on the Y axis. | 7437 7438 7439### OH_Drawing_ColorFilterCreateBlendMode() 7440 7441``` 7442OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode ) 7443``` 7444 7445**Description** 7446 7447Creates an **OH_Drawing_ColorFilter** object with a given blend mode. 7448 7449**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7450 7451**Since**: 11 7452 7453**Parameters** 7454 7455| Name | Description | 7456| -------------------- | ------------------------------------------------------------ | 7457| color | Color, which is a 32-bit (ARGB) variable. | 7458| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). | 7459 7460**Returns** 7461 7462Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7463 7464 7465### OH_Drawing_ColorFilterCreateCompose() 7466 7467``` 7468OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 ) 7469``` 7470 7471**Description** 7472 7473Creates an **OH_Drawing_ColorFilter** object by combining another two color filters. 7474 7475Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7476 7477If either **colorFilter1** or **colorFilter2** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7478 7479**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7480 7481**Since**: 11 7482 7483**Parameters** 7484 7485| Name | Description | 7486| ------------ | ----------------------------------- | 7487| colorFilter1 | Pointer to the first color filter. | 7488| colorFilter2 | Pointer to the second color filter. | 7489 7490**Returns** 7491 7492Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7493 7494 7495### OH_Drawing_ColorFilterCreateLinearToSrgbGamma() 7496 7497``` 7498OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void ) 7499``` 7500 7501**Description** 7502 7503Creates an **OH_Drawing_ColorFilter** object that applies the sRGB gamma curve to the RGB channels. 7504 7505**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7506 7507**Since**: 11 7508 7509**Returns** 7510 7511Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7512 7513 7514### OH_Drawing_ColorFilterCreateLuma() 7515 7516``` 7517OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void ) 7518``` 7519 7520**Description** 7521 7522Creates an **OH_Drawing_ColorFilter** object that multiplies the passed-in luma into the alpha channel and sets the RGB channels to zero. 7523 7524**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7525 7526**Since**: 11 7527 7528**Returns** 7529 7530Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7531 7532 7533### OH_Drawing_ColorFilterCreateMatrix() 7534 7535``` 7536OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20]) 7537``` 7538 7539**Description** 7540 7541Creates an **OH_Drawing_ColorFilter** object with a given 5x4 color matrix. 7542 7543Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7544 7545If **matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7546 7547**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7548 7549**Since**: 11 7550 7551**Parameters** 7552 7553| Name | Description | 7554| ------ | ------------------------------------------------------------ | 7555| matrix | Matrix, which is represented by a floating-point array with a length of 20. | 7556 7557**Returns** 7558 7559Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7560 7561 7562### OH_Drawing_ColorFilterCreateSrgbGammaToLinear() 7563 7564``` 7565OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void ) 7566``` 7567 7568**Description** 7569 7570Creates an **OH_Drawing_ColorFilter** object that applies the RGB channels to the sRGB gamma curve. 7571 7572**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7573 7574**Since**: 11 7575 7576**Returns** 7577 7578Returns the pointer to the **OH_Drawing_ColorFilter** object created. 7579 7580 7581### OH_Drawing_ColorFilterDestroy() 7582 7583``` 7584void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* ) 7585``` 7586 7587**Description** 7588 7589Destroys an **OH_Drawing_ColorFilter** object and reclaims the memory occupied by the object. 7590 7591**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7592 7593**Since**: 11 7594 7595**Parameters** 7596 7597| Name | Description | 7598| ---------------------- | ------------------------------------------------ | 7599| OH_Drawing_ColorFilter | Pointer to an **OH_Drawing_ColorFilter** object. | 7600 7601 7602### OH_Drawing_ColorSetArgb() 7603 7604``` 7605uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue ) 7606``` 7607 7608**Description** 7609 7610Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color. 7611 7612**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7613 7614**Since**: 8 7615 7616**Parameters** 7617 7618| Name | Description | 7619| ----- | ----------------------------------------------------- | 7620| alpha | Alpha, which is a variable ranging from 0x00 to 0xFF. | 7621| red | Read, which is a variable ranging from 0x00 to 0xFF. | 7622| green | Green, which is a variable ranging from 0x00 to 0xFF. | 7623| blue | Blue, which is a variable ranging from 0x00 to 0xFF. | 7624 7625**Returns** 7626 7627Returns a 32-bit (ARGB) variable that describes the color. 7628 7629 7630### OH_Drawing_ColorSpaceCreateSrgb() 7631 7632``` 7633OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void ) 7634``` 7635 7636**Description** 7637 7638Creates an sRGB color space. 7639 7640**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7641 7642**Since**: 12 7643 7644**Returns** 7645 7646Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created. 7647 7648 7649### OH_Drawing_ColorSpaceCreateSrgbLinear() 7650 7651``` 7652OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void ) 7653``` 7654 7655**Description** 7656 7657Creates an sRGB linear (Gamma 1.0) color space. 7658 7659**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7660 7661**Since**: 12 7662 7663**Returns** 7664 7665Returns the pointer to the [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object created. 7666 7667 7668### OH_Drawing_ColorSpaceDestroy() 7669 7670``` 7671void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* ) 7672``` 7673 7674**Description** 7675 7676Destroys an **OH_Drawing_ColorSpace** object and reclaims the memory occupied by the object. 7677 7678**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7679 7680**Since**: 12 7681 7682**Parameters** 7683 7684| Name | Description | 7685| --------------------- | ------------------------------------------------------------ | 7686| OH_Drawing_ColorSpace | Pointer to an [OH_Drawing_ColorSpace](#oh_drawing_colorspace) object. | 7687 7688 7689### OH_Drawing_CreateDashPathEffect() 7690 7691``` 7692OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase ) 7693``` 7694 7695**Description** 7696 7697Creates an **OH_Drawing_PathEffect** object with a dashed line effect. The dotted line effect is determined by a group of "on" and "off" intervals. 7698 7699Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 7700 7701If **intervals** is NULL or **count** is less than or equal to 0, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 7702 7703**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7704 7705**Since**: 12 7706 7707**Parameters** 7708 7709| Name | Description | 7710| --------- | ------------------------------------------------------------ | 7711| 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. | 7712| count | Number of entries in the dashed line interval array. The value must be an even number greater than 0. | 7713| phase | Offset in the dashed line interval array. | 7714 7715**Returns** 7716 7717Returns the pointer to the [OH_Drawing_PathEffect](#oh_drawing_patheffect) object created. 7718 7719 7720### OH_Drawing_CreateFontCollection() 7721 7722``` 7723OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void ) 7724``` 7725 7726**Description** 7727 7728Creates 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. 7729 7730**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7731 7732**Since**: 8 7733 7734**Returns** 7735 7736Returns the pointer to the **OH_Drawing_FontCollection** object created. 7737 7738 7739### OH_Drawing_CreateFontDescriptor() 7740 7741``` 7742OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void ) 7743``` 7744 7745**Description** 7746 7747Creates an **OH_Drawing_FontDescriptor** object to describe the detailed information about a system font. 7748 7749**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7750 7751**Since**: 12 7752 7753**Returns** 7754 7755Returns the pointer to the [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object created. 7756 7757 7758### OH_Drawing_CreateFontParser() 7759 7760``` 7761OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void ) 7762``` 7763 7764**Description** 7765 7766Creates an **OH_Drawing_FontParser** object to parse a system font. 7767 7768**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7769 7770**Since**: 12 7771 7772**Returns** 7773 7774Returns the pointer to the [OH_Drawing_FontParser](#oh_drawing_fontparser) object created. 7775 7776 7777### OH_Drawing_CreateSharedFontCollection() 7778 7779``` 7780OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void ) 7781``` 7782 7783**Description** 7784 7785Creates an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. 7786 7787**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7788 7789**Since**: 12 7790 7791**Returns** 7792 7793Returns the pointer to the **OH_Drawing_FontCollection** object created. 7794 7795### OH_Drawing_ClearFontCaches() 7796 7797``` 7798void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* ) 7799``` 7800 7801**Description** 7802 7803Clears 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.) 7804 7805**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7806 7807**Since**: 12 7808 7809**Parameters** 7810 7811| Name | Description | 7812| ------------------------- | ------------------------------------------------------------ | 7813| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. | 7814 7815### OH_Drawing_CreateTextShadow() 7816 7817``` 7818OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void ) 7819``` 7820 7821**Description** 7822 7823Creates a pointer to a text shadow object. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) to release the pointer to the object. 7824 7825**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7826 7827**Since**: 12 7828 7829**Returns** 7830 7831Returns the pointer to the **OH_Drawing_TextShadow** object created. 7832 7833 7834### OH_Drawing_CreateTextStyle() 7835 7836``` 7837OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void ) 7838 7839``` 7840 7841**Description** 7842 7843Creates an **OH_Drawing_TextStyle** object. 7844 7845**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7846 7847**Since**: 8 7848 7849**Returns** 7850 7851Returns the pointer to the **OH_Drawing_TextStyle** object created. 7852 7853 7854### OH_Drawing_CreateTypography() 7855 7856``` 7857OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* ) 7858 7859``` 7860 7861**Description** 7862 7863Creates an **OH_Drawing_Typography** object. When [OH_Drawing_Typography](#oh_drawing_typography) is no longer required, call [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) to release the pointer to the object. 7864 7865**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7866 7867**Since**: 8 7868 7869**Parameters** 7870 7871| Name | Description | 7872| --------------------------- | ------------------------------------------------------------ | 7873| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 7874 7875**Returns** 7876 7877Returns the pointer to the **OH_Drawing_Typography** object created. 7878 7879 7880### OH_Drawing_CreateTypographyHandler() 7881 7882``` 7883OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection* ) 7884 7885``` 7886 7887**Description** 7888 7889Creates an **OH_Drawing_TypographyCreate** object. When [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) is no longer required, call [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) to release the pointer to the object. 7890 7891**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7892 7893**Since**: 8 7894 7895**Parameters** 7896 7897| Name | Description | 7898| -------------------------- | ------------------------------------------------------------ | 7899| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 7900| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object, which is obtained by calling [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) or [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (recommended). | 7901 7902**Returns** 7903 7904Returns the pointer to the **OH_Drawing_TypographyCreate** object created. 7905 7906 7907### OH_Drawing_CreateTypographyStyle() 7908 7909``` 7910OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void ) 7911 7912``` 7913 7914**Description** 7915 7916Creates an **OH_Drawing_TypographyStyle** object. When [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) is no longer required, call [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) to release the pointer to the object. 7917 7918**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7919 7920**Since**: 8 7921 7922**Returns** 7923 7924Returns the pointer to the **OH_Drawing_TypographyStyle** object created. 7925 7926 7927### OH_Drawing_DestroyFontCollection() 7928 7929``` 7930void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* ) 7931 7932``` 7933 7934**Description** 7935 7936Destroys an **OH_Drawing_FontCollection** object and reclaims the memory occupied by the object. 7937 7938**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7939 7940**Since**: 8 7941 7942**Parameters** 7943 7944| Name | Description | 7945| ------------------------- | --------------------------------------------------- | 7946| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. | 7947 7948 7949### OH_Drawing_DestroyFontDescriptor() 7950 7951``` 7952void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* ) 7953 7954``` 7955 7956**Description** 7957 7958Destroys an **OH_Drawing_FontDescriptor** object and reclaims the memory occupied by the object. 7959 7960**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7961 7962**Since**: 12 7963 7964**Parameters** 7965 7966| Name | Description | 7967| ------------------------------------------------------------ | ------------------------------------------------------------ | 7968| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | Pointer to a [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) object, which is obtained by calling [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor). | 7969 7970 7971### OH_Drawing_DestroyFontParser() 7972 7973``` 7974void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* ) 7975``` 7976 7977**Description** 7978 7979Destroys an **OH_Drawing_FontParser** object and reclaims the memory occupied by the object. 7980 7981**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 7982 7983**Since**: 12 7984 7985**Parameters** 7986 7987| Name | Description | 7988| --------------------- | ------------------------------------------------------------ | 7989| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). | 7990 7991 7992### OH_Drawing_DestroyLineMetrics() 7993 7994``` 7995void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* ) 7996``` 7997 7998**Description** 7999 8000Destroys an **OH_Drawing_LineMetrics** object and reclaims the memory occupied by the object. 8001 8002**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8003 8004**Since**: 12 8005 8006**Parameters** 8007 8008| Name | Description | 8009| ---------------------- | ------------------------------------------------------------ | 8010| 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). | 8011 8012 8013### OH_Drawing_DestroySystemFontConfigInfo() 8014 8015``` 8016void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* ) 8017``` 8018 8019**Description** 8020 8021Reclaims the memory occupied by the system font configuration. 8022 8023**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8024 8025**Since**: 12 8026 8027**Parameters** 8028 8029| Name | Description | 8030| ------------------------- | ------------------------------------------------------------ | 8031| 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). | 8032 8033 8034### OH_Drawing_DestroySystemFontList() 8035 8036``` 8037void OH_Drawing_DestroySystemFontList (char** , size_t ) 8038``` 8039 8040**Description** 8041 8042Reclaims the memory occupied by the system font list. 8043 8044**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8045 8046**Since**: 12 8047 8048**Parameters** 8049 8050| Name | Description | 8051| -------- | ------------------------------------------------ | 8052| char\*\* | Double pointer to the list of system font names. | 8053| size_t\* | Number of system font names. | 8054 8055 8056### OH_Drawing_DestroyTextShadow() 8057 8058``` 8059void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* ) 8060``` 8061 8062**Description** 8063 8064Destroys an **OH_Drawing_TextShadow** object and reclaims the memory occupied by the object. 8065 8066**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8067 8068**Since**: 12 8069 8070**Parameters** 8071 8072| Name | Description | 8073| --------------------- | ------------------------------------------------------------ | 8074| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). | 8075 8076 8077### OH_Drawing_DestroyTextShadows() 8078 8079``` 8080void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* ) 8081``` 8082 8083**Description** 8084 8085Reclaims the memory occupied by the vector consisting of the **OH_Drawing_TextShadow** objects. 8086 8087**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8088 8089**Since**: 12 8090 8091**Parameters** 8092 8093| Name | Description | 8094| --------------------- | ------------------------------------------------------------ | 8095| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). | 8096 8097 8098### OH_Drawing_DestroyTextStyle() 8099 8100``` 8101void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* ) 8102``` 8103 8104**Description** 8105 8106Destroys an **OH_Drawing_TextStyle** object and reclaims the memory occupied by the object. 8107 8108**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8109 8110**Since**: 8 8111 8112**Parameters** 8113 8114| Name | Description | 8115| -------------------- | ------------------------------------------------------------ | 8116| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 8117 8118 8119### OH_Drawing_DestroyTypography() 8120 8121``` 8122void OH_Drawing_DestroyTypography (OH_Drawing_Typography* ) 8123 8124``` 8125 8126**Description** 8127 8128Destroys an **OH_Drawing_Typography** object and reclaims the memory occupied by the object. 8129 8130**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8131 8132**Since**: 8 8133 8134**Parameters** 8135 8136| Name | Description | 8137| --------------------- | ------------------------------------------------------------ | 8138| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 8139 8140 8141### OH_Drawing_DestroyTypographyHandler() 8142 8143``` 8144void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* ) 8145 8146``` 8147 8148**Description** 8149 8150Destroys an **OH_Drawing_TypographyCreate** object and reclaims the memory occupied by the object. 8151 8152**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8153 8154**Since**: 8 8155 8156**Parameters** 8157 8158| Name | Description | 8159| --------------------------- | ------------------------------------------------------------ | 8160| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 8161 8162 8163### OH_Drawing_DestroyTypographyStyle() 8164 8165``` 8166void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* ) 8167 8168``` 8169 8170**Description** 8171 8172Destroys an **OH_Drawing_TypographyStyle** object and reclaims the memory occupied by the object. 8173 8174**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8175 8176**Since**: 8 8177 8178**Parameters** 8179 8180| Name | Description | 8181| -------------------------- | ------------------------------------------------------------ | 8182| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 8183 8184 8185### OH_Drawing_DisableFontCollectionFallback() 8186 8187``` 8188void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection) 8189``` 8190 8191**Description** 8192 8193Disables the alternate fonts. 8194 8195**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8196 8197**Since**: 12 8198 8199**Parameters** 8200 8201| Name | Description | 8202| ------------------------- | ------------------------------------------------------------ | 8203| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. | 8204 8205 8206### OH_Drawing_DisableFontCollectionSystemFont() 8207 8208``` 8209void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection) 8210``` 8211 8212**Description** 8213 8214Disables the system fonts. 8215 8216**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8217 8218**Since**: 12 8219 8220**Parameters** 8221 8222| Name | Description | 8223| ------------------------- | ------------------------------------------------------------ | 8224| OH_Drawing_FontCollection | Pointer to an [OH_Drawing_FontCollection](#oh_drawing_fontcollection) object. | 8225 8226 8227### OH_Drawing_FilterCreate() 8228 8229``` 8230OH_Drawing_Filter* OH_Drawing_FilterCreate (void ) 8231``` 8232 8233**Description** 8234 8235Creates an **OH_Drawing_Filter** object. 8236 8237**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8238 8239**Since**: 11 8240 8241**Returns** 8242 8243Returns the pointer to the **OH_Drawing_Filter** object created. 8244 8245 8246### OH_Drawing_FilterDestroy() 8247 8248``` 8249void OH_Drawing_FilterDestroy (OH_Drawing_Filter* ) 8250``` 8251 8252**Description** 8253 8254Destroys an **OH_Drawing_Filter** object and reclaims the memory occupied by the object. 8255 8256**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8257 8258**Since**: 11 8259 8260**Parameters** 8261 8262| Name | Description | 8263| ----------------- | ------------------------------------------- | 8264| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. | 8265 8266 8267### OH_Drawing_FilterGetColorFilter() 8268 8269``` 8270void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8271``` 8272 8273**Description** 8274 8275Obtains an **OH_Drawing_ColorFilter** object from an **OH_Drawing_Filter** object. 8276 8277Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8278 8279If either **OH_Drawing_Filter** or **OH_Drawing_ColorFilter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8280 8281**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8282 8283**Since**: 12 8284 8285**Parameters** 8286 8287| Name | Description | 8288| ---------------------- | ------------------------------------------------------------ | 8289| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. | 8290| OH_Drawing_ColorFilter | Pointer to an [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) object. | 8291 8292 8293### OH_Drawing_FilterSetColorFilter() 8294 8295``` 8296void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8297``` 8298 8299**Description** 8300 8301Sets an **OH_Drawing_ColorFilter** object for an **OH_Drawing_Filter** object. 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 **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8306 8307**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8308 8309**Since**: 11 8310 8311**Parameters** 8312 8313| Name | Description | 8314| ---------------------- | ------------------------------------------------------------ | 8315| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. | 8316| 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. | 8317 8318 8319### OH_Drawing_FilterSetMaskFilter() 8320 8321``` 8322void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter* ) 8323``` 8324 8325**Description** 8326 8327Sets an **OH_Drawing_MaskFilter** object for an **OH_Drawing_Filter** object. 8328 8329Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8330 8331If **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8332 8333**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8334 8335**Since**: 11 8336 8337**Parameters** 8338 8339| Name | Description | 8340| --------------------- | ------------------------------------------------------------ | 8341| OH_Drawing_Filter | Pointer to an **OH_Drawing_Filter** object. | 8342| 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. | 8343 8344 8345### OH_Drawing_FontCountText() 8346 8347``` 8348int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding ) 8349``` 8350 8351**Description** 8352 8353Obtains the number of glyphs represented by text. 8354 8355Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8356 8357If either **OH_Drawing_Font** or **text** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8358 8359**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8360 8361**Since**: 12 8362 8363**Parameters** 8364 8365| Name | Description | 8366| --------------- | ------------------------------------------------------------ | 8367| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. | 8368| text | Pointer to the start address of the storage. | 8369| byteLength | Text length, in bytes. | 8370| encoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). | 8371 8372 8373### OH_Drawing_FontCreate() 8374 8375``` 8376OH_Drawing_Font* OH_Drawing_FontCreate (void ) 8377``` 8378 8379**Description** 8380 8381Creates an **OH_Drawing_Font** object. 8382 8383**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8384 8385**Since**: 11 8386 8387**Returns** 8388 8389Returns the pointer to the **OH_Drawing_Font** object created. 8390 8391 8392### OH_Drawing_FontDestroy() 8393 8394``` 8395void OH_Drawing_FontDestroy (OH_Drawing_Font* ) 8396``` 8397 8398**Description** 8399 8400Destroys an **OH_Drawing_Font** object and reclaims the memory occupied by the object. 8401 8402**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8403 8404**Since**: 11 8405 8406**Parameters** 8407 8408| Name | Description | 8409| --------------- | ----------------------------------------- | 8410| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 8411 8412 8413### OH_Drawing_FontGetMetrics() 8414 8415``` 8416float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics* ) 8417``` 8418 8419**Description** 8420 8421Obtains the measurement information about a font. 8422 8423Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8424 8425If either **OH_Drawing_Font** or **OH_Drawing_Font_Metrics** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8426 8427**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8428 8429**Since**: 12 8430 8431**Parameters** 8432 8433| Name | Description | 8434| ----------------------- | ------------------------------------------------------------ | 8435| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. | 8436| OH_Drawing_Font_Metrics | Pointer to an [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) object. | 8437 8438**Returns** 8439 8440Returns a floating-point variable that indicates the recommended interline spacing. 8441 8442 8443### OH_Drawing_FontGetTypeface() 8444 8445``` 8446OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* ) 8447``` 8448 8449**Description** 8450 8451Obtains the typeface of a font. 8452 8453Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8454 8455If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8456 8457**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8458 8459**Since**: 12 8460 8461**Parameters** 8462 8463| Name | Description | 8464| --------------- | --------------------------------------------------------- | 8465| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. | 8466 8467**Returns** 8468 8469Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object. 8470 8471 8472### OH_Drawing_FontMgrCreate() 8473 8474``` 8475OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void ) 8476``` 8477 8478**Description** 8479 8480Creates an **OH_Drawing_FontMgr** object, which can be used only to manage system fonts. 8481 8482**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8483 8484**Since**: 12 8485 8486**Returns** 8487 8488Returns the pointer to the [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object created. 8489 8490 8491### OH_Drawing_FontMgrCreateFontStyleSet() 8492 8493``` 8494OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index ) 8495 8496``` 8497 8498**Description** 8499 8500Creates a font style set from an **OH_Drawing_FontMgr** object. 8501 8502**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8503 8504**Since**: 12 8505 8506**Parameters** 8507 8508| Name | Description | 8509| ------------------ | ------------------------------------------------------------ | 8510| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). | 8511| index | Index of the font style set. | 8512 8513**Returns** 8514 8515Returns the pointer to the [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object created. 8516 8517 8518### OH_Drawing_FontMgrDestroy() 8519 8520``` 8521void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* ) 8522 8523``` 8524 8525**Description** 8526 8527Destroys an **OH_Drawing_FontMgr** object and reclaims the memory occupied by the object. 8528 8529**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8530 8531**Since**: 12 8532 8533**Parameters** 8534 8535| Name | Description | 8536| ------------------ | ------------------------------------------------------------ | 8537| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). | 8538 8539 8540### OH_Drawing_FontMgrDestroyFamilyName() 8541 8542``` 8543void OH_Drawing_FontMgrDestroyFamilyName (char* familyName) 8544 8545``` 8546 8547**Description** 8548 8549Reclaims the memory occupied by a font family name. 8550 8551**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8552 8553**Since**: 12 8554 8555**Parameters** 8556 8557| Name | Description | 8558| ---------- | ------------------------------ | 8559| familyName | Pointer to a font family name. | 8560 8561 8562### OH_Drawing_FontMgrDestroyFontStyleSet() 8563 8564``` 8565void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* ) 8566 8567``` 8568 8569**Description** 8570 8571Reclaims the memory occupied by a font style set. 8572 8573**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8574 8575**Since**: 12 8576 8577**Parameters** 8578 8579| Name | Description | 8580| ----------------------- | ------------------------------------------------------------ | 8581| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. | 8582 8583 8584### OH_Drawing_FontMgrGetFamilyCount() 8585 8586``` 8587int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* ) 8588 8589``` 8590 8591**Description** 8592 8593Obtains the number of font families. 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 8605**Returns** 8606 8607Returns the number of font families. 8608 8609 8610### OH_Drawing_FontMgrGetFamilyName() 8611 8612``` 8613char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index ) 8614 8615``` 8616 8617**Description** 8618 8619Obtains the font family name based on an index. 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| index | Index of the font family name. | 8631 8632**Returns** 8633 8634Returns the font family name. 8635 8636 8637### OH_Drawing_FontMgrMatchFamily() 8638 8639``` 8640OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName ) 8641 8642``` 8643 8644**Description** 8645 8646Obtains a font style set based on a font family name. 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 8659**Returns** 8660 8661Returns the pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. 8662 8663 8664### OH_Drawing_FontMgrMatchFamilyStyle() 8665 8666``` 8667OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct ) 8668 8669``` 8670 8671**Description** 8672 8673Obtains a typeface based on the font style information and font family name. 8674 8675**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8676 8677**Since**: 12 8678 8679**Parameters** 8680 8681| Name | Description | 8682| ------------------------------------------------------------ | ------------------------------------------------------------ | 8683| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). | 8684| familyName | Pointer to a font family name. | 8685| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant. | 8686 8687**Returns** 8688 8689Returns the pointer to an [OH_Drawing_Typeface](#oh_drawing_typeface) object. 8690 8691 8692### OH_Drawing_FontMgrMatchFamilyStyleCharacter() 8693 8694``` 8695OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character ) 8696 8697``` 8698 8699**Description** 8700 8701Obtains a typeface for the specified character. A null pointer is returned only when no typeface corresponding to the input UTF-8 character is found in the **OH_Drawing_FontMgr** object. 8702 8703**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8704 8705**Since**: 12 8706 8707**Parameters** 8708 8709| Name | Description | 8710| ------------------------------------------------------------ | ------------------------------------------------------------ | 8711| OH_Drawing_FontMgr | Pointer to an [OH_Drawing_FontMgr](#oh_drawing_fontmgr) object, which is obtained by calling [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate). | 8712| familyName | Pointer to a font family name. | 8713| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant. | 8714| bcp47 | Pointer to the character language code array, which is a combination of ISO 639, 15924, and 3166-1 language codes. | 8715| bcp47Count | Size of the character language code array. | 8716| character | UTF8 character used for matching. | 8717 8718**Returns** 8719 8720Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained. 8721 8722 8723### OH_Drawing_FontParserGetFontByName() 8724 8725``` 8726OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char* ) 8727 8728``` 8729 8730**Description** 8731 8732Obtains information about a system font based on the font name. 8733 8734**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8735 8736**Since**: 12 8737 8738**Parameters** 8739 8740| Name | Description | 8741| --------------------- | ------------------------------------------------------------ | 8742| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). | 8743| char\* | Pointer to the system font name. | 8744 8745**Returns** 8746 8747Returns the system font. 8748 8749 8750### OH_Drawing_FontParserGetSystemFontList() 8751 8752``` 8753char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t* ) 8754 8755``` 8756 8757**Description** 8758 8759Obtains the list of system fonts. This function can be used only on 2-in-1 devices. 8760 8761**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8762 8763**Since**: 12 8764 8765**Parameters** 8766 8767| Name | Description | 8768| --------------------- | ------------------------------------------------------------ | 8769| OH_Drawing_FontParser | Pointer to an [OH_Drawing_FontParser](#oh_drawing_fontparser) object, which is obtained by calling [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser). | 8770| size_t | Pointer to the number of system font names. | 8771 8772**Returns** 8773 8774Returns the system font list. 8775 8776 8777### OH_Drawing_FontSetFakeBoldText() 8778 8779``` 8780void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText ) 8781 8782``` 8783 8784**Description** 8785 8786Sets fake bold for a font by increasing the stroke width. 8787 8788Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8789 8790If **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| isFakeBoldText | Whether to set fake bold. The value **true** means to set fake bold, and **false** means the opposite. | 8802 8803 8804### OH_Drawing_FontSetLinearText() 8805 8806``` 8807void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText ) 8808 8809``` 8810 8811**Description** 8812 8813Sets linear scaling for a font. 8814 8815Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8816 8817If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8818 8819**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8820 8821**Since**: 11 8822 8823**Parameters** 8824 8825| Name | Description | 8826| --------------- | ------------------------------------------------------------ | 8827| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 8828| isLinearText | Whether to set linear scaling. The value **true** means to set linear scaling, and **false** means the opposite. | 8829 8830 8831### OH_Drawing_FontSetTextSize() 8832 8833``` 8834void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize ) 8835 8836``` 8837 8838**Description** 8839 8840Sets the font size. 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 **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8845 8846**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8847 8848**Since**: 11 8849 8850**Parameters** 8851 8852| Name | Description | 8853| --------------- | ------------------------------------------------------------ | 8854| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 8855| textSize | Text size. The value is a floating point number. If a negative number is passed in, the size is set to 0. If the size is 0, the text drawn will not be displayed. | 8856 8857 8858### OH_Drawing_FontSetTextSkewX() 8859 8860``` 8861void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX ) 8862 8863``` 8864 8865**Description** 8866 8867Sets a horizontal skew factor for a font. 8868 8869Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8870 8871If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8872 8873**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8874 8875**Since**: 11 8876 8877**Parameters** 8878 8879| Name | Description | 8880| --------------- | ------------------------------------------ | 8881| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 8882| skewX | Skew of the X axis relative to the Y axis. | 8883 8884 8885### OH_Drawing_FontSetTypeface() 8886 8887``` 8888void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface* ) 8889 8890``` 8891 8892**Description** 8893 8894Sets a typeface for a font. 8895 8896Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 8897 8898If **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 8899 8900**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8901 8902**Since**: 11 8903 8904**Parameters** 8905 8906| Name | Description | 8907| ------------------- | ------------------------------------------------------------ | 8908| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 8909| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. If NULL is passed in, the default **OH_Drawing_Typeface** object is used. | 8910 8911 8912### OH_Drawing_FontStyleSetCount() 8913 8914``` 8915int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* ) 8916``` 8917 8918**Description** 8919 8920Obtains the number of fonts in the font style set. 8921 8922**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8923 8924**Since**: 12 8925 8926**Parameters** 8927 8928| Name | Description | 8929| ----------------------- | ------------------------------------------------------------ | 8930| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. | 8931 8932**Returns** 8933 8934Returns the number of fonts. 8935 8936 8937### OH_Drawing_FontStyleSetCreateTypeface() 8938 8939``` 8940OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index ) 8941``` 8942 8943**Description** 8944 8945Creates a typeface for the specified index. 8946 8947**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8948 8949**Since**: 12 8950 8951**Parameters** 8952 8953| Name | Description | 8954| ----------------------- | ------------------------------------------------------------ | 8955| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. | 8956| index | Index of the typeface. | 8957 8958**Returns** 8959 8960Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created if the operation is successful; returns a null pointer otherwise. 8961 8962 8963### OH_Drawing_FontStyleSetFreeStyleName() 8964 8965``` 8966void OH_Drawing_FontStyleSetFreeStyleName (char** styleName) 8967``` 8968 8969**Description** 8970 8971Reclaims the memory occupied by a font style. 8972 8973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8974 8975**Since**: 12 8976 8977**Parameters** 8978 8979| Name | Description | 8980| --------- | ------------------------------------------------------------ | 8981| styleName | Double pointer to the string that specifies the font style name. | 8982 8983 8984### OH_Drawing_FontStyleSetGetStyle() 8985 8986``` 8987OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName ) 8988``` 8989 8990**Description** 8991 8992Obtains the font style. 8993 8994**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 8995 8996**Since**: 12 8997 8998**Parameters** 8999 9000| Name | Description | 9001| ----------------------- | ------------------------------------------------------------ | 9002| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. | 9003| index | Index of the font style. | 9004| styleName | Double pointer to the string that specifies the font style name. | 9005 9006**Returns** 9007 9008Returns the font style. 9009 9010 9011### OH_Drawing_FontStyleSetMatchStyle() 9012 9013``` 9014OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct ) 9015``` 9016 9017**Description** 9018 9019Obtains the typeface closest to the font style. 9020 9021**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9022 9023**Since**: 12 9024 9025**Parameters** 9026 9027| Name | Description | 9028| ----------------------- | ------------------------------------------------------------ | 9029| OH_Drawing_FontStyleSet | Pointer to an [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) object. | 9030| fontStyleStruct | Font style, including the font weight, width, and slant. | 9031 9032**Returns** 9033 9034Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object obtained. 9035 9036 9037### OH_Drawing_GetAffinityFromPositionAndAffinity() 9038 9039``` 9040int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 9041``` 9042 9043**Description** 9044 9045Obtains the affinity attribute of an **OH_Drawing_PositionAndAffinity** object. The affinity determines whether the font is close to the front text or rear text. 9046 9047**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9048 9049**Since**: 11 9050 9051**Parameters** 9052 9053| Name | Description | 9054| ------------------------------ | ------------------------------------------------------------ | 9055| OH_Drawing_PositionAndAffinity | Pointer to an **OH_Drawing_PositionAndAffinity** object, which is obtained by [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) or [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster). | 9056 9057**Returns** 9058 9059Returns the affinity attribute. 9060 9061 9062### OH_Drawing_GetBottomFromTextBox() 9063 9064``` 9065float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int ) 9066 9067``` 9068 9069**Description** 9070 9071Obtains the bottom position of a text box. 9072 9073**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9074 9075**Since**: 11 9076 9077**Parameters** 9078 9079| Name | Description | 9080| ------------------ | ------------------------------------------------------------ | 9081| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9082| int | Index of the text box. | 9083 9084**Returns** 9085 9086Returns the bottom position. 9087 9088 9089### OH_Drawing_GetEndFromRange() 9090 9091``` 9092size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* ) 9093 9094``` 9095 9096**Description** 9097 9098Obtains the end position of an **OH_Drawing_Range** object. 9099 9100**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9101 9102**Since**: 11 9103 9104**Parameters** 9105 9106| Name | Description | 9107| ---------------- | ------------------------------------------------------------ | 9108| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). | 9109 9110**Returns** 9111 9112Returns the end position. 9113 9114 9115### OH_Drawing_GetLeftFromTextBox() 9116 9117``` 9118float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int ) 9119 9120``` 9121 9122**Description** 9123 9124Obtains the left position of a text box. 9125 9126**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9127 9128**Since**: 11 9129 9130**Parameters** 9131 9132| Name | Description | 9133| ------------------ | ------------------------------------------------------------ | 9134| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9135| int | Index of the text box. | 9136 9137**Returns** 9138 9139Returns the left position. 9140 9141 9142### OH_Drawing_GetPositionFromPositionAndAffinity() 9143 9144``` 9145size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 9146 9147``` 9148 9149**Description** 9150 9151Obtains the position attribute of an **OH_Drawing_PositionAndAffinity** object. 9152 9153**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9154 9155**Since**: 11 9156 9157**Parameters** 9158 9159| Name | Description | 9160| ------------------------------ | ------------------------------------------------------------ | 9161| OH_Drawing_PositionAndAffinity | Pointer to an **OH_Drawing_PositionAndAffinity** object, which is obtained by [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) or [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster). | 9162 9163**Returns** 9164 9165Returns the position attribute. 9166 9167 9168### OH_Drawing_GetRightFromTextBox() 9169 9170``` 9171float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int ) 9172 9173``` 9174 9175**Description** 9176 9177Obtains the right position of a text box. 9178 9179**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9180 9181**Since**: 11 9182 9183**Parameters** 9184 9185| Name | Description | 9186| ------------------ | ------------------------------------------------------------ | 9187| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9188| int | Index of the text box. | 9189 9190**Returns** 9191 9192Returns the right position. 9193 9194 9195### OH_Drawing_GetSizeOfTextBox() 9196 9197``` 9198size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* ) 9199 9200``` 9201 9202**Description** 9203 9204Obtains the number of text boxes. 9205 9206**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9207 9208**Since**: 11 9209 9210**Parameters** 9211 9212| Name | Description | 9213| ------------------ | ------------------------------------------------------------ | 9214| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9215 9216**Returns** 9217 9218Returns the number of text boxes. 9219 9220 9221### OH_Drawing_GetStartFromRange() 9222 9223``` 9224size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* ) 9225 9226``` 9227 9228**Description** 9229 9230Obtains the start position of an **OH_Drawing_Range** object. 9231 9232**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9233 9234**Since**: 11 9235 9236**Parameters** 9237 9238| Name | Description | 9239| ---------------- | ------------------------------------------------------------ | 9240| OH_Drawing_Range | Pointer to an **OH_Drawing_Range** object, which is obtained by [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary). | 9241 9242**Returns** 9243 9244Returns the start position. 9245 9246 9247### OH_Drawing_GetSystemFontConfigInfo() 9248 9249``` 9250OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* ) 9251 9252``` 9253 9254**Description** 9255 9256Obtains the system font configuration. 9257 9258**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9259 9260**Since**: 12 9261 9262**Parameters** 9263 9264| Name | Description | 9265| --------------------------------- | ------------------------------------------------------------ | 9266| OH_Drawing_FontConfigJsonInfoCode | Pointer to the error code. For details about the available options, see [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode). | 9267 9268**Returns** 9269 9270Pointer to the system font configuration. 9271 9272 9273### OH_Drawing_GetTextDirectionFromTextBox() 9274 9275``` 9276int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int ) 9277 9278``` 9279 9280**Description** 9281 9282Obtains the text direction of a text box. 9283 9284**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9285 9286**Since**: 11 9287 9288**Parameters** 9289 9290| Name | Description | 9291| ------------------ | ------------------------------------------------------------ | 9292| OH_Drawing_TextBox | Pointer to an [OH_Drawing_TextBox](#oh_drawing_textbox) object, which is obtained by calling [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9293| int | Index of the text box. | 9294 9295**Returns** 9296 9297Returns the text direction. 9298 9299 9300### OH_Drawing_GetTopFromTextBox() 9301 9302``` 9303float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int ) 9304 9305``` 9306 9307**Description** 9308 9309Obtains the top position of a text box. 9310 9311**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9312 9313**Since**: 11 9314 9315**Parameters** 9316 9317| Name | Description | 9318| ------------------ | ------------------------------------------------------------ | 9319| OH_Drawing_TextBox | Pointer to an **OH_Drawing_TextBox** object, which is obtained by [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) or [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders). | 9320| int | Index of the text box. | 9321 9322**Returns** 9323 9324Returns the top position. 9325 9326 9327### OH_Drawing_GpuContextCreateFromGL() 9328 9329``` 9330OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions ) 9331``` 9332 9333**Description** 9334 9335Creates an **OH_Drawing_GpuContext** object that uses OpenGL as the backend interface. 9336 9337**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9338 9339**Since**: 12 9340 9341**Parameters** 9342 9343| Name | Description | 9344| ---------------------------- | ------------------------------------------------------------ | 9345| OH_Drawing_GpuContextOptions | GPU context option, which is an [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) object. | 9346 9347**Returns** 9348 9349Returns the pointer to the [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object created. 9350 9351 9352### OH_Drawing_GpuContextDestroy() 9353 9354``` 9355void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* ) 9356``` 9357 9358**Description** 9359 9360Destroys an **OH_Drawing_GpuContext** object and reclaims the memory occupied by the object. 9361 9362**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9363 9364**Since**: 12 9365 9366**Parameters** 9367 9368| Name | Description | 9369| --------------------- | ------------------------------------------------------------ | 9370| OH_Drawing_GpuContext | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. | 9371 9372 9373### OH_Drawing_ImageBuildFromBitmap() 9374 9375``` 9376bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap* ) 9377``` 9378 9379**Description** 9380 9381Builds 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. 9382 9383Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9384 9385If either **OH_Drawing_Image** or **OH_Drawing_Bitmap** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9386 9387**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9388 9389**Since**: 12 9390 9391**Parameters** 9392 9393| Name | Description | 9394| ----------------- | ------------------------------------------------------------ | 9395| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 9396| OH_Drawing_Bitmap | Pointer to an [OH_Drawing_Bitmap](#oh_drawing_bitmap) object. | 9397 9398**Returns** 9399 9400Returns **true** if the image is built; returns **false** otherwise. 9401 9402 9403### OH_Drawing_ImageCreate() 9404 9405``` 9406OH_Drawing_Image* OH_Drawing_ImageCreate (void ) 9407``` 9408 9409**Description** 9410 9411Creates an **OH_Drawing_Image** object that describes an array of two-dimensional pixels to draw. 9412 9413**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9414 9415**Since**: 12 9416 9417**Returns** 9418 9419Returns the pointer to the [OH_Drawing_Image](#oh_drawing_image) object created. 9420 9421 9422### OH_Drawing_ImageDestroy() 9423 9424``` 9425void OH_Drawing_ImageDestroy (OH_Drawing_Image* ) 9426``` 9427 9428**Description** 9429 9430Destroys an **OH_Drawing_Image** object and reclaims the memory occupied by the object. 9431 9432**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9433 9434**Since**: 12 9435 9436**Parameters** 9437 9438| Name | Description | 9439| ---------------- | ----------------------------------------------------------- | 9440| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 9441 9442 9443### OH_Drawing_ImageGetHeight() 9444 9445``` 9446int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* ) 9447``` 9448 9449**Description** 9450 9451Obtains the image height, that is, the number of pixel lines. 9452 9453Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9454 9455If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9456 9457**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9458 9459**Since**: 12 9460 9461**Parameters** 9462 9463| Name | Description | 9464| ---------------- | ----------------------------------------------------------- | 9465| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 9466 9467**Returns** 9468 9469Returns the height. 9470 9471 9472### OH_Drawing_ImageGetImageInfo() 9473 9474``` 9475void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info* ) 9476``` 9477 9478**Description** 9479 9480Obtains the image information. After this function is called, the passed-in image information object is filled. 9481 9482Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9483 9484If either **OH_Drawing_Image** or **OH_Drawing_Image_Info** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9485 9486**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9487 9488**Since**: 12 9489 9490**Parameters** 9491 9492| Name | Description | 9493| --------------------- | ------------------------------------------------------------ | 9494| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 9495| 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). | 9496 9497 9498### OH_Drawing_ImageGetWidth() 9499 9500``` 9501int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* ) 9502``` 9503 9504**Description** 9505 9506Obtains the image width, that is, the number of pixels in each line. 9507 9508Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9509 9510If **OH_Drawing_Image** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9511 9512**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9513 9514**Since**: 12 9515 9516**Parameters** 9517 9518| Name | Description | 9519| ---------------- | ----------------------------------------------------------- | 9520| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 9521 9522**Returns** 9523 9524Returns the width. 9525 9526 9527### OH_Drawing_LineMetricsGetSize() 9528 9529``` 9530size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* ) 9531``` 9532 9533**Description** 9534 9535Obtains the number of lines. 9536 9537**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9538 9539**Since**: 12 9540 9541**Parameters** 9542 9543| Name | Description | 9544| ---------------------------------------------------------- | ------------------------------------------------------------ | 9545| [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). | 9546 9547**Returns** 9548 9549Returns the number of lines. 9550 9551 9552### OH_Drawing_MaskFilterCreateBlur() 9553 9554``` 9555OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM ) 9556``` 9557 9558**Description** 9559 9560Creates an **OH_Drawing_MaskFilter** object with a blur type. 9561 9562**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9563 9564**Since**: 11 9565 9566**Parameters** 9567 9568| Name | Description | 9569| ---------- | ------------------------------------------------------------ | 9570| blurType | Blur type. | 9571| sigma | Standard deviation of the Gaussian blur to apply. The value must be greater than **0**. | 9572| respectCTM | Whether the blur's sigma is modified by the CTM. The default value is **true**. | 9573 9574**Returns** 9575 9576Returns the pointer to the **OH_Drawing_MaskFilter** object created. 9577 9578 9579### OH_Drawing_MaskFilterDestroy() 9580 9581``` 9582void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* ) 9583``` 9584 9585**Description** 9586 9587Destroys an **OH_Drawing_MaskFilter** object and reclaims the memory occupied by the object. 9588 9589**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9590 9591**Since**: 11 9592 9593**Parameters** 9594 9595| Name | Description | 9596| --------------------- | ----------------------------------------------- | 9597| OH_Drawing_MaskFilter | Pointer to an **OH_Drawing_MaskFilter** object. | 9598 9599 9600### OH_Drawing_MatrixConcat() 9601 9602``` 9603void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b ) 9604``` 9605 9606**Description** 9607 9608Multiplies two matrices to produce a new matrix. 9609 9610Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9611 9612If any of **total**, **a**, and **b** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9613 9614**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9615 9616**Since**: 12 9617 9618**Parameters** 9619 9620| Name | Description | 9621| ----- | ------------------------------------------------------------ | 9622| total | Pointer to the new matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9623| a | Pointer to the first matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9624| b | Pointer to the second matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9625 9626 9627### OH_Drawing_MatrixCreate() 9628 9629``` 9630OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void ) 9631``` 9632 9633**Description** 9634 9635Creates an **OH_Drawing_Matrix** object. 9636 9637**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9638 9639**Since**: 11 9640 9641**Returns** 9642 9643Returns the pointer to the **OH_Drawing_Matrix** object created. 9644 9645 9646### OH_Drawing_MatrixCreateRotation() 9647 9648``` 9649OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y ) 9650``` 9651 9652**Description** 9653 9654Creates 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). 9655 9656**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9657 9658**Since**: 12 9659 9660**Parameters** 9661 9662| Name | Description | 9663| ---- | ------------------------------------------------------------ | 9664| deg | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. | 9665| x | Coordinate point on the X axis. | 9666| y | Coordinate point on the X axis. | 9667 9668**Returns** 9669 9670Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created. 9671 9672 9673### OH_Drawing_MatrixCreateScale() 9674 9675``` 9676OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py ) 9677 9678``` 9679 9680**Description** 9681 9682Creates 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). 9683 9684**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9685 9686**Since**: 12 9687 9688**Parameters** 9689 9690| Name | Description | 9691| ---- | ------------------------------------------------------------ | 9692| sx | Scale coefficient along the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. | 9693| sy | Scale coefficient along the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. | 9694| px | Coordinate point on the X axis. | 9695| py | Coordinate point on the Y axis. | 9696 9697**Returns** 9698 9699Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created. 9700 9701 9702### OH_Drawing_MatrixCreateTranslation() 9703 9704``` 9705OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy ) 9706 9707``` 9708 9709**Description** 9710 9711Creates an **OH_Drawing_Matrix** with the translation attribute. The matrix is obtained by translating the identity matrix by the distance (dx, dy). 9712 9713**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9714 9715**Since**: 12 9716 9717**Parameters** 9718 9719| Name | Description | 9720| ---- | ------------------------------------------------------------ | 9721| dx | Horizontal distance to translate. A positive number indicates a translation towards the positive direction of the X axis, and a negative number indicates a translation towards the negative direction of the X axis. The value is a floating point number. | 9722| dy | Vertical distance to translate. A positive number indicates a translation towards the positive direction of the Y axis, and a negative number indicates a translation towards the negative direction of the Y axis. The value is a floating point number. | 9723 9724**Returns** 9725 9726Returns the pointer to the [OH_Drawing_Matrix](#oh_drawing_matrix) object created. 9727 9728 9729### OH_Drawing_MatrixDestroy() 9730 9731``` 9732void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* ) 9733 9734``` 9735 9736**Description** 9737 9738Destroys an **OH_Drawing_Matrix** object and reclaims the memory occupied by the object. 9739 9740**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9741 9742**Since**: 11 9743 9744**Parameters** 9745 9746| Name | Description | 9747| ----------------- | ----------------------------------------- | 9748| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Font** object. | 9749 9750 9751### OH_Drawing_MatrixGetValue() 9752 9753``` 9754float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index ) 9755 9756``` 9757 9758**Description** 9759 9760Obtains a matrix value of a given index. The index ranges from 0 to 8. 9761 9762Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9763 9764If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9765 9766If **index** is less than 0 or greater than 8, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 9767 9768**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9769 9770**Since**: 12 9771 9772**Parameters** 9773 9774| Name | Description | 9775| ----------------- | ------------------------------------------------------------ | 9776| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9777| index | Index. The value ranges from 0 to 8. | 9778 9779**Returns** 9780 9781Returns the matrix value. 9782 9783 9784### OH_Drawing_MatrixInvert() 9785 9786``` 9787bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse ) 9788 9789``` 9790 9791**Description** 9792 9793Inverts a matrix and returns the result. 9794 9795Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9796 9797If either **OH_Drawing_Matrix** or **inverse** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9798 9799**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9800 9801**Since**: 12 9802 9803**Parameters** 9804 9805| Name | Description | 9806| ----------------- | ------------------------------------------------------------ | 9807| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9808| 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). | 9809 9810**Returns** 9811 9812Returns **true** if the matrix is reversible and the passed-in **inverse** is inverted; returns **false** otherwise. 9813 9814 9815### OH_Drawing_MatrixIsEqual() 9816 9817``` 9818bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other ) 9819 9820``` 9821 9822**Description** 9823 9824Checks whether two **OH_Drawing_Matrix** objects are the same. 9825 9826Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9827 9828If either **OH_Drawing_Matrix** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9829 9830**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9831 9832**Since**: 12 9833 9834**Parameters** 9835 9836| Name | Description | 9837| ----------------- | ------------------------------------------------------------ | 9838| OH_Drawing_Matrix | Pointer to a matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9839| other | Pointer to the other matrix, which is an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9840 9841**Returns** 9842 9843Returns **true** if the two matrices are equal; returns **false** otherwise. 9844 9845 9846### OH_Drawing_MatrixIsIdentity() 9847 9848``` 9849bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* ) 9850 9851``` 9852 9853**Description** 9854 9855Checks whether an **OH_Drawing_Matrix** object is an identity matrix. 9856 9857Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9858 9859If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9860 9861**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9862 9863**Since**: 12 9864 9865**Parameters** 9866 9867| Name | Description | 9868| ----------------- | ------------------------------------------------------------ | 9869| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9870 9871**Returns** 9872 9873Returns **true** if the matrix is an identity matrix; returns **false** otherwise. 9874 9875 9876### OH_Drawing_MatrixPostRotate() 9877 9878``` 9879void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9880 9881``` 9882 9883**Description** 9884 9885Post multiplies a matrix by an identity matrix that rotates a given degree around the rotation point (px, py). 9886 9887Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9888 9889If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9890 9891**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9892 9893**Since**: 12 9894 9895**Parameters** 9896 9897| Name | Description | 9898| ----------------- | ------------------------------------------------------------ | 9899| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9900| degree | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. | 9901| px | X coordinate of the rotation point. | 9902| py | Y coordinate of the rotation point. | 9903 9904 9905### OH_Drawing_MatrixPostScale() 9906 9907``` 9908void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9909 9910``` 9911 9912**Description** 9913 9914Post multiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py). 9915 9916Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9917 9918If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9919 9920 9921**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9922 9923**Since**: 12 9924 9925**Parameters** 9926 9927| Name | Description | 9928| ----------------- | ------------------------------------------------------------ | 9929| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9930| sx | Scale factor along the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. | 9931| sy | Scale factor along the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. | 9932| px | X coordinate of the scale point. | 9933| py | Y coordinate of the scale point. | 9934 9935 9936### OH_Drawing_MatrixPostTranslate() 9937 9938``` 9939void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy ) 9940 9941``` 9942 9943**Description** 9944 9945Post multiplies a matrix by an identity matrix that translates by a given distance (dx, dy). 9946 9947Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9948 9949If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9950 9951 9952**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9953 9954**Since**: 12 9955 9956**Parameters** 9957 9958| Name | Description | 9959| ----------------- | ------------------------------------------------------------ | 9960| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9961| dx | Distance to translate on the X axis. | 9962| dy | Distance to translate on the Y axis. | 9963 9964 9965### OH_Drawing_MatrixPreRotate() 9966 9967``` 9968void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9969 9970``` 9971 9972**Description** 9973 9974Premultiplies a matrix by an identity matrix that rotates by a given degree around the rotation point (px, py). 9975 9976Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 9977 9978If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 9979 9980 9981**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 9982 9983**Since**: 12 9984 9985**Parameters** 9986 9987| Name | Description | 9988| ----------------- | ------------------------------------------------------------ | 9989| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 9990| degree | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. | 9991| px | X coordinate of the rotation point. | 9992| py | Y coordinate of the rotation point. | 9993 9994 9995### OH_Drawing_MatrixPreScale() 9996 9997``` 9998void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9999 10000``` 10001 10002**Description** 10003 10004Premultiplies a matrix by an identity matrix that scales with the factor (sx, sy) at the scale point (px, py). 10005 10006Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10007 10008If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10009 10010 10011**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10012 10013**Since**: 12 10014 10015**Parameters** 10016 10017| Name | Description | 10018| ----------------- | ------------------------------------------------------------ | 10019| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10020| sx | Scale factor along the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. | 10021| sy | Scale factor along the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. | 10022| px | X coordinate of the scale point. | 10023| py | Y coordinate of the scale point. | 10024 10025 10026### OH_Drawing_MatrixPreTranslate() 10027 10028``` 10029void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy ) 10030 10031``` 10032 10033**Description** 10034 10035Premultiplies a matrix by an identity matrix that translates by a given distance (dx, dy). 10036 10037Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10038 10039If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10040 10041**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10042 10043**Since**: 12 10044 10045**Parameters** 10046 10047| Name | Description | 10048| ----------------- | ------------------------------------------------------------ | 10049| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10050| dx | Distance to translate on the X axis. | 10051| dy | Distance to translate on the Y axis. | 10052 10053 10054### OH_Drawing_MatrixReset() 10055 10056``` 10057void OH_Drawing_MatrixReset (OH_Drawing_Matrix* ) 10058 10059``` 10060 10061**Description** 10062 10063Resets a matrix to an identity matrix: | 1 0 0 | | 0 1 0 | | 0 0 0 1 |. 10064 10065Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10066 10067If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10068 10069**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10070 10071**Since**: 12 10072 10073**Parameters** 10074 10075| Name | Description | 10076| ----------------- | ------------------------------------------------------------ | 10077| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10078 10079 10080### OH_Drawing_MatrixRotate() 10081 10082``` 10083void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 10084 10085``` 10086 10087**Description** 10088 10089Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py). 10090 10091Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10092 10093If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10094 10095**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10096 10097**Since**: 12 10098 10099**Parameters** 10100 10101| Name | Description | 10102| ----------------- | ------------------------------------------------------------ | 10103| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10104| degree | Angle to rotate, in degrees. A positive number indicates a clockwise rotation, and a negative number indicates a counterclockwise rotation. | 10105| px | Coordinate point on the X axis. | 10106| py | Coordinate point on the Y axis. | 10107 10108 10109### OH_Drawing_MatrixScale() 10110 10111``` 10112void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 10113 10114``` 10115 10116**Description** 10117 10118Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py). 10119 10120Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10121 10122If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10123 10124**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10125 10126**Since**: 12 10127 10128**Parameters** 10129 10130| Name | Description | 10131| ----------------- | ------------------------------------------------------------ | 10132| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10133| sx | Scale factor along the X axis. If a negative number is passed in, the matrix is mirrored around y = px before being scaled. The value is a floating point number. | 10134| sy | Scale factoralong the Y axis. If a negative number is passed in, the matrix is mirrored around x = py before being scaled. The value is a floating point number. | 10135| px | Coordinate point on the X axis. | 10136| py | Coordinate point on the Y axis. | 10137 10138 10139### OH_Drawing_MatrixSetMatrix() 10140 10141``` 10142void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 ) 10143 10144``` 10145 10146**Description** 10147 10148Sets matrix parameters for an **OH_Drawing_Matrix** object. 10149 10150Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10151 10152If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10153 10154**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10155 10156**Since**: 11 10157 10158**Parameters** 10159 10160| Name | Description | 10161| ----------------- | ------------------------------------------- | 10162| OH_Drawing_Matrix | Pointer to an **OH_Drawing_Matrix** object. | 10163| scaleX | Horizontal scale factor. | 10164| skewX | Horizontal skew coefficient. | 10165| transX | Horizontal translation coefficient. | 10166| skewY | Vertical skew coefficient. | 10167| scaleY | Vertical scale factor. | 10168| transY | Vertical translation coefficient. | 10169| persp0 | Perspective coefficient of the X axis. | 10170| persp1 | Perspective coefficient of the Y axis. | 10171| persp2 | Perspective scale coefficient. | 10172 10173 10174### OH_Drawing_MatrixSetPolyToPoly() 10175 10176``` 10177bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count ) 10178 10179``` 10180 10181**Description** 10182 10183Generates a transform 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]. 10184 10185Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10186 10187If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10188 10189If **count** is less than 0 or greater than 4, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10190 10191**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10192 10193**Since**: 12 10194 10195**Parameters** 10196 10197| Name | Description | 10198| ----------------- | ------------------------------------------------------------ | 10199| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10200| src | Array of source points. If NULL is passed in, **count** must be 0. | 10201| 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. | 10202| count | Number of source points or destination points. If 0 is passed in, the matrix is set to an identity matrix. | 10203 10204**Returns** 10205 10206Returns **true** if the matrix is generated; returns **false** otherwise. 10207 10208 10209### OH_Drawing_MatrixSetRectToRect() 10210 10211``` 10212bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf ) 10213 10214``` 10215 10216**Description** 10217 10218Scales a matrix to map a source rectangle to a destination rectangle. 10219 10220Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10221 10222If any of **OH_Drawing_Matrix**, **src**, and **dst** is NULL, OH_DRAWING_ERROR_INVALID_PARAMETER is returned. 10223 10224**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10225 10226**Since**: 12 10227 10228**Parameters** 10229 10230| Name | Description | 10231| ----------------- | ------------------------------------------------------------ | 10232| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10233| src | Pointer to a source rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10234| dst | Pointer to a destination rectangle, which is an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10235| stf | Scaling mode. For details about the available options, see [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit). | 10236 10237**Returns** 10238 10239Returns **true** if the operation is successful; returns **false** if the operation fails. In particular, if either the width or the height of the source rectangle is less than or equal to 0, the function returns **false** and sets the matrix to an identity matrix. If either the width or height of the destination rectangle is less than or equal to 0, the function returns **true** and sets the matrix to a matrix with all values 0, except for a perspective scaling coefficient of 1. 10240 10241### OH_Drawing_MatrixTranslate() 10242 10243``` 10244void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy ) 10245 10246``` 10247 10248**Description** 10249 10250Sets a matrix as an identity matrix and translates it by a given distance (dx, dy). 10251 10252Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10253 10254If **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10255 10256**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10257 10258**Since**: 12 10259 10260**Parameters** 10261 10262| Name | Description | 10263| ----------------- | ------------------------------------------------------------ | 10264| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 10265| dx | Horizontal distance to translate. A positive number indicates a translation towards the positive direction of the X axis, and a negative number indicates a translation towards the negative direction of the X axis. The value is a floating point number. | 10266| dy | Vertical distance to translate. A positive number indicates a translation towards the positive direction of the Y axis, and a negative number indicates a translation towards the negative direction of the Y axis. The value is a floating point number. | 10267 10268 10269### OH_Drawing_MemoryStreamCreate() 10270 10271``` 10272OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData ) 10273``` 10274 10275**Description** 10276 10277Creates an **OH_Drawing_MemoryStream** object. 10278 10279Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10280 10281If **data** is NULL or **length** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10282 10283**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10284 10285**Since**: 12 10286 10287**Parameters** 10288 10289| Name | Description | 10290| -------- | ------------------------------------------------------------ | 10291| data | Pointer to the data. | 10292| length | Length of the data. | 10293| 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. | 10294 10295**Returns** 10296 10297Returns the pointer to the [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object created. 10298 10299 10300### OH_Drawing_MemoryStreamDestroy() 10301 10302``` 10303void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* ) 10304``` 10305 10306**Description** 10307 10308Destroys an **OH_Drawing_MemoryStream** object and reclaims the memory occupied by the object. 10309 10310**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10311 10312**Since**: 12 10313 10314**Parameters** 10315 10316| Name | Description | 10317| ----------------------- | ------------------------------------------------------------ | 10318| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. | 10319 10320 10321### OH_Drawing_PathAddArc() 10322 10323``` 10324void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 10325``` 10326 10327**Description** 10328 10329Adds 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. 10330 10331Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10332 10333If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10334 10335**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10336 10337**Since**: 12 10338 10339**Parameters** 10340 10341| Name | Description | 10342| --------------- | ------------------------------------------------------------ | 10343| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10344| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10345| startAngle | Start angle of the arc, in degrees. | 10346| 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. | 10347 10348### OH_Drawing_PathAddOval() 10349 10350``` 10351void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection ) 10352``` 10353 10354**Description** 10355 10356Adds an oval to a path in the specified direction. 10357 10358Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10359If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10360 10361If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10362 10363**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10364 10365**Since**: 12 10366 10367**Parameters** 10368 10369| Name | Description | 10370| ------------------------ | ------------------------------------------------------------ | 10371| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10372| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10373| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). | 10374 10375### OH_Drawing_PathAddOvalWithInitialPoint() 10376 10377 10378``` 10379void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection ) 10380``` 10381 10382**Description** 10383 10384Adds 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. 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 either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10389 10390If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** 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 an [OH_Drawing_Path](#oh_drawing_path) object. | 10401| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10402| start | Start point of the oval. | 10403| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). | 10404 10405 10406### OH_Drawing_PathAddPath() 10407 10408``` 10409void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix* ) 10410``` 10411 10412**Description** 10413 10414Transforms the points in a **src** path by a matrix and adds the new one to the current path. 10415 10416Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10417 10418If either **OH_Drawing_Path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10419 10420**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10421 10422**Since**: 12 10423 10424**Parameters** 10425 10426| Name | Description | 10427| ----------------- | ------------------------------------------------------------ | 10428| OH_Drawing_Path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10429| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10430| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. | 10431 10432 10433### OH_Drawing_PathAddPathWithMatrixAndMode() 10434 10435``` 10436void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode ) 10437``` 10438 10439**Description** 10440 10441Transforms the points in a **src** path by a matrix and adds the new one to the current path with the specified adding mode. 10442 10443Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10444 10445If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10446 10447If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10448 10449**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10450 10451**Since**: 12 10452 10453**Parameters** 10454 10455| Name | Description | 10456| ---------------------- | ------------------------------------------------------------ | 10457| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10458| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10459| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. If NULL is passed in, it is the identity matrix. | 10460| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). | 10461 10462 10463### OH_Drawing_PathAddPathWithMode() 10464 10465``` 10466void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode ) 10467``` 10468 10469**Description** 10470 10471Adds a **src** path to the current path with the specified adding mode. 10472 10473Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10474 10475If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10476 10477If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10478 10479**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10480 10481**Since**: 12 10482 10483**Parameters** 10484 10485| Name | Description | 10486| ---------------------- | ------------------------------------------------------------ | 10487| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10488| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10489| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). | 10490 10491 10492### OH_Drawing_PathAddPathWithOffsetAndMode() 10493 10494``` 10495void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode ) 10496``` 10497 10498**Description** 10499 10500Translates a **src** path by an offset and adds the new one to the current path with the specified adding mode. 10501 10502Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10503 10504If either **path** or **src** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10505 10506If **OH_Drawing_PathAddMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10507 10508**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10509 10510**Since**: 12 10511 10512**Parameters** 10513 10514| Name | Description | 10515| ---------------------- | ------------------------------------------------------------ | 10516| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10517| src | Pointer to a source path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10518| dx | X offset. | 10519| dy | Y offset. | 10520| OH_Drawing_PathAddMode | Path adding mode. For details about the available options, see [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode). | 10521 10522 10523### OH_Drawing_PathAddRect() 10524 10525``` 10526void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection ) 10527``` 10528 10529**Description** 10530 10531Adds a rectangle to this path in the specified direction. The start point is the upper left corner of the rectangle. 10532 10533Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10534 10535If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10536 10537If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10538 10539**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10540 10541**Since**: 12 10542 10543**Parameters** 10544 10545| Name | Description | 10546| ------------------------ | ------------------------------------------------------------ | 10547| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10548| left | X coordinate of the upper left corner of the rectangle. | 10549| top | Y coordinate of the upper left corner of the rectangle. | 10550| right | X coordinate of the lower right corner of the rectangle. | 10551| bottom | Y coordinate of the lower right corner of the rectangle. | 10552| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). | 10553 10554 10555### OH_Drawing_PathAddRectWithInitialCorner() 10556 10557``` 10558void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start ) 10559 10560``` 10561 10562**Description** 10563 10564Adds a rectangle contour to a path in the specified direction. 10565 10566Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10567 10568If either **OH_Drawing_Path** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10569 10570If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10571 10572**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10573 10574**Since**: 12 10575 10576**Parameters** 10577 10578| Name | Description | 10579| ------------------------ | ------------------------------------------------------------ | 10580| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10581| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object. | 10582| OH_Drawing_PathDirection | Direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). | 10583| 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. | 10584 10585 10586### OH_Drawing_PathAddRoundRect() 10587 10588``` 10589void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection ) 10590 10591``` 10592 10593**Description** 10594 10595Adds a rounded rectangle contour to a path in the specified direction. When the path direction is clockwise, the start point is at the intersection of the rounded rectangle's left boundary and its lower left corner. When the path direction is counterclockwise, the start point is at the intersection point between the left boundary and the upper left corner. 10596 10597Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10598 10599If either **OH_Drawing_Path** or **roundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10600 10601If **OH_Drawing_PathDirection** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 10602 10603**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10604 10605**Since**: 12 10606 10607**Parameters** 10608 10609| Name | Description | 10610| ------------------------ | ------------------------------------------------------------ | 10611| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10612| roundRect | Pointer to an [OH_Drawing_RoundRect](#oh_drawing_roundrect) object. | 10613| OH_Drawing_PathDirection | Path direction. For details about the available options, see [OH_Drawing_PathDirection](#oh_drawing_pathdirection). | 10614 10615 10616### OH_Drawing_PathArcTo() 10617 10618``` 10619void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg ) 10620``` 10621 10622**Description** 10623 10624Draws 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. 10625 10626Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10627 10628If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10629 10630**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10631 10632**Since**: 8 10633 10634**Parameters** 10635 10636| Name | Description | 10637| --------------- | ------------------------------------------------------------ | 10638| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10639| x1 | X coordinate of the upper left corner of the rectangle. | 10640| y1 | Y coordinate of the upper left corner of the rectangle. | 10641| x2 | X coordinate of the lower right corner of the rectangle. | 10642| y2 | Y coordinate of the lower right corner of the rectangle. | 10643| startDeg | Start angle. The start direction (0°) of the angle is the positive direction of the X axis. | 10644| 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. | 10645 10646 10647### OH_Drawing_PathClose() 10648 10649``` 10650void OH_Drawing_PathClose (OH_Drawing_Path* ) 10651``` 10652 10653**Description** 10654 10655Closes a path by drawing a line segment from the current point to the start point of the path. 10656 10657Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10658 10659If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10660 10661**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10662 10663**Since**: 8 10664 10665**Parameters** 10666 10667| Name | Description | 10668| --------------- | ----------------------------------------- | 10669| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10670 10671 10672### OH_Drawing_PathConicTo() 10673 10674``` 10675void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10676``` 10677 10678**Description** 10679 10680Draws 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. 10681 10682Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10683 10684If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10685 10686**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10687 10688**Since**: 12 10689 10690**Parameters** 10691 10692| Name | Description | 10693| --------------- | ------------------------------------------------------------ | 10694| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10695| ctrlX | X coordinate of the control point. | 10696| ctrlY | Y coordinate of the control point. | 10697| endX | X coordinate of the target point. | 10698| endY | Y coordinate of the target point. | 10699| 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). | 10700 10701 10702### OH_Drawing_PathContains() 10703 10704``` 10705bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y ) 10706``` 10707 10708**Description** 10709 10710Checks whether a coordinate point is included in this path. For details, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1). 10711 10712Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10713 10714If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10715 10716**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10717 10718**Since**: 12 10719 10720**Parameters** 10721 10722| Name | Description | 10723| --------------- | --------------------------------------------------------- | 10724| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10725| x | Coordinate point on the X axis. | 10726| y | Coordinate point on the Y axis. | 10727 10728**Returns** 10729 10730Returns **true** if the coordinate point is included in the path; returns **false** otherwise. 10731 10732 10733### OH_Drawing_PathCopy() 10734 10735``` 10736OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* ) 10737``` 10738 10739**Description** 10740 10741Copies an existing [OH_Drawing_Path](#oh_drawing_path) object to create a new one. 10742 10743Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10744 10745If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10746 10747**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10748 10749**Since**: 12 10750 10751**Parameters** 10752 10753| Name | Description | 10754| --------------- | --------------------------------------------------------- | 10755| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10756 10757**Returns** 10758 10759Returns the pointer to the [OH_Drawing_Path](#oh_drawing_path) object created. 10760 10761 10762### OH_Drawing_PathCreate() 10763 10764``` 10765OH_Drawing_Path* OH_Drawing_PathCreate (void ) 10766``` 10767 10768**Description** 10769 10770Creates an **OH_Drawing_Path** object. 10771 10772**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10773 10774**Since**: 8 10775 10776**Returns** 10777 10778Returns the pointer to the **OH_Drawing_Path** object created. 10779 10780 10781### OH_Drawing_PathCubicTo() 10782 10783``` 10784void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 10785``` 10786 10787**Description** 10788 10789Draws 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. 10790 10791Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10792 10793If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10794 10795**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10796 10797**Since**: 8 10798 10799**Parameters** 10800 10801| Name | Description | 10802| --------------- | ----------------------------------------- | 10803| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10804| ctrlX1 | X coordinate of the first control point. | 10805| ctrlY1 | Y coordinate of the first control point. | 10806| ctrlX2 | X coordinate of the second control point. | 10807| ctrlY2 | Y coordinate of the second control point. | 10808| endX | X coordinate of the target point. | 10809| endY | Y coordinate of the target point. | 10810 10811 10812### OH_Drawing_PathDestroy() 10813 10814``` 10815void OH_Drawing_PathDestroy (OH_Drawing_Path* ) 10816``` 10817 10818**Description** 10819 10820Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object. 10821 10822**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10823 10824**Since**: 8 10825 10826**Parameters** 10827 10828| Name | Description | 10829| --------------- | ----------------------------------------- | 10830| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10831 10832 10833### OH_Drawing_PathEffectDestroy() 10834 10835``` 10836void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* ) 10837``` 10838 10839**Description** 10840 10841Destroys an **OH_Drawing_PathEffect** object and reclaims the memory occupied by the object. 10842 10843**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10844 10845**Since**: 12 10846 10847**Parameters** 10848 10849| Name | Description | 10850| --------------------- | ------------------------------------------------------------ | 10851| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. | 10852 10853 10854### OH_Drawing_PathGetLength() 10855 10856``` 10857float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed ) 10858``` 10859 10860**Description** 10861 10862Obtains the length of a path. 10863 10864Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10865 10866If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10867 10868**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10869 10870**Since**: 12 10871 10872**Parameters** 10873 10874| Name | Description | 10875| --------------- | ------------------------------------------------------------ | 10876| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 10877| 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. | 10878 10879**Returns** 10880 10881Returns the length of the path. 10882 10883 10884### OH_Drawing_PathLineTo() 10885 10886``` 10887void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y ) 10888``` 10889 10890**Description** 10891 10892Draws 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. 10893 10894Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10895 10896If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10897 10898**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10899 10900**Since**: 8 10901 10902**Parameters** 10903 10904| Name | Description | 10905| --------------- | ----------------------------------------- | 10906| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10907| x | X coordinate of the target point. | 10908| y | Y coordinate of the target point. | 10909 10910 10911### OH_Drawing_PathMoveTo() 10912 10913``` 10914void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y ) 10915``` 10916 10917**Description** 10918 10919Sets the start point of a path. 10920 10921Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 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 **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10951 10952**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10953 10954**Since**: 12 10955 10956**Parameters** 10957 10958| Name | Description | 10959| ---- | ------------------------------------------------------------ | 10960| path | Pointer to the current path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 10961| 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. | 10962| dx | X offset. | 10963| dy | Y offset. | 10964 10965 10966### OH_Drawing_PathQuadTo() 10967 10968``` 10969void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 10970``` 10971 10972**Description** 10973 10974Draws 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. 10975 10976Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 10977 10978If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 10979 10980**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 10981 10982**Since**: 8 10983 10984**Parameters** 10985 10986| Name | Description | 10987| --------------- | ----------------------------------------- | 10988| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 10989| ctrlX | X coordinate of the control point. | 10990| ctrlY | Y coordinate of the control point. | 10991| endX | X coordinate of the target point. | 10992| endY | Y coordinate of the target point. | 10993 10994 10995### OH_Drawing_PathRConicTo() 10996 10997``` 10998void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10999``` 11000 11001**Description** 11002 11003Draws 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. 11004 11005Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11006 11007If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11008 11009**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11010 11011**Since**: 12 11012 11013**Parameters** 11014 11015| Name | Description | 11016| --------------- | ------------------------------------------------------------ | 11017| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11018| ctrlX | X offset relative to the last point, which is used to specify the X coordinate of the control point. | 11019| ctrlY | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. | 11020| endX | X offset relative to the last point, which is used to specify the X coordinate of the target point. | 11021| endY | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. | 11022| 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). | 11023 11024 11025### OH_Drawing_PathRCubicTo() 11026 11027``` 11028void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 11029``` 11030 11031**Description** 11032 11033Draws 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. 11034 11035Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11036 11037If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11038 11039**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11040 11041**Since**: 12 11042 11043**Parameters** 11044 11045| Name | Description | 11046| --------------- | ------------------------------------------------------------ | 11047| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11048| ctrlX1 | X offset relative to the last point, which is used to specify the X coordinate of the first control point. | 11049| ctrlY1 | Y offset relative to the last point, which is used to specify the Y coordinate of the first control point. | 11050| ctrlX2 | X offset relative to the last point, which is used to specify the X coordinate of the second control point. | 11051| ctrlY2 | Y offset relative to the last point, which is used to specify the Y coordinate of the second control point. | 11052| endX | X offset relative to the last point, which is used to specify the X coordinate of the target point. | 11053| endY | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. | 11054 11055 11056### OH_Drawing_PathReset() 11057 11058``` 11059void OH_Drawing_PathReset (OH_Drawing_Path* ) 11060``` 11061 11062**Description** 11063 11064Resets path data. 11065 11066Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11067 11068If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11069 11070**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11071 11072**Since**: 8 11073 11074**Parameters** 11075 11076| Name | Description | 11077| --------------- | ----------------------------------------- | 11078| OH_Drawing_Path | Pointer to an **OH_Drawing_Path** object. | 11079 11080 11081### OH_Drawing_PathRLineTo() 11082 11083``` 11084void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y ) 11085``` 11086 11087**Description** 11088 11089Draws 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. 11090 11091Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11092 11093If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11094 11095**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11096 11097**Since**: 12 11098 11099**Parameters** 11100 11101| Name | Description | 11102| --------------- | ------------------------------------------------------------ | 11103| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11104| x | X offset relative to the last point, which is used to specify the X coordinate of the target point. | 11105| y | Y offset relative to the last point, which is used to specify the X coordinate of the target point. | 11106 11107 11108### OH_Drawing_PathRMoveTo() 11109 11110``` 11111void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y ) 11112``` 11113 11114**Description** 11115 11116Sets the start position relative to the last point of a path. If the path is empty, the start point (0, 0) is used. 11117 11118Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11119 11120If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11121 11122**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11123 11124**Since**: 12 11125 11126**Parameters** 11127 11128| Name | Description | 11129| --------------- | ------------------------------------------------------------ | 11130| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11131| x | X offset of the target point relative to the last point. A positive number indicates a rightward shift from the last point, and a negative number indicates a leftward shift from the last point. The value is a floating point number. | 11132| y | Y offset of the target point relative to the last point. A positive number indicates an upward shift from the last point, and a negative number indicates a downward shift from the last point. The value is a floating point number. | 11133 11134 11135### OH_Drawing_PathRQuadTo() 11136 11137``` 11138void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 11139 11140``` 11141 11142**Description** 11143 11144Draws 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. 11145 11146Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11147 11148If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11149 11150**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11151 11152**Since**: 12 11153 11154**Parameters** 11155 11156| Name | Description | 11157| --------------- | ------------------------------------------------------------ | 11158| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11159| ctrlX | X offset relative to the last point, which is used to specify the X coordinate of the control point. | 11160| ctrlY | Y offset relative to the last point, which is used to specify the Y coordinate of the control point. | 11161| endX | X offset relative to the last point, which is used to specify the X coordinate of the target point. | 11162| endY | Y offset relative to the last point, which is used to specify the Y coordinate of the target point. | 11163 11164 11165### OH_Drawing_PathSetFillType() 11166 11167``` 11168void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType ) 11169 11170``` 11171 11172**Description** 11173 11174Sets the fill type of this path. The fill type determines how "inside" of the path is drawn. For example, when the fill type **Winding** is used, "inside" of the path is determined by a non-zero sum of signed edge crossings. When **EvenOdd** is used, "inside" of the path is determined by an odd number of edge crossings. 11175 11176Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11177 11178If **OH_Drawing_Path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11179 11180If **OH_Drawing_PathFillType** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 11181 11182**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11183 11184**Since**: 12 11185 11186**Parameters** 11187 11188| Name | Description | 11189| ----------------------- | ------------------------------------------------------------ | 11190| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11191| OH_Drawing_PathFillType | Fill type of the path. For details about the available options, see [OH_Drawing_PathFillType](#oh_drawing_pathfilltype). | 11192 11193 11194### OH_Drawing_PathTransform() 11195 11196``` 11197void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix* ) 11198 11199``` 11200 11201**Description** 11202 11203Transforms the points in a path by matrix. 11204 11205Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11206 11207If either **OH_Drawing_Path** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11208 11209**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11210 11211**Since**: 12 11212 11213**Parameters** 11214 11215| Name | Description | 11216| ----------------- | ------------------------------------------------------------ | 11217| OH_Drawing_Path | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11218| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 11219 11220 11221### OH_Drawing_PathTransformWithPerspectiveClip() 11222 11223``` 11224void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip ) 11225 11226``` 11227 11228**Description** 11229 11230Transforms the points in a path by matrix. uses the new one to replace the **dst** path. If the **dst** path does not exist, the **src** path is replaced. 11231 11232Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11233 11234If either **src** or **OH_Drawing_Matrix** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11235 11236**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11237 11238**Since**: 12 11239 11240**Parameters** 11241 11242| Name | Description | 11243| -------------------- | ------------------------------------------------------------ | 11244| src | Pointer to an [OH_Drawing_Path](#oh_drawing_path) object. | 11245| OH_Drawing_Matrix | Pointer to an [OH_Drawing_Matrix](#oh_drawing_matrix) object. | 11246| dst | Pointer to a destination path, which is an [OH_Drawing_Path](#oh_drawing_path) object. | 11247| applyPerspectiveClip | Whether to apply perspective cropping to the new path. The value **true** means to apply perspective cropping, and **false** means the opposite. | 11248 11249### OH_Drawing_PenCreate() 11250 11251``` 11252OH_Drawing_Pen* OH_Drawing_PenCreate (void ) 11253``` 11254 11255**Description** 11256 11257Creates an **OH_Drawing_Pen** object. 11258 11259**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11260 11261**Since**: 8 11262 11263**Returns** 11264 11265Returns the pointer to the **OH_Drawing_Pen** object created. 11266 11267 11268### OH_Drawing_PenDestroy() 11269 11270``` 11271void OH_Drawing_PenDestroy (OH_Drawing_Pen* ) 11272``` 11273 11274**Description** 11275 11276Destroys an **OH_Drawing_Path** object and reclaims the memory occupied by the object. 11277 11278**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11279 11280**Since**: 8 11281 11282**Parameters** 11283 11284| Name | Description | 11285| -------------- | ---------------------------------------- | 11286| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11287 11288 11289### OH_Drawing_PenGetAlpha() 11290 11291``` 11292uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* ) 11293``` 11294 11295**Description** 11296 11297Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape. 11298 11299Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11300 11301If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11302 11303**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11304 11305**Since**: 11 11306 11307**Parameters** 11308 11309| Name | Description | 11310| -------------- | ---------------------------------------- | 11311| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11312 11313**Returns** 11314 11315Returns an 8-bit variable that describes the alpha value. 11316 11317 11318### OH_Drawing_PenGetCap() 11319 11320``` 11321OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* ) 11322``` 11323 11324**Description** 11325 11326Obtains the line cap style of a pen. 11327 11328Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11329 11330If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11331 11332**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11333 11334**Since**: 8 11335 11336**Parameters** 11337 11338| Name | Description | 11339| -------------- | ---------------------------------------- | 11340| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11341 11342**Returns** 11343 11344Returns the line cap style. 11345 11346 11347### OH_Drawing_PenGetColor() 11348 11349``` 11350uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* ) 11351``` 11352 11353**Description** 11354 11355Obtains the color of a pen. The color is used by the pen to outline a shape. 11356 11357Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11358 11359If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11360 11361**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11362 11363**Since**: 8 11364 11365**Parameters** 11366 11367| Name | Description | 11368| -------------- | ---------------------------------------- | 11369| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11370 11371**Returns** 11372 11373Returns a 32-bit (ARGB) variable that describes the color. 11374 11375 11376### OH_Drawing_PenGetFilter() 11377 11378``` 11379void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11380``` 11381 11382**Description** 11383 11384Obtains the filter of a pen. The filter is a container that holds a mask filter and color filter. 11385 11386Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11387 11388If either **OH_Drawing_Pen** or **OH_Drawing_Filter** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11389 11390**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11391 11392**Since**: 12 11393 11394**Parameters** 11395 11396| Name | Description | 11397| ----------------- | ------------------------------------------------------------ | 11398| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11399| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. | 11400 11401 11402### OH_Drawing_PenGetJoin() 11403 11404``` 11405OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* ) 11406``` 11407 11408**Description** 11409 11410Obtains the line join style of a pen. 11411 11412Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11413 11414If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11415 11416**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11417 11418**Since**: 8 11419 11420**Parameters** 11421 11422| Name | Description | 11423| -------------- | ---------------------------------------- | 11424| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11425 11426**Returns** 11427 11428Returns the line join style. 11429 11430### OH_Drawing_PenGetMiterLimit() 11431 11432``` 11433float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* ) 11434``` 11435 11436**Description** 11437 11438Obtains 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. 11439 11440Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11441 11442If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11443 11444**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11445 11446**Since**: 8 11447 11448**Parameters** 11449 11450| Name | Description | 11451| -------------- | ---------------------------------------- | 11452| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11453 11454**Returns** 11455 11456Returns the miter limit. 11457 11458 11459### OH_Drawing_PenGetWidth() 11460 11461``` 11462float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* ) 11463``` 11464 11465**Description** 11466 11467Obtains the width of a pen. The width describes the thickness of the outline of a shape. 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 **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11472 11473**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11474 11475**Since**: 8 11476 11477**Parameters** 11478 11479| Name | Description | 11480| -------------- | ---------------------------------------- | 11481| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11482 11483**Returns** 11484 11485Returns the width of the pen. 11486 11487 11488### OH_Drawing_PenIsAntiAlias() 11489 11490``` 11491bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* ) 11492``` 11493 11494**Description** 11495 11496Checks whether anti-aliasing is enabled for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent. 11497 11498Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11499 11500If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11501 11502**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11503 11504**Since**: 8 11505 11506**Parameters** 11507 11508| Name | Description | 11509| -------------- | ---------------------------------------- | 11510| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11511 11512**Returns** 11513 11514Returns **true** if anti-aliasing is enabled; returns **false** otherwise. 11515 11516 11517### OH_Drawing_PenReset() 11518 11519``` 11520void OH_Drawing_PenReset (OH_Drawing_Pen* ) 11521``` 11522 11523**Description** 11524 11525Resets a pen to the initial state. 11526 11527Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11528 11529If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11530 11531**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11532 11533**Since**: 12 11534 11535**Parameters** 11536 11537| Name | Description | 11538| -------------- | ------------------------------------------------------- | 11539| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11540 11541 11542### OH_Drawing_PenSetAlpha() 11543 11544``` 11545void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha ) 11546``` 11547 11548**Description** 11549 11550Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape. 11551 11552Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11553 11554If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11555 11556**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11557 11558**Since**: 11 11559 11560**Parameters** 11561 11562| Name | Description | 11563| -------------- | ---------------------------------------- | 11564| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11565| alpha | Alpha value, which is an 8-bit variable. | 11566 11567 11568### OH_Drawing_PenSetAntiAlias() 11569 11570``` 11571void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool ) 11572``` 11573 11574**Description** 11575 11576Enables or disables anti-aliasing for a pen. Anti-aliasing makes the pixels around the shape edges semi-transparent. 11577 11578Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11579 11580If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11581 11582**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11583 11584**Since**: 8 11585 11586**Parameters** 11587 11588| Name | Description | 11589| -------------- | ------------------------------------------------------------ | 11590| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11591| bool | Whether to enable anti-aliasing. The value **true** means to enable anti-aliasing, and **false** means the opposite. | 11592 11593 11594### OH_Drawing_PenSetBlendMode() 11595 11596``` 11597void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode ) 11598``` 11599 11600**Description** 11601 11602Sets a blender for a pen. The blender implements the specified blend mode. 11603 11604Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11605 11606If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11607 11608If **OH_Drawing_BlendMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 11609 11610**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11611 11612**Since**: 12 11613 11614**Parameters** 11615 11616| Name | Description | 11617| -------------------- | ------------------------------------------------------------ | 11618| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11619| OH_Drawing_BlendMode | Blend mode. For details about the available options, see [OH_Drawing_BlendMode](#oh_drawing_blendmode). | 11620 11621 11622### OH_Drawing_PenSetCap() 11623 11624``` 11625void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle ) 11626``` 11627 11628**Description** 11629 11630Sets the line cap style for a pen. 11631 11632Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11633 11634If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11635 11636If **OH_Drawing_PenLineCapStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 11637 11638**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11639 11640**Since**: 8 11641 11642**Parameters** 11643 11644| Name | Description | 11645| -------------------------- | ---------------------------------------- | 11646| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11647| OH_Drawing_PenLineCapStyle | Line cap style, which is a variable. | 11648 11649 11650### OH_Drawing_PenSetColor() 11651 11652``` 11653void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color ) 11654``` 11655 11656**Description** 11657 11658Sets the color for a pen. The color is used by the pen to outline a shape. 11659 11660Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11661 11662If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11663 11664**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11665 11666**Since**: 8 11667 11668**Parameters** 11669 11670| Name | Description | 11671| -------------- | ----------------------------------------- | 11672| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11673| color | Color, which is a 32-bit (ARGB) variable. | 11674 11675 11676### OH_Drawing_PenSetFilter() 11677 11678``` 11679void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11680``` 11681 11682**Description** 11683 11684Sets a filter for a pen. 11685 11686Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11687 11688If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11689 11690**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11691 11692**Since**: 11 11693 11694**Parameters** 11695 11696| Name | Description | 11697| ----------------- | ------------------------------------------------------------ | 11698| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11699| OH_Drawing_Filter | Pointer to an [OH_Drawing_Filter](#oh_drawing_filter) object. If NULL is passed in, the filter will be cleared. | 11700 11701 11702### OH_Drawing_PenSetJoin() 11703 11704``` 11705void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle ) 11706``` 11707 11708**Description** 11709 11710Sets the line join style for a pen. 11711 11712Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11713 11714If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11715 11716If **OH_Drawing_PenLineJoinStyle** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 11717 11718**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11719 11720**Since**: 8 11721 11722**Parameters** 11723 11724| Name | Description | 11725| --------------------------- | ---------------------------------------- | 11726| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11727| OH_Drawing_PenLineJoinStyle | Line join style. | 11728 11729 11730### OH_Drawing_PenSetMiterLimit() 11731 11732``` 11733void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter ) 11734``` 11735 11736**Description** 11737 11738Sets 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. 11739 11740Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11741 11742If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11743 11744**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11745 11746**Since**: 8 11747 11748**Parameters** 11749 11750| Name | Description | 11751| -------------- | ---------------------------------------- | 11752| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11753| miter | Stroke miter limit, which is a variable. | 11754 11755 11756### OH_Drawing_PenSetPathEffect() 11757 11758``` 11759void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect* ) 11760``` 11761 11762**Description** 11763 11764Sets the path effect for a pen. 11765 11766Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11767 11768If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11769 11770**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11771 11772**Since**: 12 11773 11774**Parameters** 11775 11776| Name | Description | 11777| --------------------- | ------------------------------------------------------------ | 11778| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11779| OH_Drawing_PathEffect | Pointer to an [OH_Drawing_PathEffect](#oh_drawing_patheffect) object. If NULL is passed in, the path effect will be cleared. | 11780 11781 11782### OH_Drawing_PenSetShaderEffect() 11783 11784``` 11785void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect* ) 11786``` 11787 11788**Description** 11789 11790Sets the shader effect for a pen. 11791 11792Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11793 11794If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11795 11796**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11797 11798**Since**: 11 11799 11800**Parameters** 11801 11802| Name | Description | 11803| ----------------------- | ------------------------------------------------------------ | 11804| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object. | 11805| OH_Drawing_ShaderEffect | Pointer to an [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) object. If NULL is passed in, the shader effect will be cleared. | 11806 11807 11808### OH_Drawing_PenSetWidth() 11809 11810``` 11811void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width ) 11812``` 11813 11814**Description** 11815 11816Sets 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. 11817 11818Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11819 11820If **OH_Drawing_Pen** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11821 11822**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11823 11824**Since**: 8 11825 11826**Parameters** 11827 11828| Name | Description | 11829| -------------- | ---------------------------------------- | 11830| OH_Drawing_Pen | Pointer to an **OH_Drawing_Pen** object. | 11831| width | Width, which is a variable. | 11832 11833 11834### OH_Drawing_PointCreate() 11835 11836``` 11837OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y ) 11838``` 11839 11840**Description** 11841 11842Creates an **OH_Drawing_Point** object. 11843 11844**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11845 11846**Since**: 11 11847 11848**Parameters** 11849 11850| Name | Description | 11851| ---- | -------------------------- | 11852| x | X coordinate of the point. | 11853| y | Y coordinate of the point. | 11854 11855**Returns** 11856 11857Returns the pointer to the **OH_Drawing_Point** object created. 11858 11859 11860### OH_Drawing_PointDestroy() 11861 11862``` 11863void OH_Drawing_PointDestroy (OH_Drawing_Point* ) 11864``` 11865 11866**Description** 11867 11868Destroys an **OH_Drawing_Point** object and reclaims the memory occupied by the object. 11869 11870**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11871 11872**Since**: 11 11873 11874**Parameters** 11875 11876| Name | Description | 11877| ---------------- | ------------------------------------------ | 11878| OH_Drawing_Point | Pointer to an **OH_Drawing_Point** object. | 11879 11880 11881### OH_Drawing_RectCopy() 11882 11883``` 11884void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect ) 11885``` 11886 11887**Description** 11888 11889Copies a source rectangle to create a new one. 11890 11891Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11892 11893If either **sRect** or **dRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11894 11895**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11896 11897**Since**: 12 11898 11899**Parameters** 11900 11901| Name | Description | 11902| ----- | ------------------------------------------------------------ | 11903| sRect | Pointer to a source rectangle, which is an **OH_Drawing_Rect** object. | 11904| dRect | Pointer to a destination rectangle, which is an **OH_Drawing_Rect** object. | 11905 11906 11907### OH_Drawing_RectCreate() 11908 11909``` 11910OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom ) 11911``` 11912 11913**Description** 11914 11915Creates 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. 11916 11917**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11918 11919**Since**: 11 11920 11921**Parameters** 11922 11923| Name | Description | 11924| ------ | -------------------------------------------------------- | 11925| left | X coordinate of the upper left corner of the rectangle. | 11926| top | Y coordinate of the upper left corner of the rectangle. | 11927| right | X coordinate of the lower right corner of the rectangle. | 11928| bottom | Y coordinate of the lower right corner of the rectangle. | 11929 11930**Returns** 11931 11932Returns the pointer to the **OH_Drawing_Rect** object created. 11933 11934 11935### OH_Drawing_RectDestroy() 11936 11937``` 11938void OH_Drawing_RectDestroy (OH_Drawing_Rect* ) 11939``` 11940 11941**Description** 11942 11943Destroys an **OH_Drawing_Rect** object and reclaims the memory occupied by the object. 11944 11945**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11946 11947**Since**: 11 11948 11949**Parameters** 11950 11951| Name | Description | 11952| --------------- | ----------------------------------------- | 11953| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 11954 11955 11956### OH_Drawing_RectGetBottom() 11957 11958``` 11959float OH_Drawing_RectGetBottom (OH_Drawing_Rect* ) 11960``` 11961 11962**Description** 11963 11964Obtains the Y coordinate of the lower right corner of a rectangle. 11965 11966Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11967 11968If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11969 11970**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 11971 11972**Since**: 12 11973 11974**Parameters** 11975 11976| Name | Description | 11977| --------------- | ----------------------------------------- | 11978| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 11979 11980**Returns** 11981 11982Returns the Y coordinate of the lower right corner of the rectangle. 11983 11984 11985### OH_Drawing_RectGetHeight() 11986 11987``` 11988float OH_Drawing_RectGetHeight (OH_Drawing_Rect* ) 11989``` 11990 11991**Description** 11992 11993Obtains 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. 11994 11995Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 11996 11997If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 11998 11999**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12000 12001**Since**: 12 12002 12003**Parameters** 12004 12005| Name | Description | 12006| --------------- | ----------------------------------------- | 12007| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12008 12009**Returns** 12010 12011Returns the height. 12012 12013 12014### OH_Drawing_RectGetLeft() 12015 12016``` 12017float OH_Drawing_RectGetLeft (OH_Drawing_Rect* ) 12018``` 12019 12020**Description** 12021 12022Obtains the X coordinate of the upper left corner of a rectangle. 12023 12024Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12025 12026If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12027 12028**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12029 12030**Since**: 12 12031 12032**Parameters** 12033 12034| Name | Description | 12035| --------------- | ----------------------------------------- | 12036| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12037 12038**Returns** 12039 12040Returns the X coordinate of the upper left corner of the rectangle. 12041 12042 12043### OH_Drawing_RectGetRight() 12044 12045``` 12046float OH_Drawing_RectGetRight (OH_Drawing_Rect* ) 12047``` 12048 12049**Description** 12050 12051Obtains the X coordinate of the lower right corner of a rectangle. 12052 12053Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12054 12055If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12056 12057**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12058 12059**Since**: 12 12060 12061**Parameters** 12062 12063| Name | Description | 12064| --------------- | ----------------------------------------- | 12065| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12066 12067**Returns** 12068 12069Returns the X coordinate of the lower right corner of the rectangle. 12070 12071 12072### OH_Drawing_RectGetTop() 12073 12074``` 12075float OH_Drawing_RectGetTop (OH_Drawing_Rect* ) 12076``` 12077 12078**Description** 12079 12080Obtains the Y coordinate of the upper left corner of a rectangle. 12081 12082Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12083 12084If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12085 12086**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12087 12088**Since**: 12 12089 12090**Parameters** 12091 12092| Name | Description | 12093| --------------- | ----------------------------------------- | 12094| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12095 12096**Returns** 12097 12098Returns the Y coordinate of the upper left corner of the rectangle. 12099 12100 12101### OH_Drawing_RectGetWidth() 12102 12103``` 12104float OH_Drawing_RectGetWidth (OH_Drawing_Rect* ) 12105``` 12106 12107**Description** 12108 12109Obtains 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. 12110 12111Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12112 12113If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12114 12115**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12116 12117**Since**: 12 12118 12119**Parameters** 12120 12121| Name | Description | 12122| --------------- | ----------------------------------------- | 12123| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12124 12125**Returns** 12126 12127Returns the width. 12128 12129 12130### OH_Drawing_RectIntersect() 12131 12132``` 12133bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 12134 12135``` 12136 12137**Description** 12138 12139Checks whether two rectangles intersect and if yes, sets **rect** to the area of intersection. 12140 12141Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12142 12143If either **rect** or **other** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12144 12145**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12146 12147**Since**: 12 12148 12149**Parameters** 12150 12151| Name | Description | 12152| ----- | ----------------------------------------- | 12153| rect | Pointer to an **OH_Drawing_Rect** object. | 12154| other | Pointer to an **OH_Drawing_Rect** object. | 12155 12156**Returns** 12157 12158Returns **true** if they intersect (**rect** is set to the intersection area); returns **false** otherwise (**rect** remains unchanged). 12159 12160 12161### OH_Drawing_RectSetBottom() 12162 12163``` 12164void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom ) 12165``` 12166 12167**Description** 12168 12169Sets the vertical coordinate of the lower right corner of a rectangle. 12170 12171Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12172 12173If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12174 12175**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12176 12177**Since**: 12 12178 12179**Parameters** 12180 12181| Name | Description | 12182| ------ | -------------------------------------------------------- | 12183| rect | Pointer to an **OH_Drawing_Rect** object. | 12184| bottom | Y coordinate of the lower right corner of the rectangle. | 12185 12186 12187### OH_Drawing_RectSetLeft() 12188 12189``` 12190void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left ) 12191``` 12192 12193**Description** 12194 12195Sets the horizontal coordinate of the upper left corner of a rectangle. 12196 12197Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12198 12199If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12200 12201**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12202 12203**Since**: 12 12204 12205**Parameters** 12206 12207| Name | Description | 12208| ---- | ------------------------------------------------------- | 12209| rect | Pointer to an **OH_Drawing_Rect** object. | 12210| left | X coordinate of the upper left corner of the rectangle. | 12211 12212 12213### OH_Drawing_RectSetRight() 12214 12215``` 12216void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right ) 12217``` 12218 12219**Description** 12220 12221Sets the horizontal coordinate of the lower right corner of a rectangle. 12222 12223Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12224 12225If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12226 12227**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12228 12229**Since**: 12 12230 12231**Parameters** 12232 12233| Name | Description | 12234| ----- | -------------------------------------------------------- | 12235| rect | Pointer to an **OH_Drawing_Rect** object. | 12236| right | X coordinate of the lower right corner of the rectangle. | 12237 12238 12239### OH_Drawing_RectSetTop() 12240 12241``` 12242void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top ) 12243``` 12244 12245**Description** 12246 12247Sets the vertical coordinate of the upper left corner of a rectangle. 12248 12249Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12250 12251If **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12252 12253**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12254 12255**Since**: 12 12256 12257**Parameters** 12258 12259| Name | Description | 12260| ---- | ------------------------------------------------------- | 12261| rect | Pointer to an **OH_Drawing_Rect** object. | 12262| top | Y coordinate of the upper left corner of the rectangle. | 12263 12264 12265### OH_Drawing_RegionCreate() 12266 12267``` 12268OH_Drawing_Region* OH_Drawing_RegionCreate (void ) 12269``` 12270 12271**Description** 12272 12273Creates an **OH_Drawing_Region** object for more accurate graphical control. 12274 12275**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12276 12277**Since**: 12 12278 12279**Returns** 12280 12281Returns the pointer to the **OH_Drawing_Region** object created. 12282 12283 12284### OH_Drawing_RegionDestroy() 12285 12286``` 12287void OH_Drawing_RegionDestroy (OH_Drawing_Region* ) 12288``` 12289 12290**Description** 12291 12292Destroys an **OH_Drawing_Region** object and reclaims the memory occupied by the object. 12293 12294**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12295 12296**Since**: 12 12297 12298**Parameters** 12299 12300| Name | Description | 12301| ----------------- | ------------------------------------------- | 12302| OH_Drawing_Region | Pointer to an **OH_Drawing_Region** object. | 12303 12304 12305### OH_Drawing_RegionSetRect() 12306 12307``` 12308bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect ) 12309``` 12310 12311**Description** 12312 12313Sets the boundary for an **OH_Drawing_Region** object. 12314 12315Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12316 12317If either **region** or **rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12318 12319**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12320 12321**Since**: 12 12322 12323**Parameters** 12324 12325| Name | Description | 12326| ------ | ------------------------------------------- | 12327| region | Pointer to an **OH_Drawing_Region** object. | 12328| rect | Pointer to an **OH_Drawing_Rect** object. | 12329 12330**Returns** 12331 12332Returns **true** if the setting is successful; returns **false** otherwise. 12333 12334 12335### OH_Drawing_RegisterFont() 12336 12337``` 12338uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc ) 12339``` 12340 12341**Description** 12342 12343Registers a custom font with the font manager. The supported font file formats are .ttf and .otf. 12344 12345**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12346 12347**Since**: 11 12348 12349**Parameters** 12350 12351| Name | Description | 12352| ------------------------- | --------------------------------------------------- | 12353| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. | 12354| fontFamily | Pointer to the family name of the font to register. | 12355| familySrc | Pointer to the path of the font file. | 12356 12357**Returns** 12358 12359Returns **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. 12360 12361 12362### OH_Drawing_RegisterFontBuffer() 12363 12364``` 12365uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length ) 12366``` 12367 12368**Description** 12369 12370Registers a font buffer with the font manager. 12371 12372**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12373 12374**Since**: 11 12375 12376**Parameters** 12377 12378| Name | Description | 12379| ------------------------- | --------------------------------------------------- | 12380| OH_Drawing_FontCollection | Pointer to an **OH_Drawing_FontCollection** object. | 12381| fontFamily | Pointer to the family name of the font to register. | 12382| fontBuffer | Pointer to the buffer of the font file. | 12383| length | Length of the font file. | 12384 12385**Returns** 12386 12387Returns **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. 12388 12389 12390### OH_Drawing_RoundRectCreate() 12391 12392``` 12393OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad ) 12394``` 12395 12396**Description** 12397 12398Creates an **OH_Drawing_RoundRect** object. 12399 12400Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12401 12402If **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12403 12404**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12405 12406**Since**: 11 12407 12408**Parameters** 12409 12410| Name | Description | 12411| --------------- | ------------------------------------------------------------ | 12412| OH_Drawing_Rect | Pointer to an **OH_Drawing_Rect** object. | 12413| xRad | Radius of the rounded corner on the X axis. A negative number is invalid. | 12414| yRad | Radius of the rounded corner on the Y axis. A negative number is invalid. | 12415 12416**Returns** 12417 12418Returns the pointer to the **OH_Drawing_RoundRect** object created. 12419 12420 12421### OH_Drawing_RoundRectDestroy() 12422 12423``` 12424void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* ) 12425``` 12426 12427**Description** 12428 12429Destroys an **OH_Drawing_RoundRect** object and reclaims the memory occupied by the object. 12430 12431**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12432 12433**Since**: 11 12434 12435**Parameters** 12436 12437| Name | Description | 12438| -------------------- | ---------------------------------------------- | 12439| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. | 12440 12441 12442### OH_Drawing_RoundRectGetCorner() 12443 12444``` 12445OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos ) 12446``` 12447 12448**Description** 12449 12450Obtains the radii of the specified rounded corner in a rounded rectangle. 12451 12452Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12453 12454If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12455 12456**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12457 12458**Since**: 12 12459 12460**Parameters** 12461 12462| Name | Description | 12463| -------------------- | ------------------------------------------------------------ | 12464| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. | 12465| pos | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). | 12466 12467**Returns** 12468 12469Returns an [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis. 12470 12471 12472### OH_Drawing_RoundRectSetCorner() 12473 12474``` 12475void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii ) 12476``` 12477 12478**Description** 12479 12480Sets the radii of the specified rounded corner in a rounded rectangle. 12481 12482Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12483 12484If **OH_Drawing_RoundRect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 12485 12486**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12487 12488**Since**: 12 12489 12490**Parameters** 12491 12492| Name | Description | 12493| ----------------------- | ------------------------------------------------------------ | 12494| OH_Drawing_RoundRect | Pointer to an **OH_Drawing_RoundRect** object. | 12495| pos | Position of the rounded corner. For details about the available options, see [OH_Drawing_CornerPos](#oh_drawing_cornerpos). | 12496| OH_Drawing_Corner_Radii | [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) struct, including the radii on the X axis and Y axis. The value must be greater than or equal to 0. | 12497 12498 12499### OH_Drawing_SamplingOptionsCreate() 12500 12501``` 12502OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode ) 12503``` 12504 12505**Description** 12506 12507Creates an **OH_Drawing_SamplingOptions** object. 12508 12509Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 12510 12511If **OH_Drawing_MipmapMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 12512 12513**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12514 12515**Since**: 12 12516 12517**Parameters** 12518 12519| Name | Description | 12520| --------------------- | ------------------------------------------------------------ | 12521| OH_Drawing_FilterMode | Filter mode. For details about the available options, see [OH_Drawing_FilterMode](#oh_drawing_filtermode). | 12522| OH_Drawing_MipmapMode | Mipmap mode. For details about the available options, see [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode). | 12523 12524**Returns** 12525 12526Returns the pointer to the [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object created. 12527 12528 12529### OH_Drawing_SamplingOptionsDestroy() 12530 12531``` 12532void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* ) 12533``` 12534 12535**Description** 12536 12537Destroys an **OH_Drawing_SamplingOptions** object and reclaims the memory occupied by the object. 12538 12539**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12540 12541**Since**: 12 12542 12543**Parameters** 12544 12545| Name | Description | 12546| -------------------------- | ------------------------------------------------------------ | 12547| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. | 12548 12549 12550### OH_Drawing_SetTextStyleBackgroundBrush() 12551 12552``` 12553void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12554``` 12555 12556**Description** 12557 12558Sets the background brush for a text style. 12559 12560**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12561 12562**Since**: 12 12563 12564**Parameters** 12565 12566| Name | Description | 12567| -------------------- | ------------------------------------------------------------ | 12568| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12569| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). | 12570 12571 12572### OH_Drawing_SetTextStyleBackgroundPen() 12573 12574``` 12575void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12576``` 12577 12578**Description** 12579 12580Sets the background pen for a text style. 12581 12582**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12583 12584**Since**: 12 12585 12586**Parameters** 12587 12588| Name | Description | 12589| -------------------- | ------------------------------------------------------------ | 12590| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12591| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). | 12592 12593 12594### OH_Drawing_SetTextStyleBaseLine() 12595 12596``` 12597void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int ) 12598``` 12599 12600**Description** 12601 12602Sets the baseline for a text style. 12603 12604**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12605 12606**Since**: 8 12607 12608**Parameters** 12609 12610| Name | Description | 12611| -------------------- | ------------------------------------------------------------ | 12612| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12613| int | Text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline). | 12614 12615 12616### OH_Drawing_SetTextStyleColor() 12617 12618``` 12619void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t ) 12620``` 12621 12622**Description** 12623 12624Sets the text color. 12625 12626**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12627 12628**Since**: 8 12629 12630**Parameters** 12631 12632| Name | Description | 12633| -------------------- | ------------------------------------------------------------ | 12634| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12635| uint32_t | Color. | 12636 12637 12638### OH_Drawing_SetTextStyleDecoration() 12639 12640``` 12641void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int ) 12642 12643``` 12644 12645**Description** 12646 12647Sets the decoration for a text style. 12648 12649**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12650 12651**Since**: 8 12652 12653**Parameters** 12654 12655| Name | Description | 12656| -------------------- | ------------------------------------------------------------ | 12657| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12658| int | Text decoration. For details about the available options, see [OH_Drawing_TextDecoration](#oh_drawing_textdecoration). | 12659 12660 12661### OH_Drawing_SetTextStyleDecorationColor() 12662 12663``` 12664void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t ) 12665 12666``` 12667 12668**Description** 12669 12670Sets the decoration color for a text style. 12671 12672**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12673 12674**Since**: 8 12675 12676**Parameters** 12677 12678| Name | Description | 12679| -------------------- | ------------------------------------------------------------ | 12680| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12681| uint32_t | Color. | 12682 12683 12684### OH_Drawing_SetTextStyleDecorationStyle() 12685 12686``` 12687void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int ) 12688 12689``` 12690 12691**Description** 12692 12693Sets the decoration style for a text style. 12694 12695**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12696 12697**Since**: 11 12698 12699**Parameters** 12700 12701| Name | Description | 12702| -------------------- | ------------------------------------------------------------ | 12703| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12704| int | Text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle). | 12705 12706 12707### OH_Drawing_SetTextStyleDecorationThicknessScale() 12708 12709``` 12710void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double ) 12711 12712``` 12713 12714**Description** 12715 12716Sets the thickness scale factor of the text decoration line. 12717 12718**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12719 12720**Since**: 11 12721 12722**Parameters** 12723 12724| Name | Description | 12725| -------------------- | ------------------------------------------------------------ | 12726| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12727| double | Scale factor. | 12728 12729 12730### OH_Drawing_SetTextStyleEllipsis() 12731 12732``` 12733void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char* ) 12734 12735``` 12736 12737**Description** 12738 12739Sets the ellipsis content for text. 12740 12741**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12742 12743**Since**: 11 12744 12745**Parameters** 12746 12747| Name | Description | 12748| -------------------- | ------------------------------------------------------------ | 12749| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12750| char\* | Pointer to the ellipsis content. The data type is a pointer pointing to char. | 12751 12752 12753### OH_Drawing_SetTextStyleEllipsisModal() 12754 12755``` 12756void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int ) 12757 12758``` 12759 12760**Description** 12761 12762Sets the ellipsis style for text. 12763 12764**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12765 12766**Since**: 11 12767 12768**Parameters** 12769 12770| Name | Description | 12771| -------------------- | ------------------------------------------------------------ | 12772| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12773| int | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). | 12774 12775 12776### OH_Drawing_SetTextStyleFontFamilies() 12777 12778``` 12779void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] ) 12780 12781``` 12782 12783**Description** 12784 12785Sets the font families for a text style. 12786 12787**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12788 12789**Since**: 8 12790 12791**Parameters** 12792 12793| Name | Description | 12794| -------------------- | ------------------------------------------------------------ | 12795| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12796| int | Number of font names. A negative number is not allowed. | 12797| char* | Pointer to the font families. | 12798 12799 12800### OH_Drawing_SetTextStyleFontHeight() 12801 12802``` 12803void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double ) 12804 12805``` 12806 12807**Description** 12808 12809Sets the line height based on the multiple of the font size. 12810 12811**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12812 12813**Since**: 8 12814 12815**Parameters** 12816 12817| Name | Description | 12818| -------------------- | ------------------------------------------------------------ | 12819| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12820| double | Multiple of the font size. | 12821 12822 12823### OH_Drawing_SetTextStyleFontSize() 12824 12825``` 12826void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double ) 12827 12828``` 12829 12830**Description** 12831 12832Sets the font size. 12833 12834**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12835 12836**Since**: 8 12837 12838**Parameters** 12839 12840| Name | Description | 12841| -------------------- | ------------------------------------------------------------ | 12842| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12843| double | Font size. | 12844 12845 12846### OH_Drawing_SetTextStyleFontStyle() 12847 12848``` 12849void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int ) 12850``` 12851 12852**Description** 12853 12854Sets the font style for a text style. 12855 12856**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12857 12858**Since**: 8 12859 12860**Parameters** 12861 12862| Name | Description | 12863| -------------------- | ------------------------------------------------------------ | 12864| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12865| int | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). | 12866 12867 12868### OH_Drawing_SetTextStyleFontStyleStruct() 12869 12870``` 12871void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle ) 12872 12873``` 12874 12875**Description** 12876 12877Sets the font style, including the font weight, width, and slant, for a text style. 12878 12879**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12880 12881**Since**: 12 12882 12883**Parameters** 12884 12885| Name | Description | 12886| ------------------------------------------------------------ | ------------------------------------------------------------ | 12887| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12888| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Font style, including the font weight, width, and slant. | 12889 12890 12891### OH_Drawing_SetTextStyleFontWeight() 12892 12893``` 12894void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int ) 12895``` 12896 12897**Description** 12898 12899Sets the font weight for a text style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect. 12900 12901**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12902 12903**Since**: 8 12904 12905**Parameters** 12906 12907| Name | Description | 12908| -------------------- | ------------------------------------------------------------ | 12909| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12910| int | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). | 12911 12912 12913### OH_Drawing_SetTextStyleForegroundBrush() 12914 12915``` 12916void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12917 12918``` 12919 12920**Description** 12921 12922Sets the foreground brush for a text style. 12923 12924**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12925 12926**Since**: 12 12927 12928**Parameters** 12929 12930| Name | Description | 12931| -------------------- | ------------------------------------------------------------ | 12932| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12933| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). | 12934 12935 12936### OH_Drawing_SetTextStyleForegroundPen() 12937 12938``` 12939void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12940 12941``` 12942 12943**Description** 12944 12945Sets the foreground pen for a text style. 12946 12947**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12948 12949**Since**: 12 12950 12951**Parameters** 12952 12953| Name | Description | 12954| -------------------- | ------------------------------------------------------------ | 12955| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12956| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). | 12957 12958 12959### OH_Drawing_SetTextStyleHalfLeading() 12960 12961``` 12962void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool ) 12963 12964``` 12965 12966**Description** 12967 12968Sets half leading for text. 12969 12970**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12971 12972**Since**: 11 12973 12974**Parameters** 12975 12976| Name | Description | 12977| -------------------- | ------------------------------------------------------------ | 12978| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 12979| bool | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. | 12980 12981 12982### OH_Drawing_SetTextStyleLetterSpacing() 12983 12984``` 12985void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double ) 12986 12987``` 12988 12989**Description** 12990 12991Sets the letter spacing for text. 12992 12993**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 12994 12995**Since**: 11 12996 12997**Parameters** 12998 12999| Name | Description | 13000| -------------------- | ------------------------------------------------------------ | 13001| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 13002| double | Letter spacing. | 13003 13004 13005### OH_Drawing_SetTextStyleLocale() 13006 13007``` 13008void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char* ) 13009 13010``` 13011 13012**Description** 13013 13014Sets the locale for a text style. 13015 13016**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13017 13018**Since**: 8 13019 13020**Parameters** 13021 13022| Name | Description | 13023| -------------------- | ------------------------------------------------------------ | 13024| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 13025| char | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. | 13026 13027 13028### OH_Drawing_SetTextStyleWordSpacing() 13029 13030``` 13031void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double ) 13032 13033``` 13034 13035**Description** 13036 13037Sets the word spacing for text. 13038 13039**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13040 13041**Since**: 11 13042 13043**Parameters** 13044 13045| Name | Description | 13046| -------------------- | ------------------------------------------------------------ | 13047| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 13048| double | Letter spacing. | 13049 13050 13051### OH_Drawing_SetTypographyStyleFontStyleStruct() 13052 13053``` 13054void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle ) 13055 13056``` 13057 13058**Description** 13059 13060Sets the font style, including the font weight, width, and slant, for the default text style of a typography style. 13061 13062**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13063 13064**Since**: 12 13065 13066**Parameters** 13067 13068| Name | Description | 13069| ------------------------------------------------------------ | ------------------------------------------------------------ | 13070| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13071| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | Sets the font style, including the font weight, width, and slant, for the text style of the strut style in a typography style. | 13072 13073 13074### OH_Drawing_SetTypographyStyleTextStrutStyle() 13075 13076``` 13077void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle* ) 13078 13079``` 13080 13081**Description** 13082 13083Sets the strut style for a typography style. 13084 13085**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13086 13087**Since**: 12 13088 13089**Parameters** 13090 13091| Name | Description | 13092| -------------------------------------------------------- | ------------------------------------------------------------ | 13093| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13094| [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). | 13095 13096 13097### OH_Drawing_SetTypographyTextAlign() 13098 13099``` 13100void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int ) 13101 13102``` 13103 13104**Description** 13105 13106Sets the text alignment mode. 13107 13108**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13109 13110**Since**: 8 13111 13112**Parameters** 13113 13114| Name | Description | 13115| -------------------------- | ------------------------------------------------------------ | 13116| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13117| int | Text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign). | 13118 13119 13120### OH_Drawing_SetTypographyTextBreakStrategy() 13121 13122``` 13123void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int ) 13124 13125``` 13126 13127**Description** 13128 13129Sets the text break strategy. 13130 13131**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13132 13133**Since**: 11 13134 13135**Parameters** 13136 13137| Name | Description | 13138| -------------------------- | ------------------------------------------------------------ | 13139| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13140| int | Text break strategy. For details about the available options, see [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy). | 13141 13142 13143### OH_Drawing_SetTypographyTextDirection() 13144 13145``` 13146void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int ) 13147 13148``` 13149 13150**Description** 13151 13152Sets the text direction in a typography style. 13153 13154**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13155 13156**Since**: 8 13157 13158**Parameters** 13159 13160| Name | Description | 13161| -------------------------- | ------------------------------------------------------------ | 13162| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13163| int | Text direction. For details about the available options, see [OH_Drawing_TextDirection](#oh_drawing_textdirection). | 13164 13165 13166### OH_Drawing_SetTypographyTextEllipsis() 13167 13168``` 13169void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis ) 13170 13171``` 13172 13173**Description** 13174 13175Sets the ellipsis text for a typography style. 13176 13177**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13178 13179**Since**: 12 13180 13181**Parameters** 13182 13183| Name | Description | 13184| -------------------------- | ------------------------------------------------------------ | 13185| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13186| char | Pinter to an ellipsis style. | 13187 13188 13189### OH_Drawing_SetTypographyTextEllipsisModal() 13190 13191``` 13192void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int ) 13193``` 13194 13195**Description** 13196 13197Sets the text ellipsis style for a typography style. 13198 13199**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13200 13201**Since**: 11 13202 13203**Parameters** 13204 13205| Name | Description | 13206| -------------------------- | ------------------------------------------------------------ | 13207| OH_Drawing_TypographyStyle | Pointer to an **OH_Drawing_TypographyStyle** object, which is obtained by [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13208| int | Ellipsis style. For details about the available options, see [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal). | 13209 13210 13211### OH_Drawing_SetTypographyTextFontFamily() 13212 13213``` 13214void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char* ) 13215 13216``` 13217 13218**Description** 13219 13220Sets the font family name for text. 13221 13222**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13223 13224**Since**: 12 13225 13226**Parameters** 13227 13228| Name | Description | 13229| -------------------------- | ------------------------------------------------------------ | 13230| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13231| char | Pointer to the name of the font family. | 13232 13233 13234### OH_Drawing_SetTypographyTextFontHeight() 13235 13236``` 13237void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double ) 13238 13239``` 13240 13241**Description** 13242 13243Sets the font height for text. 13244 13245**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13246 13247**Since**: 12 13248 13249**Parameters** 13250 13251| Name | Description | 13252| -------------------------- | ------------------------------------------------------------ | 13253| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13254| double | Font height. | 13255 13256 13257### OH_Drawing_SetTypographyTextFontSize() 13258 13259``` 13260void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double ) 13261 13262``` 13263 13264**Description** 13265 13266Sets the font size for text. 13267 13268**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13269 13270**Since**: 12 13271 13272**Parameters** 13273 13274| Name | Description | 13275| -------------------------- | ------------------------------------------------------------ | 13276| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13277| double | Font size, which must be greater than 0. | 13278 13279 13280### OH_Drawing_SetTypographyTextFontStyle() 13281 13282``` 13283void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int ) 13284``` 13285 13286**Description** 13287 13288Sets the default font style for a typography style. 13289 13290**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13291 13292**Since**: 12 13293 13294**Parameters** 13295 13296| Name | Description | 13297| -------------------------- | ------------------------------------------------------------ | 13298| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13299| int | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). | 13300 13301 13302### OH_Drawing_SetTypographyTextFontWeight() 13303 13304``` 13305void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int ) 13306``` 13307 13308**Description** 13309 13310Sets the default font weight for a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect. 13311 13312**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13313 13314**Since**: 12 13315 13316**Parameters** 13317 13318| Name | Description | 13319| -------------------------- | ------------------------------------------------------------ | 13320| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13321| int | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). | 13322 13323 13324### OH_Drawing_SetTypographyTextHalfLeading() 13325 13326``` 13327void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13328 13329``` 13330 13331**Description** 13332 13333Sets whether half leading is used 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| bool | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. | 13345 13346 13347### OH_Drawing_SetTypographyTextLineStyleFontFamilies() 13348 13349``` 13350void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] ) 13351 13352``` 13353 13354**Description** 13355 13356Sets the font families of the text line style. 13357 13358**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13359 13360**Since**: 12 13361 13362**Parameters** 13363 13364| Name | Description | 13365| -------------------------- | ------------------------------------------------------------ | 13366| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13367| int | Number of font families. | 13368| char | Pointer to the font families. | 13369 13370 13371### OH_Drawing_SetTypographyTextLineStyleFontHeight() 13372 13373``` 13374void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double ) 13375 13376``` 13377 13378**Description** 13379 13380Sets the font height of the text line style. 13381 13382**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13383 13384**Since**: 12 13385 13386**Parameters** 13387 13388| Name | Description | 13389| -------------------------- | ------------------------------------------------------------ | 13390| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13391| double | Font height. | 13392 13393 13394### OH_Drawing_SetTypographyTextLineStyleFontSize() 13395 13396``` 13397void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double ) 13398 13399``` 13400 13401**Description** 13402 13403Sets the font size for a text line. 13404 13405**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13406 13407**Since**: 12 13408 13409**Parameters** 13410 13411| Name | Description | 13412| -------------------------- | ------------------------------------------------------------ | 13413| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13414| double | Font size, which must be greater than 0. | 13415 13416 13417### OH_Drawing_SetTypographyTextLineStyleFontStyle() 13418 13419``` 13420void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int ) 13421 13422``` 13423 13424**Description** 13425 13426Sets the font style of the strut style in a typography style. 13427 13428**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13429 13430**Since**: 12 13431 13432**Parameters** 13433 13434| Name | Description | 13435| -------------------------- | ------------------------------------------------------------ | 13436| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13437| int | Font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). | 13438 13439 13440### OH_Drawing_SetTypographyTextLineStyleFontWeight() 13441 13442``` 13443void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int ) 13444``` 13445 13446**Description** 13447 13448Sets the text font weight of the strut style in a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect. 13449 13450**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13451 13452**Since**: 12 13453 13454**Parameters** 13455 13456| Name | Description | 13457| -------------------------- | ------------------------------------------------------------ | 13458| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13459| int | Font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). | 13460 13461 13462### OH_Drawing_SetTypographyTextLineStyleHalfLeading() 13463 13464``` 13465void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13466 13467``` 13468 13469**Description** 13470 13471Sets whether to enable half leading for the strut style in a typography style. 13472 13473**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13474 13475**Since**: 12 13476 13477**Parameters** 13478 13479| Name | Description | 13480| -------------------------- | ------------------------------------------------------------ | 13481| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13482| bool | Whether to enable half leading. The value **true** means to enable half lading, and **false** means the opposite. | 13483 13484 13485### OH_Drawing_SetTypographyTextLineStyleOnly() 13486 13487``` 13488void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool ) 13489 13490``` 13491 13492**Description** 13493 13494Sets whether to enable the text line style only. 13495 13496**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13497 13498**Since**: 12 13499 13500**Parameters** 13501 13502| Name | Description | 13503| -------------------------- | ------------------------------------------------------------ | 13504| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13505| 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. | 13506 13507 13508### OH_Drawing_SetTypographyTextLineStyleSpacingScale() 13509 13510``` 13511void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double ) 13512 13513``` 13514 13515**Description** 13516 13517Sets the spacing ratio of the text line style. 13518 13519**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13520 13521**Since**: 12 13522 13523**Parameters** 13524 13525| Name | Description | 13526| -------------------------- | ------------------------------------------------------------ | 13527| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13528| double | Spacing ratio. | 13529 13530 13531### OH_Drawing_SetTypographyTextLocale() 13532 13533``` 13534void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale ) 13535 13536``` 13537 13538**Description** 13539 13540Sets the locale for a typography style. 13541 13542**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13543 13544**Since**: 12 13545 13546**Parameters** 13547 13548| Name | Description | 13549| -------------------------- | ------------------------------------------------------------ | 13550| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13551| char | Pointer to the locale. For example, **'en'** indicates English, **'zh-Hans'** indicates Simplified Chinese, and **'zh-Hant'** indicates Traditional Chinese. | 13552 13553 13554### OH_Drawing_SetTypographyTextMaxLines() 13555 13556``` 13557void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int ) 13558 13559``` 13560 13561**Description** 13562 13563Sets the maximum number of lines in the text. 13564 13565**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13566 13567**Since**: 8 13568 13569**Parameters** 13570 13571| Name | Description | 13572| -------------------------- | ------------------------------------------------------------ | 13573| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13574| int | Maximum number of lines. | 13575 13576### OH_Drawing_SetTypographyTextSplitRatio() 13577 13578``` 13579void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio ) 13580 13581``` 13582 13583**Description** 13584 13585Sets the text split ratio. 13586 13587**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13588 13589**Since**: 12 13590 13591**Parameters** 13592 13593| Name | Description | 13594| -------------------------- | ------------------------------------------------------------ | 13595| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13596| float | Text split ratio. | 13597 13598 13599### OH_Drawing_SetTypographyTextStyle() 13600 13601``` 13602void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle* ) 13603 13604``` 13605 13606**Description** 13607 13608Sets a text style. 13609 13610**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13611 13612**Since**: 12 13613 13614**Parameters** 13615 13616| Name | Description | 13617| -------------------------- | ------------------------------------------------------------ | 13618| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13619| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 13620 13621 13622### OH_Drawing_SetTypographyTextUseLineStyle() 13623 13624``` 13625void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool ) 13626 13627``` 13628 13629**Description** 13630 13631Sets whether to enable the line style for text. 13632 13633**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13634 13635**Since**: 12 13636 13637**Parameters** 13638 13639| Name | Description | 13640| -------------------------- | ------------------------------------------------------------ | 13641| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13642| bool | Whether to enable the line style for text. The value **true** means to enable the line style for text, and **false** means the opposite. | 13643 13644 13645### OH_Drawing_SetTypographyTextWordBreakType() 13646 13647``` 13648void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int ) 13649 13650``` 13651 13652**Description** 13653 13654Sets the word break type. 13655 13656**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13657 13658**Since**: 11 13659 13660**Parameters** 13661 13662| Name | Description | 13663| -------------------------- | ------------------------------------------------------------ | 13664| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 13665| int | Word break type. For details about the available options, see [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype). | 13666 13667 13668### OH_Drawing_ShaderEffectCreateImageShader() 13669 13670``` 13671OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix* ) 13672 13673``` 13674 13675**Description** 13676 13677Creates 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. 13678 13679Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13680 13681If either **OH_Drawing_Image** or **OH_Drawing_SamplingOptions** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 13682 13683If either **tileX** or **tileY** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 13684 13685**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13686 13687**Since**: 12 13688 13689**Parameters** 13690 13691| Name | Description | 13692| -------------------------- | ------------------------------------------------------------ | 13693| OH_Drawing_Image | Pointer to an [OH_Drawing_Image](#oh_drawing_image) object. | 13694| 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). | 13695| 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). | 13696| OH_Drawing_SamplingOptions | Pointer to an [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) object. | 13697| 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. | 13698 13699**Returns** 13700 13701Returns the pointer to the **OH_Drawing_ShaderEffect** object created. 13702 13703 13704### OH_Drawing_ShaderEffectCreateLinearGradient() 13705 13706``` 13707OH_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 ) 13708 13709``` 13710 13711**Description** 13712 13713Creates an **OH_Drawing_ShaderEffect** object that generates a linear gradient between two points. 13714 13715Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13716 13717If any of **startPt**, **endPt**, and **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 13718 13719If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 13720 13721**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13722 13723**Since**: 11 13724 13725**Parameters** 13726 13727| Name | Description | 13728| ------------------- | ------------------------------------------------------------ | 13729| startPt | Start point. | 13730| endPt | End point. | 13731| colors | Colors to distribute. | 13732| 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. | 13733| size | Number of colors and positions (if **pos** is not NULL). | 13734| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). | 13735 13736**Returns** 13737 13738Returns the pointer to the **OH_Drawing_ShaderEffect** object created. 13739 13740 13741### OH_Drawing_ShaderEffectCreateRadialGradient() 13742 13743``` 13744OH_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 ) 13745 13746``` 13747 13748**Description** 13749 13750Creates 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. 13751 13752Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13753 13754If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER**} is returned. 13755 13756If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 13757 13758**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13759 13760**Since**: 11 13761 13762**Parameters** 13763 13764| Name | Description | 13765| ------------------- | ------------------------------------------------------------ | 13766| centerPt | Center of the circle. | 13767| radius | Circle radius of the gradient. The value should be a non-negative number. | 13768| colors | Colors to distribute in the radial direction. | 13769| pos | Relative position of each color in the color array. If **pos** is NULL, colors are evenly distributed in the radial direction. | 13770| size | Number of colors and positions (if **pos** is not NULL). | 13771| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). | 13772 13773**Returns** 13774 13775Returns the pointer to the **OH_Drawing_ShaderEffect** object created. 13776 13777 13778### OH_Drawing_ShaderEffectCreateSweepGradient() 13779 13780``` 13781OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode ) 13782 13783``` 13784 13785**Description** 13786 13787Creates 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°. 13788 13789Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13790 13791If either **centerPt** or **colors** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER**} is returned. 13792 13793If **OH_Drawing_TileMode** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 13794 13795**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13796 13797**Since**: 11 13798 13799**Parameters** 13800 13801| Name | Description | 13802| ------------------- | ------------------------------------------------------------ | 13803| centerPt | Center of the circle. | 13804| colors | Colors to distribute. | 13805| 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°). | 13806| size | Number of colors and positions (if **pos** is not NULL). | 13807| OH_Drawing_TileMode | Tile mode of the shader effect. For details about the available options, see [OH_Drawing_TileMode](#oh_drawing_tilemode-1). | 13808 13809**Returns** 13810 13811Returns the pointer to the **OH_Drawing_ShaderEffect** object created. 13812 13813 13814### OH_Drawing_ShaderEffectDestroy() 13815 13816``` 13817void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* ) 13818``` 13819 13820**Description** 13821 13822Destroys an **OH_Drawing_ShaderEffect** object and reclaims the memory occupied by the object. 13823 13824**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13825 13826**Since**: 11 13827 13828**Parameters** 13829 13830| Name | Description | 13831| ----------------------- | ------------------------------------------------- | 13832| OH_Drawing_ShaderEffect | Pointer to an **OH_Drawing_ShaderEffect** object. | 13833 13834 13835### OH_Drawing_SurfaceCreateFromGpuContext() 13836 13837``` 13838OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info ) 13839``` 13840 13841**Description** 13842 13843Creates an **OH_Drawing_Surface** object using the GPU context to manage the content drawn on the canvas. 13844 13845Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13846 13847If **OH_Drawing_GpuContext** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 13848 13849**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13850 13851**Since**: 12 13852 13853**Parameters** 13854 13855| Name | Description | 13856| --------------------------------------------------------- | ------------------------------------------------------------ | 13857| OH_Drawing_GpuContext | Pointer to an [OH_Drawing_GpuContext](#oh_drawing_gpucontext) object. | 13858| 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. | 13859| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) object. | 13860 13861**Returns** 13862 13863Returns the pointer to the [OH_Drawing_Surface](#oh_drawing_surface) object created. 13864 13865 13866### OH_Drawing_SurfaceDestroy() 13867 13868``` 13869void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* ) 13870``` 13871 13872**Description** 13873 13874Destroys an **OH_Drawing_Surface** object and reclaims the memory occupied. 13875 13876**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13877 13878**Since**: 12 13879 13880**Parameters** 13881 13882| Name | Description | 13883| ------------------ | -------------------------------------------- | 13884| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. | 13885 13886 13887### OH_Drawing_SurfaceGetCanvas() 13888 13889``` 13890OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* ) 13891``` 13892 13893**Description** 13894 13895Obtains a canvas from an **OH_Drawing_Surface** object. 13896 13897Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13898 13899If **OH_Drawing_Surface** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 13900 13901**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13902 13903**Since**: 12 13904 13905**Parameters** 13906 13907| Name | Description | 13908| ------------------ | -------------------------------------------- | 13909| OH_Drawing_Surface | Pointer to an **OH_Drawing_Surface** object. | 13910 13911**Returns** 13912 13913Returns the pointer to the [OH_Drawing_Canvas](#oh_drawing_canvas) object created. The pointer returned does not need to be managed by the caller. 13914 13915 13916### OH_Drawing_TextBlobBuilderAllocRunPos() 13917 13918``` 13919const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect* ) 13920``` 13921 13922**Description** 13923 13924Allocates 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. 13925 13926Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13927 13928If 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. 13929 13930**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13931 13932**Since**: 11 13933 13934**Parameters** 13935 13936| Name | Description | 13937| -------------------------- | ------------------------------------------------------------ | 13938| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. | 13939| OH_Drawing_Font | Pointer to an **OH_Drawing_Font** object. | 13940| count | Number of text blobs. | 13941| OH_Drawing_Rect | Rectangle of the text blob. The value NULL means that no rectangle is set. | 13942 13943 13944### OH_Drawing_TextBlobBuilderCreate() 13945 13946``` 13947OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void ) 13948``` 13949 13950**Description** 13951 13952Creates an **OH_Drawing_TextBlobBuilder** object. 13953 13954**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13955 13956**Since**: 11 13957 13958**Returns** 13959 13960Returns the pointer to the **OH_Drawing_TextBlobBuilder** object created. 13961 13962 13963### OH_Drawing_TextBlobBuilderDestroy() 13964 13965``` 13966void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* ) 13967``` 13968 13969**Description** 13970 13971Destroys an **OH_Drawing_TextBlobBuilder** object and reclaims the memory occupied by the object. 13972 13973**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13974 13975**Since**: 11 13976 13977**Parameters** 13978 13979| Name | Description | 13980| -------------------------- | ---------------------------------------------------- | 13981| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. | 13982 13983 13984### OH_Drawing_TextBlobBuilderMake() 13985 13986``` 13987OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* ) 13988``` 13989 13990**Description** 13991 13992Makes an **OH_Drawing_TextBlob** object from an **OH_Drawing_TextBlobBuilder**. 13993 13994Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 13995 13996If **OH_Drawing_TextBlobBuilder** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 13997 13998**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 13999 14000**Since**: 11 14001 14002**Parameters** 14003 14004| Name | Description | 14005| -------------------------- | ---------------------------------------------------- | 14006| OH_Drawing_TextBlobBuilder | Pointer to an **OH_Drawing_TextBlobBuilder** object. | 14007 14008**Returns** 14009 14010Returns the pointer to the **OH_Drawing_TextBlob** object created. 14011 14012 14013### OH_Drawing_TextBlobCreateFromPosText() 14014 14015``` 14016OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14017``` 14018 14019**Description** 14020 14021Creates 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. 14022 14023Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 14024 14025If any of **text**, **OH_Drawing_Point2D**, and **OH_Drawing_Font** is NULL or **byteLength** is **0**, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 14026 14027If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 14028 14029**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14030 14031**Since**: 12 14032 14033**Parameters** 14034 14035| Name | Description | 14036| -------------------------------------------------- | ------------------------------------------------------------ | 14037| text | Pointer to the text. | 14038| byteLength | Length of the text, in bytes. | 14039| [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). | 14040| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. | 14041| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). | 14042 14043**Returns** 14044 14045Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created. 14046 14047 14048### OH_Drawing_TextBlobCreateFromString() 14049 14050``` 14051OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14052``` 14053 14054**Description** 14055 14056Creates an **OH_Drawing_TextBlob** object from a string. 14057 14058Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 14059 14060If either **str** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 14061 14062If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 14063 14064**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14065 14066**Since**: 12 14067 14068**Parameters** 14069 14070| Name | Description | 14071| ----------------------- | ------------------------------------------------------------ | 14072| str | Pointer to a string. | 14073| OH_Drawing_Font | Pointer to an [OH_Drawing_Font](#oh_drawing_font) object. | 14074| OH_Drawing_TextEncoding | Encoding type of the text. For details about the available options, see [OH_Drawing_TextEncoding](#oh_drawing_textencoding). Currently, only **TEXT_ENCODING_UTF8** takes effect, and other encoding types are treated as **TEXT_ENCODING_UTF8**. | 14075 14076**Returns** 14077 14078Returns the pointer to the [OH_Drawing_TextBlob](#oh_drawing_textblob) object created. 14079 14080 14081### OH_Drawing_TextBlobCreateFromText() 14082 14083``` 14084OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14085``` 14086 14087**Description** 14088 14089Creates an **OH_Drawing_TextBlob** object from the text. 14090 14091Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 14092 14093If either **text** or **OH_Drawing_Font** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 14094 14095If **OH_Drawing_TextEncoding** is not set to one of the enumerated values, **OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE** is returned. 14096 14097**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14098 14099**Since**: 12 14100 14101**Parameters** 14102 14103| Name | Description | 14104| ----------------------- | ------------------------------------------------------------ | 14105| text | Pointer to the text. | 14106| byteLength | Length of the text, in bytes. | 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_TextBlobDestroy() 14116 14117``` 14118void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* ) 14119``` 14120 14121**Description** 14122 14123Destroys an **OH_Drawing_TextBlob** object and reclaims the memory occupied by the object. 14124 14125**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14126 14127**Since**: 11 14128 14129**Parameters** 14130 14131| Name | Description | 14132| ------------------- | --------------------------------------------- | 14133| OH_Drawing_TextBlob | Pointer to an **OH_Drawing_TextBlob** object. | 14134 14135 14136### OH_Drawing_TextBlobGetBounds() 14137 14138``` 14139void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect* ) 14140``` 14141 14142**Description** 14143 14144Obtains the bounds of an **OH_Drawing_TextBlob** object. 14145 14146Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 14147 14148If either **OH_Drawing_TextBlob** or **OH_Drawing_Rect** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 14149 14150**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14151 14152**Since**: 12 14153 14154**Parameters** 14155 14156| Name | Description | 14157| ------------------- | ------------------------------------------------------------ | 14158| OH_Drawing_TextBlob | Pointer to an [OH_Drawing_TextBlob](#oh_drawing_textblob) object. | 14159| OH_Drawing_Rect | Pointer to an [OH_Drawing_Rect](#oh_drawing_rect) object, which is obtained by calling [OH_Drawing_RectCreate](#oh_drawing_rectcreate). | 14160 14161 14162### OH_Drawing_TextStyleAddFontFeature() 14163 14164``` 14165void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value ) 14166``` 14167 14168**Description** 14169 14170Adds a font feature for a text style. 14171 14172**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14173 14174**Since**: 12 14175 14176**Parameters** 14177 14178| Name | Description | 14179| -------------------- | ------------------------------------------------------------ | 14180| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14181| char | Pointer to the string identified by the keyword in the font feature key-value pair. | 14182| int | Value of the font feature key-value pair. | 14183 14184 14185### OH_Drawing_TextStyleAddFontVariation() 14186 14187``` 14188void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* , const float ) 14189 14190``` 14191 14192**Description** 14193 14194Adds 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. 14195 14196**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14197 14198**Since**: 12 14199 14200**Parameters** 14201 14202| Name | Description | 14203| -------------------- | ------------------------------------------------------------ | 14204| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14205| char\* | Pointer to the key in the font variation key-value pair. Currently, only **'wght'** is supported, indicating the font weight. | 14206| float | Value of the font variation key-value pair. Currently, the value range of **'wght'** for the default font is \[0,900\]. | 14207 14208 14209### OH_Drawing_TextStyleAddShadow() 14210 14211``` 14212void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow* ) 14213 14214``` 14215 14216**Description** 14217 14218Adds a shadow to a text shadow container. 14219 14220**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14221 14222**Since**: 12 14223 14224**Parameters** 14225 14226| Name | Description | 14227| --------------------- | ------------------------------------------------------------ | 14228| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14229| OH_Drawing_TextShadow | Pointer to an [OH_Drawing_TextShadow](#oh_drawing_textshadow) object, which is obtained by calling [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow). | 14230 14231 14232### OH_Drawing_TextStyleClearFontFeature() 14233 14234``` 14235void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* ) 14236 14237``` 14238 14239**Description** 14240 14241Clears all the contents in a font feature map container of a text style. 14242 14243**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14244 14245**Since**: 12 14246 14247**Parameters** 14248 14249| Name | Description | 14250| -------------------- | ------------------------------------------------------------ | 14251| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14252 14253 14254### OH_Drawing_TextStyleClearShadows() 14255 14256``` 14257void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* ) 14258 14259``` 14260 14261**Description** 14262 14263Clears all shadows in a text shadow container. 14264 14265**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14266 14267**Since**: 12 14268 14269**Parameters** 14270 14271| Name | Description | 14272| -------------------- | ------------------------------------------------------------ | 14273| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14274 14275 14276### OH_Drawing_TextStyleDestroyFontFamilies() 14277 14278``` 14279void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num ) 14280``` 14281 14282**Description** 14283 14284Reclaims the memory occupied by the font families, where **num** specifies the number of font families. 14285 14286**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14287 14288**Since**: 12 14289 14290**Parameters** 14291 14292| Name | Description | 14293| ------------ | ------------------------------------ | 14294| fontFamilies | Double pointer to the font families. | 14295| num | Number of font families. | 14296 14297 14298### OH_Drawing_TextStyleDestroyFontFeatures() 14299 14300``` 14301void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize ) 14302 14303``` 14304 14305**Description** 14306 14307Reclaims the memory occupied by the struct array that holds all the font features. 14308 14309**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14310 14311**Since**: 12 14312 14313**Parameters** 14314 14315| Name | Description | 14316| ---------------------------------------------------------- | ------------------------------------------------------------ | 14317| [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). | 14318| fontFeatureSize | Size of the struct array that holds all the font features. | 14319 14320 14321### OH_Drawing_TextStyleGetBackgroundBrush() 14322 14323``` 14324void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14325 14326``` 14327 14328**Description** 14329 14330Obtains the background brush. 14331 14332**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14333 14334**Since**: 12 14335 14336**Parameters** 14337 14338| Name | Description | 14339| -------------------- | ------------------------------------------------------------ | 14340| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14341| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). | 14342 14343 14344### OH_Drawing_TextStyleGetBackgroundPen() 14345 14346``` 14347void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14348 14349``` 14350 14351**Description** 14352 14353Obtains the background pen. 14354 14355**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14356 14357**Since**: 12 14358 14359**Parameters** 14360 14361| Name | Description | 14362| -------------------- | ------------------------------------------------------------ | 14363| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14364| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). | 14365 14366 14367### OH_Drawing_TextStyleGetBaseline() 14368 14369``` 14370OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* ) 14371 14372``` 14373 14374**Description** 14375 14376Obtains the baseline of a text style. 14377 14378**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14379 14380**Since**: 12 14381 14382**Parameters** 14383 14384| Name | Description | 14385| -------------------- | ------------------------------------------------------------ | 14386| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14387 14388**Returns** 14389 14390Returns the text baseline. For details about the available options, see [OH_Drawing_TextBaseline](#oh_drawing_textbaseline). 14391 14392 14393### OH_Drawing_TextStyleGetBaselineShift() 14394 14395``` 14396double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle* ) 14397``` 14398 14399**Description** 14400 14401Obtains the baseline offset of a text style. 14402 14403**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14404 14405**Since**: 12 14406 14407**Parameters** 14408 14409| Name | Description | 14410| -------------------- | ------------------------------------------------------------ | 14411| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14412 14413**Returns** 14414 14415Returns the baseline drift. 14416 14417 14418### OH_Drawing_TextStyleGetColor() 14419 14420``` 14421uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* ) 14422 14423``` 14424 14425**Description** 14426 14427Obtains the color of a text style. 14428 14429**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14430 14431**Since**: 12 14432 14433**Parameters** 14434 14435| Name | Description | 14436| -------------------- | ------------------------------------------------------------ | 14437| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14438 14439**Returns** 14440 14441Returns the text color. 14442 14443 14444### OH_Drawing_TextStyleGetDecorationStyle() 14445 14446``` 14447OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* ) 14448 14449``` 14450 14451**Description** 14452 14453Obtains the decoration style of a text style. 14454 14455**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14456 14457**Since**: 12 14458 14459**Parameters** 14460 14461| Name | Description | 14462| -------------------- | ------------------------------------------------------------ | 14463| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14464 14465**Returns** 14466 14467Returns the text decoration style. For details about the available options, see [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle). 14468 14469 14470### OH_Drawing_TextStyleGetFontFamilies() 14471 14472``` 14473char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num ) 14474 14475``` 14476 14477**Description** 14478 14479Obtains the font families of a text style. 14480 14481**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14482 14483**Since**: 12 14484 14485**Parameters** 14486 14487| Name | Description | 14488| -------------------- | ------------------------------------------------------------ | 14489| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14490| num | Pointer to the number of font families. | 14491 14492**Returns** 14493 14494Returns the font families. 14495 14496 14497### OH_Drawing_TextStyleGetFontFeatures() 14498 14499``` 14500OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* ) 14501 14502``` 14503 14504**Description** 14505 14506Obtains all the contents in a font feature map container of a text style. 14507 14508**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14509 14510**Since**: 12 14511 14512**Parameters** 14513 14514| Name | Description | 14515| -------------------- | ------------------------------------------------------------ | 14516| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14517 14518**Returns** 14519 14520Returns the pointer to the [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) struct, which stores all the contents obtained. 14521 14522 14523### OH_Drawing_TextStyleGetFontFeatureSize() 14524 14525``` 14526size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* ) 14527 14528``` 14529 14530**Description** 14531 14532Obtains the size of a font feature map container in a text style. 14533 14534**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14535 14536**Since**: 12 14537 14538**Parameters** 14539 14540| Name | Description | 14541| -------------------- | ------------------------------------------------------------ | 14542| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14543 14544**Returns** 14545 14546Returns the size. 14547 14548 14549### OH_Drawing_TextStyleGetFontHeight() 14550 14551``` 14552double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* ) 14553 14554``` 14555 14556**Description** 14557 14558Obtains the font height of a text style. 14559 14560**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14561 14562**Since**: 12 14563 14564**Parameters** 14565 14566| Name | Description | 14567| -------------------- | ------------------------------------------------------------ | 14568| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14569 14570**Returns** 14571 14572Returns the font height. 14573 14574 14575### OH_Drawing_TextStyleGetFontMetrics() 14576 14577``` 14578bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics* ) 14579 14580``` 14581 14582**Description** 14583 14584Obtains the font metrics. 14585 14586**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14587 14588**Since**: 12 14589 14590**Parameters** 14591 14592| Name | Description | 14593| ----------------------- | ------------------------------------------------------------ | 14594| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 14595| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14596| 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). | 14597 14598**Returns** 14599 14600Returns **true** if the font metrics is obtained; returns **false** otherwise. 14601 14602 14603### OH_Drawing_TextStyleGetFontSize() 14604 14605``` 14606double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle* ) 14607``` 14608 14609**Description** 14610 14611Obtains the font size of a text style. 14612 14613**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14614 14615**Since**: 12 14616 14617**Parameters** 14618 14619| Name | Description | 14620| -------------------- | ------------------------------------------------------------ | 14621| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14622 14623**Returns** 14624 14625Returns the font size. 14626 14627 14628### OH_Drawing_TextStyleGetFontStyle() 14629 14630``` 14631OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* ) 14632``` 14633 14634**Description** 14635 14636Obtains the font style of a text style. 14637 14638**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14639 14640**Since**: 12 14641 14642**Parameters** 14643 14644| Name | Description | 14645| -------------------- | ------------------------------------------------------------ | 14646| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14647 14648**Returns** 14649 14650Returns the font style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). 14651 14652 14653### OH_Drawing_TextStyleGetFontStyleStruct() 14654 14655``` 14656OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle) 14657``` 14658 14659**Description** 14660 14661Obtains the font style, including the font weight, width, and slant, of a text style. 14662 14663**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14664 14665**Since**: 12 14666 14667**Parameters** 14668 14669| Name | Description | 14670| -------------------- | ------------------------------------------------------------ | 14671| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14672 14673**Returns** 14674 14675Returns the font style, including the font weight, width, and slant. 14676 14677 14678### OH_Drawing_TextStyleGetFontWeight() 14679 14680``` 14681OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle* ) 14682``` 14683 14684**Description** 14685 14686Obtains the font weight of a text style. 14687 14688**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14689 14690**Since**: 12 14691 14692**Parameters** 14693 14694| Name | Description | 14695| -------------------- | ------------------------------------------------------------ | 14696| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14697 14698**Returns** 14699 14700Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). 14701 14702 14703### OH_Drawing_TextStyleGetForegroundBrush() 14704 14705``` 14706void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14707``` 14708 14709**Description** 14710 14711Obtains the foreground brush. 14712 14713**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14714 14715**Since**: 12 14716 14717**Parameters** 14718 14719| Name | Description | 14720| -------------------- | ------------------------------------------------------------ | 14721| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14722| OH_Drawing_Brush | Pointer to an [OH_Drawing_Brush](#oh_drawing_brush) object, which is obtained by calling [OH_Drawing_BrushCreate](#oh_drawing_brushcreate). | 14723 14724 14725### OH_Drawing_TextStyleGetForegroundPen() 14726 14727``` 14728void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14729``` 14730 14731**Description** 14732 14733Obtains the foreground pen. 14734 14735**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14736 14737**Since**: 12 14738 14739**Parameters** 14740 14741| Name | Description | 14742| -------------------- | ------------------------------------------------------------ | 14743| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14744| OH_Drawing_Pen | Pointer to an [OH_Drawing_Pen](#oh_drawing_pen) object, which is obtained by calling [OH_Drawing_PenCreate](#oh_drawing_pencreate). | 14745 14746 14747### OH_Drawing_TextStyleGetHalfLeading() 14748 14749``` 14750bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle* ) 14751``` 14752 14753**Description** 14754 14755Checks whether half leading is enabled for a text style. 14756 14757**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14758 14759**Since**: 12 14760 14761**Parameters** 14762 14763| Name | Description | 14764| -------------------- | ------------------------------------------------------------ | 14765| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14766 14767**Returns** 14768 14769Returns **true** if half leading is enabled; returns **false** otherwise. 14770 14771 14772### OH_Drawing_TextStyleGetLetterSpacing() 14773 14774``` 14775double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle* ) 14776``` 14777 14778**Description** 14779 14780Obtains the letter spacing of a text style. 14781 14782**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14783 14784**Since**: 12 14785 14786**Parameters** 14787 14788| Name | Description | 14789| -------------------- | ------------------------------------------------------------ | 14790| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14791 14792**Returns** 14793 14794Returns the letter spacing. 14795 14796 14797### OH_Drawing_TextStyleGetLocale() 14798 14799``` 14800const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle* ) 14801``` 14802 14803**Description** 14804 14805Obtains the locale of a text style. 14806 14807**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14808 14809**Since**: 12 14810 14811**Parameters** 14812 14813| Name | Description | 14814| -------------------- | ------------------------------------------------------------ | 14815| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14816 14817**Returns** 14818 14819Returns 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. 14820 14821 14822### OH_Drawing_TextStyleGetShadowCount() 14823 14824``` 14825int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* ) 14826``` 14827 14828**Description** 14829 14830Obtains the size of a text shadow container. 14831 14832**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14833 14834**Since**: 12 14835 14836**Parameters** 14837 14838| Name | Description | 14839| -------------------- | ------------------------------------------------------------ | 14840| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14841 14842**Returns** 14843 14844Returns the size. 14845 14846 14847### OH_Drawing_TextStyleGetShadows() 14848 14849``` 14850OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* ) 14851``` 14852 14853**Description** 14854 14855Obtains a text shadow container. When [OH_Drawing_TextShadow](#oh_drawing_textshadow) is no longer required, call [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) to release the pointer to the object. 14856 14857**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14858 14859**Since**: 12 14860 14861**Parameters** 14862 14863| Name | Description | 14864| -------------------- | ------------------------------------------------------------ | 14865| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14866 14867**Returns** 14868 14869Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object. 14870 14871 14872### OH_Drawing_TextStyleGetShadowWithIndex() 14873 14874``` 14875OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int ) 14876 14877``` 14878 14879**Description** 14880 14881Obtains a shadow with a given index in a text shadow container. 14882 14883**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14884 14885**Since**: 12 14886 14887**Parameters** 14888 14889| Name | Description | 14890| -------------------- | ------------------------------------------------------------ | 14891| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14892| int | Index. | 14893 14894**Returns** 14895 14896Returns the pointer to the [OH_Drawing_TextShadow](#oh_drawing_textshadow) object. 14897 14898 14899### OH_Drawing_TextStyleGetWordSpacing() 14900 14901``` 14902double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle* ) 14903``` 14904 14905**Description** 14906 14907Obtains the word spacing of a text style. 14908 14909**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14910 14911**Since**: 12 14912 14913**Parameters** 14914 14915| Name | Description | 14916| -------------------- | ------------------------------------------------------------ | 14917| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 14918 14919**Returns** 14920 14921Returns the word spacing. 14922 14923 14924### OH_Drawing_TextStyleIsAttributeMatched() 14925 14926``` 14927bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType ) 14928 14929``` 14930 14931**Description** 14932 14933Checks whether two text styles have the same text style type. 14934 14935**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14936 14937**Since**: 12 14938 14939**Parameters** 14940 14941| Name | Description | 14942| ------------- | ------------------------------------------------------------ | 14943| style | Text style object to compare. | 14944| comparedStyle | Text style object to compare. | 14945| textStyleType | Text style type. For details about the available options, see [OH_Drawing_TextStyleType](#oh_drawing_textstyletype). | 14946 14947**Returns** 14948 14949Returns **true** if the two are the same; returns **false** otherwise. 14950 14951 14952### OH_Drawing_TextStyleIsEqual() 14953 14954``` 14955bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 14956 14957``` 14958 14959**Description** 14960 14961Checks whether two text styles are equal. The word width property is not involved in the comparison. 14962 14963**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14964 14965**Since**: 12 14966 14967**Parameters** 14968 14969| Name | Description | 14970| ------------- | ----------------------------- | 14971| style | Text style object to compare. | 14972| comparedStyle | Text style object to compare. | 14973 14974**Returns** 14975 14976Returns **true** if the two are equal; returns **false** otherwise. 14977 14978 14979### OH_Drawing_TextStyleIsEqualByFont() 14980 14981``` 14982bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 14983 14984``` 14985 14986**Description** 14987 14988Checks whether the font style properties of two text styles are equal. 14989 14990**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 14991 14992**Since**: 12 14993 14994**Parameters** 14995 14996| Name | Description | 14997| ------------- | ----------------------------- | 14998| style | Text style object to compare. | 14999| comparedStyle | Text style object to compare. | 15000 15001**Returns** 15002 15003Returns **true** if the two are equal; returns **false** otherwise. 15004 15005 15006### OH_Drawing_TextStyleIsPlaceholder() 15007 15008``` 15009bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style) 15010 15011``` 15012 15013**Description** 15014 15015Checks whether a placeholder is set for a text style. 15016 15017**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15018 15019**Since**: 12 15020 15021**Parameters** 15022 15023| Name | Description | 15024| -------------------- | ------------------------------------------------------------ | 15025| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 15026 15027**Returns** 15028 15029Returns **true** if a placeholder is set; returns **false** otherwise. 15030 15031 15032### OH_Drawing_TextStyleSetBackgroundRect() 15033 15034``` 15035void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId ) 15036 15037``` 15038 15039**Description** 15040 15041Sets a background rectangle and style ID for a text style. The style ID is valid only when the background box is a rounded rectangle. 15042 15043**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15044 15045**Since**: 12 15046 15047**Parameters** 15048 15049| Name | Description | 15050| ------------------------------------------------------------ | ------------------------------------------------------------ | 15051| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 15052| [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. | 15053| 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. | 15054 15055 15056### OH_Drawing_TextStyleSetBaselineShift() 15057 15058``` 15059void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle* , double lineShift ) 15060``` 15061 15062**Description** 15063 15064Sets a baseline drift for a text style. 15065 15066**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15067 15068**Since**: 12 15069 15070**Parameters** 15071 15072| Name | Description | 15073| -------------------- | ------------------------------------------------------------ | 15074| OH_Drawing_TextStyle | Pointer to an **OH_Drawing_TextStyle** object, which is obtained by [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 15075| double | Baseline drift of the text style. | 15076 15077 15078### OH_Drawing_TextStyleSetPlaceholder() 15079 15080``` 15081void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style) 15082 15083``` 15084 15085**Description** 15086 15087Adds a placeholder. 15088 15089**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15090 15091**Since**: 12 15092 15093**Parameters** 15094 15095| Name | Description | 15096| -------------------- | ------------------------------------------------------------ | 15097| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 15098 15099 15100### OH_Drawing_TypefaceCreateDefault() 15101 15102``` 15103OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void ) 15104``` 15105 15106**Description** 15107 15108Creates a default **OH_Drawing_Typeface** object. 15109 15110**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15111 15112**Since**: 11 15113 15114**Returns** 15115 15116Returns the pointer to the **OH_Drawing_Typeface** object created. 15117 15118 15119### OH_Drawing_TypefaceCreateFromFile() 15120 15121``` 15122OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index ) 15123``` 15124 15125**Description** 15126 15127Creates an **OH_Drawing_Typeface** object through a file. 15128 15129Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 15130 15131If **path** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 15132 15133**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15134 15135**Since**: 12 15136 15137**Parameters** 15138 15139| Name | Description | 15140| ----- | ------------------------- | 15141| path | Pointer to the file path. | 15142| index | File index. | 15143 15144**Returns** 15145 15146Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created. 15147 15148 15149### OH_Drawing_TypefaceCreateFromStream() 15150 15151``` 15152OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index ) 15153``` 15154 15155**Description** 15156 15157Creates 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. 15158 15159Error codes may be generated in the call. You can view the error code by calling [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget). 15160 15161If **OH_Drawing_MemoryStream** is NULL, **OH_DRAWING_ERROR_INVALID_PARAMETER** is returned. 15162 15163**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15164 15165**Since**: 12 15166 15167**Parameters** 15168 15169| Name | Description | 15170| ----------------------- | ------------------------------------------------------------ | 15171| OH_Drawing_MemoryStream | Pointer to an [OH_Drawing_MemoryStream](#oh_drawing_memorystream) object. | 15172| index | Index of the memory stream. | 15173 15174**Returns** 15175 15176Returns the pointer to the [OH_Drawing_Typeface](#oh_drawing_typeface) object created. 15177 15178 15179### OH_Drawing_TypefaceDestroy() 15180 15181``` 15182void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* ) 15183``` 15184 15185**Description** 15186 15187Destroys an **OH_Drawing_Typeface** object and reclaims the memory occupied by the object. 15188 15189**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15190 15191**Since**: 11 15192 15193**Parameters** 15194 15195| Name | Description | 15196| ------------------- | --------------------------------------------- | 15197| OH_Drawing_Typeface | Pointer to an **OH_Drawing_Typeface** object. | 15198 15199 15200### OH_Drawing_TypographyDestroyEllipsis() 15201 15202``` 15203void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis) 15204``` 15205 15206**Description** 15207 15208Reclaims the memory occupied by the text ellipsis names. 15209 15210**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15211 15212**Since**: 12 15213 15214**Parameters** 15215 15216| Name | Description | 15217| -------- | ----------------------------------- | 15218| ellipsis | Pointer to the text ellipsis names. | 15219 15220 15221### OH_Drawing_TypographyDestroyLineFontMetrics() 15222 15223``` 15224void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* ) 15225``` 15226 15227**Description** 15228 15229Reclaims the memory occupied by the struct array that holds all the font metrics of a given line. 15230 15231**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15232 15233**Since**: 12 15234 15235**Parameters** 15236 15237| Name | Description | 15238| ------------------------------------------------------------ | ------------------------------------------------- | 15239| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | Pointer to the first address of the struct array. | 15240 15241 15242### OH_Drawing_TypographyDidExceedMaxLines() 15243 15244``` 15245bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* ) 15246``` 15247 15248**Description** 15249 15250Checks whether the maximum number of lines of a typography object is exceeded. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. If the maximum number of lines is not set by calling [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines), **false** is returned. 15251 15252**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15253 15254**Since**: 11 15255 15256**Parameters** 15257 15258| Name | Description | 15259| --------------------- | ------------------------------------------------------------ | 15260| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15261 15262**Returns** 15263 15264Returns **true** if the maximum number of lines is exceeded; returns **false** otherwise. 15265 15266 15267### OH_Drawing_TypographyGetAlphabeticBaseline() 15268 15269``` 15270double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* ) 15271 15272``` 15273 15274**Description** 15275 15276Obtains the alphabetic baseline in a typography object. 15277 15278**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15279 15280**Since**: 9 15281 15282**Parameters** 15283 15284| Name | Description | 15285| --------------------- | ------------------------------------------------------------ | 15286| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15287 15288**Returns** 15289 15290Returns the alphabetic baseline. 15291 15292 15293### OH_Drawing_TypographyGetEffectiveAlignment() 15294 15295``` 15296int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 15297 15298``` 15299 15300**Description** 15301 15302Obtains the text alignment mode. 15303 15304**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15305 15306**Since**: 12 15307 15308**Parameters** 15309 15310| Name | Description | 15311| -------------------------- | ------------------------------------------------------------ | 15312| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15313 15314**Returns** 15315 15316Returns the text alignment mode. 15317 15318 15319### OH_Drawing_TypographyGetGlyphPositionAtCoordinate() 15320 15321``` 15322OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double ) 15323 15324``` 15325 15326**Description** 15327 15328Obtains the position and affinity of the glyph at the given coordinates. 15329 15330**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15331 15332**Since**: 11 15333 15334**Parameters** 15335 15336| Name | Description | 15337| --------------------- | ------------------------------------------------------------ | 15338| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15339| double | X coordinate. | 15340| double | Y coordinate. | 15341 15342**Returns** 15343 15344Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph. 15345 15346 15347### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster() 15348 15349``` 15350OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double ) 15351 15352``` 15353 15354**Description** 15355 15356Obtains 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. 15357 15358**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15359 15360**Since**: 11 15361 15362**Parameters** 15363 15364| Name | Description | 15365| --------------------- | ------------------------------------------------------------ | 15366| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15367| double | X coordinate. | 15368| double | Y coordinate. | 15369 15370**Returns** 15371 15372Returns the [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) struct that holds the position and affinity of the glyph cluster. 15373 15374 15375### OH_Drawing_TypographyGetHeight() 15376 15377``` 15378double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* ) 15379 15380``` 15381 15382**Description** 15383 15384Obtains the overall height of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15385 15386**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15387 15388**Since**: 9 15389 15390**Parameters** 15391 15392| Name | Description | 15393| --------------------- | ------------------------------------------------------------ | 15394| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15395 15396**Returns** 15397 15398Returns the height. 15399 15400 15401### OH_Drawing_TypographyGetIdeographicBaseline() 15402 15403``` 15404double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* ) 15405 15406``` 15407 15408**Description** 15409 15410Obtains the ideographic baseline in a typography object. 15411 15412**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15413 15414**Since**: 9 15415 15416**Parameters** 15417 15418| Name | Description | 15419| --------------------- | ------------------------------------------------------------ | 15420| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15421 15422**Returns** 15423 15424Returns the ideographic baseline. 15425 15426 15427### OH_Drawing_TypographyGetIndentsWithIndex() 15428 15429``` 15430float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int ) 15431 15432``` 15433 15434**Description** 15435 15436Obtains indents with a given index in a typography object. The line index starts from 0. 15437 15438**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15439 15440**Since**: 12 15441 15442**Parameters** 15443 15444| Name | Description | 15445| --------------------- | ------------------------------------------------------------ | 15446| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15447| int | Index. | 15448 15449**Returns** 15450 15451Returns the indents. 15452 15453 15454### OH_Drawing_TypographyGetLineCount() 15455 15456``` 15457size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* ) 15458 15459``` 15460 15461**Description** 15462 15463Obtains the number of lines in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15464 15465**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15466 15467**Since**: 11 15468 15469**Parameters** 15470 15471| Name | Description | 15472| --------------------- | ------------------------------------------------------------ | 15473| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15474 15475**Returns** 15476 15477Returns the number of lines. 15478 15479 15480### OH_Drawing_TypographyGetLineFontMetrics() 15481 15482``` 15483OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize ) 15484 15485``` 15486 15487**Description** 15488 15489Obtains all font metrics from a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. Otherwise, a null pointer is returned. When [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) is no longer required, call [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) to release the pointer to the object. 15490 15491**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15492 15493**Since**: 12 15494 15495**Parameters** 15496 15497| Name | Description | 15498| --------------------- | ------------------------------------------------------------ | 15499| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15500| 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. | 15501| fontMetricsSize | Pointer to the size of the struct. | 15502 15503**Returns** 15504 15505Returns all the font metrics. 15506 15507 15508### OH_Drawing_TypographyGetLineHeight() 15509 15510``` 15511double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int ) 15512 15513``` 15514 15515**Description** 15516 15517Obtains the line height in a typography object. This function must be called after [OH_Drawing_TypographyLayout](_drawing.md#oh_drawing_typographylayout) is called. 15518 15519**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15520 15521**Since**: 11 15522 15523**Parameters** 15524 15525| Name | Description | 15526| --------------------- | ------------------------------------------------------------ | 15527| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15528| int | Target line. | 15529 15530**Returns** 15531 15532Returns the height. 15533 15534 15535### OH_Drawing_TypographyGetLineInfo() 15536 15537``` 15538bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics* ) 15539 15540``` 15541 15542**Description** 15543 15544Obtains the metrics of a given line or the metrics of the first character in a given line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15545 15546**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15547 15548**Since**: 12 15549 15550**Parameters** 15551 15552| Name | Description | 15553| ---------------------- | ------------------------------------------------------------ | 15554| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15555| int | Row No. | 15556| 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. | 15557| bool | Whether whitespace characters are included in the text width. The value **true** means that whitespace characters are not included, **false** means the opposite. | 15558| 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). | 15559 15560**Returns** 15561 15562Returns **true** if the metrics of the given line or the metrics of the first character in the given line is obtained; returns **false** otherwise. 15563 15564 15565### OH_Drawing_TypographyGetLineMetrics() 15566 15567``` 15568OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* ) 15569 15570``` 15571 15572**Description** 15573 15574Obtains the line metrics in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) is no longer required, call [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) to release the pointer to the object. 15575 15576**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15577 15578**Since**: 12 15579 15580**Parameters** 15581 15582| Name | Description | 15583| --------------------- | ------------------------------------------------------------ | 15584| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15585 15586**Returns** 15587 15588Returns the pointer to the [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) object. 15589 15590 15591### OH_Drawing_TypographyGetLineMetricsAt() 15592 15593``` 15594bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics* ) 15595 15596``` 15597 15598**Description** 15599 15600Obtains the metrics of a given line in a typography object. For details, see [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md). This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15601 15602**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15603 15604**Since**: 12 15605 15606**Parameters** 15607 15608| Name | Description | 15609| ---------------------------------------------------------- | ------------------------------------------------------------ | 15610| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15611| int | Line No. | 15612| [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). | 15613 15614**Returns** 15615 15616Returns **true** if the metrics of the given line is obtained; returns **false** otherwise. 15617 15618 15619### OH_Drawing_TypographyGetLineTextRange() 15620 15621``` 15622OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool ) 15623 15624``` 15625 15626**Description** 15627 15628Obtains the line bounds in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. This function can only be used to obtain the bounds of existing lines. That is, the line index must start from 0, and the maximum index is [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) - 1. 15629 15630**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15631 15632**Since**: 12 15633 15634**Parameters** 15635 15636| Name | Description | 15637| --------------------- | ------------------------------------------------------------ | 15638| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15639| int | Line index. | 15640| bool | Whether the returned bounds contain spaces. The value **true** means that the bounds contain spaces, and **false** means the opposite. | 15641 15642**Returns** 15643 15644Returns the pointer to the [OH_Drawing_Range](#oh_drawing_range) object. 15645 15646 15647### OH_Drawing_TypographyGetLineWidth() 15648 15649``` 15650double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int ) 15651 15652``` 15653 15654**Description** 15655 15656Obtains the line width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15657 15658**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15659 15660**Since**: 11 15661 15662**Parameters** 15663 15664| Name | Description | 15665| --------------------- | ------------------------------------------------------------ | 15666| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15667| int | Target line. | 15668 15669**Returns** 15670 15671Returns the width. 15672 15673 15674### OH_Drawing_TypographyGetLongestLine() 15675 15676``` 15677double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* ) 15678 15679``` 15680 15681**Description** 15682 15683Obtains the width of the longest line in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. You are advised to round up the return value. If the text content is empty, **0.0** is returned. 15684 15685**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15686 15687**Since**: 9 15688 15689**Parameters** 15690 15691| Name | Description | 15692| --------------------- | ------------------------------------------------------------ | 15693| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15694 15695**Returns** 15696 15697Returns the width of the longest line. 15698 15699 15700### OH_Drawing_TypographyGetMaxIntrinsicWidth() 15701 15702``` 15703double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* ) 15704 15705``` 15706 15707**Description** 15708 15709Obtains the maximum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15710 15711**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15712 15713**Since**: 9 15714 15715**Parameters** 15716 15717| Name | Description | 15718| --------------------- | ------------------------------------------------------------ | 15719| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15720 15721**Returns** 15722 15723Returns the maximum intrinsic width. 15724 15725 15726### OH_Drawing_TypographyGetMaxWidth() 15727 15728``` 15729double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* ) 15730 15731``` 15732 15733**Description** 15734 15735Obtains the typography width set by the user. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15736 15737**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15738 15739**Since**: 9 15740 15741**Parameters** 15742 15743| Name | Description | 15744| --------------------- | ------------------------------------------------------------ | 15745| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15746 15747**Returns** 15748 15749Returns the typography width set by the user. 15750 15751 15752### OH_Drawing_TypographyGetMinIntrinsicWidth() 15753 15754``` 15755double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* ) 15756 15757``` 15758 15759**Description** 15760 15761Obtains the minimum intrinsic width in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. 15762 15763**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15764 15765**Since**: 9 15766 15767**Parameters** 15768 15769| Name | Description | 15770| --------------------- | ------------------------------------------------------------ | 15771| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15772 15773**Returns** 15774 15775Returns the minimum intrinsic width. 15776 15777 15778### OH_Drawing_TypographyGetRectsForPlaceholders() 15779 15780``` 15781OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* ) 15782 15783``` 15784 15785**Description** 15786 15787Obtains text boxes for placeholders in a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object. 15788 15789**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15790 15791**Since**: 11 15792 15793**Parameters** 15794 15795| Name | Description | 15796| --------------------- | ------------------------------------------------------------ | 15797| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15798 15799**Returns** 15800 15801Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes. 15802 15803### OH_Drawing_TypographyGetRectsForRange() 15804 15805``` 15806OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle ) 15807 15808``` 15809 15810**Description** 15811 15812Obtains text boxes in a given range of a typography object. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called. When [OH_Drawing_TextBox](#oh_drawing_textbox) is no longer required, call [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) to release the pointer to the object. 15813 15814**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15815 15816**Since**: 11 15817 15818**Parameters** 15819 15820| Name | Description | 15821| -------------------------- | ------------------------------------------------------------ | 15822| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15823| size_t | Start position. | 15824| size_t | End position. | 15825| OH_Drawing_RectHeightStyle | Height style. For details about the available options, see [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle). | 15826| OH_Drawing_RectWidthStyle | Width style. For details about the available options, see [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle). | 15827 15828**Returns** 15829 15830Returns the [OH_Drawing_TextBox](#oh_drawing_textbox) struct that holds the text boxes. 15831 15832 15833### OH_Drawing_TypographyGetTextAlign() 15834 15835``` 15836OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* ) 15837 15838``` 15839 15840**Description** 15841 15842Obtains the text alignment mode. 15843 15844**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15845 15846**Since**: 12 15847 15848**Parameters** 15849 15850| Name | Description | 15851| -------------------------- | ------------------------------------------------------------ | 15852| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15853 15854**Returns** 15855 15856Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign). 15857 15858 15859### OH_Drawing_TypographyGetTextDirection() 15860 15861``` 15862OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* ) 15863 15864``` 15865 15866**Description** 15867 15868Obtains the text direction of a typography style. 15869 15870**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15871 15872**Since**: 12 15873 15874**Parameters** 15875 15876| Name | Description | 15877| -------------------------- | ------------------------------------------------------------ | 15878| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15879 15880**Returns** 15881 15882Returns the text direction. For details, see the [OH_Drawing_TextDirection](#oh_drawing_textdirection). 15883 15884 15885### OH_Drawing_TypographyGetTextEllipsis() 15886 15887``` 15888char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* ) 15889 15890``` 15891 15892**Description** 15893 15894Obtains the text ellipsis content of a typography style. 15895 15896**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15897 15898**Since**: 12 15899 15900**Parameters** 15901 15902| Name | Description | 15903| -------------------------- | ------------------------------------------------------------ | 15904| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15905 15906**Returns** 15907 15908Returns the pointer to the text ellipsis content obtained. 15909 15910 15911### OH_Drawing_TypographyGetTextMaxLines() 15912 15913``` 15914size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* ) 15915 15916``` 15917 15918**Description** 15919 15920Obtains the maximum number of lines. 15921 15922**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15923 15924**Since**: 12 15925 15926**Parameters** 15927 15928| Name | Description | 15929| -------------------------- | ------------------------------------------------------------ | 15930| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15931 15932**Returns** 15933 15934Returns the maximum number of lines. 15935 15936 15937### OH_Drawing_TypographyGetTextStyle() 15938 15939``` 15940OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style) 15941``` 15942 15943**Description** 15944 15945Obtains the default text style of a typography style. 15946 15947**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15948 15949**Since**: 12 15950 15951**Parameters** 15952 15953| Name | Description | 15954| -------------------------- | ------------------------------------------------------------ | 15955| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 15956 15957**Returns** 15958 15959Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object. 15960 15961 15962### OH_Drawing_TypographyGetUnresolvedGlyphsCount() 15963 15964``` 15965int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* ) 15966``` 15967 15968**Description** 15969 15970Obtains the number of unresolved glyphs in a typography object. This function can be called only after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied. 15971 15972**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15973 15974**Since**: 12 15975 15976**Parameters** 15977 15978| Name | Description | 15979| --------------------- | ------------------------------------------------------------ | 15980| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 15981 15982**Returns** 15983 15984Returns the number of unresolved glyphs. 15985 15986 15987### OH_Drawing_TypographyGetWordBoundary() 15988 15989``` 15990OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t ) 15991``` 15992 15993**Description** 15994 15995Obtains the word boundary in a typography object. 15996 15997**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 15998 15999**Since**: 11 16000 16001**Parameters** 16002 16003| Name | Description | 16004| --------------------- | ------------------------------------------------------------ | 16005| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16006| size_t | Index of the word. | 16007 16008**Returns** 16009 16010Returns the [OH_Drawing_Range](#oh_drawing_range) struct that holds the word boundary. 16011 16012 16013### OH_Drawing_TypographyHandlerAddPlaceholder() 16014 16015``` 16016void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan* ) 16017 16018``` 16019 16020**Description** 16021 16022Adds a placeholder. 16023 16024**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16025 16026**Since**: 11 16027 16028**Parameters** 16029 16030| Name | Description | 16031| --------------------------- | ------------------------------------------------------------ | 16032| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 16033| OH_Drawing_PlaceholderSpan | Pointer to an [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) object. | 16034 16035 16036### OH_Drawing_TypographyHandlerAddSymbol() 16037 16038``` 16039void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol ) 16040 16041``` 16042 16043**Description** 16044 16045Adds the symbol to use in the typography creation process. 16046 16047**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16048 16049**Since**: 12 16050 16051**Parameters** 16052 16053| Name | Description | 16054| --------------------------- | ------------------------------------------------------------ | 16055| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 16056| 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) | 16057 16058 16059### OH_Drawing_TypographyHandlerAddText() 16060 16061``` 16062void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char* ) 16063 16064``` 16065 16066**Description** 16067 16068Sets the text content. 16069 16070**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16071 16072**Since**: 8 16073 16074**Parameters** 16075 16076| Name | Description | 16077| --------------------------- | ------------------------------------------------------------ | 16078| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 16079| char | Pointer to the text content. | 16080 16081 16082### OH_Drawing_TypographyHandlerPopTextStyle() 16083 16084``` 16085void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* ) 16086 16087``` 16088 16089**Description** 16090 16091Removes the topmost style in the stack, leaving the remaining styles in effect. 16092 16093**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16094 16095**Since**: 8 16096 16097**Parameters** 16098 16099| Name | Description | 16100| --------------------------- | ------------------------------------------------------------ | 16101| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 16102 16103 16104### OH_Drawing_TypographyHandlerPushTextStyle() 16105 16106``` 16107void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle* ) 16108 16109``` 16110 16111**Description** 16112 16113Sets the text style. 16114 16115**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16116 16117**Since**: 8 16118 16119**Parameters** 16120 16121| Name | Description | 16122| --------------------------- | ------------------------------------------------------------ | 16123| OH_Drawing_TypographyCreate | Pointer to an [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) object. The pointer is obtained by calling [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler). | 16124| OH_Drawing_TextStyle | Pointer to an [OH_Drawing_TextStyle](#oh_drawing_textstyle) object, which is obtained by calling [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle). | 16125 16126 16127### OH_Drawing_TypographyIsEllipsized() 16128 16129``` 16130bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style) 16131 16132``` 16133 16134**Description** 16135 16136Checks whether an ellipsis is configured for a typography style. 16137 16138**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16139 16140**Since**: 12 16141 16142**Parameters** 16143 16144| Name | Description | 16145| -------------------------- | ------------------------------------------------------------ | 16146| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16147 16148**Returns** 16149 16150Returns **true** if the text has an ellipsis; returns **false** otherwise. 16151 16152 16153### OH_Drawing_TypographyIsLineUnlimited() 16154 16155``` 16156bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style) 16157 16158``` 16159 16160**Description** 16161 16162Checks whether the maximum number of lines is limited for text. 16163 16164**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16165 16166**Since**: 12 16167 16168**Parameters** 16169 16170| Name | Description | 16171| -------------------------- | ------------------------------------------------------------ | 16172| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16173 16174**Returns** 16175 16176Returns **true** if that the maximum number of lines is limited; returns **false** otherwise. 16177 16178 16179### OH_Drawing_TypographyLayout() 16180 16181``` 16182void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double ) 16183 16184``` 16185 16186**Description** 16187 16188Lays out the typography. 16189 16190**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16191 16192**Since**: 8 16193 16194**Parameters** 16195 16196| Name | Description | 16197| --------------------- | ------------------------------------------------------------ | 16198| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16199| double | Maximum text width. | 16200 16201 16202### OH_Drawing_TypographyMarkDirty() 16203 16204``` 16205void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* ) 16206 16207``` 16208 16209**Description** 16210 16211Marks a typography object as dirty data. This function is used to initialize the typography state. 16212 16213**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16214 16215**Since**: 12 16216 16217**Parameters** 16218 16219| Name | Description | 16220| --------------------- | ------------------------------------------------------------ | 16221| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16222 16223 16224### OH_Drawing_TypographyPaint() 16225 16226``` 16227void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double ) 16228 16229``` 16230 16231**Description** 16232 16233Draws text from the upper left corner at a specified position. This function must be called after [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) is called and applied. 16234 16235**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16236 16237**Since**: 8 16238 16239**Parameters** 16240 16241| Name | Description | 16242| --------------------- | ------------------------------------------------------------ | 16243| OH_Drawing_Typography | Pointer to an **OH_Drawing_Typography** object, which is obtained by [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16244| OH_Drawing_Canvas | Pointer to an **OH_Drawing_Canvas** object, which is obtained by calling **OH_Drawing_CanvasCreate()**. | 16245| double | X coordinate. | 16246| double | Y coordinate. | 16247 16248 16249### OH_Drawing_TypographySetIndents() 16250 16251``` 16252void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] ) 16253 16254``` 16255 16256**Description** 16257 16258Sets indents for typography. If this function is not called, texts will have no indentation applied. 16259 16260**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16261 16262**Since**: 12 16263 16264**Parameters** 16265 16266| Name | Description | 16267| --------------------- | ------------------------------------------------------------ | 16268| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16269| int | Number of indents. The value must be less than or equal to the length of the indents array to avoid display exceptions caused by access to the out-of-bounds array. | 16270| float | Pointer to a floating-point array, in which each element indicates an indentation width, in px. Before using [OH_Drawing_Typography](#oh_drawing_typography), you must declare and initialize the floating-point array. | 16271 16272 16273### OH_Drawing_TypographyStyleDestroyStrutStyle() 16274 16275``` 16276void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* ) 16277 16278``` 16279 16280**Description** 16281 16282Reclaims the memory occupied by a strut style. 16283 16284**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16285 16286**Since**: 12 16287 16288**Parameters** 16289 16290| Name | Description | 16291| -------------------------------------------------------- | ------------------------------------------------------------ | 16292| [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). | 16293 16294 16295### OH_Drawing_TypographyStyleEquals() 16296 16297``` 16298bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to ) 16299 16300``` 16301 16302**Description** 16303 16304Checks whether two typography styles are the same. The text height modifier mode [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) is not involved in the comparison. 16305 16306**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16307 16308**Since**: 12 16309 16310**Parameters** 16311 16312| Name | Description | 16313| ---- | --------------------------------------- | 16314| from | Pointer to the first typography style. | 16315| to | Pointer to the second typography style. | 16316 16317**Returns** 16318 16319Returns **true** if the two are the same; returns **false** otherwise. 16320 16321 16322### OH_Drawing_TypographyStyleGetEffectiveAlignment() 16323 16324``` 16325OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 16326 16327``` 16328 16329**Description** 16330 16331Obtains the text alignment mode. 16332 16333**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16334 16335**Since**: 12 16336 16337**Parameters** 16338 16339| Name | Description | 16340| -------------------------- | ------------------------------------------------------------ | 16341| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16342 16343**Returns** 16344 16345Returns the text alignment mode. For details about the available options, see [OH_Drawing_TextAlign](#oh_drawing_textalign). 16346 16347 16348### OH_Drawing_TypographyStyleGetFontStyleStruct() 16349 16350``` 16351OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle) 16352 16353``` 16354 16355**Description** 16356 16357Obtains the font style, including the font weight, width, and slant, of the default text style of a typography style. 16358 16359**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16360 16361**Since**: 12 16362 16363**Parameters** 16364 16365| Name | Description | 16366| -------------------------- | ------------------------------------------------------------ | 16367| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16368 16369**Returns** 16370 16371Returns the font style, including the font weight, width, and slant. 16372 16373 16374### OH_Drawing_TypographyStyleGetStrutStyle() 16375 16376``` 16377OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* ) 16378``` 16379 16380**Description** 16381 16382Obtains the strut style of a typography style. 16383 16384**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16385 16386**Since**: 12 16387 16388**Parameters** 16389 16390| Name | Description | 16391| -------------------------- | ------------------------------------------------------------ | 16392| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16393 16394**Returns** 16395 16396Returns the pointer to the strut style, which is an [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) object. 16397 16398 16399### OH_Drawing_TypographyStyleIsHintEnabled() 16400 16401``` 16402bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style) 16403``` 16404 16405**Description** 16406 16407Checks 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. 16408 16409**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16410 16411**Since**: 12 16412 16413**Parameters** 16414 16415| Name | Description | 16416| -------------------------- | ------------------------------------------------------------ | 16417| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16418 16419**Returns** 16420 16421Returns **true** if font hinting is enabled; returns **false** otherwise. 16422 16423 16424### OH_Drawing_TypographyStyleSetHintsEnabled() 16425 16426``` 16427void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled ) 16428``` 16429 16430**Description** 16431 16432Sets 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. 16433 16434**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16435 16436**Since**: 12 16437 16438**Parameters** 16439 16440| Name | Description | 16441| -------------------------- | ------------------------------------------------------------ | 16442| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16443| hintsEnabled | Whether to enable font hinting. The value **true** means to enable font hinting, and **false** means the opposite. | 16444 16445 16446### OH_Drawing_TypographyStyleStrutStyleEquals() 16447 16448``` 16449bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to ) 16450``` 16451 16452**Description** 16453 16454Checks whether two strut styles are equal. 16455 16456**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16457 16458**Since**: 12 16459 16460**Parameters** 16461 16462| Name | Description | 16463| ---- | ---------------------------------- | 16464| from | Pointer to the first strut style. | 16465| to | Pointer to the second strut style. | 16466 16467**Returns** 16468 16469Returns **true** if the two strut styles are the same; returns **false** otherwise. 16470 16471### OH_Drawing_TypographyTextGetHeightBehavior() 16472 16473``` 16474OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* ) 16475``` 16476 16477**Description** 16478 16479Obtains the text height modifier pattern. 16480 16481**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16482 16483**Since**: 12 16484 16485**Parameters** 16486 16487| Name | Description | 16488| -------------------------- | ------------------------------------------------------------ | 16489| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16490 16491**Returns** 16492 16493Returns the text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior). 16494 16495 16496### OH_Drawing_TypographyTextGetLineStyle() 16497 16498``` 16499bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* ) 16500``` 16501 16502**Description** 16503 16504Checks whether the text line style is enabled for a typography style. 16505 16506**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16507 16508**Since**: 12 16509 16510**Parameters** 16511 16512| Name | Description | 16513| -------------------------- | ------------------------------------------------------------ | 16514| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16515 16516**Returns** 16517 16518Returns **true** if the text line style is enabled; returns **false** otherwise. 16519 16520 16521### OH_Drawing_TypographyTextlineGetStyleOnly() 16522 16523``` 16524bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* ) 16525``` 16526 16527**Description** 16528 16529Checks whether only the text line style is enabled for a typography style. 16530 16531**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16532 16533**Since**: 12 16534 16535**Parameters** 16536 16537| Name | Description | 16538| -------------------------- | ------------------------------------------------------------ | 16539| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16540 16541**Returns** 16542 16543Returns **true** if only the text line style is enabled; returns **false** otherwise. 16544 16545 16546### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies() 16547 16548``` 16549void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum ) 16550``` 16551 16552**Description** 16553 16554Reclaims the memory occupied by the font families. 16555 16556**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16557 16558**Since**: 12 16559 16560**Parameters** 16561 16562| Name | Description | 16563| --------------- | ------------------------------------ | 16564| fontFamilies | Double pointer to the font families. | 16565| fontFamiliesNum | Number of font families. | 16566 16567 16568### OH_Drawing_TypographyTextlineStyleGetFontFamilies() 16569 16570``` 16571char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* ) 16572``` 16573 16574**Description** 16575 16576Obtains the font families of a text line style. 16577 16578**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16579 16580**Since**: 12 16581 16582**Parameters** 16583 16584| Name | Description | 16585| -------------------------- | ------------------------------------------------------------ | 16586| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16587 16588**Returns** 16589 16590Returns the font families. 16591 16592 16593### OH_Drawing_TypographyTextlineStyleGetFontSize() 16594 16595``` 16596double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* ) 16597``` 16598 16599**Description** 16600 16601Obtains the font size of a text line style. 16602 16603**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16604 16605**Since**: 12 16606 16607**Parameters** 16608 16609| Name | Description | 16610| -------------------------- | ------------------------------------------------------------ | 16611| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16612 16613**Returns** 16614 16615Returns the font size. 16616 16617 16618### OH_Drawing_TypographyTextlineStyleGetFontStyle() 16619 16620``` 16621OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* ) 16622``` 16623 16624**Description** 16625 16626Obtains the font style of the strut style in the typography style. 16627 16628**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16629 16630**Since**: 12 16631 16632**Parameters** 16633 16634| Name | Description | 16635| -------------------------- | ------------------------------------------------------------ | 16636| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16637 16638**Returns** 16639 16640Obtains the font style of the strut style in the typography style. For details about the available options, see [OH_Drawing_FontStyle](#oh_drawing_fontstyle). 16641 16642 16643### OH_Drawing_TypographyTextlineStyleGetFontWeight() 16644 16645``` 16646OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle* ) 16647``` 16648 16649**Description** 16650 16651Obtains the font weight of the strut style in a typography style. 16652 16653**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16654 16655**Since**: 12 16656 16657**Parameters** 16658 16659| Name | Description | 16660| -------------------------- | ------------------------------------------------------------ | 16661| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16662 16663**Returns** 16664 16665Returns the font weight. For details about the available options, see [OH_Drawing_FontWeight](#oh_drawing_fontweight). 16666 16667 16668### OH_Drawing_TypographyTextlineStyleGetHalfLeading() 16669 16670``` 16671bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* ) 16672``` 16673 16674**Description** 16675 16676Checks whether half leading is enabled for a text line style. 16677 16678**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16679 16680**Since**: 12 16681 16682**Parameters** 16683 16684| Name | Description | 16685| -------------------------- | ------------------------------------------------------------ | 16686| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16687 16688**Returns** 16689 16690Returns **true** if half leading is enabled; returns **false** otherwise. 16691 16692 16693### OH_Drawing_TypographyTextlineStyleGetHeightOnly() 16694 16695``` 16696bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* ) 16697``` 16698 16699**Description** 16700 16701Checks whether only the font height is used for a text line style. 16702 16703**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16704 16705**Since**: 12 16706 16707**Parameters** 16708 16709| Name | Description | 16710| -------------------------- | ------------------------------------------------------------ | 16711| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16712 16713**Returns** 16714 16715Returns **true** if only the font height is used; returns false otherwise. 16716 16717 16718### OH_Drawing_TypographyTextlineStyleGetHeightScale() 16719 16720``` 16721double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* ) 16722``` 16723 16724**Description** 16725 16726Obtains the height scale factor of a text line style. 16727 16728**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16729 16730**Since**: 12 16731 16732**Parameters** 16733 16734| Name | Description | 16735| -------------------------- | ------------------------------------------------------------ | 16736| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16737 16738**Returns** 16739 16740Returns the height scale factor of a text line style. 16741 16742 16743### OH_Drawing_TypographyTextlineStyleGetSpacingScale() 16744 16745``` 16746double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* ) 16747``` 16748 16749**Description** 16750 16751Obtains the spacing scale factor of a text line style. 16752 16753**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16754 16755**Since**: 12 16756 16757**Parameters** 16758 16759| Name | Description | 16760| -------------------------- | ------------------------------------------------------------ | 16761| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16762 16763**Returns** 16764 16765Returns the spacing scale factor. 16766 16767 16768### OH_Drawing_TypographyTextSetHeightBehavior() 16769 16770``` 16771void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode ) 16772``` 16773 16774**Description** 16775 16776Sets a text height modifier pattern. 16777 16778**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16779 16780**Since**: 12 16781 16782**Parameters** 16783 16784| Name | Description | 16785| -------------------------- | ------------------------------------------------------------ | 16786| OH_Drawing_TypographyStyle | Pointer to an [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) object, which is obtained by calling [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle). | 16787| heightMode | Text height modifier pattern. For details about the available options, see [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior). | 16788 16789 16790### OH_Drawing_TypographyUpdateFontSize() 16791 16792``` 16793void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize ) 16794``` 16795 16796**Description** 16797 16798Updates the font size in a typography object. 16799 16800**System capability**: SystemCapability.Graphic.Graphic2D.NativeDrawing 16801 16802**Since**: 12 16803 16804**Parameters** 16805 16806| Name | Description | 16807| --------------------- | ------------------------------------------------------------ | 16808| OH_Drawing_Typography | Pointer to an [OH_Drawing_Typography](#oh_drawing_typography) object, which is obtained by calling [OH_Drawing_CreateTypography](#oh_drawing_createtypography). | 16809| from | Reserved field, which is not used. | 16810| to | Reserved field, which is not used. | 16811| fontSize | New font size. |