1# Drawing 2 3 4## 概述 5 6Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 本模块采用屏幕物理像素单位px。本模块为单线程模型策略,需要调用方自行管理线程安全和上下文状态的切换。 7 8**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9 10**起始版本:** 8 11 12 13## 汇总 14 15 16### 文件 17 18| 名称 | 描述 | 19| -------- | -------- | 20| [drawing_bitmap.h](drawing__bitmap_8h.md) | 文件中定义了与位图相关的功能函数 | 21| [drawing_brush.h](drawing__brush_8h.md) | 文件中定义了与画刷相关的功能函数。 | 22| [drawing_canvas.h](drawing__canvas_8h.md) | 文件中定义了与画布相关的功能函数。画布自带一个黑色,开启抗锯齿,不具备其他任何样式的默认画刷,当且仅当画布中主动设置的画刷和画笔都不存在时生效。非录制类型画布会将绘制指令直接绘制到绑定的位图中,录制类型画布会将绘制指令录制下来用于后续的回放。 | 23| [drawing_color.h](drawing__color_8h.md) | 文件中定义了与颜色相关的功能函数。 | 24| [drawing_color_filter.h](drawing__color__filter_8h.md) | 声明与绘图模块中的颜色滤波器对象相关的函数。 | 25| [drawing_error_code.h](drawing__error__code_8h.md) | 声明与绘图模块中的错误码相关的函数。 | 26| [drawing_color_space.h](drawing__color__space_8h.md) | 文件中定义了与颜色空间相关的功能函数。 | 27| [drawing_filter.h](drawing__filter_8h.md) | 声明与绘图模块中的滤波器对象相关的函数。 | 28| [drawing_font.h](drawing__font_8h.md) | 文件中定义了与字体相关的功能函数。 | 29| [drawing_font_collection.h](drawing__font__collection_8h.md) | 定义绘制模块中与字体集合相关的函数。 | 30| [drawing_font_mgr.h](drawing__font__mgr_8h.md) | 文件中定义了与字体管理相关的功能函数,用于加载和匹配系统中可用的字体。 | 31| [drawing_gpu_context.h](drawing__gpu__context_8h.md) | 声明与绘图模块中的图形处理器上下文对象相关的函数。 | 32| [drawing_image.h](drawing__image_8h.md) | 文件中定义了与图片相关的功能函数。 | 33| [drawing_image_filter.h](drawing__image__filter_8h.md) | 声明与绘图模块中的图像滤波器对象相关的函数。 | 34| [drawing_mask_filter.h](drawing__mask__filter_8h.md) | 声明与绘图模块中的对象相关的函数。 | 35| [drawing_matrix.h](drawing__matrix_8h.md) | 文件中定义了与矩阵相关的功能函数。 | 36| [drawing_memory_stream.h](drawing__memory__stream_8h.md) | 文件中定义了与内存流相关的功能函数。 | 37| [drawing_path.h](drawing__path_8h.md) | 文件中定义了与自定义路径相关的功能函数 | 38| [drawing_path_effect.h](drawing__path__effect_8h.md) | 文件中定义了与路径效果相关的功能函数。 | 39| [drawing_pen.h](drawing__pen_8h.md) | 文件中定义了与画笔相关的功能函数。 | 40| [drawing_pixel_map.h](drawing__pixel__map_8h.md) | 声明与绘图模块中的像素图对象相关的函数。 | 41| [drawing_point.h](drawing__point_8h.md) | 文件中定义了与坐标点相关的功能函数。 | 42| [drawing_record_cmd.h](drawing__record__cmd_8h.md) | 文件中定义了与录制指令对象相关的功能函数。 | 43| [drawing_rect.h](drawing__rect_8h.md) | 文件中定义了与矩形相关的功能函数。 | 44| [drawing_region.h](drawing__region_8h.md) | 定义了与区域相关的功能函数,包括区域的创建,边界设置和销毁等。 | 45| [drawing_register_font.h](drawing__register__font_8h.md) | 定义绘制模块中字体管理器相关的函数。 | 46| [drawing_round_rect.h](drawing__round__rect_8h.md) | 文件中定义了与圆角矩形相关的功能函数。 | 47| [drawing_sampling_options.h](drawing__sampling__options_8h.md) | 文件中定义了与采样相关的功能函数。用于图片或者纹理等图像的采样。 | 48| [drawing_shader_effect.h](drawing__shader__effect_8h.md) | 声明与绘图模块中的着色器对象相关的函数。 | 49| [drawing_shadow_layer.h](drawing__shadow__layer_8h.md) | 声明与绘图模块中的阴影层对象相关的函数。 | 50| [drawing_surface.h](drawing__surface_8h.md) | 文件中定义与surface相关的功能函数,包括surface的创建、销毁和使用等。 | 51| [drawing_text_blob.h](drawing__text__blob_8h.md) | 文件中定义了与文字相关的功能函数。 | 52| [drawing_text_declaration.h](drawing__text__declaration_8h.md) | 提供2d 绘制文本相关的数据结构声明 | 53| [drawing_text_font_descriptor.h](drawing__text__font__descriptor_8h.md) | 定义了字体信息的相关接口,比如获取字体信息,查找指定字体等。 | 54| [drawing_text_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数。 | 55| [drawing_typeface.h](drawing__typeface_8h.md) | 文件中定义了与字形相关的功能函数。 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 | 56| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 | 57 58 59### 结构体 60 61| 名称 | 描述 | 62| -------- | -------- | 63| struct [OH_Drawing_String](_o_h___drawing___string.md) | 采用UTF-16编码的字符串信息结构体。 | 64| struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | 65| struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 定义字体度量信息的结构体。 | 66| struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | 定义有关图形处理器上下文的选项。 | 67| struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | 结构体用于描述一块内存,描述文字和位置信息。 | 68| struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 用于描述位占位符跨度的结构体 | 69| struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 描述系统字体详细信息的结构体。 | 70| struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 文字行位置信息。 | 71| struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | 备用字体信息结构体。 | 72| struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | 备用字体集信息结构体。 | 73| struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | 字重映射信息结构体。 | 74| struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | 别名字体信息结构体。 | 75| struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | 系统所支持的通用字体集信息结构体。 | 76| struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | 系统字体配置信息结构体。 | 77| struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 定义字体样式信息的结构体。 | 78| struct [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 描述文本字体特征结构体。 | 79| struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 | 80| struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 定义一个二维的坐标点。 | 81| struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | 定义一个三维的坐标点。 | 82| struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 定义图片信息结构体。 | 83| struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 定义矩形框样式结构体。 | 84 85 86### 类型定义 87 88| 名称 | 描述 | 89| -------- | -------- | 90| typedef struct [OH_Drawing_String](_o_h___drawing___string.md) [OH_Drawing_String](#oh_drawing_string) | 采用UTF-16编码的字符串信息结构体。 | 91| typedef enum [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype) | 字体类型的枚举。 | 92| typedef struct [OH_Drawing_Array](#oh_drawing_array) [OH_Drawing_Array](#oh_drawing_array) | 定义数组对象, 用于存储多个同类型对象。 | 93| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | 用于描述字型参数。 | 94| typedef struct [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) | 定义指令录制工具,用于生成录制指令。 | 95| typedef struct [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) | 定义录制指令类, 用于存储录制指令的集合。 | 96| typedef enum [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCode](#oh_drawing_errorcode) | 枚举本模块可能产生的错误码。 | 97| typedef enum [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | 路径操作类型枚举。 | 98| typedef enum [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | 路径测量获取相应矩阵信息维度枚举。 | 99| typedef enum [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) | 区域操作类型枚举。 | 100| typedef struct [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) | 定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 | 101| typedef struct [OH_Drawing_Filter](#oh_drawing_filter) [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器,模板滤波器和图像滤波器。 | 102| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | 103| typedef enum [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) | 源矩形区域约束类型枚举。 | 104| typedef enum [OH_Drawing_PointMode](#oh_drawing_pointmode) [OH_Drawing_PointMode](#oh_drawing_pointmode) | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 | 105| typedef enum [OH_Drawing_VertexMode](#oh_drawing_vertexmode) [OH_Drawing_VertexMode](#oh_drawing_vertexmode) | 用于指定如何解释给定顶点的几何形状的枚举类型。 | 106| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | 画布裁剪方式的枚举集合。 | 107| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontEdging](#oh_drawing_fontedging) | 字形边缘效果类型枚举。 | 108| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | 字形轮廓效果类型枚举。 | 109| typedef struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) [OH_Drawing_Font_Metrics](#oh_drawing_font_metrics) | 定义字体度量信息的结构体。 | 110| typedef struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) [OH_Drawing_GpuContextOptions](#oh_drawing_gpucontextoptions) | 定义有关图形处理器上下文的选项。 | 111| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype) [OH_Drawing_BlurType](#oh_drawing_blurtype) | 蒙版滤波器模糊操作类型的枚举。 | 112| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | 矩阵缩放方式枚举。 | 113| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection) [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | 添加闭合轮廓方向枚举。 | 114| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | 定义路径的填充类型枚举。 | 115| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | 用于指定路径添加模式的枚举类型。 | 116| typedef enum [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 | 117| typedef enum [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 | 118| typedef enum [OH_Drawing_CornerPos](#oh_drawing_cornerpos) [OH_Drawing_CornerPos](#oh_drawing_cornerpos) | 用于描述圆角位置的枚举。 | 119| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode) [OH_Drawing_FilterMode](#oh_drawing_filtermode) | 过滤模式枚举。 | 120| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | 多级渐远纹理模式枚举。 | 121| typedef enum [OH_Drawing_TileMode](#oh_drawing_tilemode) [OH_Drawing_TileMode](#oh_drawing_tilemode) | 着色器效果平铺模式的枚举。 | 122| typedef struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) [OH_Drawing_RunBuffer](#oh_drawing_runbuffer) | 结构体用于描述一块内存,描述文字和位置信息。 | 123| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection) [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | 用于加载字体。 | 124| typedef struct [OH_Drawing_Typography](#oh_drawing_typography) [OH_Drawing_Typography](#oh_drawing_typography) | 用于管理排版的布局和显示等。 | 125| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle) [OH_Drawing_TextStyle](#oh_drawing_textstyle) | 用于管理字体颜色、装饰等。 | 126| typedef struct [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | 用于管理排版风格,如文字方向等。 | 127| typedef struct [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | 用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 | 128| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox) [OH_Drawing_TextBox](#oh_drawing_textbox) | 用于接收文本框的矩形大小、方向和数量大小 | 129| typedef struct [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | 用于接收字体的位置和亲和性 | 130| typedef struct [OH_Drawing_Range](#oh_drawing_range) [OH_Drawing_Range](#oh_drawing_range) | 用于接收字体的起始位置和结束位置 | 131| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow) [OH_Drawing_TextShadow](#oh_drawing_textshadow) | 用于管理文本阴影。 | 132| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser) [OH_Drawing_FontParser](#oh_drawing_fontparser) | 用来解析系统字体文件。 | 133| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | 占位符垂直对齐枚举 | 134| typedef struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) [OH_Drawing_PlaceholderSpan](#oh_drawing_placeholderspan) | 用于描述位占位符跨度的结构体 | 135| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | 文本装饰样式枚举 | 136| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | 省略号样式枚举 | 137| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | 文本的中断策略枚举 | 138| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | 单词的断词方式枚举 | 139| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | 矩形框高度样式枚举 | 140| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | 矩形框宽度样式枚举 | 141| typedef struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) [OH_Drawing_FontDescriptor](#oh_drawing_fontdescriptor) | 描述系统字体详细信息的结构体。 | 142| typedef struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) [OH_Drawing_LineMetrics](#oh_drawing_linemetrics) | 文字行位置信息。 | 143| typedef struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) [OH_Drawing_FontFallbackInfo](#oh_drawing_fontfallbackinfo) | 备用字体信息结构体。 | 144| typedef struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) [OH_Drawing_FontFallbackGroup](#oh_drawing_fontfallbackgroup) | 备用字体集信息结构体。 | 145| typedef struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) [OH_Drawing_FontAdjustInfo](#oh_drawing_fontadjustinfo) | 字重映射信息结构体。 | 146| typedef struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) [OH_Drawing_FontAliasInfo](#oh_drawing_fontaliasinfo) | 别名字体信息结构体。 | 147| typedef struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) [OH_Drawing_FontGenericInfo](#oh_drawing_fontgenericinfo) | 系统所支持的通用字体集信息结构体。 | 148| typedef struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) [OH_Drawing_FontConfigInfo](#oh_drawing_fontconfiginfo) | 系统字体配置信息结构体。 | 149| typedef struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_FontStyleStruct](#oh_drawing_fontstylestruct) | 定义字体样式信息的结构体。 | 150| typedef struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) [OH_Drawing_StrutStyle](#oh_drawing_strutstyle) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 | 151| typedef struct [OH_Drawing_Canvas](#oh_drawing_canvas) [OH_Drawing_Canvas](#oh_drawing_canvas) | 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 | 152| typedef struct [OH_Drawing_Pen](#oh_drawing_pen) [OH_Drawing_Pen](#oh_drawing_pen) | 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 | 153| typedef struct [OH_Drawing_Region](#oh_drawing_region) [OH_Drawing_Region](#oh_drawing_region) | 定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 | 154| typedef struct [OH_Drawing_Brush](#oh_drawing_brush) [OH_Drawing_Brush](#oh_drawing_brush) | 定义为画刷,画刷用于描述填充图形的样式和颜色。 | 155| typedef struct [OH_Drawing_Path](#oh_drawing_path) [OH_Drawing_Path](#oh_drawing_path) | 定义为路径,路径用于自定义各种形状。 | 156| typedef struct [OH_Drawing_PixelMap](#oh_drawing_pixelmap) [OH_Drawing_PixelMap](#oh_drawing_pixelmap) | 定义像素图,用于包装图像框架支持的真实像素图。 | 157| typedef struct [OH_Drawing_Bitmap](#oh_drawing_bitmap) [OH_Drawing_Bitmap](#oh_drawing_bitmap) | 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 | 158| typedef struct [OH_Drawing_Point](#oh_drawing_point) [OH_Drawing_Point](#oh_drawing_point) | 定义一个点,用于描述坐标点。 | 159| typedef struct [OH_Drawing_ColorSpace](#oh_drawing_colorspace) [OH_Drawing_ColorSpace](#oh_drawing_colorspace) | 定义色彩空间,用于解释颜色信息。 | 160| typedef struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) [OH_Drawing_Point2D](#oh_drawing_point2d) | 定义一个二维的坐标点。 | 161| typedef [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) | 定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 | 162| typedef struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) [OH_Drawing_Point3D](#oh_drawing_point3d) | 定义一个三维的坐标点。 | 163| typedef struct [OH_Drawing_PathEffect](#oh_drawing_patheffect) [OH_Drawing_PathEffect](#oh_drawing_patheffect) | 定义一个路径效果,用于影响描边路径。 | 164| typedef struct [OH_Drawing_Rect](#oh_drawing_rect) [OH_Drawing_Rect](#oh_drawing_rect) | 用于描述矩形。 | 165| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect) [OH_Drawing_RoundRect](#oh_drawing_roundrect) | 用于描述圆角矩形。 | 166| typedef struct [OH_Drawing_Matrix](#oh_drawing_matrix) [OH_Drawing_Matrix](#oh_drawing_matrix) | 定义一个矩阵,用于描述坐标变换。 | 167| typedef struct [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | 定义一个着色器,用于描述绘制内容的源颜色。 | 168| typedef struct [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) | 定义一个阴影层,用于描述绘制内容的阴影层。 | 169| typedef struct [OH_Drawing_Filter](#oh_drawing_filter) [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器和模板滤波器。 | 170| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | 定义模板滤波器,用于在绘制模板前对其进行转换。 | 171| typedef struct [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 | 172| typedef struct [OH_Drawing_Font](#oh_drawing_font) [OH_Drawing_Font](#oh_drawing_font) | 用于描述字体。 | 173| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream) [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | 用于描述内存流。 | 174| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface) [OH_Drawing_Typeface](#oh_drawing_typeface) | 用于描述字形。 | 175| typedef struct [OH_Drawing_TextBlob](#oh_drawing_textblob) [OH_Drawing_TextBlob](#oh_drawing_textblob) | 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 | 176| typedef struct [OH_Drawing_Image](#oh_drawing_image) [OH_Drawing_Image](#oh_drawing_image) | 定义一个用于描述绘制二维像素数组的图片。 | 177| typedef struct [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) | 定义一个采样选项,用于描述图片、位图等图像的采样方法。 | 178| typedef struct [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | 定义文本构建器,用于构建文本。 | 179| typedef struct [OH_Drawing_GpuContext](#oh_drawing_gpucontext) [OH_Drawing_GpuContext](#oh_drawing_gpucontext) | 定义图形处理器上下文,用于描述图形处理器后端上下文。 | 180| typedef struct [OH_Drawing_Surface](#oh_drawing_surface) [OH_Drawing_Surface](#oh_drawing_surface) | 定义surface,用于管理画布绘制的内容。 | 181| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | 用于描述位图像素的存储格式。 | 182| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | 用于描述位图像素的透明度分量。 | 183| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode) [OH_Drawing_BlendMode](#oh_drawing_blendmode) | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 | 184| typedef struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) [OH_Drawing_Image_Info](#oh_drawing_image_info) | 定义图片信息结构体。 | 185| typedef struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) [OH_Drawing_RectStyle_Info](#oh_drawing_rectstyle_info) | 定义矩形框样式结构体。 | 186| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding) [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | 文本编码类型枚举。 | 187| typedef struct [OH_Drawing_FontMgr](#oh_drawing_fontmgr) [OH_Drawing_FontMgr](#oh_drawing_fontmgr) | 定义字体管理类, 用于字体管理。 | 188| typedef struct [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) | 定义字体样式集, 用于字体样式族匹配。 | 189| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 | 190 191### 枚举 192 193| 名称 | 描述 | 194| -------- | -------- | 195| [OH_Drawing_SystemFontType](#oh_drawing_systemfonttype-1) { ALL = 1 << 0, GENERIC = 1 << 1, STYLISH = 1 << 2, INSTALLED = 1 << 3 } | 字体类型的枚举。 | 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 } | 枚举本模块可能产生的错误码。 | 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/>} | 路径操作类型枚举。 | 198| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags-1) { GET_POSITION_MATRIX, GET_TANGENT_MATRIX, GET_POSITION_AND_TANGENT_MATRIX } | 路径测量获取相应矩阵信息维度枚举。 | 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/>} | 区域操作类型枚举。 | 200| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | 源矩形区域约束类型枚举。 | 201| [OH_Drawing_PointMode](#oh_drawing_pointmode-1) { POINT_MODE_POINTS, POINT_MODE_LINES, POINT_MODE_POLYGON } | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 | 202| [OH_Drawing_VertexMode](#oh_drawing_vertexmode-1) { VERTEX_MODE_TRIANGLES, VERTEX_MODE_TRIANGLESSTRIP, VERTEX_MODE_TRIANGLEFAN } | 用于指定如何解释给定顶点的几何形状的枚举类型。 | 203| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | 画布裁剪方式的枚举集合。 | 204| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | 字形边缘效果类型枚举。 | 205| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | 字形轮廓效果类型枚举。 | 206| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | 蒙版滤波器模糊操作类型的枚举。 | 207| [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit-1) { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } | 矩阵缩放方式枚举。 | 208| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | 添加闭合轮廓方向枚举。 | 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 } | 定义路径的填充类型枚举。 | 210| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | 用于指定路径添加模式的枚举类型。 | 211| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle-1) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 | 212| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle-1) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 | 213| [OH_Drawing_CornerPos](#oh_drawing_cornerpos-1) { CORNER_POS_TOP_LEFT, CORNER_POS_TOP_RIGHT, CORNER_POS_BOTTOM_RIGHT, CORNER_POS_BOTTOM_LEFT } | 用于描述圆角位置的枚举。 | 214| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | 过滤模式枚举。 | 215| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | 多级渐远纹理模式枚举。 | 216| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | 着色器效果平铺模式的枚举。 | 217| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向 | 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/>} | 文字对齐方式 | 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/>} | 字重 | 220| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置 | 221| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰 | 222| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | 区分字体是否为斜体 | 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/>} | 占位符垂直对齐枚举 | 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/>} | 文本装饰样式枚举 | 225| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | 省略号样式枚举 | 226| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy-1) { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } | 文本的中断策略枚举 | 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 } | 单词的断词方式枚举 | 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/>} | 矩形框高度样式枚举 | 229| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | 矩形框宽度样式枚举 | 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/>} | 获取系统字体配置信息列表结果枚举。 | 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/>} | 字体宽度的枚举。 | 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 } | 文本高度修饰符模式枚举。 | 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/>} | 文本样式类型枚举。 | 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/>} | 用于描述位图像素的存储格式。 | 235| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat-1) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | 用于描述位图像素的透明度分量。 | 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/>} | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 | 237| [OH_Drawing_TextEncoding](#oh_drawing_textencoding-1) { TEXT_ENCODING_UTF8, TEXT_ENCODING_UTF16, TEXT_ENCODING_UTF32, TEXT_ENCODING_GLYPH_ID } | 文本编码类型枚举。 | 238| [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags-1) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 | 239 240### 函数 241 242| 名称 | 描述 | 243| -------- | -------- | 244| OH_Drawing_FontCollection \* [OH_Drawing_GetFontCollectionGlobalInstance](#oh_drawing_getfontcollectionglobalinstance) (void) | 获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。 | 245| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 用于创建一个位图对象。 | 246| void [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于销毁位图对象并回收该对象占有内存。 | 247| [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) | 用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 | 248| 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) \*) | 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 | 249| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的宽度。 | 250| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的高度。 | 251| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_BitmapGetColorFormat](#oh_drawing_bitmapgetcolorformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素存储格式。 | 252| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_BitmapGetAlphaFormat](#oh_drawing_bitmapgetalphaformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素透明度分量。 | 253| void \* [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 | 254| void [OH_Drawing_BitmapGetImageInfo](#oh_drawing_bitmapgetimageinfo) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 用于获取指定位图的信息。 | 255| 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) | 将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 | 256| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 用于创建一个画刷对象。 | 257| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCopy](#oh_drawing_brushcopy) ([OH_Drawing_Brush](#oh_drawing_brush) \*brush) | 创建一个画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush),用于拷贝一个已有画刷对象。 | 258| void [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于销毁画刷对象并回收该对象占有的内存。 | 259| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 260| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 261| uint32_t [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | 262| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | 263| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 | 264| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 | 265| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 为画刷设置着色器效果。 | 266| void [OH_Drawing_BrushSetShadowLayer](#oh_drawing_brushsetshadowlayer) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 | 267| void [OH_Drawing_BrushSetFilter](#oh_drawing_brushsetfilter) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 268| void [OH_Drawing_BrushGetFilter](#oh_drawing_brushgetfilter) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 从画刷获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 269| void [OH_Drawing_BrushSetBlendMode](#oh_drawing_brushsetblendmode) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 | 270| void [OH_Drawing_BrushReset](#oh_drawing_brushreset) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 将画刷重置至初始状态,清空所有已设置的属性。 | 271| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 用于创建一个画布对象。 | 272| void [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于销毁画布对象并回收该对象占有的内存。 | 273| void [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 | 274| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 | 275| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 | 276| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 | 277| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 | 278| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于保存当前画布的状态(画布矩阵)到一个栈顶。 | 279| 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) \*) | 保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 | 280| void [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于恢复保存在栈顶的画布状态(画布矩阵)。 | 281| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于获取栈中保存的画布状态(画布矩阵)的数量。 | 282| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | 用于恢复到指定数量的画布状态(画布矩阵)。 | 283| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 用于画一条直线段。 | 284| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 用于画一个自定义路径。 | 285| 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) \*) | 用于将像素图的指定区域绘制到画布的指定区域。 | 286| void [OH_Drawing_CanvasDrawBackground](#oh_drawing_canvasdrawbackground) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于画一个背景,此背景以画刷填充。 | 287| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | 用于画一块区域。 | 288| [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) | 用于画一个点。 | 289| 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) \*) | 用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 | 290| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 | 291| 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) \*) | 将位图的指定区域绘制到画布的指定区域。 | 292| void [OH_Drawing_CanvasSetMatrix](#oh_drawing_canvassetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 设置画布的矩阵状态。 | 293| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 重置当前画布的矩阵为单位矩阵。 | 294| 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)) | 将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 | 295| 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) \*) | 将图片绘制到画布的指定区域上。 | 296| 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) | 用于画顶点数组描述的三角网格。 | 297| 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) | 从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 | 298| 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) | 从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 | 299| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasIsClipEmpty](#oh_drawing_canvasisclipempty) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, bool \*isClipEmpty) | 用于判断裁剪后可绘制区域是否为空。 | 300| [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) | 用于获取画布的图像信息。 | 301| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个矩形。 | 302| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | 用于画一个圆形。 | 303| [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) | 用于使用指定的颜色及混合模式来填充整个画布。 | 304| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个椭圆。 | 305| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 用于画一个弧。 | 306| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于画一个圆角矩形。 | 307| [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) | 用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 | 308| void [OH_Drawing_CanvasDrawTextBlob](#oh_drawing_canvasdrawtextblob) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*, float x, float y) | 用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。 | 309| uint32_t [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 | 310| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 创建具有混合模式的颜色滤波器。 | 311| [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) | 将两个颜色滤波器合成一个新的颜色滤波器。 | 312| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | 创建具有5x4颜色矩阵的颜色滤波器。 | 313| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | 创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 | 314| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 | 315| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 | 316| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 销毁颜色滤波器对象,并收回该对象占用的内存。 | 317| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | 创建一个标准颜色空间。 | 318| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | 创建一个Gamma 1.0空间上的颜色空间。 | 319| void [OH_Drawing_ColorSpaceDestroy](#oh_drawing_colorspacedestroy) ([OH_Drawing_ColorSpace](#oh_drawing_colorspace) \*) | 销毁颜色空间对象,并回收该对象占有内存。 | 320| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | 获取本模块的错误码。 | 321| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | 创建一个滤波器对象。 | 322| void [OH_Drawing_FilterSetImageFilter](#oh_drawing_filtersetimagefilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 为滤波器对象设置图像滤波器对象。 | 323| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 为滤波器对象设置模板滤波器对象。 | 324| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 为滤波器对象设置颜色滤波器对象。 | 325| void [OH_Drawing_FilterGetColorFilter](#oh_drawing_filtergetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 从滤波器对象获取颜色滤波器对象。 | 326| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | 销毁滤波器对象,并收回该对象占用的内存。 | 327| void [OH_Drawing_FontSetBaselineSnap](#oh_drawing_fontsetbaselinesnap) ([OH_Drawing_Font](#oh_drawing_font) \*, bool baselineSnap) | 当前画布矩阵轴对齐时,将字形基线设置为是否与像素对齐。 | 328| bool [OH_Drawing_FontIsBaselineSnap](#oh_drawing_fontisbaselinesnap) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 当前画布矩阵轴对齐时,获取字形基线是否与像素对齐。 | 329| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | 用于设置字形边缘效果。 | 330| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形边缘效果。 | 331| void [OH_Drawing_FontSetForceAutoHinting](#oh_drawing_fontsetforceautohinting) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isForceAutoHinting) | 用于设置是否自动调整字形轮廓。 | 332| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形轮廓是否自动调整。 | 333| void [OH_Drawing_FontSetSubpixel](#oh_drawing_fontsetsubpixel) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isSubpixel) | 设置字形是否使用次像素渲染。 | 334| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否使用次像素渲染。 | 335| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | 用于创建一个字体对象。 | 336| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于给字体设置字形。 | 337| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形对象。 | 338| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | 用于给字体设置文字大小。 | 339| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形文本大小。 | 340| 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) | 获取文本所表示的字符数量。 | 341| 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) | 用于将文本转换为字形索引。 | 342| void [OH_Drawing_FontGetWidths](#oh_drawing_fontgetwidths) (const [OH_Drawing_Font](#oh_drawing_font) \*, const uint16_t \*glyphs, int count, float \*widths) | 用于获取字符串中每个字符的宽度。 | 343| [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) | 用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 | 344| [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) | 用于获取文本的宽度和边界框。 | 345| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | 用于设置线性可缩放字体。 | 346| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否使用线性缩放。 | 347| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | 用于给字体设置文本倾斜。 | 348| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形文本在x轴上的倾斜度。 | 349| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | 用于设置增加描边宽度以近似粗体字体效果。 | 350| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取是否增加笔画宽度以接近粗体字形。 | 351| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | 用于设置字形对象在x轴上的缩放比例。 | 352| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形对象在x轴上的缩放比例。 | 353| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | 用于设置字形轮廓效果。 | 354| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形轮廓效果枚举类型。 | 355| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | 用于设置字形是否转换成位图处理。 | 356| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否转换成位图处理。 | 357| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | 用于销毁字体对象并回收该对象占有的内存。 | 358| float [OH_Drawing_FontGetMetrics](#oh_drawing_fontgetmetrics) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 获取字体度量信息。 | 359| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 | 360| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被字体集对象占据的内存。 | 361| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用备用字体。 | 362| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用系统字体。 | 363| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (void) | 创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 | 364| void [OH_Drawing_ClearFontCaches](#oh_drawing_clearfontcaches) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 | 365| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | 构造字体管理对象。 | 366| void [OH_Drawing_FontMgrDestroy](#oh_drawing_fontmgrdestroy) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 释放字体管理对象占用的内存。 | 367| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 获取字体家族的数量。 | 368| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由索引值获取字体家族名称。 | 369| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | 释放指定字体家族名称占用的内存。 | 370| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrCreateFontStyleSet](#oh_drawing_fontmgrcreatefontstyleset) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由字体管理对象构造字体样式集对象。 | 371| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 释放字体样式集对象占用的内存。 | 372| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrMatchFamily](#oh_drawing_fontmgrmatchfamily) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName) | 由指定的字体家族名称,获取字体样式集对象。 | 373| [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)) | 根据指定的字体样式信息和字体家族名称,获取字型对象。 | 374| [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) | 为指定字符获取字型对象。 | 375| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetCreateTypeface](#oh_drawing_fontstylesetcreatetypeface) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int index) | 为指定索引获取字型对象。 | 376| [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) | 获取字体样式。 | 377| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | 释放指定字体样式的内存。 | 378| [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) | 获取最接近字体样式的字型对象。 | 379| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 获取字体样式集中字体的个数。 | 380| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreateFromGL](#oh_drawing_gpucontextcreatefromgl) ([OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)) | 用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 | 381| void [OH_Drawing_GpuContextDestroy](#oh_drawing_gpucontextdestroy) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*) | 用于销毁图形处理器上下文对象并回收该对象占用的内存。 | 382| [OH_Drawing_Image](#oh_drawing_image) \* [OH_Drawing_ImageCreate](#oh_drawing_imagecreate) (void) | 创建一个图片对象,描述了要绘制的二维像素数组。 | 383| void [OH_Drawing_ImageDestroy](#oh_drawing_imagedestroy) ([OH_Drawing_Image](#oh_drawing_image) \*) | 销毁图片对象并回收该对象占有内存。 | 384| bool [OH_Drawing_ImageBuildFromBitmap](#oh_drawing_imagebuildfrombitmap) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 | 385| int32_t [OH_Drawing_ImageGetWidth](#oh_drawing_imagegetwidth) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片宽度,即每行的像素个数。 | 386| int32_t [OH_Drawing_ImageGetHeight](#oh_drawing_imagegetheight) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片高度,即像素行数。 | 387| void [OH_Drawing_ImageGetImageInfo](#oh_drawing_imagegetimageinfo) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 获取图片信息。调用该接口后,传入的图片信息对象被填充。 | 388| [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) | 创建具有模糊效果的图像滤波器。 | 389| [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) | 创建具有颜色变换效果的图像滤波器。 | 390| void [OH_Drawing_ImageFilterDestroy](#oh_drawing_imagefilterdestroy) ([OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 销毁图像滤波器对象并回收该对象占有内存。 | 391| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | 创建具有模糊效果的模板滤波器。 | 392| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 销毁模板滤波器对象,并收回该对象占用的内存。 | 393| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | 用于创建一个矩阵对象。 | 394| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateRotation](#oh_drawing_matrixcreaterotation) (float deg, float x, float y) | 创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 | 395| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateScale](#oh_drawing_matrixcreatescale) (float sx, float sy, float px, float py) | 创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 | 396| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateTranslation](#oh_drawing_matrixcreatetranslation) (float dx, float dy) | 创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 | 397| 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) | 用于给矩阵对象设置参数。 | 398| 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) | 将矩阵以缩放方式适配目标矩阵。 | 399| void [OH_Drawing_MatrixPreRotate](#oh_drawing_matrixprerotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 例如给定的矩阵: | 400| void [OH_Drawing_MatrixPreScale](#oh_drawing_matrixprescale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 例如给定的矩阵: | 401| void [OH_Drawing_MatrixPreTranslate](#oh_drawing_matrixpretranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 例如给定的矩阵: | 402| void [OH_Drawing_MatrixPostRotate](#oh_drawing_matrixpostrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 例如给定的矩阵: | 403| void [OH_Drawing_MatrixPostScale](#oh_drawing_matrixpostscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 例如给定的矩阵: | 404| void [OH_Drawing_MatrixPostTranslate](#oh_drawing_matrixposttranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 例如给定的矩阵: | 405| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 重置当前矩阵为单位矩阵: \| 1 0 0 \| \| 0 1 0 \| \| 0 0 1 \| | 406| 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) | 将矩阵total设置为矩阵a乘以矩阵b。 例如给定矩阵a和矩阵b如下所示: \| A B C \| \| J K L \| a = \| D E F \|, b = \| M N O \| \| G H I \| \| P Q R \| 设置的最终矩阵total为: \| 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 \| | 407| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_MatrixGetAll](#oh_drawing_matrixgetall) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, float value[9]) | 获取矩阵所有元素值。 | 408| float [OH_Drawing_MatrixGetValue](#oh_drawing_matrixgetvalue) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, int index) | 获取矩阵给定索引位的值。索引范围0-8。 | 409| void [OH_Drawing_MatrixRotate](#oh_drawing_matrixrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 | 410| void [OH_Drawing_MatrixTranslate](#oh_drawing_matrixtranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 设置矩阵为单位矩阵,并平移(dx, dy)。 | 411| void [OH_Drawing_MatrixScale](#oh_drawing_matrixscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 | 412| bool [OH_Drawing_MatrixInvert](#oh_drawing_matrixinvert) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*inverse) | 将矩阵inverse设置为矩阵的倒数,并返回结果。 | 413| 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) | 通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。 | 414| 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) | 通过矩阵变换将源点数组映射到目标点数组。 | 415| 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) | 将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 | 416| bool [OH_Drawing_MatrixIsEqual](#oh_drawing_matrixisequal) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*other) | 判断两个矩阵是否相等。 | 417| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 判断矩阵是否是单位矩阵。 单位矩阵为 : \| 1 0 0 \| \| 0 1 0 \| \| 0 0 1 \| | 418| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 用于销毁矩阵对象并回收该对象占有的内存。 | 419| [OH_Drawing_MemoryStream](#oh_drawing_memorystream) \* [OH_Drawing_MemoryStreamCreate](#oh_drawing_memorystreamcreate) (const void \*data, size_t length, bool copyData) | 创建一个内存流对象。 | 420| void [OH_Drawing_MemoryStreamDestroy](#oh_drawing_memorystreamdestroy) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*) | 销毁内存流对象并回收该对象占有内存。 | 421| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 用于创建一个路径对象。 | 422| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCopy](#oh_drawing_pathcopy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 | 423| void [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于销毁路径对象并回收该对象占有的内存。 | 424| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置自定义路径的起始点位置。 | 425| void [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 | 426| 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) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框, 矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数, 从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 | 427| void [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 | 428| void [OH_Drawing_PathConicTo](#oh_drawing_pathconicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY, float weight) | 在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。 | 429| 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) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 | 430| void [OH_Drawing_PathRMoveTo](#oh_drawing_pathrmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 | 431| void [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 | 432| void [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 | 433| void [OH_Drawing_PathRConicTo](#oh_drawing_pathrconicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY, float weight) | 使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段。 | 434| 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) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 | 435| 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)) | 按指定方向,向路径添加矩形轮廓。 | 436| 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) | 按指定方向,向路径添加矩形轮廓。 | 437| 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)) | 按指定方向,向路径添加圆角矩形轮廓。 | 438| 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)) | 将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 | 439| void [OH_Drawing_PathAddArc](#oh_drawing_pathaddarc) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫描角度添加弧, 添加的弧是矩形内切椭圆的一部分,如果扫描角度<= -360°,或>= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。 | 440| 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) \*) | 将源路径矩阵变换后,添加到当前路径中。 | 441| 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)) | 将源路径矩阵变换后,以规定模式添加到当前路径中。 | 442| 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)) | 将源路径以规定模式添加到当前路径中。 | 443| 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)) | 将源路径偏移后,以规定模式添加到当前路径中。 | 444| 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) | 向路径添加多边形。 | 445| 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)) | 按指定方向,向路径添加圆形。 | 446| 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)) | 按指定方向,向路径添加椭圆。 | 447| bool [OH_Drawing_PathBuildFromSvgString](#oh_drawing_pathbuildfromsvgstring) ([OH_Drawing_Path](#oh_drawing_path) \*path, const char \*str) | 解析SVG字符串表示的路径。 | 448| bool [OH_Drawing_PathContains](#oh_drawing_pathcontains) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 | 449| void [OH_Drawing_PathTransform](#oh_drawing_pathtransform) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 对路径进行矩阵变换。 | 450| 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) | 对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为NULL,则替换源路径。 | 451| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | 设置填充路径的规则。 | 452| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | 获取当前路径的长度。 | 453| void [OH_Drawing_PathGetBounds](#oh_drawing_pathgetbounds) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取包含路径的最小边界框。 | 454| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 | 455| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | 获取路径是否闭合。 | 456| 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) | 获取距路径起始点指定距离的坐标点和切线值。 | 457| 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) | 将两个路径按照指定的路径操作类型合并。 | 458| 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) | 获取距路径起始点指定距离的相应变换矩阵。 | 459| 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) | 将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。 | 460| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于重置自定义路径数据。 | 461| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDashPathEffect](#oh_drawing_createdashpatheffect) (float \*intervals, int count, float phase) | 创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 | 462| void [OH_Drawing_PathEffectDestroy](#oh_drawing_patheffectdestroy) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 销毁路径效果对象并回收该对象占有内存。 | 463| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 用于创建一个画笔对象。 | 464| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCopy](#oh_drawing_pencopy) ([OH_Drawing_Pen](#oh_drawing_pen) \*pen) | 创建一个画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen),用于拷贝一个已有画笔对象。 | 465| void [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于销毁画笔对象并回收该对象占有的内存。 | 466| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 467| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 468| uint32_t [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | 469| void [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | 470| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 | 471| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 | 472| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 | 473| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 | 474| float [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | 475| void [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | 476| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔笔帽的样式。 | 477| void [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 用于设置画笔笔帽样式。 | 478| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔绘制折线转角的样式。 | 479| void [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 用于设置画笔绘制转角的样式。 | 480| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 设置画笔着色器效果。 | 481| void [OH_Drawing_PenSetShadowLayer](#oh_drawing_pensetshadowlayer) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 | 482| void [OH_Drawing_PenSetPathEffect](#oh_drawing_pensetpatheffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 设置画笔路径效果。 | 483| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 设置画笔滤波器。 | 484| void [OH_Drawing_PenGetFilter](#oh_drawing_pengetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 从画笔获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 485| void [OH_Drawing_PenSetBlendMode](#oh_drawing_pensetblendmode) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 | 486| 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) \*) | 获取使用画笔绘制的源路径轮廓,并用目标路径表示。 | 487| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 将画笔重置至初始值。 | 488| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) (NativePixelMap_ \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 | 489| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative) (OH_PixelmapNative \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 | 490| void [OH_Drawing_PixelMapDissolve](#oh_drawing_pixelmapdissolve) ([OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*) | 解除本模块定义的像素图对象和图像框架定义的像素图对象之间的关系,该关系通过调用 [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap)或[OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative)建立。 | 491| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | 用于创建一个坐标点对象。 | 492| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetX](#oh_drawing_pointgetx) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*x) | 用于获取点的x轴坐标。 | 493| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetY](#oh_drawing_pointgety) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*y) | 用于获取点的y轴坐标。 | 494| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointSet](#oh_drawing_pointset) ([OH_Drawing_Point](#oh_drawing_point) \*point, float x, float y) | 用于设置点的x轴和y轴坐标。 | 495| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | 用于销毁坐标点对象并回收该对象占有的内存。 | 496| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | 创建一个录制指令工具对象。 | 497| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdUtilsDestroy](#oh_drawing_recordcmdutilsdestroy) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils) | 销毁一个录制指令工具对象,并回收该对象占有的内存。 | 498| [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) | 开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。<br/>指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。 | 499| [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) | 结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。<br/>指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 | 500| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) ([OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | 销毁录制指令对象,并回收该对象占有的内存。 | 501| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | 用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 | 502| float [OH_Drawing_RectGetHeight](#oh_drawing_rectgetheight) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 | 503| float [OH_Drawing_RectGetWidth](#oh_drawing_rectgetwidth) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 | 504| float [OH_Drawing_RectGetLeft](#oh_drawing_rectgetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的横坐标。 | 505| float [OH_Drawing_RectGetTop](#oh_drawing_rectgettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的纵坐标。 | 506| float [OH_Drawing_RectGetRight](#oh_drawing_rectgetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的横坐标。 | 507| float [OH_Drawing_RectGetBottom](#oh_drawing_rectgetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的纵坐标。 | 508| bool [OH_Drawing_RectIntersect](#oh_drawing_rectintersect) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 | 509| bool [OH_Drawing_RectJoin](#oh_drawing_rectjoin) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 将两个矩形取并集。 | 510| void [OH_Drawing_RectSetLeft](#oh_drawing_rectsetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float left) | 用于设置矩形左上角的横坐标。 | 511| void [OH_Drawing_RectSetTop](#oh_drawing_rectsettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float top) | 用于设置矩形左上角的纵坐标。 | 512| void [OH_Drawing_RectSetRight](#oh_drawing_rectsetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float right) | 用于设置矩形右下角的横坐标。 | 513| void [OH_Drawing_RectSetBottom](#oh_drawing_rectsetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float bottom) | 用于设置矩形右下角的纵坐标。 | 514| void [OH_Drawing_RectCopy](#oh_drawing_rectcopy) ([OH_Drawing_Rect](#oh_drawing_rect) \*sRect, [OH_Drawing_Rect](#oh_drawing_rect) \*dRect) | 用于将源矩形对象复制到目标矩形对象。 | 515| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于销毁矩形对象并回收该对象占有的内存。 | 516| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | 用于创建一个区域对象,实现更精确的图形控制。 | 517| bool [OH_Drawing_RegionContains](#oh_drawing_regioncontains) ([OH_Drawing_Region](#oh_drawing_region) \*region, int32_t x, int32_t y) | 判断区域是否包含指定坐标点。 | 518| 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) | 将两个区域按照指定的区域操作类型合并。 | 519| bool [OH_Drawing_RegionSetRect](#oh_drawing_regionsetrect) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect) | 用于尝试给区域对象设置矩形边界。 | 520| 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) | 给区域对象设置为指定区域内路径表示的范围。 | 521| void [OH_Drawing_RegionDestroy](#oh_drawing_regiondestroy) ([OH_Drawing_Region](#oh_drawing_region) \*) | 用于销毁区域对象并回收该对象占有的内存。 | 522| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | 用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 | 523| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | 用于在字体管理器中注册字体缓冲区。 | 524| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | 用于创建一个圆角矩形对象。 | 525| 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)) | 用于设置圆角矩形中指定圆角位置的圆角半径。 | 526| [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) | 用于获取圆角矩形中指定圆角位置的圆角半径。 | 527| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于销毁圆角矩形对象并回收该对象占有的内存。 | 528| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_RoundRectOffset](#oh_drawing_roundrectoffset) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*roundRect, float dx, float dy) | 用于将圆角矩形沿x轴方向和y轴方向平移指定距离。 | 529| [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \* [OH_Drawing_SamplingOptionsCreate](#oh_drawing_samplingoptionscreate) ([OH_Drawing_FilterMode](#oh_drawing_filtermode), [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)) | 创建一个采样选项对象。 | 530| void [OH_Drawing_SamplingOptionsDestroy](#oh_drawing_samplingoptionsdestroy) ([OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 销毁采样选项对象并回收该对象占有内存。 | 531| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateColorShader](#oh_drawing_shadereffectcreatecolorshader) (const uint32_t color) | 创建具有单一颜色的着色器。 | 532| [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)) | 创建着色器,在两个指定点之间生成线性渐变。 | 533| [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) \*) | 创建着色器,在两个指定点之间生成线性渐变。 | 534| [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)) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 | 535| [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) \*) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 | 536| [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)) | 创建着色器,在给定中心的情况下生成扇形渐变。 颜色从0°到360°渐变被称为扇形渐变。 | 537| [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) \*) | 创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 | 538| [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) \*) | 创建着色器,在给定两个圆之间生成渐变。 | 539| void [OH_Drawing_ShaderEffectDestroy](#oh_drawing_shadereffectdestroy) ([OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 销毁着色器对象,并收回该对象占用的内存。 | 540| [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \* [OH_Drawing_ShadowLayerCreate](#oh_drawing_shadowlayercreate) (float blurRadius, float x, float y, uint32_t color) | 创建一个阴影层对象。 | 541| void [OH_Drawing_ShadowLayerDestroy](#oh_drawing_shadowlayerdestroy) ([OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 销毁阴影层对象,并收回该对象占用的内存。 | 542| [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)) | 使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。 | 543| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_SurfaceGetCanvas](#oh_drawing_surfacegetcanvas) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 通过surface对象获取画布对象。 | 544| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 销毁surface对象并回收该对象占用的内存。 | 545| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | 用于创建一个文本构造器对象。 | 546| [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)) | 使用文本创建一个文本对象。 | 547| [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)) | 使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。 | 548| [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)) | 使用字符串创建文本对象。 | 549| void [OH_Drawing_TextBlobGetBounds](#oh_drawing_textblobgetbounds) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取文本对象的边界范围。 | 550| uint32_t [OH_Drawing_TextBlobUniqueID](#oh_drawing_textblobuniqueid) (const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 获取文本的标识符,该标识符是唯一的非零值。 | 551| 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) \*) | 申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。 | 552| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于从文本构造器中创建文本对象。 | 553| void [OH_Drawing_TextBlobDestroy](#oh_drawing_textblobdestroy) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 用于销毁文本对象并回收该对象占有的内存。 | 554| void [OH_Drawing_TextBlobBuilderDestroy](#oh_drawing_textblobbuilderdestroy) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于销毁文本构造器对象并回收该对象占有的内存。 | 555| [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)) | 根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。 | 556| [OH_Drawing_Array](#oh_drawing_array) \* [OH_Drawing_GetSystemFontFullNamesByType](#oh_drawing_getsystemfontfullnamesbytype) ([OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)) | 根据字体类型获取对应字体的字体名称数组。 | 557| const [OH_Drawing_String](_o_h___drawing___string.md) \* [OH_Drawing_GetSystemFontFullNameByIndex](#oh_drawing_getsystemfontfullnamebyindex) ([OH_Drawing_Array](#oh_drawing_array) \*, size_t) | 在字体名称数组中通过索引获取对应位置的字体名称。 | 558| void [OH_Drawing_DestroySystemFontFullNames](#oh_drawing_destroysystemfontfullnames) ([OH_Drawing_Array](#oh_drawing_array) \*) | 释放通过字体类型获取的对应字体的字体名称数组占用的内存。 | 559| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建指向OH_Drawing_TypographyStyle对象的指针。 | 560| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 | 561| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本方向。 | 562| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 | 563| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文字对齐方式。 | 564| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 | 565| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建指向OH_Drawing_TextStyle对象的指针。 | 566| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取字体风格。 | 567| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 | 568| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 | 569| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 | 570| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 | 571| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体基线位置。 | 572| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置装饰。 | 573| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置装饰颜色。 | 574| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置行高,按当前字体大小的倍数进行设置。 | 575| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型。 | 576| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体风格。 | 577| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本语言类型。 | 578| void [OH_Drawing_SetTextStyleForegroundBrush](#oh_drawing_settextstyleforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置前景色画刷。 | 579| void [OH_Drawing_TextStyleGetForegroundBrush](#oh_drawing_textstylegetforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的前景色画刷。 | 580| void [OH_Drawing_SetTextStyleForegroundPen](#oh_drawing_settextstyleforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置前景色画笔。 | 581| void [OH_Drawing_TextStyleGetForegroundPen](#oh_drawing_textstylegetforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的前景色画笔。 | 582| void [OH_Drawing_SetTextStyleBackgroundBrush](#oh_drawing_settextstylebackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置背景色画刷。 | 583| void [OH_Drawing_TextStyleGetBackgroundBrush](#oh_drawing_textstylegetbackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的背景色画刷。 | 584| void [OH_Drawing_SetTextStyleBackgroundPen](#oh_drawing_settextstylebackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置背景色画笔。 | 585| void [OH_Drawing_TextStyleGetBackgroundPen](#oh_drawing_textstylegetbackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的背景色画笔。 | 586| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \* [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 创建指向OH_Drawing_TypographyCreate对象的指针。 | 587| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 | 588| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版风格。 | 589| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 | 590| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 排版弹出。 | 591| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建指向OH_Drawing_Typography对象的指针。 | 592| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 | 593| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 | 594| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, double, double) | 显示文本。 | 595| 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) | 沿路径绘制文本。 | 596| double [OH_Drawing_TypographyGetMaxWidth](#oh_drawing_typographygetmaxwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最大宽度。 | 597| double [OH_Drawing_TypographyGetHeight](#oh_drawing_typographygetheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取高度。 | 598| double [OH_Drawing_TypographyGetLongestLine](#oh_drawing_typographygetlongestline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最长行的宽度,建议实际使用时将返回值向上取整。当文本内容为空时,返回float的最小值, 即:-340282346638528859811704183484516925440.000000。 | 599| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最长行的宽度(该宽度包含当前行缩进的宽度),建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 | 600| double [OH_Drawing_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最小固有宽度。 | 601| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最大固有宽度。 | 602| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取字母文字基线。 | 603| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取表意文字基线。 | 604| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | 设置占位符。 | 605| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本是否超过最大行。 | 606| [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)) | 获取指定范围内的文本框。 | 607| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取占位符的文本框。 | 608| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框左侧位置。 | 609| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框右侧位置。 | 610| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框顶部位置。 | 611| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框底部位置。 | 612| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框方向。 | 613| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 获取文本框数量大小。 | 614| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本的索引位置和亲和性。 | 615| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 | 616| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的位置属性。 | 617| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 | 618| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | 获取单词的边界。 | 619| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象开始位置。 | 620| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象结束位置。 | 621| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本行数。 | 622| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本装饰样式。 | 623| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本装饰线的厚度缩放比例。 | 624| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的字符间距。 | 625| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的单词间距。 | 626| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | 设置文本为一半行间距。 | 627| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本的省略号内容。 | 628| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本的省略号样式。 | 629| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的中断策略。 | 630| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置单词的断词方式。 | 631| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的省略号样式。 | 632| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | 设置省略号样式。 | 633| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行高 | 634| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行宽。 | 635| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | 设置文本划分比率。 | 636| bool [OH_Drawing_TypographyIsLineUnlimited](#oh_drawing_typographyislineunlimited) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有最大行数限制。 | 637| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有省略号。 | 638| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) | 设置段落语言类型。 | 639| 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) \*) | 获取文本字体属性。 | 640| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置段落样式。 | 641| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) (void) | 构造字体描述对象,用于描述系统字体详细信息。 | 642| void [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*) | 释放字体描述对象占用的内存。 | 643| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | 构造字体解析对象,用于解析系统字体。 | 644| void [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*) | 释放字体解析对象占用的内存。 | 645| char \*\* [OH_Drawing_FontParserGetSystemFontList](#oh_drawing_fontparsergetsystemfontlist) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, size_t \*) | 获取系统字体名称列表,此接口仅在2in1设备上可用。 | 646| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | 释放系统字体名称列表占用的内存。 | 647| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_FontParserGetFontByName](#oh_drawing_fontparsergetfontbyname) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, const char \*) | 根据传入的系统字体名称获取系统字体的相关信息。 | 648| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \* [OH_Drawing_TypographyGetLineMetrics](#oh_drawing_typographygetlinemetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取行位置信息。 | 649| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取行数量。 | 650| void [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 释放行位置信息对象占用的内存。 | 651| bool [OH_Drawing_TypographyGetLineMetricsAt](#oh_drawing_typographygetlinemetricsat) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取指定行位置信息对象。 | 652| 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) \*) | 获取指定行的位置信息或指定行第一个字符的位置信息。 | 653| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 | 654| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置字体风格。 | 655| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | 设置字体家族的名称。 | 656| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字号。 | 657| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字体高度。 | 658| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否为一半行间距。 | 659| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否启用行样式。 | 660| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 | 661| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式风格。 | 662| void [OH_Drawing_SetTypographyTextLineStyleFontFamilies](#oh_drawing_settypographytextlinestylefontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int, const char \*fontFamilies[]) | 设置文本排版行样式字体类型。 | 663| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字号。 | 664| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字体高度。 | 665| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版行样式是否为一半行间距。 | 666| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式间距比例。 | 667| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否仅启用行样式。 | 668| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | 创建指向字体阴影对象的指针。 | 669| void [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放被字体阴影对象占据的内存。 | 670| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器。 | 671| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器的大小。 | 672| void [OH_Drawing_TextStyleAddShadow](#oh_drawing_textstyleaddshadow) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 字体阴影容器中添加字体阴影元素。 | 673| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体阴影容器中的所有元素。 | 674| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadowWithIndex](#oh_drawing_textstylegetshadowwithindex) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 根据下标获取字体阴影容器中的元素。 | 675| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | 设置文本的排版缩进,不调用此接口默认文本无缩进。 | 676| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 根据下标获取排版缩进容器中的元素。 | 677| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | 获取行的边界。 | 678| void [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 | 679| [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \* [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo) ([OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) \*) | 获取系统字体配置信息。 | 680| void [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) ([OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \*) | 释放系统字体配置信息占用的的内存。 | 681| 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) | 设置字体样式,包括字体字重、字体宽度和字体斜度。 | 682| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TextStyleGetFontStyleStruct](#oh_drawing_textstylegetfontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle) | 获取字体样式,包括字体字重、字体宽度和字体斜度。 | 683| 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) | 设置文本字体样式,包括字体字重、字体宽度和字体斜度。 | 684| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | 获取文本字体样式,包括字体字重、字体宽度和字体斜度。 | 685| 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) | 设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。 | 686| void [OH_Drawing_TypographyHandlerAddSymbol](#oh_drawing_typographyhandleraddsymbol) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, uint32_t symbol) | 设置排版创建过程中的符号。 | 687| void [OH_Drawing_TextStyleAddFontFeature](#oh_drawing_textstyleaddfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*tag, int value) | 添加文本字体特征。 | 688| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*, const float) | 添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 | 689| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器中的所有内容。 | 690| void [OH_Drawing_TextStyleDestroyFontFeatures](#oh_drawing_textstyledestroyfontfeatures) ([OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \*, size_t fontFeatureSize) | 释放存放字体特征所有内容的结构体数组所占用的空间。 | 691| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器的大小。 | 692| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体特征map容器中的所有内容。 | 693| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的基线漂移。 | 694| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | 设置文本的基线漂移。 | 695| void [OH_Drawing_TypographyTextSetHeightBehavior](#oh_drawing_typographytextsetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) heightMode) | 设置文本高度修饰符模式。 | 696| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本高度修饰符模式。 | 697| [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) | 从目标行获取所有字体指标。 | 698| void [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) ([OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 释放指定行所有字体度量结构体集合所占用的所有空间。 | 699| bool [OH_Drawing_TextStyleIsEqual](#oh_drawing_textstyleisequal) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象是否相等。 | 700| bool [OH_Drawing_TextStyleIsEqualByFont](#oh_drawing_textstyleisequalbyfont) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象的字体样式属性是否相等。 | 701| 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) | 判断两个字体风格对象是否有一样的文本样式类型。 | 702| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 设置占位符。 | 703| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 返回是否有设置文本占位符。 | 704| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本对齐模式。 | 705| bool [OH_Drawing_TypographyStyleIsHintEnabled](#oh_drawing_typographystyleishintenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 | 706| void [OH_Drawing_SetTypographyStyleTextStrutStyle](#oh_drawing_settypographystyletextstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 设置文本支柱样式。 | 707| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \* [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本支柱样式。 | 708| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 释放被支柱样式对象占据的内存。 | 709| 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) | 判断支柱样式结构体是否相同。 | 710| void [OH_Drawing_TypographyStyleSetHintsEnabled](#oh_drawing_typographystylesethintsenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, bool hintsEnabled) | 设置文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 | 711| void [OH_Drawing_TypographyMarkDirty](#oh_drawing_typographymarkdirty) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 将排版标记为脏数据,用于初始化排版状态。 | 712| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本中尚未解析的字形的数量。 | 713| void [OH_Drawing_TypographyUpdateFontSize](#oh_drawing_typographyupdatefontsize) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t from, size_t to, float fontSize) | 更新文本中的字体大小。 | 714| bool [OH_Drawing_TypographyTextGetLineStyle](#oh_drawing_typographytextgetlinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否启用行样式。 | 715| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字重。 | 716| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式风格。 | 717| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字体家族名。 | 718| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | 释放字体类型占用的内存。 | 719| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字号。 | 720| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版中字体高度规模。 | 721| bool [OH_Drawing_TypographyTextlineStyleGetHeightOnly](#oh_drawing_typographytextlinestylegetheightonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取字体渲染过程中计算字体块高度相关参数的方法。 | 722| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式是否为一半行间距。 | 723| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式间距比例。 | 724| bool [OH_Drawing_TypographyTextlineGetStyleOnly](#oh_drawing_typographytextlinegetstyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否仅启用行样式。 | 725| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本对齐方式。 | 726| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本方向。 | 727| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本的最大行数。 | 728| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取设置的省略号内容。 | 729| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | 释放省略号名称列表占用的内存。 | 730| bool [OH_Drawing_TypographyStyleEquals](#oh_drawing_typographystyleequals) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*from, [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*to) | 判断排版样式是否相同。 | 731| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本颜色。 | 732| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextStyleGetDecorationStyle](#oh_drawing_textstylegetdecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本装饰样式。 | 733| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TextStyleGetFontWeight](#oh_drawing_textstylegetfontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字重。 | 734| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体风格。 | 735| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) [OH_Drawing_TextStyleGetBaseline](#oh_drawing_textstylegetbaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体基线位置。 | 736| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | 获取字体类型名称列表。 | 737| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | 释放字体类型名称列表占用的内存。 | 738| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字号。 | 739| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的字符间距。 | 740| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的单词间距。 | 741| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体高度。 | 742| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取当前文档是否设置为一半行间距。 | 743| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取语言文本语言类型。 | 744| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 释放文本框占用的内存。 | 745| 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) | 设置字体阴影对象的参数。 | 746| size_t [OH_Drawing_GetDrawingArraySize](#oh_drawing_getdrawingarraysize) ([OH_Drawing_Array](#oh_drawing_array) \*drawingArray) | 获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。 | 747| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | 用于创建一个默认的字形对象。 | 748| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile) (const char \*path, int index) | 通过文件创建一个字形对象。 | 749| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFileWithArguments](#oh_drawing_typefacecreatefromfilewitharguments) (const char \*path, const [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。 | 750| [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) | 通过已存在的字体对象创建带有字型参数的字体对象。 | 751| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromStream](#oh_drawing_typefacecreatefromstream) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*, int32_t index) | 通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 | 752| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于销毁字形对象并回收该对象占有的内存。 | 753| [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \* [OH_Drawing_FontArgumentsCreate](#oh_drawing_fontargumentscreate) (void) | 用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 | 754| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsAddVariation](#oh_drawing_fontargumentsaddvariation) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments, const char \*axis, float value) | 给字型参数对象添加可变维度。 | 755| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsDestroy](#oh_drawing_fontargumentsdestroy) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 用于销毁一个字型参数对象。 | 756| enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 | 757| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 | 758| 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) | 用于裁剪一个矩形。 | 759| 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) | 用于裁剪一个圆角矩形。 | 760| 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) | 用于裁剪一个自定义路径。 | 761| [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) | 用于裁剪一个区域。 | 762| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 | 763| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | 用于平移画布一段距离。 | 764| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布缩放。 | 765| void [OH_Drawing_CanvasSkew](#oh_drawing_canvasskew) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布倾斜变换。等同于将当前画布矩阵左乘(premultiply)倾斜变换矩阵,并应用到画布上。其中倾斜变换矩阵为: \|1 sx 0\| \|sy 1 0\| \|0 0 1\|。 | 766| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 用于使用指定颜色去清空画布。 | 767| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布宽度。 | 768| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布高度。 | 769| void [OH_Drawing_CanvasGetLocalClipBounds](#oh_drawing_canvasgetlocalclipbounds) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取画布裁剪区域的边界。该接口不可用于录制类型画布。 | 770| void [OH_Drawing_CanvasGetTotalMatrix](#oh_drawing_canvasgettotalmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 获取画布3x3矩阵。 | 771| void [OH_Drawing_CanvasConcatMatrix](#oh_drawing_canvasconcatmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 | 772| 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) | 绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 | 773| [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) | 用于绘制录制指令对象。 | 774 775## 类型定义说明 776 777 778### OH_Drawing_Array 779 780``` 781typedef struct OH_Drawing_Array OH_Drawing_Array 782``` 783 784**描述** 785 786定义数组对象, 用于存储多个同类型对象。 787 788**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 789 790**起始版本:** 14 791 792### OH_Drawing_String 793 794``` 795typedef struct OH_Drawing_String OH_Drawing_String 796``` 797 798**描述** 799 800采用UTF-16编码的字符串信息结构体。 801 802**起始版本:** 14 803 804 805### OH_Drawing_SystemFontType 806 807``` 808typedef enum OH_Drawing_SystemFontType OH_Drawing_SystemFontType 809``` 810 811**描述** 812 813字体类型的枚举。 814 815**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 816 817**起始版本:** 14 818 819 820### OH_Drawing_FontArguments 821 822``` 823typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments 824``` 825 826**描述** 827 828用于描述字型参数。 829 830**起始版本:** 13 831 832### OH_Drawing_RecordCmd 833 834``` 835typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd 836``` 837 838**描述** 839 840定义录制指令类, 用于存储录制指令的集合。 841 842**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 843 844**起始版本:** 13 845 846 847### OH_Drawing_RecordCmdUtils 848 849``` 850typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils 851``` 852 853**描述** 854 855定义指令录制工具,用于生成录制指令。 856 857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 858 859**起始版本:** 13 860 861 862### OH_Drawing_ErrorCode 863 864``` 865typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode 866``` 867 868 869**描述** 870 871枚举本模块可能产生的错误码。 872 873**起始版本:** 12 874 875 876### OH_Drawing_PathOpMode 877 878``` 879typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode 880``` 881 882**描述** 883 884路径操作类型枚举。 885 886**起始版本:** 12 887 888 889### OH_Drawing_PathMeasureMatrixFlags 890 891``` 892typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags 893``` 894 895**描述** 896 897路径测量获取相应矩阵信息维度枚举。 898 899**起始版本:** 12 900 901 902### OH_Drawing_RegionOpMode 903 904``` 905typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode 906``` 907 908**描述** 909 910区域操作类型枚举。 911 912**起始版本:** 12 913 914 915### OH_Drawing_ImageFilter 916 917``` 918typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter 919``` 920 921**描述** 922 923定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 924 925**起始版本:** 12 926 927 928### OH_Drawing_Filter 929 930``` 931typedef struct OH_Drawing_Filter OH_Drawing_Filter 932``` 933 934**描述** 935 936定义一个滤波器,用于存储颜色滤波器,模板滤波器和图像滤波器。 937 938**起始版本:** 11 939 940### OH_Drawing_AlphaFormat 941 942``` 943typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat 944``` 945 946**描述** 947 948用于描述位图像素的透明度分量。 949 950**起始版本:** 8 951 952 953### OH_Drawing_Bitmap 954 955``` 956typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap 957``` 958 959**描述** 960 961定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 962 963**起始版本:** 8 964 965 966### OH_Drawing_BitmapFormat 967 968``` 969typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat 970``` 971 972**描述** 973 974结构体用于描述位图像素的格式,包括颜色类型和透明度类型 975 976**起始版本:** 8 977 978 979### OH_Drawing_BlendMode 980 981``` 982typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode 983``` 984 985**描述** 986 987混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 988 989为简洁起见,我们使用以下缩写: 990 991s : source,源的缩写。 992 993d : destination,目标的缩写。 994 995sa : source alpha,源透明度的缩写。 996 997da : destination alpha,目标透明度的缩写。 998 999计算结果用如下缩写表示: 1000 1001r : 如果4个通道的计算方式相同,用r表示。 1002 1003ra : 如果只操作透明度通道,用ra表示。 1004 1005rc : 如果操作3个颜色通道,用rc表示。 1006 1007**起始版本:** 11 1008 1009 1010### OH_Drawing_BlurType 1011 1012``` 1013typedef enum OH_Drawing_BlurType OH_Drawing_BlurType 1014``` 1015 1016**描述** 1017 1018蒙版滤波器模糊操作类型的枚举。 1019 1020**起始版本:** 11 1021 1022 1023### OH_Drawing_BreakStrategy 1024 1025``` 1026typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy 1027``` 1028 1029**描述** 1030 1031文本的中断策略枚举 1032 1033**起始版本:** 11 1034 1035 1036### OH_Drawing_Brush 1037 1038``` 1039typedef struct OH_Drawing_Brush OH_Drawing_Brush 1040``` 1041 1042**描述** 1043 1044定义为画刷,画刷用于描述填充图形的样式和颜色。 1045 1046**起始版本:** 8 1047 1048 1049### OH_Drawing_Canvas 1050 1051``` 1052typedef struct OH_Drawing_Canvas OH_Drawing_Canvas 1053``` 1054 1055**描述** 1056 1057定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 1058 1059**起始版本:** 8 1060 1061 1062### OH_Drawing_CanvasClipOp 1063 1064``` 1065typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp 1066``` 1067 1068**描述** 1069 1070画布裁剪方式的枚举集合。 1071 1072**起始版本:** 11 1073 1074 1075### OH_Drawing_CanvasShadowFlags 1076 1077``` 1078typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags 1079``` 1080 1081**描述** 1082 1083阴影标志枚举。 1084 1085**起始版本:** 12 1086 1087 1088### OH_Drawing_ColorFilter 1089 1090``` 1091typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter 1092``` 1093 1094**描述** 1095 1096定义颜色滤波器,传入一个颜色并返回一个新的颜色。 1097 1098**起始版本:** 11 1099 1100 1101### OH_Drawing_ColorFormat 1102 1103``` 1104typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat 1105``` 1106 1107**描述** 1108 1109用于描述位图像素的存储格式。 1110 1111**起始版本:** 8 1112 1113 1114### OH_Drawing_ColorSpace 1115 1116``` 1117typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace 1118``` 1119 1120**描述** 1121 1122定义色彩空间,用于解释颜色信息。 1123 1124**起始版本:** 12 1125 1126 1127### OH_Drawing_Corner_Radii 1128 1129``` 1130typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii 1131``` 1132 1133**描述** 1134 1135定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 1136 1137**起始版本:** 12 1138 1139 1140### OH_Drawing_CornerPos 1141 1142``` 1143typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos 1144``` 1145 1146**描述** 1147 1148用于描述圆角位置的枚举。 1149 1150**起始版本:** 12 1151 1152 1153### OH_Drawing_EllipsisModal 1154 1155``` 1156typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal 1157``` 1158 1159**描述** 1160 1161省略号样式枚举 1162 1163**起始版本:** 11 1164 1165 1166### OH_Drawing_FilterMode 1167 1168``` 1169typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode 1170``` 1171 1172**描述** 1173 1174过滤模式枚举。 1175 1176**起始版本:** 12 1177 1178 1179### OH_Drawing_Font 1180 1181``` 1182typedef struct OH_Drawing_Font OH_Drawing_Font 1183``` 1184 1185**描述** 1186 1187用于描述字体。 1188 1189**起始版本:** 11 1190 1191 1192### OH_Drawing_Font_Metrics 1193 1194``` 1195typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics 1196``` 1197 1198**描述** 1199 1200定义字体度量信息的结构体。 1201 1202**起始版本:** 12 1203 1204 1205### OH_Drawing_FontAdjustInfo 1206 1207``` 1208typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo 1209``` 1210 1211**描述** 1212 1213字重映射信息结构体。 1214 1215**起始版本:** 12 1216 1217 1218### OH_Drawing_FontAliasInfo 1219 1220``` 1221typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo 1222``` 1223 1224**描述** 1225 1226别名字体信息结构体。 1227 1228**起始版本:** 12 1229 1230 1231### OH_Drawing_FontCollection 1232 1233``` 1234typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection 1235``` 1236 1237**描述** 1238 1239用于加载字体。 1240 1241**起始版本:** 8 1242 1243 1244### OH_Drawing_FontConfigInfo 1245 1246``` 1247typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo 1248``` 1249 1250**描述** 1251 1252系统字体配置信息结构体。 1253 1254**起始版本:** 12 1255 1256 1257### OH_Drawing_FontDescriptor 1258 1259``` 1260typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor 1261``` 1262 1263**描述** 1264 1265描述系统字体详细信息的结构体。 1266 1267**起始版本:** 12 1268 1269 1270### OH_Drawing_FontEdging 1271 1272``` 1273typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging 1274``` 1275 1276**描述** 1277 1278字形边缘效果类型枚举。 1279 1280**起始版本:** 12 1281 1282 1283### OH_Drawing_FontFallbackGroup 1284 1285``` 1286typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup 1287``` 1288 1289**描述** 1290 1291备用字体集信息结构体。 1292 1293**起始版本:** 12 1294 1295 1296### OH_Drawing_FontFallbackInfo 1297 1298``` 1299typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo 1300``` 1301 1302**描述** 1303 1304备用字体信息结构体。 1305 1306**起始版本:** 12 1307 1308 1309### OH_Drawing_FontGenericInfo 1310 1311``` 1312typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo 1313``` 1314 1315**描述** 1316 1317系统所支持的通用字体集信息结构体。 1318 1319**起始版本:** 12 1320 1321 1322### OH_Drawing_FontHinting 1323 1324``` 1325typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting 1326``` 1327 1328**描述** 1329 1330字形轮廓效果类型枚举。 1331 1332**起始版本:** 12 1333 1334 1335### OH_Drawing_FontMgr 1336 1337``` 1338typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr 1339``` 1340 1341**描述** 1342 1343定义字体管理类, 用于字体管理。 1344 1345**起始版本:** 12 1346 1347 1348### OH_Drawing_FontParser 1349 1350``` 1351typedef struct OH_Drawing_FontParser OH_Drawing_FontParser 1352``` 1353 1354**描述** 1355 1356用来解析系统字体文件。 1357 1358**起始版本:** 12 1359 1360 1361### OH_Drawing_FontStyleSet 1362 1363``` 1364typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet 1365``` 1366 1367**描述** 1368 1369定义字体样式集, 用于字体样式族匹配。 1370 1371**起始版本:** 12 1372 1373 1374### OH_Drawing_FontStyleStruct 1375 1376``` 1377typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct 1378``` 1379 1380**描述** 1381 1382定义字体样式信息的结构体。 1383 1384**起始版本:** 12 1385 1386 1387### OH_Drawing_GpuContext 1388 1389``` 1390typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext 1391``` 1392 1393**描述** 1394 1395定义图形处理器上下文,用于描述图形处理器后端上下文。 1396 1397**起始版本:** 12 1398 1399 1400### OH_Drawing_GpuContextOptions 1401 1402``` 1403typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions 1404``` 1405 1406**描述** 1407 1408定义有关图形处理器上下文的选项。 1409 1410**起始版本:** 12 1411 1412 1413### OH_Drawing_Image 1414 1415``` 1416typedef struct OH_Drawing_Image OH_Drawing_Image 1417``` 1418 1419**描述** 1420 1421定义一个用于描述绘制二维像素数组的图片。 1422 1423**起始版本:** 12 1424 1425 1426### OH_Drawing_Image_Info 1427 1428``` 1429typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info 1430``` 1431 1432**描述** 1433 1434定义图片信息结构体。 1435 1436**起始版本:** 12 1437 1438 1439### OH_Drawing_LineMetrics 1440 1441``` 1442typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics 1443``` 1444 1445**描述** 1446 1447文字行位置信息。 1448 1449**起始版本:** 12 1450 1451 1452### OH_Drawing_MaskFilter 1453 1454``` 1455typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter 1456``` 1457 1458**描述** 1459 1460定义模板滤波器,用于在绘制模板前对其进行转换。 1461 1462**起始版本:** 11 1463 1464 1465### OH_Drawing_Matrix 1466 1467``` 1468typedef struct OH_Drawing_Matrix OH_Drawing_Matrix 1469``` 1470 1471**描述** 1472 1473定义一个矩阵,用于描述坐标变换。 1474 1475**起始版本:** 11 1476 1477 1478### OH_Drawing_MemoryStream 1479 1480``` 1481typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream 1482``` 1483 1484**描述** 1485 1486用于描述内存流。 1487 1488**起始版本:** 12 1489 1490 1491### OH_Drawing_MipmapMode 1492 1493``` 1494typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode 1495``` 1496 1497**描述** 1498 1499多级渐远纹理模式枚举。 1500 1501**起始版本:** 12 1502 1503 1504### OH_Drawing_Path 1505 1506``` 1507typedef struct OH_Drawing_Path OH_Drawing_Path 1508``` 1509 1510**描述** 1511 1512定义为路径,路径用于自定义各种形状。 1513 1514**起始版本:** 8 1515 1516 1517### OH_Drawing_PathAddMode 1518 1519``` 1520typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode 1521``` 1522 1523**描述** 1524 1525用于指定路径添加模式的枚举类型。 1526 1527**起始版本:** 12 1528 1529 1530### OH_Drawing_PathDirection 1531 1532``` 1533typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection 1534``` 1535 1536**描述** 1537 1538添加闭合轮廓方向枚举。 1539 1540**起始版本:** 12 1541 1542 1543### OH_Drawing_PathEffect 1544 1545``` 1546typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect 1547``` 1548 1549**描述** 1550 1551定义一个路径效果,用于影响描边路径。 1552 1553**起始版本:** 12 1554 1555 1556### OH_Drawing_PathFillType 1557 1558``` 1559typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType 1560``` 1561 1562**描述** 1563 1564定义路径的填充类型枚举。 1565 1566**起始版本:** 12 1567 1568 1569### OH_Drawing_Pen 1570 1571``` 1572typedef struct OH_Drawing_Pen OH_Drawing_Pen 1573``` 1574 1575**描述** 1576 1577定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 1578 1579**起始版本:** 8 1580 1581 1582### OH_Drawing_PenLineCapStyle 1583 1584``` 1585typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle 1586``` 1587 1588**描述** 1589 1590枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 1591 1592**起始版本:** 8 1593 1594 1595### OH_Drawing_PenLineJoinStyle 1596 1597``` 1598typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle 1599``` 1600 1601**描述** 1602 1603枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 1604 1605**起始版本:** 8 1606 1607 1608### OH_Drawing_PixelMap 1609 1610``` 1611typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap 1612``` 1613 1614**描述** 1615 1616定义像素图,用于包装图像框架支持的真实像素图。 1617 1618**起始版本:** 12 1619 1620 1621### OH_Drawing_PlaceholderSpan 1622 1623``` 1624typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan 1625``` 1626 1627**描述** 1628 1629用于描述位占位符跨度的结构体 1630 1631**起始版本:** 11 1632 1633 1634### OH_Drawing_PlaceholderVerticalAlignment 1635 1636``` 1637typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment 1638``` 1639 1640**描述** 1641 1642占位符垂直对齐枚举 1643 1644**起始版本:** 11 1645 1646 1647### OH_Drawing_Point 1648 1649``` 1650typedef struct OH_Drawing_Point OH_Drawing_Point 1651``` 1652 1653**描述** 1654 1655定义一个点,用于描述坐标点。 1656 1657**起始版本:** 11 1658 1659 1660### OH_Drawing_Point2D 1661 1662``` 1663typedef struct OH_Drawing_Point2D OH_Drawing_Point2D 1664``` 1665 1666**描述** 1667 1668定义一个二维的坐标点。 1669 1670**起始版本:** 12 1671 1672 1673### OH_Drawing_Point3D 1674 1675``` 1676typedef struct OH_Drawing_Point3D OH_Drawing_Point3D 1677``` 1678 1679**描述** 1680 1681定义一个三维的坐标点。 1682 1683**起始版本:** 12 1684 1685 1686### OH_Drawing_PointMode 1687 1688``` 1689typedef enum OH_Drawing_PointMode OH_Drawing_PointMode 1690``` 1691 1692**描述** 1693 1694绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 1695 1696**起始版本:** 12 1697 1698 1699### OH_Drawing_PositionAndAffinity 1700 1701``` 1702typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity 1703``` 1704 1705**描述** 1706 1707用于接收字体的位置和亲和性 1708 1709**起始版本:** 11 1710 1711 1712### OH_Drawing_Range 1713 1714``` 1715typedef struct OH_Drawing_Range OH_Drawing_Range 1716``` 1717 1718**描述** 1719 1720用于接收字体的起始位置和结束位置 1721 1722**起始版本:** 11 1723 1724 1725### OH_Drawing_Rect 1726 1727``` 1728typedef struct OH_Drawing_Rect OH_Drawing_Rect 1729``` 1730 1731**描述** 1732 1733用于描述矩形。 1734 1735**起始版本:** 11 1736 1737 1738### OH_Drawing_RectHeightStyle 1739 1740``` 1741typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle 1742``` 1743 1744**描述** 1745 1746矩形框高度样式枚举 1747 1748**起始版本:** 11 1749 1750 1751### OH_Drawing_RectStyle_Info 1752 1753``` 1754typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info 1755``` 1756 1757**描述** 1758 1759定义矩形框样式结构体。 1760 1761**起始版本:** 12 1762 1763 1764### OH_Drawing_RectWidthStyle 1765 1766``` 1767typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle 1768``` 1769 1770**描述** 1771 1772矩形框宽度样式枚举 1773 1774**起始版本:** 11 1775 1776 1777### OH_Drawing_Region 1778 1779``` 1780typedef struct OH_Drawing_Region OH_Drawing_Region 1781``` 1782 1783**描述** 1784 1785定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 1786 1787**起始版本:** 12 1788 1789 1790### OH_Drawing_RoundRect 1791 1792``` 1793typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect 1794``` 1795 1796**描述** 1797 1798用于描述圆角矩形。 1799 1800**起始版本:** 11 1801 1802 1803### OH_Drawing_RunBuffer 1804 1805``` 1806typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer 1807``` 1808 1809**描述** 1810 1811结构体用于描述一块内存,描述文字和位置信息。 1812 1813**起始版本:** 11 1814 1815 1816### OH_Drawing_SamplingOptions 1817 1818``` 1819typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions 1820``` 1821 1822**描述** 1823 1824定义一个采样选项,用于描述图片、位图等图像的采样方法。 1825 1826**起始版本:** 12 1827 1828 1829### OH_Drawing_ScaleToFit 1830 1831``` 1832typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit 1833``` 1834 1835**描述** 1836 1837矩阵缩放方式枚举。 1838 1839**起始版本:** 12 1840 1841 1842### OH_Drawing_ShaderEffect 1843 1844``` 1845typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect 1846``` 1847 1848**描述** 1849 1850定义一个着色器,用于描述绘制内容的源颜色。 1851 1852**起始版本:** 11 1853 1854 1855### OH_Drawing_ShadowLayer 1856 1857``` 1858typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer 1859``` 1860 1861**描述** 1862 1863定义一个阴影层,用于描述绘制内容的阴影层。 1864 1865**起始版本:** 12 1866 1867 1868### OH_Drawing_SrcRectConstraint 1869 1870``` 1871typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint 1872``` 1873 1874**描述** 1875 1876源矩形区域约束类型枚举。 1877 1878**起始版本:** 12 1879 1880 1881### OH_Drawing_StrutStyle 1882 1883``` 1884typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle 1885``` 1886 1887**描述** 1888 1889用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 1890 1891**起始版本:** 12 1892 1893 1894### OH_Drawing_Surface 1895 1896``` 1897typedef struct OH_Drawing_Surface OH_Drawing_Surface 1898``` 1899 1900**描述** 1901 1902定义surface,用于管理画布绘制的内容。 1903 1904**起始版本:** 12 1905 1906 1907### OH_Drawing_TextBlob 1908 1909``` 1910typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob 1911``` 1912 1913**描述** 1914 1915定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 1916 1917**起始版本:** 11 1918 1919 1920### OH_Drawing_TextBlobBuilder 1921 1922``` 1923typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder 1924``` 1925 1926**描述** 1927 1928定义文本构建器,用于构建文本。 1929 1930**起始版本:** 11 1931 1932 1933### OH_Drawing_TextBox 1934 1935``` 1936typedef struct OH_Drawing_TextBox OH_Drawing_TextBox 1937``` 1938 1939**描述** 1940 1941用于接收文本框的矩形大小、方向和数量大小 1942 1943**起始版本:** 11 1944 1945 1946### OH_Drawing_TextDecorationStyle 1947 1948``` 1949typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle 1950``` 1951 1952**描述** 1953 1954文本装饰样式枚举 1955 1956**起始版本:** 11 1957 1958 1959### OH_Drawing_TextEncoding 1960 1961``` 1962typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding 1963``` 1964 1965**描述** 1966 1967文本编码类型枚举。 1968 1969**起始版本:** 12 1970 1971 1972### OH_Drawing_TextShadow 1973 1974``` 1975typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow 1976``` 1977 1978**描述** 1979 1980用于管理文本阴影。 1981 1982**起始版本:** 12 1983 1984 1985### OH_Drawing_TextStyle 1986 1987``` 1988typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle 1989``` 1990 1991**描述** 1992 1993用于管理字体颜色、装饰等。 1994 1995**起始版本:** 8 1996 1997 1998### OH_Drawing_TileMode 1999 2000``` 2001typedef enum OH_Drawing_TileMode OH_Drawing_TileMode 2002``` 2003 2004**描述** 2005 2006着色器效果平铺模式的枚举。 2007 2008**起始版本:** 11 2009 2010 2011### OH_Drawing_Typeface 2012 2013``` 2014typedef struct OH_Drawing_Typeface OH_Drawing_Typeface 2015``` 2016 2017**描述** 2018 2019用于描述字形。 2020 2021**起始版本:** 11 2022 2023 2024### OH_Drawing_Typography 2025 2026``` 2027typedef struct OH_Drawing_Typography OH_Drawing_Typography 2028``` 2029 2030**描述** 2031 2032用于管理排版的布局和显示等。 2033 2034**起始版本:** 8 2035 2036 2037### OH_Drawing_TypographyCreate 2038 2039``` 2040typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate 2041``` 2042 2043**描述** 2044 2045用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 2046 2047**起始版本:** 8 2048 2049 2050### OH_Drawing_TypographyStyle 2051 2052``` 2053typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle 2054``` 2055 2056**描述** 2057 2058用于管理排版风格,如文字方向等。 2059 2060**起始版本:** 8 2061 2062 2063### OH_Drawing_VertexMode 2064 2065``` 2066typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode 2067``` 2068 2069**描述** 2070 2071用于指定如何解释给定顶点的几何形状的枚举类型。 2072 2073**起始版本:** 12 2074 2075 2076### OH_Drawing_WordBreakType 2077 2078``` 2079typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType 2080``` 2081 2082**描述** 2083 2084单词的断词方式枚举 2085 2086**起始版本:** 11 2087 2088 2089## 枚举类型说明 2090 2091### OH_Drawing_SystemFontType 2092 2093``` 2094enum OH_Drawing_SystemFontType 2095``` 2096 2097**描述** 2098 2099字体类型的枚举。 2100 2101**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 2102 2103**起始版本:** 14 2104 2105| 枚举值 | 描述 | 2106| -------- | -------- | 2107| ALL | 所有字体类型 | 2108| GENERIC | 系统字体类型 | 2109| STYLISH | 风格字体类型 | 2110| INSTALLED | 用户已安装字体类型 | 2111 2112### OH_Drawing_ErrorCode 2113 2114``` 2115enum OH_Drawing_ErrorCode 2116``` 2117 2118**描述** 2119 2120枚举本模块可能产生的错误码。 2121 2122**起始版本:** 12 2123 2124| 枚举值 | 描述 | 2125| -------- | -------- | 2126| OH_DRAWING_SUCCESS | 操作成功完成。 | 2127| OH_DRAWING_ERROR_NO_PERMISSION | 权限校验失败。 | 2128| OH_DRAWING_ERROR_INVALID_PARAMETER | 无效的输入参数,如参数中传入了NULL。 | 2129| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | 输入参数不在有效的范围内。 | 2130| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | 内存分配失败。 | 2131 2132### OH_Drawing_PathMeasureMatrixFlags 2133 2134``` 2135enum OH_Drawing_PathMeasureMatrixFlags 2136``` 2137 2138**描述** 2139 2140路径测量获取相应矩阵信息维度枚举。 2141 2142**起始版本:** 12 2143 2144| 枚举值 | 描述 | 2145| -------- | -------- | 2146| GET_POSITION_MATRIX | 获取位置信息对应的矩阵。 | 2147| GET_TANGENT_MATRIX | 获取切线信息对应的矩阵。 | 2148| GET_POSITION_AND_TANGENT_MATRIX | 获取位置和切线信息对应的矩阵。 | 2149 2150 2151### OH_Drawing_PathOpMode 2152 2153``` 2154enum OH_Drawing_PathOpMode 2155``` 2156 2157**描述** 2158 2159路径操作类型枚举。 2160 2161**起始版本:** 12 2162 2163| 枚举值 | 描述 | 2164| -------- | -------- | 2165| PATH_OP_MODE_DIFFERENCE | 差集操作。 | 2166| PATH_OP_MODE_INTERSECT | 交集操作。 | 2167| PATH_OP_MODE_UNION | 并集操作。 | 2168| PATH_OP_MODE_XOR | 异或操作。 | 2169| PATH_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 | 2170 2171 2172### OH_Drawing_RegionOpMode 2173 2174``` 2175enum OH_Drawing_RegionOpMode 2176``` 2177 2178**描述** 2179 2180区域操作类型枚举。 2181 2182**起始版本:** 12 2183 2184| 枚举值 | 描述 | 2185| -------- | -------- | 2186| REGION_OP_MODE_DIFFERENCE | 差集操作。 | 2187| REGION_OP_MODE_INTERSECT | 交集操作。 | 2188| REGION_OP_MODE_UNION | 并集操作。 | 2189| REGION_OP_MODE_XOR | 异或操作。 | 2190| REGION_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 | 2191| REGION_OP_MODE_REPLACE | 替换操作。 | 2192 2193 2194### OH_Drawing_AlphaFormat 2195 2196``` 2197enum OH_Drawing_AlphaFormat 2198``` 2199 2200**描述** 2201 2202用于描述位图像素的透明度分量。 2203 2204**起始版本:** 8 2205 2206| 枚举值 | 描述 | 2207| -------- | -------- | 2208| ALPHA_FORMAT_UNKNOWN | 未知格式 | 2209| ALPHA_FORMAT_OPAQUE | 位图无透明度 | 2210| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以 | 2211| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以 | 2212 2213 2214### OH_Drawing_BlendMode 2215 2216``` 2217enum OH_Drawing_BlendMode 2218``` 2219 2220**描述** 2221 2222混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 2223 2224为简洁起见,我们使用以下缩写: 2225 2226s : source,源的缩写。 2227 2228d : destination,目标的缩写。 2229 2230sa : source alpha,源透明度的缩写。 2231 2232da : destination alpha,目标透明度的缩写。 2233 2234计算结果用如下缩写表示: 2235 2236r : 如果4个通道的计算方式相同,用r表示。 2237 2238ra : 如果只操作透明度通道,用ra表示。 2239 2240rc : 如果操作3个颜色通道,用rc表示。 2241 2242**起始版本:** 11 2243 2244| 枚举值 | 描述 | 2245| -------- | -------- | 2246| BLEND_MODE_CLEAR | 清除模式,r = 0. | 2247| BLEND_MODE_SRC | r = s(result的4个通道,都等于source的4个通道,即结果等于源。) | 2248| BLEND_MODE_DST | r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) | 2249| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. | 2250| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. | 2251| BLEND_MODE_SRC_IN | r = s \* da. | 2252| BLEND_MODE_DST_IN | r = d \* sa. | 2253| BLEND_MODE_SRC_OUT | r = s \* (1 - da). | 2254| BLEND_MODE_DST_OUT | r = d \* (1 - sa). | 2255| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). | 2256| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). | 2257| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). | 2258| BLEND_MODE_PLUS | r = min(s + d, 1). | 2259| BLEND_MODE_MODULATE | r = s \* d. | 2260| BLEND_MODE_SCREEN | 滤色模式,r = s + d - s \* d. | 2261| BLEND_MODE_OVERLAY | 叠加模式 | 2262| BLEND_MODE_DARKEN | 变暗模式,rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d. | 2263| BLEND_MODE_LIGHTEN | 变亮模式,rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d. | 2264| BLEND_MODE_COLOR_DODGE | 颜色减淡模式 | 2265| BLEND_MODE_COLOR_BURN | 颜色加深模式 | 2266| BLEND_MODE_HARD_LIGHT | 强光模式 | 2267| BLEND_MODE_SOFT_LIGHT | 柔光模式 | 2268| BLEND_MODE_DIFFERENCE | 差值模式,rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d. | 2269| BLEND_MODE_EXCLUSION | 排除模式,rc = s + d - two(s \* d), ra = s + (1 - sa) \* d. | 2270| BLEND_MODE_MULTIPLY | 正片叠底,r = s \* (1 - da) + d \* (1 - sa) + s \* d. | 2271| BLEND_MODE_HUE | 色相模式 | 2272| BLEND_MODE_SATURATION | 饱和度模式 | 2273| BLEND_MODE_COLOR | 颜色模式 | 2274| BLEND_MODE_LUMINOSITY | 亮度模式 | 2275 2276 2277### OH_Drawing_BlurType 2278 2279``` 2280enum OH_Drawing_BlurType 2281``` 2282 2283**描述** 2284 2285蒙版滤波器模糊操作类型的枚举。 2286 2287**起始版本:** 11 2288 2289| 枚举值 | 描述 | 2290| -------- | -------- | 2291| NORMAL | 内外模糊。 | 2292| SOLID | 内部实体,外部模糊。 | 2293| OUTER | 内部空白,外部模糊。 | 2294| INNER | 内部模糊,外部空白。 | 2295 2296 2297### OH_Drawing_BreakStrategy 2298 2299``` 2300enum OH_Drawing_BreakStrategy 2301``` 2302 2303**描述** 2304 2305文本的中断策略枚举 2306 2307**起始版本:** 11 2308 2309| 枚举值 | 描述 | 2310| -------- | -------- | 2311| BREAK_STRATEGY_GREEDY | 贪心策略,换行时尽可能填满每一行 | 2312| BREAK_STRATEGY_HIGH_QUALITY | 高质量策略,换行时优先考虑文本的连续性 | 2313| BREAK_STRATEGY_BALANCED | 平衡策略,换行时在单词边界换行 | 2314 2315 2316### OH_Drawing_CanvasClipOp 2317 2318``` 2319enum OH_Drawing_CanvasClipOp 2320``` 2321 2322**描述** 2323 2324画布裁剪方式的枚举集合。 2325 2326**起始版本:** 11 2327 2328| 枚举值 | 描述 | 2329| -------- | -------- | 2330| DIFFERENCE | 将指定区域裁剪(取差集)。 | 2331| INTERSECT | 将指定区域保留(取交集)。 | 2332 2333 2334### OH_Drawing_CanvasShadowFlags 2335 2336``` 2337enum OH_Drawing_CanvasShadowFlags 2338``` 2339 2340**描述** 2341 2342阴影标志枚举。 2343 2344**起始版本:** 12 2345 2346| 枚举值 | 描述 | 2347| -------- | -------- | 2348| SHADOW_FLAGS_NONE | 无阴影标志。 | 2349| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | 遮挡物对象不透明标志。 | 2350| SHADOW_FLAGS_GEOMETRIC_ONLY | 不分析阴影标志。 | 2351| SHADOW_FLAGS_ALL | 使能以上所有阴影标志。 | 2352 2353 2354### OH_Drawing_ColorFormat 2355 2356``` 2357enum OH_Drawing_ColorFormat 2358``` 2359 2360**描述** 2361 2362用于描述位图像素的存储格式。 2363 2364**起始版本:** 8 2365 2366| 枚举值 | 描述 | 2367| -------- | -------- | 2368| COLOR_FORMAT_UNKNOWN | 未知格式. | 2369| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度 | 2370| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝 | 2371| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝 | 2372| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝 | 2373| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度 | 2374 2375 2376### OH_Drawing_CornerPos 2377 2378``` 2379enum OH_Drawing_CornerPos 2380``` 2381 2382**描述** 2383 2384用于描述圆角位置的枚举。 2385 2386**起始版本:** 12 2387 2388| 枚举值 | 描述 | 2389| -------- | -------- | 2390| CORNER_POS_TOP_LEFT | 左上角圆角位置。 | 2391| CORNER_POS_TOP_RIGHT | 右上角圆角位置。 | 2392| CORNER_POS_BOTTOM_RIGHT | 右下角圆角位置。 | 2393| CORNER_POS_BOTTOM_LEFT | 左下角圆角位置。 | 2394 2395 2396### OH_Drawing_EllipsisModal 2397 2398``` 2399enum OH_Drawing_EllipsisModal 2400``` 2401 2402**描述** 2403 2404省略号样式枚举 2405 2406**起始版本:** 11 2407 2408| 枚举值 | 描述 | 2409| -------- | -------- | 2410| ELLIPSIS_MODAL_HEAD | 头部模式,即省略号放在文本头部 | 2411| ELLIPSIS_MODAL_MIDDLE | 中部模式,即省略号放在文本中部 | 2412| ELLIPSIS_MODAL_TAIL | 尾部模式,即省略号放在文本尾部 | 2413 2414 2415### OH_Drawing_FilterMode 2416 2417``` 2418enum OH_Drawing_FilterMode 2419``` 2420 2421**描述** 2422 2423过滤模式枚举。 2424 2425**起始版本:** 12 2426 2427| 枚举值 | 描述 | 2428| -------- | -------- | 2429| FILTER_MODE_NEAREST | 邻近过滤模式 | 2430| FILTER_MODE_LINEAR | 线性过滤模式 | 2431 2432 2433### OH_Drawing_FontConfigInfoErrorCode 2434 2435``` 2436enum OH_Drawing_FontConfigInfoErrorCode 2437``` 2438 2439**描述** 2440 2441获取系统字体配置信息列表结果枚举。 2442 2443**起始版本:** 12 2444 2445| 枚举值 | 描述 | 2446| -------- | -------- | 2447| SUCCESS_FONT_CONFIG_INFO | 获取系统字体配置信息列表成功 | 2448| ERROR_FONT_CONFIG_INFO_UNKNOWN | 未知错误 | 2449| ERROR_FONT_CONFIG_INFO_PARSE_FILE | 解析系统配置文件失败 | 2450| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | 申请内存失败 | 2451| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | 拷贝字符串数据失败 | 2452 2453 2454### OH_Drawing_FontEdging 2455 2456``` 2457enum OH_Drawing_FontEdging 2458``` 2459 2460**描述** 2461 2462字形边缘效果类型枚举。 2463 2464**起始版本:** 12 2465 2466| 枚举值 | 描述 | 2467| -------- | -------- | 2468| FONT_EDGING_ALIAS | 无抗锯齿处理。 | 2469| FONT_EDGING_ANTI_ALIAS | 使用抗锯齿来平滑字形边缘。 | 2470| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | 使用次像素级别的抗锯齿来平滑字形边缘,可以获得更加平滑的字形渲染效果。 | 2471 2472 2473### OH_Drawing_FontHinting 2474 2475``` 2476enum OH_Drawing_FontHinting 2477``` 2478 2479**描述** 2480 2481字形轮廓效果类型枚举。 2482 2483**起始版本:** 12 2484 2485| 枚举值 | 描述 | 2486| -------- | -------- | 2487| FONT_HINTING_NONE | 不修改字形轮廓。 | 2488| FONT_HINTING_SLIGHT | 最小限度修改字形轮廓以改善对比度。 | 2489| FONT_HINTING_NORMAL | 修改字形轮廓以提高对比度。 | 2490| FONT_HINTING_FULL | 修改字形轮廓以获得最大对比度。 | 2491 2492 2493### OH_Drawing_FontStyle 2494 2495``` 2496enum OH_Drawing_FontStyle 2497``` 2498 2499**描述** 2500 2501区分字体是否为斜体 2502 2503| 枚举值 | 描述 | 2504| -------- | -------- | 2505| FONT_STYLE_NORMAL | 非斜体 | 2506| FONT_STYLE_ITALIC | 斜体 | 2507| FONT_STYLE_OBLIQUE | 倾斜字体<br/>自从<br/>12 | 2508 2509 2510### OH_Drawing_FontWeight 2511 2512``` 2513enum OH_Drawing_FontWeight 2514``` 2515 2516**描述** 2517 2518字重 2519 2520| 枚举值 | 描述 | 2521| -------- | -------- | 2522| FONT_WEIGHT_100 | 字重为thin | 2523| FONT_WEIGHT_200 | 字重为extra-light | 2524| FONT_WEIGHT_300 | 字重为light | 2525| FONT_WEIGHT_400 | 字重为normal/regular | 2526| FONT_WEIGHT_500 | 字重为medium | 2527| FONT_WEIGHT_600 | 字重为semi-bold | 2528| FONT_WEIGHT_700 | 字重为bold | 2529| FONT_WEIGHT_800 | 字重为extra-bold | 2530| FONT_WEIGHT_900 | 字重为black | 2531 2532 2533### OH_Drawing_FontWidth 2534 2535``` 2536enum OH_Drawing_FontWidth 2537``` 2538 2539**描述** 2540 2541字体宽度的枚举。 2542 2543**起始版本:** 12 2544 2545 2546### OH_Drawing_MipmapMode 2547 2548``` 2549enum OH_Drawing_MipmapMode 2550``` 2551 2552**描述** 2553 2554多级渐远纹理模式枚举。 2555 2556**起始版本:** 12 2557 2558| 枚举值 | 描述 | 2559| -------- | -------- | 2560| MIPMAP_MODE_NONE | 忽略多级渐远纹理级别 | 2561| MIPMAP_MODE_NEAREST | 邻近多级渐远级别采样 | 2562| MIPMAP_MODE_LINEAR | 两个邻近多级渐远纹理之间,线性插值采样 | 2563 2564 2565### OH_Drawing_PathAddMode 2566 2567``` 2568enum OH_Drawing_PathAddMode 2569``` 2570 2571**描述** 2572 2573用于指定路径添加模式的枚举类型。 2574 2575**起始版本:** 12 2576 2577| 枚举值 | 描述 | 2578| -------- | -------- | 2579| PATH_ADD_MODE_APPEND | 以追加的方式添加路径 | 2580| PATH_ADD_MODE_EXTEND | 如果之前的路径未闭合,则添加直线闭合路径 | 2581 2582 2583### OH_Drawing_PathDirection 2584 2585``` 2586enum OH_Drawing_PathDirection 2587``` 2588 2589**描述** 2590 2591添加闭合轮廓方向枚举。 2592 2593**起始版本:** 12 2594 2595| 枚举值 | 描述 | 2596| -------- | -------- | 2597| PATH_DIRECTION_CW | 顺时针方向添加闭合轮廓 | 2598| PATH_DIRECTION_CCW | 逆时针方向添加闭合轮廓 | 2599 2600 2601### OH_Drawing_PathFillType 2602 2603``` 2604enum OH_Drawing_PathFillType 2605``` 2606 2607**描述** 2608 2609定义路径的填充类型枚举。 2610 2611**起始版本:** 12 2612 2613| 枚举值 | 描述 | 2614| -------- | -------- | 2615| PATH_FILL_TYPE_WINDING | 绘制区域中的任意一点,向任意方向射出一条射线,对于射线和路径的所有交点,初始计数为0,遇到每个顺时针的交点(路径从射线的左边向右穿过),计数加1,遇到每个逆时针的交点(路径从射线的右边向左穿过),计数减1,若最终的计数结果为0,则认为这个点在路径内部,需要被涂色;若计数为0则不被涂色 | 2616| PATH_FILL_TYPE_EVEN_ODD | 绘制区域中的任意一点,向任意方向射出一条射线,若这条射线和路径相交的次数是奇数,则这个点被认为在路径内部,需要被涂色;若是偶数则不被涂色 | 2617| PATH_FILL_TYPE_INVERSE_WINDING | PATH_FILL_TYPE_WINDING 涂色规则取反 | 2618| PATH_FILL_TYPE_INVERSE_EVEN_ODD | PATH_FILL_TYPE_EVEN_ODD 涂色规则取反 | 2619 2620 2621### OH_Drawing_PenLineCapStyle 2622 2623``` 2624enum OH_Drawing_PenLineCapStyle 2625``` 2626 2627**描述** 2628 2629枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 2630 2631**起始版本:** 8 2632 2633| 枚举值 | 描述 | 2634| -------- | -------- | 2635| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 | 2636| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 | 2637| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 | 2638 2639 2640### OH_Drawing_PenLineJoinStyle 2641 2642``` 2643enum OH_Drawing_PenLineJoinStyle 2644``` 2645 2646**描述** 2647 2648枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 2649 2650**起始版本:** 8 2651 2652| 枚举值 | 描述 | 2653| -------- | -------- | 2654| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 | 2655| LINE_ROUND_JOIN | 转角类型为圆头 | 2656| LINE_BEVEL_JOIN | 转角类型为平头 | 2657 2658 2659### OH_Drawing_PlaceholderVerticalAlignment 2660 2661``` 2662enum OH_Drawing_PlaceholderVerticalAlignment 2663``` 2664 2665**描述** 2666 2667占位符垂直对齐枚举 2668 2669**起始版本:** 11 2670 2671| 枚举值 | 描述 | 2672| -------- | -------- | 2673| ALIGNMENT_OFFSET_AT_BASELINE | 偏移于基线对齐 | 2674| ALIGNMENT_ABOVE_BASELINE | 高于基线对齐 | 2675| ALIGNMENT_BELOW_BASELINE | 低于基线对齐 | 2676| ALIGNMENT_TOP_OF_ROW_BOX | 行框顶部对齐 | 2677| ALIGNMENT_BOTTOM_OF_ROW_BOX | 行框底部对齐 | 2678| ALIGNMENT_CENTER_OF_ROW_BOX | 行框中心对齐 | 2679 2680 2681### OH_Drawing_PointMode 2682 2683``` 2684enum OH_Drawing_PointMode 2685``` 2686 2687**描述** 2688 2689绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 2690 2691**起始版本:** 12 2692 2693| 枚举值 | 描述 | 2694| -------- | -------- | 2695| POINT_MODE_POINTS | 分别绘制每个点。 | 2696| POINT_MODE_LINES | 将每两个点绘制为线段。 | 2697| POINT_MODE_POLYGON | 将点阵列绘制为开放多边形。 | 2698 2699 2700### OH_Drawing_RectHeightStyle 2701 2702``` 2703enum OH_Drawing_RectHeightStyle 2704``` 2705 2706**描述** 2707 2708矩形框高度样式枚举 2709 2710**起始版本:** 11 2711 2712| 枚举值 | 描述 | 2713| -------- | -------- | 2714| RECT_HEIGHT_STYLE_TIGHT | 紧密样式 | 2715| RECT_HEIGHT_STYLE_MAX | 最大样式 | 2716| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | 包含行间距中间样式 | 2717| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | 包含行间距顶部样式 | 2718| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | 包含行间距底部样式 | 2719| RECT_HEIGHT_STYLE_STRUCT | 结构样式 | 2720 2721 2722### OH_Drawing_RectWidthStyle 2723 2724``` 2725enum OH_Drawing_RectWidthStyle 2726``` 2727 2728**描述** 2729 2730矩形框宽度样式枚举 2731 2732**起始版本:** 11 2733 2734| 枚举值 | 描述 | 2735| -------- | -------- | 2736| RECT_WIDTH_STYLE_TIGHT | 紧密样式 | 2737| RECT_WIDTH_STYLE_MAX | 最大样式 | 2738 2739 2740### OH_Drawing_ScaleToFit 2741 2742``` 2743enum OH_Drawing_ScaleToFit 2744``` 2745 2746**描述** 2747 2748矩阵缩放方式枚举。 2749 2750**起始版本:** 12 2751 2752| 枚举值 | 描述 | 2753| -------- | -------- | 2754| SCALE_TO_FIT_FILL | 按水平轴和垂直轴缩放以填充目标矩形。 | 2755| SCALE_TO_FIT_START | 缩放并对齐到左侧和顶部。 | 2756| SCALE_TO_FIT_CENTER | 缩放并居中对齐。 | 2757| SCALE_TO_FIT_END | 缩放并向右和向下对齐。 | 2758 2759 2760### OH_Drawing_SrcRectConstraint 2761 2762``` 2763enum OH_Drawing_SrcRectConstraint 2764``` 2765 2766**描述** 2767 2768源矩形区域约束类型枚举。 2769 2770**起始版本:** 12 2771 2772| 枚举值 | 描述 | 2773| -------- | -------- | 2774| STRICT_SRC_RECT_CONSTRAINT | 严格约束,源矩形区域必须完全包含在图像中 | 2775| FAST_SRC_RECT_CONSTRAINT | 快速约束,源矩形区域可以部分位于图像之外 | 2776 2777 2778### OH_Drawing_TextAlign 2779 2780``` 2781enum OH_Drawing_TextAlign 2782``` 2783 2784**描述** 2785 2786文字对齐方式 2787 2788| 枚举值 | 描述 | 2789| -------- | -------- | 2790| TEXT_ALIGN_LEFT | 左对齐 | 2791| TEXT_ALIGN_RIGHT | 右对齐 | 2792| TEXT_ALIGN_CENTER | 居中对齐 | 2793| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 | 2794| TEXT_ALIGN_START | 当OH_Drawing_TextDirection是TEXT_DIRECTION_LTR时, TEXT_ALIGN_START和TEXT_ALIGN_LEFT相同; 类似地,当OH_Drawing_TextDirection是TEXT_DIRECTION_RTL时, TEXT_ALIGN_START和TEXT_ALIGN_RIGHT相同。 | 2795| TEXT_ALIGN_END | 当OH_Drawing_TextDirection是TEXT_DIRECTION_LTR时, TEXT_ALIGN_END和TEXT_ALIGN_RIGHT相同; 类似地,当OH_Drawing_TextDirection是TEXT_DIRECTION_RTL时, TEXT_ALIGN_END和TEXT_ALIGN_LEFT相同。 | 2796 2797 2798### OH_Drawing_TextBaseline 2799 2800``` 2801enum OH_Drawing_TextBaseline 2802``` 2803 2804**描述** 2805 2806基线位置 2807 2808| 枚举值 | 描述 | 2809| -------- | -------- | 2810| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 | 2811| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 | 2812 2813 2814### OH_Drawing_TextDecoration 2815 2816``` 2817enum OH_Drawing_TextDecoration 2818``` 2819 2820**描述** 2821 2822文本装饰 2823 2824| 枚举值 | 描述 | 2825| -------- | -------- | 2826| TEXT_DECORATION_NONE | 无装饰 | 2827| TEXT_DECORATION_UNDERLINE | 下划线 | 2828| TEXT_DECORATION_OVERLINE | 上划线 | 2829| TEXT_DECORATION_LINE_THROUGH | 删除线 | 2830 2831 2832### OH_Drawing_TextDecorationStyle 2833 2834``` 2835enum OH_Drawing_TextDecorationStyle 2836``` 2837 2838**描述** 2839 2840文本装饰样式枚举 2841 2842**起始版本:** 11 2843 2844| 枚举值 | 描述 | 2845| -------- | -------- | 2846| TEXT_DECORATION_STYLE_SOLID | 实心样式 | 2847| TEXT_DECORATION_STYLE_DOUBLE | 双重样式 | 2848| TEXT_DECORATION_STYLE_DOTTED | 圆点样式 | 2849| TEXT_DECORATION_STYLE_DASHED | 虚线样式 | 2850| TEXT_DECORATION_STYLE_WAVY | 波浪样式 | 2851 2852 2853### OH_Drawing_TextDirection 2854 2855``` 2856enum OH_Drawing_TextDirection 2857``` 2858 2859**描述** 2860 2861文字方向 2862 2863| 枚举值 | 描述 | 2864| -------- | -------- | 2865| TEXT_DIRECTION_RTL | 方向:从右到左 | 2866| TEXT_DIRECTION_LTR | 方向:从左到右 | 2867 2868 2869### OH_Drawing_TextEncoding 2870 2871``` 2872enum OH_Drawing_TextEncoding 2873``` 2874 2875**描述** 2876 2877文本编码类型枚举。 2878 2879**起始版本:** 12 2880 2881| 枚举值 | 描述 | 2882| -------- | -------- | 2883| TEXT_ENCODING_UTF8 | 单字节,表示UTF-8或ASCII | 2884| TEXT_ENCODING_UTF16 | 双字节,表示大部分Unicode | 2885| TEXT_ENCODING_UTF32 | 四字节,表示所有Unicode | 2886| TEXT_ENCODING_GLYPH_ID | 双字节,表示字形索引 | 2887 2888 2889### OH_Drawing_TextHeightBehavior 2890 2891``` 2892enum OH_Drawing_TextHeightBehavior 2893``` 2894 2895**描述** 2896 2897文本高度修饰符模式枚举。 2898 2899**起始版本:** 12 2900 2901| 枚举值 | 描述 | 2902| -------- | -------- | 2903| TEXT_HEIGHT_ALL | 高度修饰符设置为段落中第一行和最后一行都上升 | 2904| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | 高度修饰符设置为禁止段落中第一行上升 | 2905| TEXT_HEIGHT_DISABLE_LAST_ASCENT | 高度修饰符设置为禁止段落中最后一行上升 | 2906| TEXT_HEIGHT_DISABLE_ALL | 高度修饰符设置为段落中第一行和最后一行都不上升 | 2907 2908 2909### OH_Drawing_TextStyleType 2910 2911``` 2912enum OH_Drawing_TextStyleType 2913``` 2914 2915**描述** 2916 2917文本样式类型枚举。 2918 2919**起始版本:** 12 2920 2921| 枚举值 | 描述 | 2922| -------- | -------- | 2923| TEXT_STYLE_NONE | 无文本样式 | 2924| TEXT_STYLE_ALL_ATTRIBUTES | 所有文本样式 | 2925| TEXT_STYLE_FONT | 字体样式 | 2926| TEXT_STYLE_FOREGROUND | 文本前景样式 | 2927| TEXT_STYLE_BACKGROUND | 文本背景样式 | 2928| TEXT_STYLE_SHADOW | 文本阴影样式 | 2929| TEXT_STYLE_DECORATIONS | 文本装饰样式 | 2930| TEXT_STYLE_LETTER_SPACING | 文本字符间距样式 | 2931| TEXT_STYLE_WORD_SPACING | 文本单词间距样式 | 2932 2933 2934### OH_Drawing_TileMode 2935 2936``` 2937enum OH_Drawing_TileMode 2938``` 2939 2940**描述** 2941 2942着色器效果平铺模式的枚举。 2943 2944**起始版本:** 11 2945 2946| 枚举值 | 描述 | 2947| -------- | -------- | 2948| CLAMP | 如果着色器效果超出其原始边界,则复制边缘颜色。 | 2949| REPEAT | 在水平和垂直方向上重复着色器效果图像。 | 2950| MIRROR | 水平和垂直重复着色器效果图像,交替镜像。 | 2951| DECAL | 只在原始区域内绘制,其他地方返回透明黑色。 | 2952 2953 2954### OH_Drawing_VertexMode 2955 2956``` 2957enum OH_Drawing_VertexMode 2958``` 2959 2960**描述** 2961 2962用于指定如何解释给定顶点的几何形状的枚举类型。 2963 2964**起始版本:** 12 2965 2966| 枚举值 | 描述 | 2967| -------- | -------- | 2968| VERTEX_MODE_TRIANGLES | 每三个顶点表示一个三角形,如果顶点数不是3的倍数,则多余的顶点会被忽略。 | 2969| VERTEX_MODE_TRIANGLESSTRIP | 相邻三个顶点表示一个三角形,每个新的顶点将与前两个顶点组成一个新的三角形。 | 2970| VERTEX_MODE_TRIANGLEFAN | 第一个顶点作为中心点,后续的每个顶点都与前一个顶点和中心点组成一个三角形。 | 2971 2972 2973### OH_Drawing_WordBreakType 2974 2975``` 2976enum OH_Drawing_WordBreakType 2977``` 2978 2979**描述** 2980 2981单词的断词方式枚举 2982 2983**起始版本:** 11 2984 2985| 枚举值 | 描述 | 2986| -------- | -------- | 2987| WORD_BREAK_TYPE_NORMAL | 常规方式 | 2988| WORD_BREAK_TYPE_BREAK_ALL | 全部中断方式 | 2989| WORD_BREAK_TYPE_BREAK_WORD | 单词中断方式 | 2990 2991 2992 2993## 函数说明 2994 2995### OH_Drawing_GetFontCollectionGlobalInstance() 2996 2997``` 2998OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance (void ) 2999``` 3000**描述** 3001 3002获取全局字体集对象OH_Drawing_FontCollection,可感知主题字信息,禁止释放该对象。 3003 3004**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3005 3006**起始版本:** 14 3007 3008**返回:** 3009 3010指向全局字体集对象的指针。 3011 3012### OH_Drawing_GetDrawingArraySize() 3013 3014``` 3015size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array* drawingArray) 3016``` 3017 3018**描述** 3019 3020获取传入类型为对象数组[OH_Drawing_Array](#oh_drawing_array)中的对象个数。 3021 3022**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3023 3024**起始版本:** 14 3025 3026**参数:** 3027 3028| 名称 | 描述 | 3029| -------- | -------- | 3030| drawingArray | 指向对象数组[OH_Drawing_Array](#oh_drawing_array)的指针。 | 3031 3032**返回:** 3033 3034数组中的对象个数。 3035 3036### OH_Drawing_DestroySystemFontFullNames() 3037 3038``` 3039void OH_Drawing_DestroySystemFontFullNames (OH_Drawing_Array* ) 3040``` 3041 3042**描述** 3043 3044释放通过字体类型获取的对应字体的字体名称数组占用的内存。 3045 3046**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3047 3048**起始版本:** 14 3049 3050**参数:** 3051 3052| 名称 | 描述 | 3053| -------- | -------- | 3054| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 | 3055 3056### OH_Drawing_GetSystemFontFullNameByIndex() 3057 3058``` 3059const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex (OH_Drawing_Array* , size_t ) 3060``` 3061 3062**描述** 3063 3064在字体名称数组中通过索引获取对应位置的字体名称。 3065 3066**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3067 3068**起始版本:** 14 3069 3070**参数:** 3071 3072| 名称 | 描述 | 3073| -------- | -------- | 3074| OH_Drawing_Array | 表示字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 | 3075| size_t | 数组的索引。 | 3076 3077**返回:** 3078 3079返回对应索引的字体名称[OH_Drawing_String](_o_h___drawing___string.md)的指针。 3080 3081### OH_Drawing_GetSystemFontFullNamesByType() 3082 3083``` 3084OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType (OH_Drawing_SystemFontType ) 3085``` 3086 3087**描述** 3088 3089根据字体类型获取对应字体的字体名称数组。 3090 3091**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3092 3093**起始版本:** 14 3094 3095**参数:** 3096 3097| 名称 | 描述 | 3098| -------- | -------- | 3099| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 | 3100 3101**返回:** 3102 3103返回对应字体类型的字体名称数组[OH_Drawing_Array](#oh_drawing_array)的指针。 3104 3105### OH_Drawing_GetFontDescriptorByFullName() 3106 3107``` 3108OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName (const OH_Drawing_String* , OH_Drawing_SystemFontType ) 3109``` 3110 3111**描述** 3112 3113根据字体名称和字体类型获取指定的字体描述符,支持系统字体、风格字体和用户已安装字体。 字体描述符是描述字体特征的一种数据结构,它包含了定义字体外观和属性的详细信息。 3114 3115**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3116 3117**起始版本:** 14 3118 3119**参数:** 3120 3121| 名称 | 描述 | 3122| -------- | -------- | 3123| [OH_Drawing_String](_o_h___drawing___string.md) | 表示指向字体名称字符串[OH_Drawing_String](_o_h___drawing___string.md)的指针。 | 3124| OH_Drawing_SystemFontType | 表示字体类型的枚举值[OH_Drawing_SystemFontType](#oh_drawing_systemfonttype)。 | 3125 3126**返回:** 3127 3128指向字体描述符对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。 3129 3130### OH_Drawing_TypefaceCreateFromFileWithArguments() 3131 3132``` 3133OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments ) 3134``` 3135 3136**描述** 3137 3138从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。 3139 3140**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3141 3142**起始版本:** 13 3143 3144**参数:** 3145 3146| 名称 | 描述 | 3147| -------- | -------- | 3148| path | 指向字体对象所在文件路径的指针。 | 3149| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 3150 3151**返回:** 3152 3153函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的路径无效。 3154 3155 3156### OH_Drawing_TypefaceCreateFromCurrent() 3157 3158``` 3159OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments ) 3160``` 3161 3162**描述** 3163 3164通过已存在的字体对象创建带有字型参数的字体对象。 3165 3166**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3167 3168**起始版本:** 13 3169 3170**参数:** 3171 3172| 名称 | 描述 | 3173| -------- | -------- | 3174| current | 指向字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)的指针。 | 3175| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 3176 3177**返回:** 3178 3179函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的字体对象不支持字型参数对象中描述的可变维度。 3180 3181 3182### OH_Drawing_FontArgumentsAddVariation() 3183 3184``` 3185OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value ) 3186``` 3187 3188**描述** 3189 3190给字型参数对象添加可变维度。 3191 3192**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3193 3194**起始版本:** 13 3195 3196**参数:** 3197 3198| 名称 | 描述 | 3199| -------- | -------- | 3200| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 3201| axis | 字型参数对象可变维度的标签,必须为4个ASCII字符。具体可支持的标签取决于加载的字体文件,如'wght'即为字重标签。 | 3202| value | 可变维度标签对应的取值。 | 3203 3204**返回:** 3205 3206函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments或axis任意一个为NULL或者axis的长度不为4。 3207 3208 3209### OH_Drawing_FontArgumentsCreate() 3210 3211``` 3212OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void) 3213``` 3214 3215**描述** 3216 3217用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 3218 3219**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3220 3221**起始版本:** 13 3222 3223**返回:** 3224 3225返回一个指针,指针指向创建的字型参数对象。 3226 3227 3228### OH_Drawing_FontArgumentsDestroy() 3229 3230``` 3231OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments) 3232``` 3233 3234**描述** 3235 3236用于销毁一个字型参数对象。 3237 3238**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3239 3240**起始版本:** 13 3241 3242**参数:** 3243 3244| 名称 | 描述 | 3245| -------- | -------- | 3246| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 3247 3248**返回:** 3249 3250函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments为NULL。 3251 3252 3253### OH_Drawing_TypographyGetLongestLineWithIndent() 3254 3255``` 3256double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* ) 3257``` 3258 3259**描述** 3260 3261获取最长行的宽度(该宽度包含当前行缩进的宽度),建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 3262 3263**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3264 3265**起始版本:** 13 3266 3267**参数:** 3268 3269| 名称 | 描述 | 3270| -------- | -------- | 3271| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 3272 3273**返回:** 3274 3275返回最长行的宽度(该宽度包含当前行缩进的宽度),单位:物理像素px。 3276 3277 3278 3279### OH_Drawing_RecordCmdDestroy() 3280 3281``` 3282OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd) 3283``` 3284 3285**描述** 3286 3287销毁录制指令对象,并回收该对象占有的内存。 3288 3289**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3290 3291**起始版本:** 13 3292 3293**参数:** 3294 3295| 名称 | 描述 | 3296| -------- | -------- | 3297| recordCmd | 指向对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 | 3298 3299**返回:** 3300 3301函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmd为空。 3302 3303 3304### OH_Drawing_RecordCmdUtilsBeginRecording() 3305 3306``` 3307OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas ) 3308``` 3309 3310**描述** 3311 3312开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。 3313 3314指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。 3315 3316**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3317 3318**起始版本:** 13 3319 3320**参数:** 3321 3322| 名称 | 描述 | 3323| -------- | -------- | 3324| recordCmdUtils | 指向录制工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3325| width | 画布的宽度。 | 3326| height | 画布的高度。 | 3327| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的二级指针,作为出参,开发者无需释放。 该画布对象不支持嵌套调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口。 | 3328 3329**返回:** 3330 3331函数返回执行错误码。 返回OH_DRAWING_SUCCESS, 表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER, 表示参数recordCmdUtils或者canvas为空。 当width和height小于等于0的时,也会返回OH_DRAWING_ERROR_INVALID_PARAMETER。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。 3332 3333 3334### OH_Drawing_RecordCmdUtilsCreate() 3335 3336``` 3337OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void ) 3338``` 3339 3340**描述** 3341 3342创建一个录制指令工具对象。 3343 3344**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3345 3346**起始版本:** 13 3347 3348**返回:** 3349 3350返回用于录制指令的工具对象。 3351 3352 3353### OH_Drawing_RecordCmdUtilsDestroy() 3354 3355``` 3356OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils) 3357``` 3358 3359**描述** 3360 3361销毁一个录制指令工具对象,并回收该对象占有的内存。 3362 3363**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3364 3365**起始版本:** 13 3366 3367**参数:** 3368 3369| 名称 | 描述 | 3370| -------- | -------- | 3371| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3372 3373**返回:** 3374 3375函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils为空。 3376 3377 3378### OH_Drawing_RecordCmdUtilsFinishRecording() 3379 3380``` 3381OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd ) 3382``` 3383 3384**描述** 3385 3386结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。 3387 3388指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 3389 3390**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3391 3392**起始版本:** 13 3393 3394**参数:** 3395 3396| 名称 | 描述 | 3397| -------- | -------- | 3398| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3399| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的二级指针,作为出参,开发者调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口绘制该对象。 需要调用[OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy)接口释放。 | 3400 3401**返回:** 3402 3403函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils或者recordCmd为空。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。 3404 3405 3406### OH_Drawing_CanvasDrawRecordCmd() 3407 3408``` 3409OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd ) 3410``` 3411 3412**描述** 3413 3414用于绘制录制指令对象。 3415 3416**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3417 3418**起始版本:** 13 3419 3420**参数:** 3421 3422| 名称 | 描述 | 3423| -------- | -------- | 3424| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针,仅支持录制类型画布。 | 3425| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 | 3426 3427**返回:** 3428 3429函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者recordCmd为空。 3430 3431 3432 3433### OH_Drawing_TypographyDestroyTextBox() 3434 3435``` 3436void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* ) 3437``` 3438 3439**描述** 3440 3441释放文本框占用的内存。 3442 3443**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3444 3445**起始版本:** 12 3446 3447**参数:** 3448 3449| 名称 | 描述 | 3450| -------- | -------- | 3451| OH_Drawing_TextBox | 指向文本框对象[OH_Drawing_TextBox](#oh_drawing_textbox)的指针。 | 3452 3453 3454### OH_Drawing_SetTextShadow() 3455 3456``` 3457void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius ) 3458``` 3459 3460**描述** 3461 3462设置字体阴影对象的参数。 3463 3464**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3465 3466**起始版本:** 12 3467 3468**参数:** 3469 3470| 名称 | 描述 | 3471| -------- | -------- | 3472| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 3473| color | 字体阴影的颜色,例如入参为0xAABBCCDD,AA代表透明度,BB代表红色分量的值,CC代表绿色分量的值,DD代表蓝色分量的值。 | 3474| OH_Drawing_Point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针,字体阴影基于当前文本的偏移位置。 | 3475| blurRadius | 模糊半径,浮点数,没有单位,值为0.0时表示没有模糊效果。 | 3476 3477 3478 3479### OH_Drawing_CanvasDrawSingleCharacter() 3480 3481``` 3482OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y ) 3483``` 3484 3485**描述** 3486 3487用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 3488 3489**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3490 3491**起始版本:** 12 3492 3493**参数:** 3494 3495| 名称 | 描述 | 3496| -------- | -------- | 3497| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3498| str | 待绘制的单个字符。可以传入字符串,但只会以UTF-8编码解析并绘制字符串中的首个字符。 | 3499| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3500| x | 字符对象基线左端点(靠近字符左下角)的横坐标。 | 3501| y | 字符对象基线左端点(靠近字符左下角)的纵坐标。 | 3502 3503**返回:** 3504 3505函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、str、font任意一个为NULL或者str的长度为0。 3506 3507 3508 3509### OH_Drawing_FontMeasureSingleCharacter() 3510 3511``` 3512OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth ) 3513``` 3514 3515**描述** 3516 3517用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 3518 3519**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3520 3521**起始版本:** 12 3522 3523**参数:** 3524 3525| 名称 | 描述 | 3526| -------- | -------- | 3527| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3528| str | 待测量的单个字符。可以传入字符串,但只会以UTF-8编码解析并测量字符串中的首个字符。 | 3529| textWidth | 用于存储得到的字符宽度。 | 3530 3531**返回:** 3532 3533函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font、str、textWidth任意一个为NULL或者str的长度为0。 3534 3535 3536 3537### OH_Drawing_TypographyPaintOnPath() 3538 3539``` 3540void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* , OH_Drawing_Canvas* , OH_Drawing_Path* , double , double ) 3541``` 3542 3543**描述** 3544 3545沿路径绘制文本。 3546 3547**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3548 3549**起始版本:** 12 3550 3551**参数:** 3552 3553| 名称 | 描述 | 3554| -------- | -------- | 3555| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 3556| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由[OH_Drawing_CanvasCreate](#oh_drawing_canvascreate)获取。 | 3557| OH_Drawing_Path | 指向OH_Drawing_Path对象的指针,由[OH_Drawing_PathCreate](#oh_drawing_pathcreate)获取。 | 3558| double | 沿路径方向偏置,从路径起点向前为正,向后为负。 | 3559| double | 沿路径垂直方向偏置,沿路径方向左侧为负,右侧为正。 | 3560 3561 3562### OH_Drawing_RoundRectOffset() 3563 3564``` 3565OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy ) 3566``` 3567 3568**描述** 3569 3570用于将圆角矩形沿x轴方向和y轴方向平移指定距离。 3571 3572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3573 3574**起始版本:** 12 3575 3576**参数:** 3577 3578| 名称 | 描述 | 3579| -------- | -------- | 3580| roundRect | 指向圆角矩形对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 | 3581| dx | x轴方向偏移量。 | 3582| dy | y轴方向偏移量。 | 3583 3584**返回:** 3585 3586函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数roundRect为空。 3587 3588 3589### OH_Drawing_PointGetX() 3590 3591``` 3592OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x ) 3593``` 3594 3595**描述** 3596 3597用于获取点的x轴坐标。 3598 3599**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3600 3601**起始版本:** 12 3602 3603**参数:** 3604 3605| 名称 | 描述 | 3606| -------- | -------- | 3607| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3608| x | 表示点的x轴坐标。 | 3609 3610**返回:** 3611 3612函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者x为空。 3613 3614 3615### OH_Drawing_PointGetY() 3616 3617``` 3618OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y ) 3619``` 3620 3621**描述** 3622 3623用于获取点的y轴坐标。 3624 3625**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3626 3627**起始版本:** 12 3628 3629**参数:** 3630 3631| 名称 | 描述 | 3632| -------- | -------- | 3633| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3634| y | 表示点的y轴坐标。 | 3635 3636**返回:** 3637 3638函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者y为空。 3639 3640 3641### OH_Drawing_PointSet() 3642 3643``` 3644OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y ) 3645``` 3646 3647**描述** 3648 3649用于设置点的x轴和y轴坐标。 3650 3651**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3652 3653**起始版本:** 12 3654 3655**参数:** 3656 3657| 名称 | 描述 | 3658| -------- | -------- | 3659| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3660| x | 表示点的x轴坐标。 | 3661| y | 表示点的y轴坐标。 | 3662 3663**返回:** 3664 3665函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point为空。 3666 3667 3668### OH_Drawing_FontMeasureText() 3669 3670``` 3671OH_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 ) 3672``` 3673 3674**描述** 3675 3676用于获取文本的宽度和边界框。 3677 3678**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3679 3680**起始版本:** 12 3681 3682**参数:** 3683 3684| 名称 | 描述 | 3685| -------- | -------- | 3686| font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3687| text | 指向文本的指针。 | 3688| byteLength | 表示以字节为单位的文本长度。 | 3689| encoding | 文本编码类型。 | 3690| bounds | 用于承载获取的边界框,可以为NULL。 | 3691| textWidth | 表示文本宽度。 | 3692 3693**返回:** 3694 3695函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font,text,textWidth至少有一个为空, 或者byteLength为0。 3696 3697 3698### OH_Drawing_CanvasClipRegion() 3699 3700``` 3701OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp ) 3702``` 3703 3704**描述** 3705 3706用于裁剪一个区域。 3707 3708**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3709 3710**起始版本:** 12 3711 3712**参数:** 3713 3714| 名称 | 描述 | 3715| -------- | -------- | 3716| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3717| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 3718| clipOp | 表示裁剪类型。 | 3719 3720**返回:** 3721 3722函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者region为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示clipOp不在枚举范围内。 3723 3724 3725### OH_Drawing_CanvasDrawColor() 3726 3727``` 3728OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode ) 3729``` 3730 3731**描述** 3732 3733用于使用指定的颜色及混合模式来填充整个画布。 3734 3735**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3736 3737**起始版本:** 12 3738 3739**参数:** 3740 3741| 名称 | 描述 | 3742| -------- | -------- | 3743| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3744| color | 表示指定的颜色。 | 3745| blendMode | 表示指定的混合模式。 | 3746 3747**返回:** 3748 3749函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示blendMode不在枚举范围内。 3750 3751 3752### OH_Drawing_CanvasGetImageInfo() 3753 3754``` 3755OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo ) 3756``` 3757 3758**描述** 3759 3760用于获取画布的图像信息。 3761 3762**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3763 3764**起始版本:** 12 3765 3766**参数:** 3767 3768| 名称 | 描述 | 3769| -------- | -------- | 3770| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3771| imageInfo | 指向图像信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 3772 3773**返回:** 3774 3775函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者imageInfo为空。 3776 3777 3778### OH_Drawing_CanvasIsClipEmpty() 3779 3780``` 3781OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty ) 3782``` 3783 3784**描述** 3785 3786用于判断裁剪后可绘制区域是否为空。 3787 3788**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3789 3790**起始版本:** 12 3791 3792**参数:** 3793 3794| 名称 | 描述 | 3795| -------- | -------- | 3796| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3797| isClipEmpty | 表示裁剪后可绘制区域是否为空。true表示为空,false表示不为空。 | 3798 3799**返回:** 3800 3801函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者isClipEmpty为空。 3802 3803 3804### OH_Drawing_CanvasDrawPoint() 3805 3806``` 3807OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point ) 3808``` 3809 3810**描述** 3811 3812用于画一个点。 3813 3814**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3815 3816**起始版本:** 12 3817 3818**参数:** 3819 3820| 名称 | 描述 | 3821| -------- | -------- | 3822| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3823| point | 指向点对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 | 3824 3825**返回:** 3826 3827函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者point为空。 3828 3829 3830### OH_Drawing_MatrixGetAll() 3831 3832``` 3833OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] ) 3834``` 3835 3836**描述** 3837 3838获取矩阵所有元素值。 3839 3840**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3841 3842**起始版本:** 12 3843 3844**参数:** 3845 3846| 名称 | 描述 | 3847| -------- | -------- | 3848| matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 3849| value | 用于存储得到的矩阵元素值的数组。 | 3850 3851**返回:** 3852 3853返回错误码。 返回OH_DRAWING_SUCCESS,表示成功获取矩阵的所有元素值。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示获取矩阵元素值失败,原因是矩阵对象或者存储矩阵元素值数组为空。 3854 3855 3856 3857### OH_Drawing_ErrorCodeGet() 3858 3859``` 3860OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet () 3861``` 3862 3863**描述** 3864 3865获取本模块的最近一次的错误码。当函数成功运行后,本函数返回的错误码不会被修改。 3866 3867**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3868 3869**起始版本:** 12 3870 3871**返回:** 3872 3873函数返回错误码枚举值。 3874 3875### OH_Drawing_BrushCopy() 3876 3877``` 3878OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush) 3879``` 3880 3881**描述** 3882 3883创建一个画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush),用于拷贝一个已有画刷对象。 3884 3885本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3886 3887brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3888 3889**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3890 3891**起始版本:** 12 3892 3893**参数:** 3894 3895| 名称 | 描述 | 3896| -------- | -------- | 3897| brush | 指向画刷对象的指针。 | 3898 3899**返回:** 3900 3901函数会返回一个指针,指针指向创建的画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是brush为NULL。 3902 3903 3904 3905### OH_Drawing_FilterSetImageFilter() 3906 3907``` 3908void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* ) 3909``` 3910 3911**描述** 3912 3913为滤波器对象设置图像滤波器对象。 3914 3915本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3916 3917OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3918 3919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3920 3921**起始版本:** 12 3922 3923**参数:** 3924 3925| 名称 | 描述 | 3926| -------- | -------- | 3927| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 3928| OH_Drawing_ImageFilter | 指示指向图像滤波器[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)对象的指针,为NULL表示清空滤波器对象中的图像滤波器效果。 | 3929 3930 3931### OH_Drawing_ImageFilterCreateBlur() 3932 3933``` 3934OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input ) 3935``` 3936 3937**描述** 3938 3939创建具有模糊效果的图像滤波器。 3940 3941**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3942 3943**起始版本:** 12 3944 3945**参数:** 3946 3947| 名称 | 描述 | 3948| -------- | -------- | 3949| sigmaX | 表示沿x轴方向上高斯模糊的方差。 | 3950| sigmaY | 表示沿y轴方向上高斯模糊的方差。 | 3951| OH_Drawing_TileMode | 图像滤波器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 3952| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 | 3953 3954**返回:** 3955 3956函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。 3957 3958 3959### OH_Drawing_ImageFilterCreateFromColorFilter() 3960 3961``` 3962OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input ) 3963``` 3964 3965**描述** 3966 3967创建具有颜色变换效果的图像滤波器。 3968 3969本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3970 3971colorFilter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3972 3973**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3974 3975**起始版本:** 12 3976 3977**参数:** 3978 3979| 名称 | 描述 | 3980| -------- | -------- | 3981| colorFilter | 指向具有颜色变换效果的颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)。 | 3982| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 | 3983 3984**返回:** 3985 3986函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是colorFilter为NULL。 3987 3988 3989### OH_Drawing_ImageFilterDestroy() 3990 3991``` 3992void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* ) 3993``` 3994 3995**描述** 3996 3997销毁图像滤波器对象并回收该对象占有内存。 3998 3999**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4000 4001**起始版本:** 12 4002 4003**参数:** 4004 4005| 名称 | 描述 | 4006| -------- | -------- | 4007| OH_Drawing_ImageFilter | 指向图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)的指针。 | 4008 4009 4010### OH_Drawing_MatrixMapPoints() 4011 4012``` 4013void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count ) 4014``` 4015 4016**描述** 4017 4018通过矩阵变换将源点数组映射到目标点数组。 4019 4020本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4021 4022OH_Drawing_Matrix、src、dst任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4023 4024**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4025 4026**起始版本:** 12 4027 4028**参数:** 4029 4030| 名称 | 描述 | 4031| -------- | -------- | 4032| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 4033| src | 源点数组。 | 4034| dst | 目标点数组,个数要与源点相等。 | 4035| count | 源点数组以及目标点数组的个数。 | 4036 4037 4038### OH_Drawing_MatrixMapRect() 4039 4040``` 4041bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst ) 4042``` 4043 4044**描述** 4045 4046将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 4047 4048本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4049 4050OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4051 4052**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4053 4054**起始版本:** 12 4055 4056**参数:** 4057 4058| 名称 | 描述 | 4059| -------- | -------- | 4060| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 4061| src | 源矩形。 | 4062| dst | 目标矩形。 | 4063 4064**返回:** 4065 4066函数返回源矩形与映射后的目标矩形是否相等。true表示相等,false表示不相等。 4067 4068 4069### OH_Drawing_PathAddPolygon() 4070 4071``` 4072void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed ) 4073``` 4074 4075**描述** 4076 4077向路径添加多边形。 4078 4079本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4080 4081path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4082 4083**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4084 4085**起始版本:** 12 4086 4087**参数:** 4088 4089| 名称 | 描述 | 4090| -------- | -------- | 4091| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4092| points | 表示多边形的顶点坐标数组。 | 4093| count | 表示多边形顶点坐标数组的大小。 | 4094| isClosed | 是否添加连接起始点和终止点的线,true表示添加,false表示不添加。 | 4095 4096 4097### OH_Drawing_PathAddCircle() 4098 4099``` 4100void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection ) 4101``` 4102 4103**描述** 4104 4105按指定方向,向路径添加圆形。 4106 4107本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4108 4109path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4110 4111radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE; 4112 4113OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4114 4115**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4116 4117**起始版本:** 12 4118 4119**参数:** 4120 4121| 名称 | 描述 | 4122| -------- | -------- | 4123| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4124| x | 表示圆心的x轴坐标。 | 4125| y | 表示圆心的y轴坐标。 | 4126| radius | 表示圆形的半径。 | 4127| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 4128 4129 4130### OH_Drawing_PathBuildFromSvgString() 4131 4132``` 4133bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str ) 4134``` 4135 4136**描述** 4137 4138解析SVG字符串表示的路径。 4139 4140本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4141 4142path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4143 4144**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4145 4146**起始版本:** 12 4147 4148**参数:** 4149 4150| 名称 | 描述 | 4151| -------- | -------- | 4152| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4153| str | 表示SVG字符串。 | 4154 4155**返回:** 4156 4157函数返回解析SVG字符串是否成功。true表示成功,false表示不成功。 4158 4159 4160### OH_Drawing_PathGetBounds() 4161 4162``` 4163void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect* ) 4164``` 4165 4166**描述** 4167 4168获取包含路径的最小边界框。 4169 4170本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4171 4172OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4173 4174**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4175 4176**起始版本:** 12 4177 4178**参数:** 4179 4180| 名称 | 描述 | 4181| -------- | -------- | 4182| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4183| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 4184 4185 4186### OH_Drawing_PathIsClosed() 4187 4188``` 4189bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed ) 4190``` 4191 4192**描述** 4193 4194获取路径是否闭合。 4195 4196本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4197 4198path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4199 4200**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4201 4202**起始版本:** 12 4203 4204**参数:** 4205 4206| 名称 | 描述 | 4207| -------- | -------- | 4208| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4209| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4210 4211**返回:** 4212 4213返回路径是否闭合。true表示路径的测量结果为已闭合,false表示路径的测量结果为未闭合。 4214 4215 4216### OH_Drawing_PathGetPositionTangent() 4217 4218``` 4219bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent ) 4220``` 4221 4222**描述** 4223 4224获取距路径起始点指定距离的坐标点和切线值。 4225 4226本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4227 4228path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4229 4230**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4231 4232**起始版本:** 12 4233 4234**参数:** 4235 4236| 名称 | 描述 | 4237| -------- | -------- | 4238| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4239| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4240| distance | 表示距离起始点的距离。 | 4241| position | 表示距路径起始点指定距离的坐标点。 | 4242| tangent | 表示距路径起始点指定距离的切线值。 | 4243 4244**返回:** 4245 4246返回测量是否成功。true表示成功,false表示失败。 4247 4248 4249### OH_Drawing_PathOp() 4250 4251``` 4252bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op ) 4253``` 4254 4255**描述** 4256 4257将两个路径按照指定的路径操作类型合并。 4258 4259本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4260 4261path、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4262 4263op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4264 4265**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4266 4267**起始版本:** 12 4268 4269**参数:** 4270 4271| 名称 | 描述 | 4272| -------- | -------- | 4273| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,操作完成后的路径结果将会保存在此路径对象中。 | 4274| other | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4275| op | 路径操作枚举类型,支持可选的具体模式可见[OH_Drawing_PathOpMode](#oh_drawing_pathopmode)枚举。 | 4276 4277**返回:** 4278 4279返回操作后的路径是否为空。true表示路径不为空,false表示路径为空。 4280 4281 4282### OH_Drawing_PathGetMatrix() 4283 4284``` 4285bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag ) 4286``` 4287 4288**描述** 4289 4290获取距路径起始点指定距离的相应变换矩阵。 4291 4292本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4293 4294path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4295 4296flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4297 4298**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4299 4300**起始版本:** 12 4301 4302**参数:** 4303 4304| 名称 | 描述 | 4305| -------- | -------- | 4306| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4307| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4308| distance | 表示距离起始点的距离。 | 4309| matrix | 表示要获取的变换矩阵。 | 4310| flag | 矩阵信息维度枚举,支持可选的具体模式可见[OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)枚举。 | 4311 4312**返回:** 4313 4314返回获取变换矩阵是否成功。true表示获取成功,false表示获取失败,失败的原因可能是path为NULL或者长度为0。 4315 4316 4317### OH_Drawing_PenGetFillPath() 4318 4319``` 4320bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix* ) 4321``` 4322 4323**描述** 4324 4325获取使用画笔绘制的源路径轮廓,并用目标路径表示。 4326 4327本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4328 4329OH_Drawing_Pen、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4330 4331**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4332 4333**起始版本:** 12 4334 4335**参数:** 4336 4337| 名称 | 描述 | 4338| -------- | -------- | 4339| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 4340| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4341| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4342| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,推荐使用NULL。 | 4343| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,推荐使用NULL, 默认是一个单位矩阵。 | 4344 4345**返回:** 4346 4347获取目标路径是否成功。true表示获取成功,false表示获取失败。 4348 4349 4350### OH_Drawing_PenCopy() 4351 4352``` 4353OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen) 4354``` 4355 4356**描述** 4357 4358创建一个画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen),用于拷贝一个已有画笔对象。 4359 4360本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4361 4362pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4363 4364**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4365 4366**起始版本:** 12 4367 4368**参数:** 4369 4370| 名称 | 描述 | 4371| -------- | -------- | 4372| pen | 指向画笔对象的指针。 | 4373 4374**返回:** 4375 4376函数会返回一个指针,指针指向创建的画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是pen为NULL。 4377 4378 4379### OH_Drawing_PixelMapGetFromNativePixelMap() 4380 4381``` 4382OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* ) 4383``` 4384 4385**描述** 4386 4387从图像框架定义的像素图对象中获取本模块定义的像素图对象。 4388 4389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4390 4391**起始版本:** 12 4392 4393**参数:** 4394 4395| 名称 | 描述 | 4396| -------- | -------- | 4397| NativePixelMap_ | 指向图像框架定义的像素图对象**NativePixelMap_**的指针。 | 4398 4399**返回:** 4400 4401函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是NativePixelMap_为NULL。 4402 4403 4404### OH_Drawing_PixelMapGetFromOhPixelMapNative() 4405 4406``` 4407OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* ) 4408``` 4409 4410**描述** 4411 4412从图像框架定义的像素图对象中获取本模块定义的像素图对象。 4413 4414**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4415 4416**起始版本:** 12 4417 4418**参数:** 4419 4420| 名称 | 描述 | 4421| -------- | -------- | 4422| OH_PixelmapNative | 指向图像框架定义的像素图对象**OH_PixelmapNative**的指针。 | 4423 4424**返回:** 4425 4426函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是OH_PixelmapNative为NULL。 4427 4428 4429### OH_Drawing_PixelMapDissolve() 4430 4431``` 4432void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* ) 4433``` 4434 4435**描述** 4436 4437解除本模块定义的像素图对象和图像框架定义的像素图对象之间的关系,该关系通过调用 [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap)或[OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative)建立。 4438 4439**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4440 4441**起始版本:** 12 4442 4443**参数:** 4444 4445| 名称 | 描述 | 4446| -------- | -------- | 4447| OH_Drawing_PixelMap | 指向像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 | 4448 4449 4450### OH_Drawing_RectJoin() 4451 4452``` 4453bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 4454``` 4455 4456**描述** 4457 4458将两个矩形取并集。 4459 4460本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4461 4462rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4463 4464**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4465 4466**起始版本:** 12 4467 4468**参数:** 4469 4470| 名称 | 描述 | 4471| -------- | -------- | 4472| rect | 指向矩形对象的指针。 | 4473| other | 指向矩形对象的指针。 | 4474 4475**返回:** 4476 4477返回两个矩形取并集的结果。true表示成功,false表示失败,失败的原因可能是两个矩形至少有一个为NULL或者other矩形大小为空。 4478 4479 4480### OH_Drawing_RegionContains() 4481 4482``` 4483bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y ) 4484``` 4485 4486**描述** 4487 4488判断区域是否包含指定坐标点。 4489 4490本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4491 4492region为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4493 4494**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4495 4496**起始版本:** 12 4497 4498**参数:** 4499 4500| 名称 | 描述 | 4501| -------- | -------- | 4502| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4503| int32_t | 表示指定坐标点的x轴坐标。 | 4504| int32_t | 表示指定坐标点的y轴坐标。 | 4505 4506**返回:** 4507 4508返回区域是否包含指定坐标点。true表示区域包含该坐标点,false表示区域不包含该坐标点。 4509 4510 4511### OH_Drawing_RegionOp() 4512 4513``` 4514bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op ) 4515``` 4516 4517**描述** 4518 4519将两个区域按照指定的区域操作类型合并。 4520 4521本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4522 4523region、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4524 4525op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4526 4527**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4528 4529**起始版本:** 12 4530 4531**参数:** 4532 4533| 名称 | 描述 | 4534| -------- | -------- | 4535| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针,操作完成后的区域结果将会保存在此区域对象中。 | 4536| other | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4537| op | 区域操作枚举类型,支持可选的具体模式可见[OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)枚举。 | 4538 4539**返回:** 4540 4541返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。 4542 4543 4544### OH_Drawing_RegionSetPath() 4545 4546``` 4547bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip ) 4548``` 4549 4550**描述** 4551 4552给区域对象设置为指定区域内路径表示的范围。 4553 4554本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4555 4556region、path、clip任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4557 4558**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4559 4560**起始版本:** 12 4561 4562**参数:** 4563 4564| 名称 | 描述 | 4565| -------- | -------- | 4566| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4567| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4568| clip | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4569 4570**返回:** 4571 4572返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。 4573 4574 4575### OH_Drawing_ShaderEffectCreateColorShader() 4576 4577``` 4578OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color) 4579``` 4580 4581**描述** 4582 4583创建具有单一颜色的着色器。 4584 4585**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4586 4587**起始版本:** 12 4588 4589**参数:** 4590 4591| 名称 | 描述 | 4592| -------- | -------- | 4593| color | 表示着色器的颜色. | 4594 4595**返回:** 4596 4597函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。 4598 4599 4600### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix() 4601 4602``` 4603OH_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* ) 4604``` 4605 4606**描述** 4607 4608创建着色器,在两个指定点之间生成线性渐变。 4609 4610本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4611 4612startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4613 4614OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4615 4616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4617 4618**起始版本:** 12 4619 4620**参数:** 4621 4622| 名称 | 描述 | 4623| -------- | -------- | 4624| startPt | 表示渐变的起点。 | 4625| endPt | 表示渐变的终点。 | 4626| colors | 表示在两个点之间分布的颜色。 | 4627| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在起点和终点之间。 | 4628| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4629| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 4630| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4631 4632**返回:** 4633 4634函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。 4635 4636 4637### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix() 4638 4639``` 4640OH_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* ) 4641``` 4642 4643**描述** 4644 4645创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 4646 4647本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4648 4649centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4650 4651OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4652 4653**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4654 4655**起始版本:** 12 4656 4657**参数:** 4658 4659| 名称 | 描述 | 4660| -------- | -------- | 4661| centerPt | 表示渐变的圆心。 | 4662| radius | 表示渐变的半径。 | 4663| colors | 表示在径向上分布的颜色。 | 4664| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在径向上。 | 4665| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4666| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 4667| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4668 4669**返回:** 4670 4671函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是centerPt、colors至少一个为NULL。 4672 4673 4674### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient() 4675 4676``` 4677OH_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* ) 4678``` 4679 4680**描述** 4681 4682创建着色器,在给定两个圆之间生成渐变。 4683 4684本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4685 4686startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4687 4688OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4689 4690**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4691 4692**起始版本:** 12 4693 4694**参数:** 4695 4696| 名称 | 描述 | 4697| -------- | -------- | 4698| startPt | 表示渐变的起点圆心。 | 4699| startRadius | 表示渐变的起点半径。 | 4700| endPt | 表示渐变的终点圆心。 | 4701| endRadius | 表示渐变的终点半径。 | 4702| colors | 表示在两个圆之间分布的颜色。 | 4703| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在两个圆之间。 | 4704| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4705| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 4706| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4707 4708**返回:** 4709 4710函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。 4711 4712 4713 4714### OH_Drawing_TextBlobUniqueID() 4715 4716``` 4717uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* ) 4718``` 4719 4720**描述** 4721 4722获取文本的标识符,该标识符是唯一的非零值。 4723 4724本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4725 4726OH_Drawing_TextBlob为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4727 4728**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4729 4730**起始版本:** 12 4731 4732**参数:** 4733 4734| 名称 | 描述 | 4735| -------- | -------- | 4736| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 | 4737 4738**返回:** 4739 4740返回文本对象的标识符。 4741 4742 4743### OH_Drawing_PenSetShadowLayer() 4744 4745``` 4746void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* ) 4747``` 4748 4749**描述** 4750 4751设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 4752 4753本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4754 4755OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4756 4757**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4758 4759**起始版本:** 12 4760 4761**参数:** 4762 4763| 名称 | 描述 | 4764| -------- | -------- | 4765| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 4766| OH_Drawing_ShadowLayer | 指向阴影层对象[OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)的指针,为NULL表示清空阴影层效果。 | 4767 4768 4769### OH_Drawing_BrushSetShadowLayer() 4770 4771``` 4772void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* ) 4773``` 4774 4775**描述** 4776 4777为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 4778 4779本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4780 4781OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4782 4783**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4784 4785**起始版本:** 12 4786 4787**参数:** 4788 4789| 名称 | 描述 | 4790| -------- | -------- | 4791| OH_Drawing_Brush | 指向画刷对象的指针。 | 4792| OH_Drawing_ShadowLayer | 表示指向阴影层的指针,为NULL表示清空画刷的阴影层效果。 | 4793 4794 4795### OH_Drawing_ShadowLayerCreate() 4796 4797``` 4798OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color ) 4799``` 4800 4801**描述** 4802 4803创建一个阴影层对象。 4804 4805本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4806 4807blurRadius小于0等于时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4808 4809**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4810 4811**起始版本:** 12 4812 4813**参数:** 4814 4815| 名称 | 描述 | 4816| -------- | -------- | 4817| blurRadius | 表示阴影的半径,必须大于零。 | 4818| x | 表示x轴上的偏移点。 | 4819| y | 表示y轴上的偏移点。 | 4820| color | 表示阴影的颜色。 | 4821 4822**返回:** 4823 4824返回创建的阴影层对象的指针。 4825 4826 4827### OH_Drawing_ShadowLayerDestroy() 4828 4829``` 4830void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* ) 4831``` 4832 4833**描述** 4834 4835销毁阴影层对象,并收回该对象占用的内存。 4836 4837**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4838 4839**起始版本:** 12 4840 4841**参数:** 4842 4843| 名称 | 描述 | 4844| -------- | -------- | 4845| OH_Drawing_ShadowLayer | 表示指向阴影层对象的指针。 | 4846 4847 4848### OH_Drawing_FontSetBaselineSnap() 4849 4850``` 4851void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap ) 4852``` 4853 4854**描述** 4855 4856当前画布矩阵轴对齐时,将字形基线设置为是否与像素对齐。 4857 4858本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4859 4860OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4861 4862**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4863 4864**起始版本:** 12 4865 4866**参数:** 4867 4868| 名称 | 描述 | 4869| -------- | -------- | 4870| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4871| baselineSnap | 指示字形基线是否和像素对齐,true表示对齐,false表示不对齐。 | 4872 4873 4874### OH_Drawing_FontIsBaselineSnap() 4875 4876``` 4877bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* ) 4878``` 4879 4880**描述** 4881 4882当前画布矩阵轴对齐时,获取字形基线是否与像素对齐。 4883 4884本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4885 4886OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4887 4888**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4889 4890**起始版本:** 12 4891 4892**参数:** 4893 4894| 名称 | 描述 | 4895| -------- | -------- | 4896| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4897 4898**返回:** 4899 4900返回字形基线是否与像素对齐,true为对齐,false为没有对齐。 4901 4902 4903### OH_Drawing_FontSetEdging() 4904 4905``` 4906void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging ) 4907``` 4908 4909**描述** 4910 4911用于设置字形边缘效果。 4912 4913本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4914 4915OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4916 4917OH_Drawing_FontEdging不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4918 4919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4920 4921**起始版本:** 12 4922 4923**参数:** 4924 4925| 名称 | 描述 | 4926| -------- | -------- | 4927| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4928| OH_Drawing_FontEdging | 字形边缘效果。 | 4929 4930 4931### OH_Drawing_FontGetEdging() 4932 4933``` 4934OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* ) 4935``` 4936 4937**描述** 4938 4939获取字形边缘效果。 4940 4941本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4942 4943OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4944 4945**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4946 4947**起始版本:** 12 4948 4949**参数:** 4950 4951| 名称 | 描述 | 4952| -------- | -------- | 4953| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4954 4955**返回:** 4956 4957返回字形边缘效果。 4958 4959 4960 4961### OH_Drawing_FontSetForceAutoHinting() 4962 4963``` 4964void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting ) 4965``` 4966 4967**描述** 4968 4969用于设置是否自动调整字形轮廓。 4970 4971本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4972 4973OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4974 4975**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4976 4977**起始版本:** 12 4978 4979**参数:** 4980 4981| 名称 | 描述 | 4982| -------- | -------- | 4983| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4984| isForceAutoHinting | 是否自动调整字形轮廓,true为自动调整,false为不自动调整。 | 4985 4986 4987### OH_Drawing_FontIsForceAutoHinting() 4988 4989``` 4990bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* ) 4991``` 4992 4993**描述** 4994 4995获取字形轮廓是否自动调整。 4996 4997本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4998 4999OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5000 5001**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5002 5003**起始版本:** 12 5004 5005**参数:** 5006 5007| 名称 | 描述 | 5008| -------- | -------- | 5009| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5010 5011**返回:** 5012 5013返回字形轮廓是否自动调整,true为自动调整,false为不自动调整。 5014 5015 5016### OH_Drawing_FontSetSubpixel() 5017 5018``` 5019void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel ) 5020``` 5021 5022**描述** 5023 5024设置字形是否使用次像素渲染。 5025 5026本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5027 5028OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5029 5030**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5031 5032**起始版本:** 12 5033 5034**参数:** 5035 5036| 名称 | 描述 | 5037| -------- | -------- | 5038| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5039| isSubpixel | 字形是否使用次像素渲染,true为使用,false为不使用。 | 5040 5041 5042### OH_Drawing_FontIsSubpixel() 5043 5044``` 5045bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* ) 5046``` 5047 5048**描述** 5049 5050获取字形是否使用次像素渲染。 5051 5052本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5053 5054OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5055 5056**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5057 5058**起始版本:** 12 5059 5060**参数:** 5061 5062| 名称 | 描述 | 5063| -------- | -------- | 5064| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5065 5066**返回:** 5067 5068返回字形是否使用次像素渲染,true为使用,false为不使用。 5069 5070 5071### OH_Drawing_FontGetTextSize() 5072 5073``` 5074float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* ) 5075``` 5076 5077**描述** 5078 5079获取字形文本大小。 5080 5081本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5082 5083OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5084 5085**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5086 5087**起始版本:** 12 5088 5089**参数:** 5090 5091| 名称 | 描述 | 5092| -------- | -------- | 5093| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5094 5095**返回:** 5096 5097返回一个浮点数,表示字形文本大小。 5098 5099 5100### OH_Drawing_FontTextToGlyphs() 5101 5102``` 5103uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount ) 5104``` 5105 5106**描述** 5107 5108用于将文本转换为字形索引。 5109 5110本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5111 5112OH_Drawing_Font、text、glyphs任意一个为NULL或者byteLength等于0或者maxGlyphCount小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5113 5114**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5115 5116**起始版本:** 12 5117 5118**参数:** 5119 5120| 名称 | 描述 | 5121| -------- | -------- | 5122| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5123| text | 文本存储首地址。 | 5124| byteLength | 文本长度,单位为字节。 | 5125| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 5126| glyphs | 字形索引存储首地址,用于存储得到的字形索引。 | 5127| maxGlyphCount | 文本所表示的最大字符数量。 | 5128 5129**返回:** 5130 5131返回字形索引数量。 5132 5133 5134### OH_Drawing_FontGetWidths() 5135 5136``` 5137void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths ) 5138``` 5139 5140**描述** 5141 5142用于获取字符串中每个字符的宽度。 5143 5144本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5145 5146OH_Drawing_Font、glyphs、widths任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5147 5148**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5149 5150**起始版本:** 12 5151 5152**参数:** 5153 5154| 名称 | 描述 | 5155| -------- | -------- | 5156| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5157| glyphs | 字形索引存储首地址。 | 5158| count | 字形索引的数量。 | 5159| widths | 字形宽度存储首地址,用于存储得到的字形宽度。 | 5160 5161 5162### OH_Drawing_FontIsLinearText() 5163 5164``` 5165bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* ) 5166``` 5167 5168**描述** 5169 5170获取字形是否使用线性缩放。 5171 5172本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5173 5174OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5175 5176**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5177 5178**起始版本:** 12 5179 5180**参数:** 5181 5182| 名称 | 描述 | 5183| -------- | -------- | 5184| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5185 5186**返回:** 5187 5188返回字形是否使用线性缩放,true为使用,false为不使用。 5189 5190 5191### OH_Drawing_FontGetTextSkewX() 5192 5193``` 5194float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* ) 5195``` 5196 5197**描述** 5198 5199获取字形文本在x轴上的倾斜度。 5200 5201本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5202 5203OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5204 5205**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5206 5207**起始版本:** 12 5208 5209**参数:** 5210 5211| 名称 | 描述 | 5212| -------- | -------- | 5213| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5214 5215**返回:** 5216 5217返回一个浮点数,表示x轴上的文本倾斜度。 5218 5219 5220### OH_Drawing_FontIsFakeBoldText() 5221 5222``` 5223bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* ) 5224``` 5225 5226**描述** 5227 5228获取是否增加笔画宽度以接近粗体字形。 5229 5230本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5231 5232OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5233 5234**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5235 5236**起始版本:** 12 5237 5238**参数:** 5239 5240| 名称 | 描述 | 5241| -------- | -------- | 5242| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5243 5244**返回:** 5245 5246返回是否增加笔画宽度以接近粗体字形,true为增加,false为不增加。 5247 5248 5249### OH_Drawing_FontSetScaleX() 5250 5251``` 5252void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX ) 5253``` 5254 5255**描述** 5256 5257用于设置字形对象在x轴上的缩放比例。 5258 5259本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5260 5261OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5262 5263**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5264 5265**起始版本:** 12 5266 5267**参数:** 5268 5269| 名称 | 描述 | 5270| -------- | -------- | 5271| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5272| scaleX | 文本在x轴上的缩放比例。 | 5273 5274 5275### OH_Drawing_FontGetScaleX() 5276 5277``` 5278float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* ) 5279``` 5280 5281**描述** 5282 5283获取字形对象在x轴上的缩放比例。 5284 5285本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5286 5287OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5288 5289**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5290 5291**起始版本:** 12 5292 5293**参数:** 5294 5295| 名称 | 描述 | 5296| -------- | -------- | 5297| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5298 5299**返回:** 5300 5301返回文本在x轴上的缩放比例。 5302 5303 5304### OH_Drawing_FontSetHinting() 5305 5306``` 5307void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting ) 5308``` 5309 5310**描述** 5311 5312用于设置字形轮廓效果。 5313 5314本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5315 5316OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 5317 5318OH_Drawing_FontHinting不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 5319 5320**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5321 5322**起始版本:** 12 5323 5324**参数:** 5325 5326| 名称 | 描述 | 5327| -------- | -------- | 5328| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5329| OH_Drawing_FontHinting | 字形轮廓枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 | 5330 5331 5332### OH_Drawing_FontGetHinting() 5333 5334``` 5335OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* ) 5336``` 5337 5338**描述** 5339 5340获取字形轮廓效果枚举类型。 5341 5342本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5343 5344OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5345 5346**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5347 5348**起始版本:** 12 5349 5350**参数:** 5351 5352| 名称 | 描述 | 5353| -------- | -------- | 5354| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5355 5356**返回:** 5357 5358OH_Drawing_FontHinting 返回字形轮廓效果枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 5359 5360 5361### OH_Drawing_FontSetEmbeddedBitmaps() 5362 5363``` 5364void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps ) 5365``` 5366 5367**描述** 5368 5369用于设置字形是否转换成位图处理。 5370 5371本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5372 5373OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5374 5375**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5376 5377**起始版本:** 12 5378 5379**参数:** 5380 5381| 名称 | 描述 | 5382| -------- | -------- | 5383| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5384| isEmbeddedBitmaps | 设置字形是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 | 5385 5386 5387### OH_Drawing_FontIsEmbeddedBitmaps() 5388 5389``` 5390bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* ) 5391``` 5392 5393**描述** 5394 5395获取字形是否转换成位图处理。 5396 5397本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5398 5399OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5400 5401**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5402 5403**起始版本:** 12 5404 5405**参数:** 5406 5407| 名称 | 描述 | 5408| -------- | -------- | 5409| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5410 5411**返回:** 5412 5413返回字形是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 5414 5415 5416### OH_Drawing_BitmapBuild() 5417 5418``` 5419void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat* ) 5420``` 5421 5422**描述** 5423 5424用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 5425 5426本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5427 5428OH_Drawing_Bitmap、OH_Drawing_BitmapFormat任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5429 5430**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5431 5432**起始版本:** 8 5433 5434**参数:** 5435 5436| 名称 | 描述 | 5437| -------- | -------- | 5438| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5439| width | 位图要初始化设置的宽度。 | 5440| height | 位图要初始化设置的高度。 | 5441| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 | 5442 5443 5444### OH_Drawing_BitmapCreate() 5445 5446``` 5447OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void ) 5448``` 5449 5450**描述** 5451 5452用于创建一个位图对象。 5453 5454**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5455 5456**起始版本:** 8 5457 5458**返回:** 5459 5460函数会返回一个指针,指针指向创建的位图对象。 5461 5462 5463### OH_Drawing_BitmapCreateFromPixels() 5464 5465``` 5466OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes ) 5467``` 5468 5469**描述** 5470 5471用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 5472 5473本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5474 5475OH_Drawing_Image_Info、pixels任意一个为NULL或者rowBytes等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5476 5477**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5478 5479**起始版本:** 12 5480 5481**参数:** 5482 5483| 名称 | 描述 | 5484| -------- | -------- | 5485| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5486| pixels | 指向像素存储的内存首地址,内存由开发者申请,保证有效性。 | 5487| rowBytes | 每行像素的大小。 | 5488 5489**返回:** 5490 5491函数返回一个指针,指针指向创建的位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)。 5492 5493 5494### OH_Drawing_BitmapDestroy() 5495 5496``` 5497void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* ) 5498``` 5499 5500**描述** 5501 5502用于销毁位图对象并回收该对象占有内存。 5503 5504**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5505 5506**起始版本:** 8 5507 5508**参数:** 5509 5510| 名称 | 描述 | 5511| -------- | -------- | 5512| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5513 5514 5515### OH_Drawing_BitmapGetAlphaFormat() 5516 5517``` 5518OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* ) 5519``` 5520 5521**描述** 5522 5523用于获取指定位图的像素透明度分量。 5524 5525本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5526 5527OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5528 5529**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5530 5531**起始版本:** 12 5532 5533**参数:** 5534 5535| 名称 | 描述 | 5536| -------- | -------- | 5537| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5538 5539**返回:** 5540 5541函数返回位图的像素透明度分量,支持格式参考[OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)。 5542 5543 5544### OH_Drawing_BitmapGetColorFormat() 5545 5546``` 5547OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* ) 5548``` 5549 5550**描述** 5551 5552用于获取指定位图的像素存储格式。 5553 5554本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5555 5556OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5557 5558**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5559 5560**起始版本:** 12 5561 5562**参数:** 5563 5564| 名称 | 描述 | 5565| -------- | -------- | 5566| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5567 5568**返回:** 5569 5570函数返回位图的像素存储格式,支持格式参考[OH_Drawing_ColorFormat](#oh_drawing_colorformat)。 5571 5572 5573### OH_Drawing_BitmapGetHeight() 5574 5575``` 5576uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* ) 5577``` 5578 5579**描述** 5580 5581用于获取指定位图的高度。 5582 5583本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5584 5585OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5586 5587**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5588 5589**起始版本:** 8 5590 5591**参数:** 5592 5593| 名称 | 描述 | 5594| -------- | -------- | 5595| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5596 5597**返回:** 5598 5599函数返回位图的高度。 5600 5601 5602### OH_Drawing_BitmapGetImageInfo() 5603 5604``` 5605void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info* ) 5606``` 5607 5608**描述** 5609 5610用于获取指定位图的信息。 5611 5612本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5613 5614OH_Drawing_Bitmap、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5615 5616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5617 5618**起始版本:** 12 5619 5620**参数:** 5621 5622| 名称 | 描述 | 5623| -------- | -------- | 5624| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 5625| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5626 5627 5628### OH_Drawing_BitmapGetPixels() 5629 5630``` 5631void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* ) 5632``` 5633 5634**描述** 5635 5636用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 5637 5638本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5639 5640OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5641 5642**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5643 5644**起始版本:** 8 5645 5646**参数:** 5647 5648| 名称 | 描述 | 5649| -------- | -------- | 5650| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5651 5652**返回:** 5653 5654函数返回位图的像素地址。 5655 5656 5657### OH_Drawing_BitmapGetWidth() 5658 5659``` 5660uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* ) 5661``` 5662 5663**描述** 5664 5665用于获取指定位图的宽度。 5666 5667本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5668 5669OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5670 5671**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5672 5673**起始版本:** 8 5674 5675**参数:** 5676 5677| 名称 | 描述 | 5678| -------- | -------- | 5679| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5680 5681**返回:** 5682 5683函数返回位图的宽度。 5684 5685### OH_Drawing_BitmapReadPixels() 5686 5687``` 5688bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY ) 5689``` 5690 5691**描述** 5692 5693将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 5694 5695本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5696 5697OH_Drawing_Bitmap、dstInfo、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5698 5699**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5700 5701**起始版本:** 12 5702 5703**参数:** 5704 5705| 名称 | 描述 | 5706| -------- | -------- | 5707| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 5708| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5709| dstPixels | 目标像素存储区域。 | 5710| dstRowBytes | 目标像素数据每行的字节数,应大于或等于图片信息对象中的最小每行字节数。 | 5711| srcX | 源位图中读取像素数据的起始x轴坐标,应小于源位图的宽度。 | 5712| srcY | 源位图中读取像素数据的起始y轴坐标,应小于源位图的高度。 | 5713 5714**返回:** 5715 5716返回接口调用成功与否的结果。true表示复制成功,false表示复制失败。 5717 5718 5719### OH_Drawing_BrushCreate() 5720 5721``` 5722OH_Drawing_Brush* OH_Drawing_BrushCreate (void ) 5723``` 5724 5725**描述** 5726 5727用于创建一个画刷对象。 5728 5729**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5730 5731**起始版本:** 8 5732 5733**返回:** 5734 5735函数会返回一个指针,指针指向创建的画刷对象。 5736 5737 5738### OH_Drawing_BrushDestroy() 5739 5740``` 5741void OH_Drawing_BrushDestroy (OH_Drawing_Brush* ) 5742``` 5743 5744**描述** 5745 5746用于销毁画刷对象并回收该对象占有的内存。 5747 5748**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5749 5750**起始版本:** 8 5751 5752**参数:** 5753 5754| 名称 | 描述 | 5755| -------- | -------- | 5756| OH_Drawing_Brush | 指向画刷对象的指针。 | 5757 5758 5759### OH_Drawing_BrushGetAlpha() 5760 5761``` 5762uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* ) 5763``` 5764 5765**描述** 5766 5767获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 5768 5769本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5770 5771OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5772 5773**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5774 5775**起始版本:** 11 5776 5777**参数:** 5778 5779| 名称 | 描述 | 5780| -------- | -------- | 5781| OH_Drawing_Brush | 表示指向画刷对象的指针。 | 5782 5783**返回:** 5784 5785返回一个8位变量,用于表示透明度值。 5786 5787 5788### OH_Drawing_BrushGetColor() 5789 5790``` 5791uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* ) 5792``` 5793 5794**描述** 5795 5796用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 5797 5798本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5799 5800OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5801 5802**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5803 5804**起始版本:** 8 5805 5806**参数:** 5807 5808| 名称 | 描述 | 5809| -------- | -------- | 5810| OH_Drawing_Brush | 指向画刷对象的指针。 | 5811 5812**返回:** 5813 5814函数返回一个描述颜色的32位(ARGB)变量。 5815 5816 5817### OH_Drawing_BrushGetFilter() 5818 5819``` 5820void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 5821``` 5822 5823**描述** 5824 5825从画刷获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 5826 5827本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5828 5829OH_Drawing_Brush、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5830 5831**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5832 5833**起始版本:** 12 5834 5835**参数:** 5836 5837| 名称 | 描述 | 5838| -------- | -------- | 5839| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5840| OH_Drawing_Filter | 表示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 5841 5842 5843### OH_Drawing_BrushIsAntiAlias() 5844 5845``` 5846bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* ) 5847``` 5848 5849**描述** 5850 5851用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 5852 5853本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5854 5855OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5856 5857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5858 5859**起始版本:** 8 5860 5861**参数:** 5862 5863| 名称 | 描述 | 5864| -------- | -------- | 5865| OH_Drawing_Brush | 指向画刷对象的指针。 | 5866 5867**返回:** 5868 5869函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 5870 5871 5872### OH_Drawing_BrushReset() 5873 5874``` 5875void OH_Drawing_BrushReset (OH_Drawing_Brush* ) 5876``` 5877 5878**描述** 5879 5880将画刷重置至初始状态,清空所有已设置的属性。 5881 5882本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5883 5884OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5885 5886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5887 5888**起始版本:** 12 5889 5890**参数:** 5891 5892| 名称 | 描述 | 5893| -------- | -------- | 5894| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5895 5896 5897### OH_Drawing_BrushSetAlpha() 5898 5899``` 5900void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha ) 5901``` 5902 5903**描述** 5904 5905为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 5906 5907本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5908 5909OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5910 5911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5912 5913**起始版本:** 11 5914 5915**参数:** 5916 5917| 名称 | 描述 | 5918| -------- | -------- | 5919| OH_Drawing_Brush | 指向画刷对象的指针。 | 5920| alpha | 表示要设置的透明度值,是一个8位变量。 | 5921 5922 5923### OH_Drawing_BrushSetAntiAlias() 5924 5925``` 5926void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool ) 5927``` 5928 5929**描述** 5930 5931用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 5932 5933本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5934 5935OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5936 5937**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5938 5939**起始版本:** 8 5940 5941**参数:** 5942 5943| 名称 | 描述 | 5944| -------- | -------- | 5945| OH_Drawing_Brush | 指向画刷对象的指针。 | 5946| bool | 真为抗锯齿,假则不做抗锯齿处理。 | 5947 5948 5949### OH_Drawing_BrushSetBlendMode() 5950 5951``` 5952void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode ) 5953``` 5954 5955**描述** 5956 5957为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 5958 5959本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5960 5961OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 5962 5963OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 5964 5965**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5966 5967**起始版本:** 12 5968 5969**参数:** 5970 5971| 名称 | 描述 | 5972| -------- | -------- | 5973| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5974| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 5975 5976 5977### OH_Drawing_BrushSetColor() 5978 5979``` 5980void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color ) 5981``` 5982 5983**描述** 5984 5985用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 5986 5987本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5988 5989OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5990 5991**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5992 5993**起始版本:** 8 5994 5995**参数:** 5996 5997| 名称 | 描述 | 5998| -------- | -------- | 5999| OH_Drawing_Brush | 指向画刷对象的指针。 | 6000| color | 描述颜色的32位(ARGB)变量。 | 6001 6002 6003### OH_Drawing_BrushSetFilter() 6004 6005``` 6006void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 6007``` 6008 6009**描述** 6010 6011为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 6012 6013本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6014 6015OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6016 6017**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6018 6019**起始版本:** 11 6020 6021**参数:** 6022 6023| 名称 | 描述 | 6024| -------- | -------- | 6025| OH_Drawing_Brush | 指向画刷对象的指针。 | 6026| OH_Drawing_Filter | 表示指向滤波器对象的指针,为NULL表示清空画刷滤波器。 | 6027 6028 6029### OH_Drawing_BrushSetShaderEffect() 6030 6031``` 6032void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect* ) 6033``` 6034 6035**描述** 6036 6037为画刷设置着色器效果。 6038 6039本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6040 6041OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6042 6043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6044 6045**起始版本:** 11 6046 6047**参数:** 6048 6049| 名称 | 描述 | 6050| -------- | -------- | 6051| OH_Drawing_Brush | 指向画刷对象的指针。 | 6052| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针,为NULL表示清空画刷的着色器效果。 | 6053 6054 6055### OH_Drawing_CanvasAttachBrush() 6056 6057``` 6058void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 6059``` 6060 6061**描述** 6062 6063用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 6064 6065本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6066 6067OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6068 6069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6070 6071**起始版本:** 8 6072 6073**参数:** 6074 6075| 名称 | 描述 | 6076| -------- | -------- | 6077| OH_Drawing_Canvas | 指向画布对象的指针。 | 6078| OH_Drawing_Brush | 指向画刷对象的指针。 | 6079 6080 6081### OH_Drawing_CanvasAttachPen() 6082 6083``` 6084void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen* ) 6085``` 6086 6087**描述** 6088 6089用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 6090 6091本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6092 6093OH_Drawing_Canvas、OH_Drawing_Pen任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6094 6095**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6096 6097**起始版本:** 8 6098 6099**参数:** 6100 6101| 名称 | 描述 | 6102| -------- | -------- | 6103| OH_Drawing_Canvas | 指向画布对象的指针。 | 6104| OH_Drawing_Pen | 指向画笔对象的指针。 | 6105 6106 6107### OH_Drawing_CanvasBind() 6108 6109``` 6110void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap* ) 6111``` 6112 6113**描述** 6114 6115用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。绑定位图对象后的画布为非录制类型画布。 6116 6117本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6118 6119OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6120 6121**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6122 6123**起始版本:** 8 6124 6125**参数:** 6126 6127| 名称 | 描述 | 6128| -------- | -------- | 6129| OH_Drawing_Canvas | 指向画布对象的指针。 | 6130| OH_Drawing_Bitmap | 指向位图对象的指针。 | 6131 6132 6133### OH_Drawing_CanvasClear() 6134 6135``` 6136void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color ) 6137``` 6138 6139**描述** 6140 6141用于使用指定颜色去清空画布。 6142 6143本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6144 6145OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6146 6147**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6148 6149**起始版本:** 8 6150 6151**参数:** 6152 6153| 名称 | 描述 | 6154| -------- | -------- | 6155| OH_Drawing_Canvas | 指向画布对象的指针。 | 6156| color | 描述颜色的32位(ARGB)变量。 | 6157 6158 6159### OH_Drawing_CanvasClipPath() 6160 6161``` 6162void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6163``` 6164 6165**描述** 6166 6167用于裁剪一个自定义路径。 6168 6169本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6170 6171OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6172 6173clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6174 6175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6176 6177**起始版本:** 11 6178 6179**参数:** 6180 6181| 名称 | 描述 | 6182| -------- | -------- | 6183| OH_Drawing_Canvas | 指向画布对象的指针。 | 6184| OH_Drawing_Path | 指向路径对象的指针。 | 6185| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6186| doAntiAlias | 真为抗锯齿,假则不做抗锯齿处理。 | 6187 6188 6189### OH_Drawing_CanvasClipRect() 6190 6191``` 6192void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6193``` 6194 6195**描述** 6196 6197用于裁剪一个矩形。 6198 6199本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6200 6201OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6202 6203clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6204 6205**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6206 6207**起始版本:** 11 6208 6209**参数:** 6210 6211| 名称 | 描述 | 6212| -------- | -------- | 6213| OH_Drawing_Canvas | 指向画布对象的指针。 | 6214| OH_Drawing_Rect | 指向矩形对象的指针。 | 6215| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6216| doAntiAlias | 值为true则做抗锯齿处理,反之不做。 | 6217 6218### OH_Drawing_CanvasClipRoundRect() 6219 6220``` 6221void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6222``` 6223 6224**描述** 6225 6226用于裁剪一个圆角矩形。 6227 6228本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6229 6230OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6231 6232clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6233 6234**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6235 6236**起始版本:** 12 6237 6238**参数:** 6239 6240| 名称 | 描述 | 6241| -------- | -------- | 6242| OH_Drawing_Canvas | 指向画布对象的指针。 | 6243| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 6244| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6245| doAntiAlias | 表示是否需要做抗锯齿处理,值为true时为需要,为false时为不需要。 | 6246 6247### OH_Drawing_CanvasConcatMatrix() 6248 6249``` 6250void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 6251``` 6252 6253**描述** 6254 6255画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 6256 6257本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6258 6259OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6260 6261**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6262 6263**起始版本:** 12 6264 6265**参数:** 6266 6267| 名称 | 描述 | 6268| -------- | -------- | 6269| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6270| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 6271 6272 6273### OH_Drawing_CanvasCreate() 6274 6275``` 6276OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void ) 6277``` 6278 6279**描述** 6280 6281用于创建一个画布对象。 6282 6283**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6284 6285**起始版本:** 8 6286 6287**返回:** 6288 6289函数会返回一个指针,指针指向创建的画布对象。 6290 6291 6292### OH_Drawing_CanvasDestroy() 6293 6294``` 6295void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* ) 6296``` 6297 6298**描述** 6299 6300用于销毁画布对象并回收该对象占有的内存。 6301 6302**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6303 6304**起始版本:** 8 6305 6306**参数:** 6307 6308| 名称 | 描述 | 6309| -------- | -------- | 6310| OH_Drawing_Canvas | 指向画布对象的指针。 | 6311 6312 6313### OH_Drawing_CanvasDetachBrush() 6314 6315``` 6316void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* ) 6317``` 6318 6319**描述** 6320 6321用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 6322 6323本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6324 6325OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6326 6327**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6328 6329**起始版本:** 8 6330 6331**参数:** 6332 6333| 名称 | 描述 | 6334| -------- | -------- | 6335| OH_Drawing_Canvas | 指向画布对象的指针。 | 6336 6337 6338### OH_Drawing_CanvasDetachPen() 6339 6340``` 6341void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* ) 6342``` 6343 6344**描述** 6345 6346用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 6347 6348本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6349 6350OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6351 6352**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6353 6354**起始版本:** 8 6355 6356**参数:** 6357 6358| 名称 | 描述 | 6359| -------- | -------- | 6360| OH_Drawing_Canvas | 指向画布对象的指针。 | 6361 6362 6363### OH_Drawing_CanvasDrawArc() 6364 6365``` 6366void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 6367``` 6368 6369**描述** 6370 6371用于画一个弧。 6372 6373本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6374 6375OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6376 6377**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6378 6379**起始版本:** 11 6380 6381**参数:** 6382 6383| 名称 | 描述 | 6384| -------- | -------- | 6385| OH_Drawing_Canvas | 指向画布对象的指针。 | 6386| OH_Drawing_Rect | 指向矩形对象的指针。 | 6387| startAngle | 弧的起始角度。 | 6388| sweepAngle | 弧的扫描角度。 | 6389 6390 6391### OH_Drawing_CanvasDrawBackground() 6392 6393``` 6394void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 6395``` 6396 6397**描述** 6398 6399用于画一个背景,此背景以画刷填充。 6400 6401本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6402 6403OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6404 6405**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6406 6407**起始版本:** 12 6408 6409**参数:** 6410 6411| 名称 | 描述 | 6412| -------- | -------- | 6413| OH_Drawing_Canvas | 指向画布对象的指针。 | 6414| OH_Drawing_Brush | 指向画刷对象的指针。 | 6415 6416 6417### OH_Drawing_CanvasDrawBitmap() 6418 6419``` 6420void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top ) 6421``` 6422 6423**描述** 6424 6425用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 6426 6427本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6428 6429OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6430 6431**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6432 6433**起始版本:** 11 6434 6435**参数:** 6436 6437| 名称 | 描述 | 6438| -------- | -------- | 6439| OH_Drawing_Canvas | 指向画布对象的指针。 | 6440| OH_Drawing_Bitmap | 指向位图对象的指针。 | 6441| left | 位图对象左上角的横坐标。 | 6442| top | 位图对象左上角的纵坐标。 | 6443 6444 6445### OH_Drawing_CanvasDrawBitmapRect() 6446 6447``` 6448void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6449``` 6450 6451**描述** 6452 6453将位图的指定区域绘制到画布的指定区域。 6454 6455本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6456 6457OH_Drawing_Canvas、OH_Drawing_Bitmap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6458 6459**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6460 6461**起始版本:** 12 6462 6463**参数:** 6464 6465| 名称 | 描述 | 6466| -------- | -------- | 6467| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6468| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 6469| src | 源位图指定矩形区域,为NULL将指定整个源位图区域。 | 6470| dst | 目标画布指定矩形区域。 | 6471| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6472 6473 6474### OH_Drawing_CanvasDrawCircle() 6475 6476``` 6477void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius ) 6478``` 6479 6480**描述** 6481 6482用于画一个圆形。 6483 6484本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6485 6486OH_Drawing_Canvas、OH_Drawing_Point任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6487 6488radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6489 6490**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6491 6492**起始版本:** 11 6493 6494**参数:** 6495 6496| 名称 | 描述 | 6497| -------- | -------- | 6498| OH_Drawing_Canvas | 指向画布对象的指针。 | 6499| OH_Drawing_Point | 指向坐标点对象的指针,表示圆心。 | 6500| radius | 圆形的半径。 | 6501 6502 6503### OH_Drawing_CanvasDrawImageRect() 6504 6505``` 6506void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions* ) 6507``` 6508 6509**描述** 6510 6511将图片绘制到画布的指定区域上。 6512 6513本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6514 6515OH_Drawing_Canvas、OH_Drawing_Image、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6516 6517**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6518 6519**起始版本:** 12 6520 6521**参数:** 6522 6523| 名称 | 描述 | 6524| -------- | -------- | 6525| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6526| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 6527| dst | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6528| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6529 6530 6531### OH_Drawing_CanvasDrawImageRectWithSrc() 6532 6533``` 6534void 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 ) 6535``` 6536 6537**描述** 6538 6539将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 6540 6541本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6542 6543OH_Drawing_Canvas、OH_Drawing_Image、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6544 6545**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6546 6547**起始版本:** 12 6548 6549**参数:** 6550 6551| 名称 | 描述 | 6552| -------- | -------- | 6553| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6554| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 6555| src | 指向源矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6556| dst | 指向目标矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6557| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6558| OH_Drawing_SrcRectConstraint | 约束类型,支持可选的具体类型可见[OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1)枚举。 | 6559 6560 6561### OH_Drawing_CanvasDrawLine() 6562 6563``` 6564void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 ) 6565``` 6566 6567**描述** 6568 6569用于画一条直线段。 6570 6571本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6572 6573OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6574 6575**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6576 6577**起始版本:** 8 6578 6579**参数:** 6580 6581| 名称 | 描述 | 6582| -------- | -------- | 6583| OH_Drawing_Canvas | 指向画布对象的指针。 | 6584| x1 | 线段起始点的横坐标。 | 6585| y1 | 线段起始点的纵坐标。 | 6586| x2 | 线段结束点的横坐标。 | 6587| y2 | 线段结束点的纵坐标。 | 6588 6589 6590### OH_Drawing_CanvasDrawOval() 6591 6592``` 6593void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6594``` 6595 6596**描述** 6597 6598用于画一个椭圆。 6599 6600本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6601 6602OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6603 6604**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6605 6606**起始版本:** 11 6607 6608**参数:** 6609 6610| 名称 | 描述 | 6611| -------- | -------- | 6612| OH_Drawing_Canvas | 指向画布对象的指针。 | 6613| OH_Drawing_Rect | 指向矩形对象的指针。 | 6614 6615 6616### OH_Drawing_CanvasDrawPath() 6617 6618``` 6619void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path* ) 6620``` 6621 6622**描述** 6623 6624用于画一个自定义路径。 6625 6626本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6627 6628OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6629 6630**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6631 6632**起始版本:** 8 6633 6634**参数:** 6635 6636| 名称 | 描述 | 6637| -------- | -------- | 6638| OH_Drawing_Canvas | 指向画布对象的指针。 | 6639| OH_Drawing_Path | 指向路径对象的指针。 | 6640 6641 6642### OH_Drawing_CanvasDrawPixelMapRect() 6643 6644``` 6645void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6646``` 6647 6648**描述** 6649 6650用于将像素图的指定区域绘制到画布的指定区域。 6651 6652本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6653 6654OH_Drawing_Canvas、OH_Drawing_PixelMap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6655 6656**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6657 6658**起始版本:** 12 6659 6660**参数:** 6661 6662| 名称 | 描述 | 6663| -------- | -------- | 6664| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6665| OH_Drawing_PixelMap | 指向像素图[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 | 6666| src | 像素图指定矩形区域,为NULL将指定整个像素图区域。 | 6667| dst | 目标画布指定矩形区域。 | 6668| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6669 6670 6671### OH_Drawing_CanvasDrawPoints() 6672 6673``` 6674void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D* ) 6675``` 6676 6677**描述** 6678 6679用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 6680 6681本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6682 6683OH_Drawing_Canvas、OH_Drawing_Point2D任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6684 6685mode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6686 6687**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6688 6689**起始版本:** 12 6690 6691**参数:** 6692 6693| 名称 | 描述 | 6694| -------- | -------- | 6695| OH_Drawing_Canvas | 指向画布对象的指针。 | 6696| mode | 绘制多个点的方式,支持方式参考[OH_Drawing_PointMode](#oh_drawing_pointmode)。 | 6697| count | 点的数量,即点数组中点的个数。 | 6698| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 指向多个点的数组。 | 6699 6700 6701### OH_Drawing_CanvasDrawRect() 6702 6703``` 6704void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6705``` 6706 6707**描述** 6708 6709用于画一个矩形。 6710 6711本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6712 6713OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6714 6715**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6716 6717**起始版本:** 11 6718 6719**参数:** 6720 6721| 名称 | 描述 | 6722| -------- | -------- | 6723| OH_Drawing_Canvas | 指向画布对象的指针。 | 6724| OH_Drawing_Rect | 指向矩形对象的指针。 | 6725 6726 6727### OH_Drawing_CanvasDrawRegion() 6728 6729``` 6730void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region* ) 6731``` 6732 6733**描述** 6734 6735用于画一块区域。 6736 6737本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6738 6739OH_Drawing_Canvas、OH_Drawing_Region任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6740 6741**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6742 6743**起始版本:** 12 6744 6745**参数:** 6746 6747| 名称 | 描述 | 6748| -------- | -------- | 6749| OH_Drawing_Canvas | 指向画布对象的指针。 | 6750| OH_Drawing_Region | 指向区域对象的指针。 | 6751 6752 6753### OH_Drawing_CanvasDrawRoundRect() 6754 6755``` 6756void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* ) 6757``` 6758 6759**描述** 6760 6761用于画一个圆角矩形。 6762 6763本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6764 6765OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6766 6767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6768 6769**起始版本:** 11 6770 6771**参数:** 6772 6773| 名称 | 描述 | 6774| -------- | -------- | 6775| OH_Drawing_Canvas | 指向画布对象的指针。 | 6776| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 6777 6778 6779### OH_Drawing_CanvasDrawShadow() 6780 6781``` 6782void OH_Drawing_CanvasDrawShadow (OH_Drawing_Canvas* , OH_Drawing_Path* , OH_Drawing_Point3D planeParams, OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, OH_Drawing_CanvasShadowFlags flag ) 6783``` 6784 6785**描述** 6786 6787绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 6788 6789本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6790 6791OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6792 6793flag不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6794 6795**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6796 6797**起始版本:** 12 6798 6799**参数:** 6800 6801| 名称 | 描述 | 6802| -------- | -------- | 6803| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6804| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,用于生成阴影。 | 6805| planeParams | 基于x轴和y轴的遮挡器从画布返回z轴偏移量的函数值。 | 6806| devLightPos | 光线相对于画布的位置。 | 6807| lightRadius | 圆形灯半径。 | 6808| ambientColor | 环境阴影颜色。 | 6809| spotColor | 点阴影颜色。 | 6810| flag | 阴影标志枚举[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags)。 | 6811 6812 6813### OH_Drawing_CanvasDrawTextBlob() 6814 6815``` 6816void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y ) 6817``` 6818 6819**描述** 6820 6821用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。 6822 6823本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6824 6825OH_Drawing_Canvas、OH_Drawing_TextBlob任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6826 6827**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6828 6829**起始版本:** 11 6830 6831**参数:** 6832 6833| 名称 | 描述 | 6834| -------- | -------- | 6835| OH_Drawing_Canvas | 指向画布对象的指针。 | 6836| OH_Drawing_TextBlob | 指向文本对象的指针。 | 6837| x | 文本对象左下角的横坐标。 | 6838| y | 文本对象左下角的纵坐标。 | 6839 6840 6841### OH_Drawing_CanvasDrawVertices() 6842 6843``` 6844void 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 ) 6845``` 6846 6847**描述** 6848 6849用于画顶点数组描述的三角网格。 6850 6851本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6852 6853OH_Drawing_Canvas或positions为NULL、vertexCount值小于3、indexCount值小于3且不为0,存在以上任意一种情况时设置错误码为OH_DRAWING_ERROR_INVALID_PARAMETER; 6854 6855vertexMmode、mode任意一个不在枚举范围内时设置错误码为OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6856 6857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6858 6859**起始版本:** 12 6860 6861**参数:** 6862 6863| 名称 | 描述 | 6864| -------- | -------- | 6865| OH_Drawing_Canvas | 指向画布对象的指针。 | 6866| vertexMmode | 绘制顶点的连接方式,支持方式参考[OH_Drawing_VertexMode](#oh_drawing_vertexmode)。 | 6867| vertexCount | 顶点数组元素的数量,值必须大于等于3。 | 6868| positions | 描述顶点位置的数组指针,不能为空,其长度必须等于vertexCount。 | 6869| texs | 描述顶点对应纹理空间坐标的数组指针,可以为空,若不为空其长度必须等于vertexCount。 | 6870| colors | 描述顶点对应颜色的数组指针,用于在三角形中进行插值,可以为空,若不为空其长度必须等于vertexCount。 | 6871| indexCount | 索引的数量,可以为0,若不为0则值必须大于等于3。 | 6872| indices | 描述顶点对应索引的数组指针,可以为空,若不为空其长度必须等于indexCount。 | 6873| mode | 混合模式枚举,支持方式参考[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 6874 6875 6876### OH_Drawing_CanvasGetHeight() 6877 6878``` 6879int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* ) 6880``` 6881 6882**描述** 6883 6884获取画布高度。 6885 6886本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6887 6888OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6889 6890**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6891 6892**起始版本:** 12 6893 6894**参数:** 6895 6896| 名称 | 描述 | 6897| -------- | -------- | 6898| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6899 6900**返回:** 6901 6902函数返回画布高度,单位为像素。 6903 6904 6905### OH_Drawing_CanvasGetLocalClipBounds() 6906 6907``` 6908void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect* ) 6909``` 6910 6911**描述** 6912 6913获取画布裁剪区域的边界。该接口不可用于录制类型画布。 6914 6915本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6916 6917OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6918 6919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6920 6921**起始版本:** 12 6922 6923**参数:** 6924 6925| 名称 | 描述 | 6926| -------- | -------- | 6927| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6928| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 | 6929 6930 6931### OH_Drawing_CanvasGetSaveCount() 6932 6933``` 6934uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* ) 6935``` 6936 6937**描述** 6938 6939用于获取栈中保存的画布状态(画布矩阵)的数量。 6940 6941本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6942 6943OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6944 6945**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6946 6947**起始版本:** 11 6948 6949**参数:** 6950 6951| 名称 | 描述 | 6952| -------- | -------- | 6953| OH_Drawing_Canvas | 指向画布对象的指针。 | 6954 6955**返回:** 6956 6957函数会返回一个32位的值描述画布状态(画布矩阵)的数量,画布初始状态数量为1。 6958 6959 6960### OH_Drawing_CanvasGetTotalMatrix() 6961 6962``` 6963void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 6964``` 6965 6966**描述** 6967 6968获取画布3x3矩阵。 6969 6970本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6971 6972OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6973 6974**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6975 6976**起始版本:** 12 6977 6978**参数:** 6979 6980| 名称 | 描述 | 6981| -------- | -------- | 6982| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6983| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 6984 6985 6986### OH_Drawing_CanvasGetWidth() 6987 6988``` 6989int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* ) 6990``` 6991 6992**描述** 6993 6994获取画布宽度。 6995 6996本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6997 6998OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6999 7000**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7001 7002**起始版本:** 12 7003 7004**参数:** 7005 7006| 名称 | 描述 | 7007| -------- | -------- | 7008| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7009 7010**返回:** 7011 7012函数返回画布宽度,单位为像素。 7013 7014 7015### OH_Drawing_CanvasReadPixels() 7016 7017``` 7018bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY ) 7019``` 7020 7021**描述** 7022 7023从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 7024 7025本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7026 7027OH_Drawing_Canvas、OH_Drawing_Image_Info、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7028 7029**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7030 7031**起始版本:** 12 7032 7033**参数:** 7034 7035| 名称 | 描述 | 7036| -------- | -------- | 7037| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7038| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 指向图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 7039| dstPixels | 目标像素存储首地址。 | 7040| dstRowBytes | 一行像素的大小。 | 7041| srcX | 画布像素的x轴偏移量,单位为像素。 | 7042| srcY | 画布像素的y轴偏移量,单位为像素。 | 7043 7044**返回:** 7045 7046函数返回true表示像素成功拷贝到目标像素存储首地址,函数返回false表示拷贝失败。 7047 7048 7049### OH_Drawing_CanvasReadPixelsToBitmap() 7050 7051``` 7052bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY ) 7053``` 7054 7055**描述** 7056 7057从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 7058 7059本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7060 7061OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7062 7063**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7064 7065**起始版本:** 12 7066 7067**参数:** 7068 7069| 名称 | 描述 | 7070| -------- | -------- | 7071| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7072| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 7073| srcX | 画布像素的x轴偏移量,单位为像素。 | 7074| srcY | 画布像素的y轴偏移量,单位为像素。 | 7075 7076**返回:** 7077 7078函数返回true表示像素成功拷贝到位图,函数返回false表示拷贝失败。 7079 7080 7081### OH_Drawing_CanvasResetMatrix() 7082 7083``` 7084void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* ) 7085``` 7086 7087**描述** 7088 7089重置当前画布的矩阵为单位矩阵。 7090 7091本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7092 7093OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7094 7095**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7096 7097**起始版本:** 12 7098 7099**参数:** 7100 7101| 名称 | 描述 | 7102| -------- | -------- | 7103| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7104 7105 7106### OH_Drawing_CanvasRestore() 7107 7108``` 7109void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* ) 7110``` 7111 7112**描述** 7113 7114用于恢复保存在栈顶的画布状态(画布矩阵)。 7115 7116本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7117 7118OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7119 7120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7121 7122**起始版本:** 8 7123 7124**参数:** 7125 7126| 名称 | 描述 | 7127| -------- | -------- | 7128| OH_Drawing_Canvas | 指向画布对象的指针。 | 7129 7130 7131### OH_Drawing_CanvasRestoreToCount() 7132 7133``` 7134void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount ) 7135``` 7136 7137**描述** 7138 7139用于恢复到指定数量的画布状态(画布矩阵)。 7140 7141本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7142 7143OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7144 7145**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7146 7147**起始版本:** 11 7148 7149**参数:** 7150 7151| 名称 | 描述 | 7152| -------- | -------- | 7153| OH_Drawing_Canvas | 指向画布对象的指针。 | 7154| saveCount | 要恢复的画布状态深度。小于等于1时,恢复为初始状态;大于已保存的画布状态数量时,不执行任何操作。 | 7155 7156 7157### OH_Drawing_CanvasRotate() 7158 7159``` 7160void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py ) 7161``` 7162 7163**描述** 7164 7165用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 7166 7167本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7168 7169OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7170 7171**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7172 7173**起始版本:** 11 7174 7175**参数:** 7176 7177| 名称 | 描述 | 7178| -------- | -------- | 7179| OH_Drawing_Canvas | 指向画布对象的指针。 | 7180| degrees | 旋转角度。 | 7181| px | 旋转中心的横坐标。 | 7182| py | 旋转中心的纵坐标。 | 7183 7184 7185### OH_Drawing_CanvasSave() 7186 7187``` 7188void OH_Drawing_CanvasSave (OH_Drawing_Canvas* ) 7189``` 7190 7191**描述** 7192 7193用于保存当前画布的状态(画布矩阵)到一个栈顶。 7194 7195本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7196 7197OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7198 7199**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7200 7201**起始版本:** 8 7202 7203**参数:** 7204 7205| 名称 | 描述 | 7206| -------- | -------- | 7207| OH_Drawing_Canvas | 指向画布对象的指针。 | 7208 7209 7210### OH_Drawing_CanvasSaveLayer() 7211 7212``` 7213void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush* ) 7214``` 7215 7216**描述** 7217 7218保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 7219 7220本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7221 7222OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7223 7224**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7225 7226**起始版本:** 12 7227 7228**参数:** 7229 7230| 名称 | 描述 | 7231| -------- | -------- | 7232| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7233| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,用于限制图层大小,为NULL表示无限制。 | 7234| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针,绘制位图时会应用画刷对象的透明度,滤波器效果,混合模式,为NULL表示不应用任何效果。 | 7235 7236 7237### OH_Drawing_CanvasScale() 7238 7239``` 7240void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy ) 7241``` 7242 7243**描述** 7244 7245用于画布缩放。 7246 7247本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7248 7249OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7250 7251**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7252 7253**起始版本:** 11 7254 7255**参数:** 7256 7257| 名称 | 描述 | 7258| -------- | -------- | 7259| OH_Drawing_Canvas | 指向画布对象的指针。 | 7260| sx | x轴方向的缩放比例。 | 7261| sy | y轴方向的缩放比例。 | 7262 7263 7264### OH_Drawing_CanvasSetMatrix() 7265 7266``` 7267void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 7268``` 7269 7270**描述** 7271 7272设置画布的矩阵状态。 7273 7274本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7275 7276OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7277 7278**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7279 7280**起始版本:** 12 7281 7282**参数:** 7283 7284| 名称 | 描述 | 7285| -------- | -------- | 7286| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7287| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 7288 7289 7290### OH_Drawing_CanvasSkew() 7291 7292``` 7293void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy ) 7294``` 7295 7296**描述** 7297 7298用于画布倾斜变换。等同于将当前画布矩阵左乘(premultiply)倾斜变换矩阵,并应用到画布上。其中倾斜变换矩阵为:\|1 sx 0\| \|sy 1 0\| \|0 0 1\|。 7299 7300本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7301 7302OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7303 7304**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7305 7306**起始版本:** 12 7307 7308**参数:** 7309 7310| 名称 | 描述 | 7311| -------- | -------- | 7312| OH_Drawing_Canvas | 指向画布对象的指针。 | 7313| sx | 沿x轴的倾斜量。正值会使绘制沿y轴增量方向向右倾斜;负值会使绘制沿y轴增量方向向左倾斜。 | 7314| sy | 沿y轴的倾斜量。正值会使绘制沿x轴增量方向向下倾斜;负值会使绘制沿x轴增量方向向上倾斜。 | 7315 7316 7317### OH_Drawing_CanvasTranslate() 7318 7319``` 7320void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy ) 7321``` 7322 7323**描述** 7324 7325用于平移画布一段距离。 7326 7327本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7328 7329OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7330 7331**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7332 7333**起始版本:** 11 7334 7335**参数:** 7336 7337| 名称 | 描述 | 7338| -------- | -------- | 7339| OH_Drawing_Canvas | 指向画布对象的指针。 | 7340| dx | x轴方向的移动距离。 | 7341| dy | y轴方向的移动距离。 | 7342 7343 7344### OH_Drawing_ColorFilterCreateBlendMode() 7345 7346``` 7347OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode ) 7348``` 7349 7350**描述** 7351 7352创建具有混合模式的颜色滤波器。 7353 7354**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7355 7356**起始版本:** 11 7357 7358**参数:** 7359 7360| 名称 | 描述 | 7361| -------- | -------- | 7362| color | 表示颜色,是一个32位(ARGB)变量。 | 7363| OH_Drawing_BlendMode | 表示混合模式。支持可选的混合模式具体可见[OH_Drawing_BlendMode](#oh_drawing_blendmode)枚举。 | 7364 7365**返回:** 7366 7367返回创建的颜色滤波器对象的指针。 7368 7369 7370### OH_Drawing_ColorFilterCreateCompose() 7371 7372``` 7373OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 ) 7374``` 7375 7376**描述** 7377 7378将两个颜色滤波器合成一个新的颜色滤波器。 7379 7380本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7381 7382colorFilter1、colorFilter2任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7383 7384**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7385 7386**起始版本:** 11 7387 7388**参数:** 7389 7390| 名称 | 描述 | 7391| -------- | -------- | 7392| colorFilter1 | 指向颜色滤波器对象一的指针。 | 7393| colorFilter2 | 指向颜色滤波器对象二的指针。 | 7394 7395**返回:** 7396 7397返回创建的颜色滤波器对象的指针。 7398 7399 7400### OH_Drawing_ColorFilterCreateLinearToSrgbGamma() 7401 7402``` 7403OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void ) 7404``` 7405 7406**描述** 7407 7408创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 7409 7410**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7411 7412**起始版本:** 11 7413 7414**返回:** 7415 7416返回创建的颜色滤波器对象的指针。 7417 7418 7419### OH_Drawing_ColorFilterCreateLuma() 7420 7421``` 7422OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void ) 7423``` 7424 7425**描述** 7426 7427创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 7428 7429**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7430 7431**起始版本:** 11 7432 7433**返回:** 7434 7435返回创建的颜色滤波器对象的指针。 7436 7437 7438### OH_Drawing_ColorFilterCreateMatrix() 7439 7440``` 7441OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20]) 7442``` 7443 7444**描述** 7445 7446创建具有5x4颜色矩阵的颜色滤波器。 7447 7448本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7449 7450matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7451 7452**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7453 7454**起始版本:** 11 7455 7456**参数:** 7457 7458| 名称 | 描述 | 7459| -------- | -------- | 7460| matrix | 表示矩阵,以长度为20的浮点数组表示。 | 7461 7462**返回:** 7463 7464返回创建的颜色滤波器对象的指针。 7465 7466 7467### OH_Drawing_ColorFilterCreateSrgbGammaToLinear() 7468 7469``` 7470OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void ) 7471``` 7472 7473**描述** 7474 7475创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 7476 7477**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7478 7479**起始版本:** 11 7480 7481**返回:** 7482 7483返回创建的颜色滤波器对象的指针。 7484 7485 7486### OH_Drawing_ColorFilterDestroy() 7487 7488``` 7489void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* ) 7490``` 7491 7492**描述** 7493 7494销毁颜色滤波器对象,并收回该对象占用的内存。 7495 7496**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7497 7498**起始版本:** 11 7499 7500**参数:** 7501 7502| 名称 | 描述 | 7503| -------- | -------- | 7504| OH_Drawing_ColorFilter | 表示指向颜色滤波器对象的指针。 | 7505 7506 7507### OH_Drawing_ColorSetArgb() 7508 7509``` 7510uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue ) 7511``` 7512 7513**描述** 7514 7515用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 7516 7517**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7518 7519**起始版本:** 8 7520 7521**参数:** 7522 7523| 名称 | 描述 | 7524| -------- | -------- | 7525| alpha | 描述透明度的变量, 变量范围是0x00~0xFF。 | 7526| red | 描述红色的变量, 变量范围是0x00~0xFF。 | 7527| green | 描述绿色的变量, 变量范围是0x00~0xFF。 | 7528| blue | 描述蓝色的变量, 变量范围是0x00~0xFF。 | 7529 7530**返回:** 7531 7532函数返回一个描述颜色的32位(ARGB)变量。 7533 7534 7535### OH_Drawing_ColorSpaceCreateSrgb() 7536 7537``` 7538OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void ) 7539``` 7540 7541**描述** 7542 7543创建一个标准颜色空间。 7544 7545**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7546 7547**起始版本:** 12 7548 7549**返回:** 7550 7551函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。 7552 7553 7554### OH_Drawing_ColorSpaceCreateSrgbLinear() 7555 7556``` 7557OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void ) 7558``` 7559 7560**描述** 7561 7562创建一个Gamma 1.0空间上的颜色空间。 7563 7564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7565 7566**起始版本:** 12 7567 7568**返回:** 7569 7570函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。 7571 7572 7573### OH_Drawing_ColorSpaceDestroy() 7574 7575``` 7576void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* ) 7577``` 7578 7579**描述** 7580 7581销毁颜色空间对象,并回收该对象占有内存。 7582 7583**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7584 7585**起始版本:** 12 7586 7587**参数:** 7588 7589| 名称 | 描述 | 7590| -------- | -------- | 7591| OH_Drawing_ColorSpace | 指向颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)的指针。 | 7592 7593 7594### OH_Drawing_CreateDashPathEffect() 7595 7596``` 7597OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase ) 7598``` 7599 7600**描述** 7601 7602创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 7603 7604本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7605 7606intervals为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7607 7608**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7609 7610**起始版本:** 12 7611 7612**参数:** 7613 7614| 名称 | 描述 | 7615| -------- | -------- | 7616| intervals | 虚线间隔数组首地址,偶数项的值表示虚线开的间隔长度, 奇数项的值表示虚线关的间隔长度,单位为像素。 | 7617| count | 虚线间隔数组元素的个数,必须为大于0的偶数。 | 7618| phase | 虚线间隔数组中偏移量。 | 7619 7620**返回:** 7621 7622函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。 7623 7624 7625### OH_Drawing_CreateFontCollection() 7626 7627``` 7628OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void ) 7629``` 7630 7631**描述** 7632 7633创建字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。该函数创建的字体集指针对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)只能被一个[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象使用,无法被多个[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象共享使用。如需在多个[OH_Drawing_TypographyCreate](#oh_drawing_typographycreate)对象间共享同一个[OH_Drawing_FontCollection](#oh_drawing_fontcollection),请使用[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)函数创建[OH_Drawing_FontCollection](#oh_drawing_fontcollection)对象。 7634 7635**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7636 7637**起始版本:** 8 7638 7639**返回:** 7640 7641指向创建的字体集对象的指针。 7642 7643 7644### OH_Drawing_CreateFontDescriptor() 7645 7646``` 7647OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void ) 7648``` 7649 7650**描述** 7651 7652构造字体描述对象,用于描述系统字体详细信息。 7653 7654**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7655 7656**起始版本:** 12 7657 7658**返回:** 7659 7660返回指向已创建的字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。 7661 7662 7663### OH_Drawing_CreateFontParser() 7664 7665``` 7666OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void ) 7667``` 7668 7669**描述** 7670 7671构造字体解析对象,用于解析系统字体。 7672 7673**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7674 7675**起始版本:** 12 7676 7677**返回:** 7678 7679返回指向已创建的字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针。 7680 7681 7682### OH_Drawing_CreateSharedFontCollection() 7683 7684``` 7685OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void ) 7686``` 7687 7688**描述** 7689 7690创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 7691 7692**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7693 7694**起始版本:** 12 7695 7696**返回:** 7697 7698指向创建的字体集对象的指针。 7699 7700### OH_Drawing_ClearFontCaches() 7701 7702``` 7703void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* ) 7704``` 7705 7706**描述** 7707 7708清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 7709 7710**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7711 7712**起始版本:** 12 7713 7714**参数:** 7715 7716| 名称 | 描述 | 7717| -------- | -------- | 7718| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 7719 7720### OH_Drawing_CreateTextShadow() 7721 7722``` 7723OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void ) 7724``` 7725 7726**描述** 7727 7728创建指向字体阴影对象的指针。 7729 7730**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7731 7732**起始版本:** 12 7733 7734**返回:** 7735 7736指向创建的字体阴影对象。 7737 7738 7739### OH_Drawing_CreateTextStyle() 7740 7741``` 7742OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void ) 7743``` 7744 7745**描述** 7746 7747创建指向OH_Drawing_TextStyle对象的指针。 7748 7749**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7750 7751**起始版本:** 8 7752 7753**返回:** 7754 7755指向创建的OH_Drawing_TextStyle对象的指针。 7756 7757 7758### OH_Drawing_CreateTypography() 7759 7760``` 7761OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* ) 7762``` 7763 7764**描述** 7765 7766创建指向OH_Drawing_Typography对象的指针。 7767 7768**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7769 7770**起始版本:** 8 7771 7772**参数:** 7773 7774| 名称 | 描述 | 7775| -------- | -------- | 7776| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 7777 7778**返回:** 7779 7780指向OH_Drawing_Typography对象的指针。 7781 7782 7783### OH_Drawing_CreateTypographyHandler() 7784 7785``` 7786OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection* ) 7787``` 7788 7789**描述** 7790 7791创建指向OH_Drawing_TypographyCreate对象的指针。 7792 7793**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7794 7795**起始版本:** 8 7796 7797**参数:** 7798 7799| 名称 | 描述 | 7800| -------- | -------- | 7801| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 7802| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针,可由[OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection)或[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)获取,建议使用[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)。 | 7803 7804**返回:** 7805 7806指向新创建的OH_Drawing_TypographyCreate对象的指针。 7807 7808 7809### OH_Drawing_CreateTypographyStyle() 7810 7811``` 7812OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void ) 7813``` 7814 7815**描述** 7816 7817创建指向OH_Drawing_TypographyStyle对象的指针。 7818 7819**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7820 7821**起始版本:** 8 7822 7823**返回:** 7824 7825指向创建的OH_Drawing_TypographyStyle对象的指针。 7826 7827 7828### OH_Drawing_DestroyFontCollection() 7829 7830``` 7831void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* ) 7832``` 7833 7834**描述** 7835 7836释放被字体集对象占据的内存。 7837 7838**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7839 7840**起始版本:** 8 7841 7842**参数:** 7843 7844| 名称 | 描述 | 7845| -------- | -------- | 7846| OH_Drawing_FontCollection | 指向字体集对象的指针。 | 7847 7848 7849### OH_Drawing_DestroyFontDescriptor() 7850 7851``` 7852void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* ) 7853``` 7854 7855**描述** 7856 7857释放字体描述对象占用的内存。 7858 7859**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7860 7861**起始版本:** 12 7862 7863**参数:** 7864 7865| 名称 | 描述 | 7866| -------- | -------- | 7867| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 指向字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针,由[OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor)获取。 | 7868 7869 7870### OH_Drawing_DestroyFontParser() 7871 7872``` 7873void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* ) 7874``` 7875 7876**描述** 7877 7878释放字体解析对象占用的内存。 7879 7880**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7881 7882**起始版本:** 12 7883 7884**参数:** 7885 7886| 名称 | 描述 | 7887| -------- | -------- | 7888| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 7889 7890 7891### OH_Drawing_DestroyLineMetrics() 7892 7893``` 7894void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* ) 7895``` 7896 7897**描述** 7898 7899释放行位置信息对象占用的内存。 7900 7901**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7902 7903**起始版本:** 12 7904 7905**参数:** 7906 7907| 名称 | 描述 | 7908| -------- | -------- | 7909| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 7910 7911 7912### OH_Drawing_DestroySystemFontConfigInfo() 7913 7914``` 7915void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* ) 7916``` 7917 7918**描述** 7919 7920释放系统字体配置信息占用的的内存。 7921 7922**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7923 7924**起始版本:** 12 7925 7926**参数:** 7927 7928| 名称 | 描述 | 7929| -------- | -------- | 7930| OH_Drawing_FontConfigInfo | 指向系统字体配置信息[OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)的指针, 由[OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo)获取。 | 7931 7932 7933### OH_Drawing_DestroySystemFontList() 7934 7935``` 7936void OH_Drawing_DestroySystemFontList (char** , size_t ) 7937``` 7938 7939**描述** 7940 7941释放系统字体名称列表占用的内存。 7942 7943**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7944 7945**起始版本:** 12 7946 7947**参数:** 7948 7949| 名称 | 描述 | 7950| -------- | -------- | 7951| char\*\* | 指向系统字体名称列表的指针。 | 7952| size_t\* | 系统字体名称列表的数量。 | 7953 7954 7955### OH_Drawing_DestroyTextShadow() 7956 7957``` 7958void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* ) 7959``` 7960 7961**描述** 7962 7963释放被字体阴影对象占据的内存。 7964 7965**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7966 7967**起始版本:** 12 7968 7969**参数:** 7970 7971| 名称 | 描述 | 7972| -------- | -------- | 7973| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 7974 7975 7976### OH_Drawing_DestroyTextShadows() 7977 7978``` 7979void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* ) 7980``` 7981 7982**描述** 7983 7984释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 7985 7986**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7987 7988**起始版本:** 12 7989 7990**参数:** 7991 7992| 名称 | 描述 | 7993| -------- | -------- | 7994| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 7995 7996 7997### OH_Drawing_DestroyTextStyle() 7998 7999``` 8000void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* ) 8001``` 8002 8003**描述** 8004 8005释放被OH_Drawing_TextStyle对象占据的内存。 8006 8007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8008 8009**起始版本:** 8 8010 8011**参数:** 8012 8013| 名称 | 描述 | 8014| -------- | -------- | 8015| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 8016 8017 8018### OH_Drawing_DestroyTypography() 8019 8020``` 8021void OH_Drawing_DestroyTypography (OH_Drawing_Typography* ) 8022``` 8023 8024**描述** 8025 8026释放OH_Drawing_Typography对象占据的内存。 8027 8028**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8029 8030**起始版本:** 8 8031 8032**参数:** 8033 8034| 名称 | 描述 | 8035| -------- | -------- | 8036| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 8037 8038 8039### OH_Drawing_DestroyTypographyHandler() 8040 8041``` 8042void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* ) 8043``` 8044 8045**描述** 8046 8047释放被OH_Drawing_TypographyCreate对象占据的内存。 8048 8049**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8050 8051**起始版本:** 8 8052 8053**参数:** 8054 8055| 名称 | 描述 | 8056| -------- | -------- | 8057| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 8058 8059 8060### OH_Drawing_DestroyTypographyStyle() 8061 8062``` 8063void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* ) 8064``` 8065 8066**描述** 8067 8068释放被OH_Drawing_TypographyStyle对象占据的内存。 8069 8070**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8071 8072**起始版本:** 8 8073 8074**参数:** 8075 8076| 名称 | 描述 | 8077| -------- | -------- | 8078| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 8079 8080 8081### OH_Drawing_DisableFontCollectionFallback() 8082 8083``` 8084void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection) 8085``` 8086 8087**描述** 8088 8089禁用备用字体。 8090 8091**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8092 8093**起始版本:** 12 8094 8095**参数:** 8096 8097| 名称 | 描述 | 8098| -------- | -------- | 8099| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 8100 8101 8102### OH_Drawing_DisableFontCollectionSystemFont() 8103 8104``` 8105void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection) 8106``` 8107 8108**描述** 8109 8110禁用系统字体。 8111 8112**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8113 8114**起始版本:** 12 8115 8116**参数:** 8117 8118| 名称 | 描述 | 8119| -------- | -------- | 8120| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 8121 8122 8123### OH_Drawing_FilterCreate() 8124 8125``` 8126OH_Drawing_Filter* OH_Drawing_FilterCreate (void ) 8127``` 8128 8129**描述** 8130 8131创建一个滤波器对象。 8132 8133**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8134 8135**起始版本:** 11 8136 8137**返回:** 8138 8139返回创建的滤波器对象的指针。 8140 8141 8142### OH_Drawing_FilterDestroy() 8143 8144``` 8145void OH_Drawing_FilterDestroy (OH_Drawing_Filter* ) 8146``` 8147 8148**描述** 8149 8150销毁滤波器对象,并收回该对象占用的内存。 8151 8152**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8153 8154**起始版本:** 11 8155 8156**参数:** 8157 8158| 名称 | 描述 | 8159| -------- | -------- | 8160| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8161 8162 8163### OH_Drawing_FilterGetColorFilter() 8164 8165``` 8166void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8167``` 8168 8169**描述** 8170 8171从滤波器对象获取颜色滤波器对象。 8172 8173本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8174 8175OH_Drawing_Filter、OH_Drawing_ColorFilter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8176 8177**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8178 8179**起始版本:** 12 8180 8181**参数:** 8182 8183| 名称 | 描述 | 8184| -------- | -------- | 8185| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 8186| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)的指针。 | 8187 8188 8189### OH_Drawing_FilterSetColorFilter() 8190 8191``` 8192void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8193``` 8194 8195**描述** 8196 8197为滤波器对象设置颜色滤波器对象。 8198 8199本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8200 8201OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8202 8203**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8204 8205**起始版本:** 11 8206 8207**参数:** 8208 8209| 名称 | 描述 | 8210| -------- | -------- | 8211| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8212| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象的指针,为NULL表示清空滤波器对象中的颜色滤波器效果。 | 8213 8214 8215### OH_Drawing_FilterSetMaskFilter() 8216 8217``` 8218void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter* ) 8219``` 8220 8221**描述** 8222 8223为滤波器对象设置蒙板滤波器对象。 8224 8225本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8226 8227OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8228 8229**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8230 8231**起始版本:** 11 8232 8233**参数:** 8234 8235| 名称 | 描述 | 8236| -------- | -------- | 8237| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8238| OH_Drawing_MaskFilter | 指示指向模板滤波器对象的指针,为NULL表示清空滤波器对象中的模板滤波器效果。 | 8239 8240 8241### OH_Drawing_FontCountText() 8242 8243``` 8244int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding ) 8245``` 8246 8247**描述** 8248 8249获取文本所表示的字符数量。 8250 8251本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8252 8253OH_Drawing_Font、text任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8254 8255**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8256 8257**起始版本:** 12 8258 8259**参数:** 8260 8261| 名称 | 描述 | 8262| -------- | -------- | 8263| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8264| text | 文本存储首地址。 | 8265| byteLength | 文本长度,单位为字节。 | 8266| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 8267 8268 8269### OH_Drawing_FontCreate() 8270 8271``` 8272OH_Drawing_Font* OH_Drawing_FontCreate (void ) 8273``` 8274 8275**描述** 8276 8277用于创建一个字体对象。 8278 8279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8280 8281**起始版本:** 11 8282 8283**返回:** 8284 8285函数会返回一个指针,指针指向创建的字体对象。 8286 8287 8288### OH_Drawing_FontDestroy() 8289 8290``` 8291void OH_Drawing_FontDestroy (OH_Drawing_Font* ) 8292``` 8293 8294**描述** 8295 8296用于销毁字体对象并回收该对象占有的内存。 8297 8298**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8299 8300**起始版本:** 11 8301 8302**参数:** 8303 8304| 名称 | 描述 | 8305| -------- | -------- | 8306| OH_Drawing_Font | 指向字体对象的指针。 | 8307 8308 8309### OH_Drawing_FontGetMetrics() 8310 8311``` 8312float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics* ) 8313``` 8314 8315**描述** 8316 8317获取字体度量信息。 8318 8319本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8320 8321OH_Drawing_Font、OH_Drawing_Font_Metrics任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8322 8323**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8324 8325**起始版本:** 12 8326 8327**参数:** 8328 8329| 名称 | 描述 | 8330| -------- | -------- | 8331| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8332| OH_Drawing_Font_Metrics | 指向字体度量信息对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针。 | 8333 8334**返回:** 8335 8336函数返回一个浮点数变量,表示建议的行间距。 8337 8338 8339### OH_Drawing_FontGetTypeface() 8340 8341``` 8342OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* ) 8343``` 8344 8345**描述** 8346 8347获取字形对象。 8348 8349本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8350 8351OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8352 8353**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8354 8355**起始版本:** 12 8356 8357**参数:** 8358 8359| 名称 | 描述 | 8360| -------- | -------- | 8361| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8362 8363**返回:** 8364 8365OH_Drawing_Typeface 函数返回一个指针,指向字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8366 8367 8368### OH_Drawing_FontMgrCreate() 8369 8370``` 8371OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void ) 8372``` 8373 8374**描述** 8375 8376构造字体管理对象。 8377 8378**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8379 8380**起始版本:** 12 8381 8382**返回:** 8383 8384返回指向已创建的字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针。 8385 8386 8387### OH_Drawing_FontMgrCreateFontStyleSet() 8388 8389``` 8390OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index ) 8391``` 8392 8393**描述** 8394 8395由字体管理对象构造字体样式集对象。 8396 8397**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8398 8399**起始版本:** 12 8400 8401**参数:** 8402 8403| 名称 | 描述 | 8404| -------- | -------- | 8405| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8406| index | 用于从字体管理对象获取字体样式集对象的索引值。 | 8407 8408**返回:** 8409 8410返回指向已创建的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 8411 8412 8413### OH_Drawing_FontMgrDestroy() 8414 8415``` 8416void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* ) 8417``` 8418 8419**描述** 8420 8421释放字体管理对象占用的内存。 8422 8423**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8424 8425**起始版本:** 12 8426 8427**参数:** 8428 8429| 名称 | 描述 | 8430| -------- | -------- | 8431| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8432 8433 8434### OH_Drawing_FontMgrDestroyFamilyName() 8435 8436``` 8437void OH_Drawing_FontMgrDestroyFamilyName (char* familyName) 8438``` 8439 8440**描述** 8441 8442释放指定字体家族名称占用的内存。 8443 8444**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8445 8446**起始版本:** 12 8447 8448**参数:** 8449 8450| 名称 | 描述 | 8451| -------- | -------- | 8452| familyName | 指定字体家族名称数组。 | 8453 8454 8455### OH_Drawing_FontMgrDestroyFontStyleSet() 8456 8457``` 8458void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* ) 8459``` 8460 8461**描述** 8462 8463释放字体样式集对象占用的内存。 8464 8465**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8466 8467**起始版本:** 12 8468 8469**参数:** 8470 8471| 名称 | 描述 | 8472| -------- | -------- | 8473| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8474 8475 8476### OH_Drawing_FontMgrGetFamilyCount() 8477 8478``` 8479int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* ) 8480``` 8481 8482**描述** 8483 8484获取字体家族的数量。 8485 8486**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8487 8488**起始版本:** 12 8489 8490**参数:** 8491 8492| 名称 | 描述 | 8493| -------- | -------- | 8494| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8495 8496**返回:** 8497 8498返回字体家族的数量。 8499 8500 8501### OH_Drawing_FontMgrGetFamilyName() 8502 8503``` 8504char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index ) 8505``` 8506 8507**描述** 8508 8509由索引值获取字体家族名称。 8510 8511**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8512 8513**起始版本:** 12 8514 8515**参数:** 8516 8517| 名称 | 描述 | 8518| -------- | -------- | 8519| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8520| index | 用于获取对应字体家族名称的索引值。 | 8521 8522**返回:** 8523 8524返回索引值对应的字体家族名称。 8525 8526 8527### OH_Drawing_FontMgrMatchFamily() 8528 8529``` 8530OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName ) 8531``` 8532 8533**描述** 8534 8535由指定的字体家族名称,获取字体样式集对象。 8536 8537**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8538 8539**起始版本:** 12 8540 8541**参数:** 8542 8543| 名称 | 描述 | 8544| -------- | -------- | 8545| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8546| familyName | 指定的字体家族名称。 | 8547 8548**返回:** 8549 8550返回对应的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)。 8551 8552 8553### OH_Drawing_FontMgrMatchFamilyStyle() 8554 8555``` 8556OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct ) 8557``` 8558 8559**描述** 8560 8561根据指定的字体样式信息和字体家族名称,获取字型对象。 8562 8563**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8564 8565**起始版本:** 12 8566 8567**参数:** 8568 8569| 名称 | 描述 | 8570| -------- | -------- | 8571| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8572| familyName | 指定的字体家族名称。 | 8573| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8574 8575**返回:** 8576 8577返回对应的字体样式的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8578 8579 8580### OH_Drawing_FontMgrMatchFamilyStyleCharacter() 8581 8582``` 8583OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character ) 8584``` 8585 8586**描述** 8587 8588为指定字符获取字型对象。 8589 8590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8591 8592**起始版本:** 12 8593 8594**参数:** 8595 8596| 名称 | 描述 | 8597| -------- | -------- | 8598| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8599| familyName | 指定的字体家族名称。 | 8600| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8601| bcp47 | 用来指示character语言编码数组,是ISO 639、15924和3166-1语言编码的组合。 | 8602| bcp47Count | 参数bcp47数组大小。 | 8603| character | 待匹配的UTF8字符值。 | 8604 8605**返回:** 8606 8607返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8608 8609 8610### OH_Drawing_FontParserGetFontByName() 8611 8612``` 8613OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char* ) 8614``` 8615 8616**描述** 8617 8618根据传入的系统字体名称获取系统字体的相关信息。 8619 8620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8621 8622**起始版本:** 12 8623 8624**参数:** 8625 8626| 名称 | 描述 | 8627| -------- | -------- | 8628| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 8629| char\* | 系统字体名。 | 8630 8631**返回:** 8632 8633返回系统字体。 8634 8635 8636### OH_Drawing_FontParserGetSystemFontList() 8637 8638``` 8639char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t* ) 8640``` 8641 8642**描述** 8643 8644获取系统字体名称列表,此接口仅在2in1设备上可用。 8645 8646**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8647 8648**起始版本:** 12 8649 8650**参数:** 8651 8652| 名称 | 描述 | 8653| -------- | -------- | 8654| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 8655| size_t | 返回获取到的系统字体名称数量。 | 8656 8657**返回:** 8658 8659返回获取到的系统字体列表。 8660 8661 8662### OH_Drawing_FontSetFakeBoldText() 8663 8664``` 8665void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText ) 8666``` 8667 8668**描述** 8669 8670用于设置增加描边宽度以近似粗体字体效果。 8671 8672本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8673 8674OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8675 8676**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8677 8678**起始版本:** 11 8679 8680**参数:** 8681 8682| 名称 | 描述 | 8683| -------- | -------- | 8684| OH_Drawing_Font | 指向字体对象的指针。 | 8685| isFakeBoldText | 真为使能增加描边宽度,假为不使能。 | 8686 8687 8688### OH_Drawing_FontSetLinearText() 8689 8690``` 8691void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText ) 8692``` 8693 8694**描述** 8695 8696用于设置线性可缩放字体。 8697 8698本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8699 8700OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8701 8702**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8703 8704**起始版本:** 11 8705 8706**参数:** 8707 8708| 名称 | 描述 | 8709| -------- | -------- | 8710| OH_Drawing_Font | 指向字体对象的指针。 | 8711| isLinearText | 真为使能线性可缩放字体,假为不使能。 | 8712 8713 8714### OH_Drawing_FontSetTextSize() 8715 8716``` 8717void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize ) 8718``` 8719 8720**描述** 8721 8722用于给字体设置文字大小。 8723 8724本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8725 8726OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8727 8728**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8729 8730**起始版本:** 11 8731 8732**参数:** 8733 8734| 名称 | 描述 | 8735| -------- | -------- | 8736| OH_Drawing_Font | 指向字体对象的指针。 | 8737| textSize | 字体大小。 | 8738 8739 8740### OH_Drawing_FontSetTextSkewX() 8741 8742``` 8743void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX ) 8744``` 8745 8746**描述** 8747 8748用于给字体设置文本倾斜。 8749 8750本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8751 8752OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8753 8754**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8755 8756**起始版本:** 11 8757 8758**参数:** 8759 8760| 名称 | 描述 | 8761| -------- | -------- | 8762| OH_Drawing_Font | 指向字体对象的指针。 | 8763| skewX | X轴相对于Y轴的倾斜度。 | 8764 8765 8766### OH_Drawing_FontSetTypeface() 8767 8768``` 8769void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface* ) 8770``` 8771 8772**描述** 8773 8774用于给字体设置字形。 8775 8776本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8777 8778OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8779 8780**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8781 8782**起始版本:** 11 8783 8784**参数:** 8785 8786| 名称 | 描述 | 8787| -------- | -------- | 8788| OH_Drawing_Font | 指向字体对象的指针。 | 8789| OH_Drawing_Typeface | 指向字形对象的指针,为NULL会使用系统默认字形对象。 | 8790 8791 8792### OH_Drawing_FontStyleSetCount() 8793 8794``` 8795int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* ) 8796``` 8797 8798**描述** 8799 8800获取字体样式集中字体的个数。 8801 8802**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8803 8804**起始版本:** 12 8805 8806**参数:** 8807 8808| 名称 | 描述 | 8809| -------- | -------- | 8810| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8811 8812**返回:** 8813 8814返回此字体样式集中字体的个数。 8815 8816 8817### OH_Drawing_FontStyleSetCreateTypeface() 8818 8819``` 8820OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index ) 8821``` 8822 8823**描述** 8824 8825为指定索引获取字型对象。 8826 8827**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8828 8829**起始版本:** 12 8830 8831**参数:** 8832 8833| 名称 | 描述 | 8834| -------- | -------- | 8835| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8836| index | 指定的字型对象的索引。 | 8837 8838**返回:** 8839 8840如果成功,返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface); 如果失败,返回nullptr。 8841 8842 8843### OH_Drawing_FontStyleSetFreeStyleName() 8844 8845``` 8846void OH_Drawing_FontStyleSetFreeStyleName (char** styleName) 8847``` 8848 8849**描述** 8850 8851释放指定字体样式的内存。 8852 8853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8854 8855**起始版本:** 12 8856 8857**参数:** 8858 8859| 名称 | 描述 | 8860| -------- | -------- | 8861| styleName | 指定字体样式名称的字符串。 | 8862 8863 8864### OH_Drawing_FontStyleSetGetStyle() 8865 8866``` 8867OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName ) 8868``` 8869 8870**描述** 8871 8872获取字体样式。 8873 8874**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8875 8876**起始版本:** 12 8877 8878**参数:** 8879 8880| 名称 | 描述 | 8881| -------- | -------- | 8882| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8883| index | 指定的字体样式的索引。 | 8884| styleName | 指定字体样式名称的字符串。 | 8885 8886**返回:** 8887 8888返回对应的字体样式。 8889 8890 8891### OH_Drawing_FontStyleSetMatchStyle() 8892 8893``` 8894OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct ) 8895``` 8896 8897**描述** 8898 8899获取最接近字体样式的字型对象。 8900 8901**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8902 8903**起始版本:** 12 8904 8905**参数:** 8906 8907| 名称 | 描述 | 8908| -------- | -------- | 8909| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8910| fontStyleStruct | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8911 8912**返回:** 8913 8914返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8915 8916 8917### OH_Drawing_GetAffinityFromPositionAndAffinity() 8918 8919``` 8920int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 8921``` 8922 8923**描述** 8924 8925获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 8926 8927**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8928 8929**起始版本:** 11 8930 8931**参数:** 8932 8933| 名称 | 描述 | 8934| -------- | -------- | 8935| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 | 8936 8937**返回:** 8938 8939返回OH_Drawing_PositionAndAffinity对象的亲和性。 8940 8941 8942### OH_Drawing_GetBottomFromTextBox() 8943 8944``` 8945float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int ) 8946``` 8947 8948**描述** 8949 8950获取文本框底部位置。 8951 8952**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8953 8954**起始版本:** 11 8955 8956**参数:** 8957 8958| 名称 | 描述 | 8959| -------- | -------- | 8960| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 8961| int | 文本框的索引。 | 8962 8963**返回:** 8964 8965返回文本框底部位置。 8966 8967 8968### OH_Drawing_GetEndFromRange() 8969 8970``` 8971size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* ) 8972``` 8973 8974**描述** 8975 8976获取OH_Drawing_Range对象结束位置。 8977 8978**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8979 8980**起始版本:** 11 8981 8982**参数:** 8983 8984| 名称 | 描述 | 8985| -------- | -------- | 8986| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 | 8987 8988**返回:** 8989 8990返回OH_Drawing_Range对象结束位置。 8991 8992 8993### OH_Drawing_GetLeftFromTextBox() 8994 8995``` 8996float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int ) 8997``` 8998 8999**描述** 9000 9001获取文本框左侧位置。 9002 9003**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9004 9005**起始版本:** 11 9006 9007**参数:** 9008 9009| 名称 | 描述 | 9010| -------- | -------- | 9011| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9012| int | 文本框的索引。 | 9013 9014**返回:** 9015 9016返回文本框左侧位置。 9017 9018 9019### OH_Drawing_GetPositionFromPositionAndAffinity() 9020 9021``` 9022size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 9023``` 9024 9025**描述** 9026 9027获取OH_Drawing_PositionAndAffinity对象的位置属性。 9028 9029**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9030 9031**起始版本:** 11 9032 9033**参数:** 9034 9035| 名称 | 描述 | 9036| -------- | -------- | 9037| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 | 9038 9039**返回:** 9040 9041返回OH_Drawing_PositionAndAffinity对象的位置属性。 9042 9043 9044### OH_Drawing_GetRightFromTextBox() 9045 9046``` 9047float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int ) 9048``` 9049 9050**描述** 9051 9052获取文本框右侧位置。 9053 9054**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9055 9056**起始版本:** 11 9057 9058**参数:** 9059 9060| 名称 | 描述 | 9061| -------- | -------- | 9062| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9063| int | 文本框的索引。 | 9064 9065**返回:** 9066 9067返回文本框右侧位置。 9068 9069 9070### OH_Drawing_GetSizeOfTextBox() 9071 9072``` 9073size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* ) 9074``` 9075 9076**描述** 9077 9078获取文本框数量大小。 9079 9080**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9081 9082**起始版本:** 11 9083 9084**参数:** 9085 9086| 名称 | 描述 | 9087| -------- | -------- | 9088| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9089 9090**返回:** 9091 9092返回文本框数量大小。 9093 9094 9095### OH_Drawing_GetStartFromRange() 9096 9097``` 9098size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* ) 9099``` 9100 9101**描述** 9102 9103获取OH_Drawing_Range对象开始位置。 9104 9105**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9106 9107**起始版本:** 11 9108 9109**参数:** 9110 9111| 名称 | 描述 | 9112| -------- | -------- | 9113| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 | 9114 9115**返回:** 9116 9117返回OH_Drawing_Range对象开始位置。 9118 9119 9120### OH_Drawing_GetSystemFontConfigInfo() 9121 9122``` 9123OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* ) 9124``` 9125 9126**描述** 9127 9128获取系统字体配置信息。 9129 9130**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9131 9132**起始版本:** 12 9133 9134**参数:** 9135 9136| 名称 | 描述 | 9137| -------- | -------- | 9138| OH_Drawing_FontConfigJsonInfoCode | 错误码,具体可见[OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode)枚举。 | 9139 9140**返回:** 9141 9142返回系统字体配置信息的指针。 9143 9144 9145### OH_Drawing_GetTextDirectionFromTextBox() 9146 9147``` 9148int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int ) 9149``` 9150 9151**描述** 9152 9153获取文本框方向。 9154 9155**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9156 9157**起始版本:** 11 9158 9159**参数:** 9160 9161| 名称 | 描述 | 9162| -------- | -------- | 9163| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9164| int | 文本框的索引。 | 9165 9166**返回:** 9167 9168返回文本框方向。 9169 9170 9171### OH_Drawing_GetTopFromTextBox() 9172 9173``` 9174float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int ) 9175``` 9176 9177**描述** 9178 9179获取文本框顶部位置。 9180 9181**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9182 9183**起始版本:** 11 9184 9185**参数:** 9186 9187| 名称 | 描述 | 9188| -------- | -------- | 9189| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9190| int | 文本框的索引。 | 9191 9192**返回:** 9193 9194返回文本框顶部位置。 9195 9196 9197### OH_Drawing_GpuContextCreateFromGL() 9198 9199``` 9200OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions ) 9201``` 9202 9203**描述** 9204 9205用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 9206 9207**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9208 9209**起始版本:** 12 9210 9211**参数:** 9212 9213| 名称 | 描述 | 9214| -------- | -------- | 9215| OH_Drawing_GpuContextOptions | 图形处理器上下文选项[OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)。 | 9216 9217**返回:** 9218 9219返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 9220 9221 9222### OH_Drawing_GpuContextDestroy() 9223 9224``` 9225void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* ) 9226``` 9227 9228**描述** 9229 9230用于销毁图形处理器上下文对象并回收该对象占用的内存。 9231 9232**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9233 9234**起始版本:** 12 9235 9236**参数:** 9237 9238| 名称 | 描述 | 9239| -------- | -------- | 9240| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 | 9241 9242 9243### OH_Drawing_ImageBuildFromBitmap() 9244 9245``` 9246bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap* ) 9247``` 9248 9249**描述** 9250 9251从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 9252 9253本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9254 9255OH_Drawing_Image、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9256 9257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9258 9259**起始版本:** 12 9260 9261**参数:** 9262 9263| 名称 | 描述 | 9264| -------- | -------- | 9265| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9266| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 9267 9268**返回:** 9269 9270函数返回true表示构造图片内容成功,函数返回false表示构建图片内容失败。 9271 9272 9273### OH_Drawing_ImageCreate() 9274 9275``` 9276OH_Drawing_Image* OH_Drawing_ImageCreate (void ) 9277``` 9278 9279**描述** 9280 9281创建一个图片对象,描述了要绘制的二维像素数组。 9282 9283**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9284 9285**起始版本:** 12 9286 9287**返回:** 9288 9289函数返回一个指针,指针指向创建的图片对象[OH_Drawing_Image](#oh_drawing_image)。 9290 9291 9292### OH_Drawing_ImageDestroy() 9293 9294``` 9295void OH_Drawing_ImageDestroy (OH_Drawing_Image* ) 9296``` 9297 9298**描述** 9299 9300销毁图片对象并回收该对象占有内存。 9301 9302**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9303 9304**起始版本:** 12 9305 9306**参数:** 9307 9308| 名称 | 描述 | 9309| -------- | -------- | 9310| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9311 9312 9313### OH_Drawing_ImageGetHeight() 9314 9315``` 9316int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* ) 9317``` 9318 9319**描述** 9320 9321获取图片高度,即像素行数。 9322 9323本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9324 9325OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9326 9327**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9328 9329**起始版本:** 12 9330 9331**参数:** 9332 9333| 名称 | 描述 | 9334| -------- | -------- | 9335| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9336 9337**返回:** 9338 9339函数返回图片高度。 9340 9341 9342### OH_Drawing_ImageGetImageInfo() 9343 9344``` 9345void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info* ) 9346``` 9347 9348**描述** 9349 9350获取图片信息。调用该接口后,传入的图片信息对象被填充。 9351 9352本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9353 9354OH_Drawing_Image、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9355 9356**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9357 9358**起始版本:** 12 9359 9360**参数:** 9361 9362| 名称 | 描述 | 9363| -------- | -------- | 9364| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9365| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针, 开发者可调用[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)创建。 | 9366 9367 9368### OH_Drawing_ImageGetWidth() 9369 9370``` 9371int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* ) 9372``` 9373 9374**描述** 9375 9376获取图片宽度,即每行的像素个数。 9377 9378本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9379 9380OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9381 9382**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9383 9384**起始版本:** 12 9385 9386**参数:** 9387 9388| 名称 | 描述 | 9389| -------- | -------- | 9390| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9391 9392**返回:** 9393 9394函数返回图片宽度。 9395 9396 9397### OH_Drawing_LineMetricsGetSize() 9398 9399``` 9400size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* ) 9401``` 9402 9403**描述** 9404 9405获取行数量。 9406 9407**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9408 9409**起始版本:** 12 9410 9411**参数:** 9412 9413| 名称 | 描述 | 9414| -------- | -------- | 9415| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 9416 9417**返回:** 9418 9419返回行数量。 9420 9421 9422### OH_Drawing_MaskFilterCreateBlur() 9423 9424``` 9425OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM ) 9426``` 9427 9428**描述** 9429 9430创建具有模糊效果的模板滤波器。 9431 9432**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9433 9434**起始版本:** 11 9435 9436**参数:** 9437 9438| 名称 | 描述 | 9439| -------- | -------- | 9440| blurType | 表示模糊类型。 | 9441| sigma | 表示要应用的高斯模糊的标准偏差。必须大于0。 | 9442| respectCTM | 表示模糊标准差值被CTM修改,默认为真。 | 9443 9444**返回:** 9445 9446返回创建的模板滤波器对象的指针。 9447 9448 9449### OH_Drawing_MaskFilterDestroy() 9450 9451``` 9452void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* ) 9453``` 9454 9455**描述** 9456 9457销毁模板滤波器对象,并收回该对象占用的内存。 9458 9459**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9460 9461**起始版本:** 11 9462 9463**参数:** 9464 9465| 名称 | 描述 | 9466| -------- | -------- | 9467| OH_Drawing_MaskFilter | 表示指向模板滤波器对象的指针。 | 9468 9469 9470### OH_Drawing_MatrixConcat() 9471 9472``` 9473void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b ) 9474``` 9475 9476**描述** 9477 9478将矩阵total设置为矩阵a乘以矩阵b。 9479 9480本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9481 9482total、a、b任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9483 9484**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9485 9486**起始版本:** 12 9487 9488**参数:** 9489 9490| 名称 | 描述 | 9491| -------- | -------- | 9492| total | 指向最终的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9493| a | 指向矩阵对象a[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9494| b | 指向矩阵对象b[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9495 9496 9497### OH_Drawing_MatrixCreate() 9498 9499``` 9500OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void ) 9501``` 9502 9503**描述** 9504 9505用于创建一个矩阵对象。 9506 9507**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9508 9509**起始版本:** 11 9510 9511**返回:** 9512 9513函数会返回一个指针,指针指向创建的矩阵对象。 9514 9515 9516### OH_Drawing_MatrixCreateRotation() 9517 9518``` 9519OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y ) 9520``` 9521 9522**描述** 9523 9524创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 9525 9526**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9527 9528**起始版本:** 12 9529 9530**参数:** 9531 9532| 名称 | 描述 | 9533| -------- | -------- | 9534| deg | 旋转的角度,单位为度。正数表示按顺时针旋转,负数表示按逆时针旋转。 | 9535| x | x轴上坐标点。 | 9536| y | y轴上坐标点。 | 9537 9538**返回:** 9539 9540函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9541 9542 9543### OH_Drawing_MatrixCreateScale() 9544 9545``` 9546OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py ) 9547``` 9548 9549**描述** 9550 9551创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 9552 9553**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9554 9555**起始版本:** 12 9556 9557**参数:** 9558 9559| 名称 | 描述 | 9560| -------- | -------- | 9561| sx | 水平缩放因子。 | 9562| sy | 垂直缩放因子。 | 9563| px | x轴上坐标点。 | 9564| py | y轴上坐标点。 | 9565 9566**返回:** 9567 9568函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9569 9570 9571### OH_Drawing_MatrixCreateTranslation() 9572 9573``` 9574OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy ) 9575``` 9576 9577**描述** 9578 9579创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 9580 9581**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9582 9583**起始版本:** 12 9584 9585**参数:** 9586 9587| 名称 | 描述 | 9588| -------- | -------- | 9589| dx | 水平方向平移距离。 | 9590| dy | 垂直方向平移距离。 | 9591 9592**返回:** 9593 9594函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9595 9596 9597### OH_Drawing_MatrixDestroy() 9598 9599``` 9600void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* ) 9601``` 9602 9603**描述** 9604 9605用于销毁矩阵对象并回收该对象占有的内存。 9606 9607**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9608 9609**起始版本:** 11 9610 9611**参数:** 9612 9613| 名称 | 描述 | 9614| -------- | -------- | 9615| OH_Drawing_Matrix | 指向字体对象的指针。 | 9616 9617 9618### OH_Drawing_MatrixGetValue() 9619 9620``` 9621float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index ) 9622``` 9623 9624**描述** 9625 9626获取矩阵给定索引位的值。索引范围0-8。 9627 9628本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9629 9630OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 9631 9632index小于0或者大于8时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 9633 9634**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9635 9636**起始版本:** 12 9637 9638**参数:** 9639 9640| 名称 | 描述 | 9641| -------- | -------- | 9642| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9643| index | 索引位置,范围0-8。 | 9644 9645**返回:** 9646 9647函数返回矩阵给定索引位对应的值。 9648 9649 9650### OH_Drawing_MatrixInvert() 9651 9652``` 9653bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse ) 9654``` 9655 9656**描述** 9657 9658将矩阵inverse设置为矩阵的倒数,并返回结果。 9659 9660本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9661 9662OH_Drawing_Matrix、inverse任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9663 9664**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9665 9666**起始版本:** 12 9667 9668**参数:** 9669 9670| 名称 | 描述 | 9671| -------- | -------- | 9672| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9673| inverse | 指向逆矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 9674 9675**返回:** 9676 9677函数返回true表示矩阵可逆,inverse被填充为逆矩阵;函数返回false表示矩阵不可逆,inverse不被改变。 9678 9679 9680### OH_Drawing_MatrixIsEqual() 9681 9682``` 9683bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other ) 9684``` 9685 9686**描述** 9687 9688判断两个矩阵是否相等。 9689 9690本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9691 9692OH_Drawing_Matrix、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9693 9694**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9695 9696**起始版本:** 12 9697 9698**参数:** 9699 9700| 名称 | 描述 | 9701| -------- | -------- | 9702| OH_Drawing_Matrix | 指向用于判断的其中一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9703| other | 指向用于判断的另一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9704 9705**返回:** 9706 9707函数返回两个矩阵的比较结果,返回true表示两个矩阵相等,返回false表示两个矩阵不相等。 9708 9709 9710### OH_Drawing_MatrixIsIdentity() 9711 9712``` 9713bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* ) 9714``` 9715 9716**描述** 9717 9718判断矩阵是否是单位矩阵。 9719 9720本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9721 9722OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9723 9724**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9725 9726**起始版本:** 12 9727 9728**参数:** 9729 9730| 名称 | 描述 | 9731| -------- | -------- | 9732| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9733 9734**返回:** 9735 9736函数返回true表示矩阵是单位矩阵,函数返回false表示矩阵不是单位矩阵。 9737 9738 9739### OH_Drawing_MatrixPostRotate() 9740 9741``` 9742void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9743``` 9744 9745**描述** 9746 9747将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 9748 9749本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9750 9751OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9752 9753**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9754 9755**起始版本:** 12 9756 9757**参数:** 9758 9759| 名称 | 描述 | 9760| -------- | -------- | 9761| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9762| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 9763| px | 旋转中心点的横坐标。 | 9764| py | 旋转中心点的纵坐标。 | 9765 9766 9767### OH_Drawing_MatrixPostScale() 9768 9769``` 9770void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9771``` 9772 9773**描述** 9774 9775将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 9776 9777本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9778 9779OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9780 9781 9782**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9783 9784**起始版本:** 12 9785 9786**参数:** 9787 9788| 名称 | 描述 | 9789| -------- | -------- | 9790| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9791| sx | x轴方向的缩放比例因子。 | 9792| sy | y轴方向的缩放比例因子。 | 9793| px | 缩放中心点的横坐标。 | 9794| py | 缩放中心点的纵坐标。 | 9795 9796 9797### OH_Drawing_MatrixPostTranslate() 9798 9799``` 9800void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy ) 9801``` 9802 9803**描述** 9804 9805将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 9806 9807本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9808 9809OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9810 9811 9812**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9813 9814**起始版本:** 12 9815 9816**参数:** 9817 9818| 名称 | 描述 | 9819| -------- | -------- | 9820| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9821| dx | 表示在x轴方向上的平移距离。 | 9822| dy | 表示在y轴方向上的平移距离。 | 9823 9824 9825### OH_Drawing_MatrixPreRotate() 9826 9827``` 9828void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9829``` 9830 9831**描述** 9832 9833将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 9834 9835本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9836 9837OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9838 9839 9840**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9841 9842**起始版本:** 12 9843 9844**参数:** 9845 9846| 名称 | 描述 | 9847| -------- | -------- | 9848| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9849| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 9850| px | 旋转中心点的横坐标。 | 9851| py | 旋转中心点的纵坐标。 | 9852 9853 9854### OH_Drawing_MatrixPreScale() 9855 9856``` 9857void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9858``` 9859 9860**描述** 9861 9862将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 9863 9864本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9865 9866OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9867 9868 9869**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9870 9871**起始版本:** 12 9872 9873**参数:** 9874 9875| 名称 | 描述 | 9876| -------- | -------- | 9877| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9878| sx | x轴方向的缩放比例因子。 | 9879| sy | y轴方向的缩放比例因子。 | 9880| px | 缩放中心点的横坐标。 | 9881| py | 缩放中心点的纵坐标。 | 9882 9883 9884### OH_Drawing_MatrixPreTranslate() 9885 9886``` 9887void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy ) 9888``` 9889 9890**描述** 9891 9892将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 9893 9894本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9895 9896OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9897 9898**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9899 9900**起始版本:** 12 9901 9902**参数:** 9903 9904| 名称 | 描述 | 9905| -------- | -------- | 9906| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9907| dx | 表示在x轴方向上的平移距离。 | 9908| dy | 表示在y轴方向上的平移距离。 | 9909 9910 9911### OH_Drawing_MatrixReset() 9912 9913``` 9914void OH_Drawing_MatrixReset (OH_Drawing_Matrix* ) 9915``` 9916 9917**描述** 9918 9919重置当前矩阵为单位矩阵: | 1 0 0 | | 0 1 0 | | 0 0 1 |。 9920 9921本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9922 9923OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9924 9925**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9926 9927**起始版本:** 12 9928 9929**参数:** 9930 9931| 名称 | 描述 | 9932| -------- | -------- | 9933| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9934 9935 9936### OH_Drawing_MatrixRotate() 9937 9938``` 9939void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9940``` 9941 9942**描述** 9943 9944设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 9945 9946本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9947 9948OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9949 9950**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9951 9952**起始版本:** 12 9953 9954**参数:** 9955 9956| 名称 | 描述 | 9957| -------- | -------- | 9958| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9959| degree | 角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 9960| px | x轴上坐标点。 | 9961| py | y轴上坐标点。 | 9962 9963 9964### OH_Drawing_MatrixScale() 9965 9966``` 9967void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9968``` 9969 9970**描述** 9971 9972设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 9973 9974本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9975 9976OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9977 9978**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9979 9980**起始版本:** 12 9981 9982**参数:** 9983 9984| 名称 | 描述 | 9985| -------- | -------- | 9986| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9987| sx | 水平缩放因子。 | 9988| sy | 垂直缩放因子。 | 9989| px | x轴上坐标点。 | 9990| py | y轴上坐标点。 | 9991 9992 9993### OH_Drawing_MatrixSetMatrix() 9994 9995``` 9996void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 ) 9997``` 9998 9999**描述** 10000 10001用于给矩阵对象设置参数。 10002 10003本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10004 10005OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10006 10007**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10008 10009**起始版本:** 11 10010 10011**参数:** 10012 10013| 名称 | 描述 | 10014| -------- | -------- | 10015| OH_Drawing_Matrix | 指向矩阵对象的指针。 | 10016| scaleX | 水平缩放系数。 | 10017| skewX | 水平倾斜系数。 | 10018| transX | 水平位移系数。 | 10019| skewY | 垂直倾斜系数。 | 10020| scaleY | 垂直缩放系数。 | 10021| transY | 垂直位移系数。 | 10022| persp0 | X轴透视系数。 | 10023| persp1 | Y轴透视系数。 | 10024| persp2 | 透视缩放系数。 | 10025 10026 10027### OH_Drawing_MatrixSetPolyToPoly() 10028 10029``` 10030bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count ) 10031``` 10032 10033**描述** 10034 10035通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。 10036 10037本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10038 10039OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10040 10041count小于0或者大于4时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10042 10043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10044 10045**起始版本:** 12 10046 10047**参数:** 10048 10049| 名称 | 描述 | 10050| -------- | -------- | 10051| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10052| src | 源点数组,为NULL时count应当为0。 | 10053| dst | 目标点数组,个数要与源点相等,为NULL时count应当为0。 | 10054| count | 源点数组以及目标点数组的个数,为0时将矩阵对象设为单位矩阵。 | 10055 10056**返回:** 10057 10058函数返回是否可以生成对应矩阵以用来完成变换。true表示矩阵生成成功,false表示无法生成对应矩阵。 10059 10060 10061### OH_Drawing_MatrixSetRectToRect() 10062 10063``` 10064bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf ) 10065``` 10066 10067**描述** 10068 10069将矩阵以缩放方式适配目标矩阵。 10070 10071本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10072 10073OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10074 10075**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10076 10077**起始版本:** 12 10078 10079**参数:** 10080 10081| 名称 | 描述 | 10082| -------- | -------- | 10083| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10084| src | 指向映射源的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 | 10085| dst | 指向要映射到的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 | 10086| stf | 缩放方式,支持方式[OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)。 | 10087 10088**返回:** 10089 10090如果设置失败,则返回false;如果设置成功,则返回true;如果矩阵为空,则返回true,并将矩阵设置为:|0 0 0| |0 0 0| |0 0 1| 10091 10092### OH_Drawing_MatrixTranslate() 10093 10094``` 10095void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy ) 10096``` 10097 10098**描述** 10099 10100设置矩阵为单位矩阵,并平移(dx, dy)。 10101 10102本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10103 10104OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10105 10106**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10107 10108**起始版本:** 12 10109 10110**参数:** 10111 10112| 名称 | 描述 | 10113| -------- | -------- | 10114| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10115| dx | 水平方向平移距离。 | 10116| dy | 垂直方向平移距离。 | 10117 10118 10119### OH_Drawing_MemoryStreamCreate() 10120 10121``` 10122OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData ) 10123``` 10124 10125**描述** 10126 10127创建一个内存流对象。 10128 10129本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10130 10131data为NULL或者length等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10132 10133**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10134 10135**起始版本:** 12 10136 10137**参数:** 10138 10139| 名称 | 描述 | 10140| -------- | -------- | 10141| data | 数据段。 | 10142| length | 数据段长度。 | 10143| copyData | 是否拷贝数据。true表示内存流对象会拷贝一份数据段数据, false表示内存流对象直接使用数据段数据,不拷贝。 | 10144 10145**返回:** 10146 10147函数会返回一个指针,指针指向创建的内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)。 10148 10149 10150### OH_Drawing_MemoryStreamDestroy() 10151 10152``` 10153void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* ) 10154``` 10155 10156**描述** 10157 10158销毁内存流对象并回收该对象占有内存。 10159 10160**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10161 10162**起始版本:** 12 10163 10164**参数:** 10165 10166| 名称 | 描述 | 10167| -------- | -------- | 10168| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 | 10169 10170 10171### OH_Drawing_PathAddArc() 10172 10173``` 10174void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 10175``` 10176 10177**描述** 10178 10179将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫掠角度添加弧, 添加的弧是椭圆边界椭圆的一部分,单位为度。正扫掠表示按顺时针方向延长弧, 负扫掠表示按逆时针方向延长弧。如果扫掠角度<= -360°,或扫掠角度>= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。 10180 10181本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10182 10183OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10184 10185**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10186 10187**起始版本:** 12 10188 10189**参数:** 10190 10191| 名称 | 描述 | 10192| -------- | -------- | 10193| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10194| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10195| startAngle | 弧的起始角度,单位为度。 | 10196| sweepAngle | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 | 10197 10198### OH_Drawing_PathAddOval() 10199 10200``` 10201void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection ) 10202``` 10203 10204**描述** 10205 10206按指定方向,向路径添加椭圆。 10207 10208本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10209 10210OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10211 10212OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10213 10214**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10215 10216**起始版本:** 12 10217 10218**参数:** 10219 10220| 名称 | 描述 | 10221| -------- | -------- | 10222| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10223| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10224| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10225 10226### OH_Drawing_PathAddOvalWithInitialPoint() 10227 10228``` 10229void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection ) 10230``` 10231 10232**描述** 10233 10234将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 10235 10236本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10237 10238OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10239 10240OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10241 10242**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10243 10244**起始版本:** 12 10245 10246**参数:** 10247 10248| 名称 | 描述 | 10249| -------- | -------- | 10250| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10251| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10252| start | 表示椭圆初始点的索引。 | 10253| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10254 10255 10256### OH_Drawing_PathAddPath() 10257 10258``` 10259void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix* ) 10260``` 10261 10262**描述** 10263 10264将源路径矩阵变换后,添加到当前路径中。 10265 10266本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10267 10268OH_Drawing_Path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10269 10270**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10271 10272**起始版本:** 12 10273 10274**参数:** 10275 10276| 名称 | 描述 | 10277| -------- | -------- | 10278| OH_Drawing_Path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10279| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10280| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 | 10281 10282 10283### OH_Drawing_PathAddPathWithMatrixAndMode() 10284 10285``` 10286void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode ) 10287``` 10288 10289**描述** 10290 10291将源路径矩阵变换后,以规定模式添加到当前路径中。 10292 10293本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10294 10295path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10296 10297OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10298 10299**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10300 10301**起始版本:** 12 10302 10303**参数:** 10304 10305| 名称 | 描述 | 10306| -------- | -------- | 10307| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10308| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10309| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 | 10310| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10311 10312 10313### OH_Drawing_PathAddPathWithMode() 10314 10315``` 10316void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode ) 10317``` 10318 10319**描述** 10320 10321将源路径以规定模式添加到当前路径中。 10322 10323本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10324 10325path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10326 10327OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10328 10329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10330 10331**起始版本:** 12 10332 10333**参数:** 10334 10335| 名称 | 描述 | 10336| -------- | -------- | 10337| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10338| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10339| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10340 10341 10342### OH_Drawing_PathAddPathWithOffsetAndMode() 10343 10344``` 10345void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode ) 10346``` 10347 10348**描述** 10349 10350将源路径偏移后,以规定模式添加到当前路径中。 10351 10352本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10353 10354path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10355 10356OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10357 10358**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10359 10360**起始版本:** 12 10361 10362**参数:** 10363 10364| 名称 | 描述 | 10365| -------- | -------- | 10366| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10367| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10368| dx | 添加到目标路径横坐标的偏移量。 | 10369| dy | 添加到目标路径纵坐标的偏移量。 | 10370| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10371 10372 10373### OH_Drawing_PathAddRect() 10374 10375``` 10376void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection ) 10377``` 10378 10379**描述** 10380 10381按指定方向,向路径添加矩形轮廓。 10382 10383本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10384 10385OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10386 10387OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10388 10389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10390 10391**起始版本:** 12 10392 10393**参数:** 10394 10395| 名称 | 描述 | 10396| -------- | -------- | 10397| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10398| left | 矩形左上角的x轴坐标。 | 10399| top | 矩形左上角的y轴坐标。 | 10400| right | 矩形右下角的x轴坐标。 | 10401| bottom | 矩形右下角的y轴坐标。 | 10402| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10403 10404 10405### OH_Drawing_PathAddRectWithInitialCorner() 10406 10407``` 10408void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start ) 10409``` 10410 10411**描述** 10412 10413按指定方向,向路径添加矩形轮廓。 10414 10415本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10416 10417OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10418 10419OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10420 10421**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10422 10423**起始版本:** 12 10424 10425**参数:** 10426 10427| 名称 | 描述 | 10428| -------- | -------- | 10429| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10430| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10431| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10432| start | 起始点的位置,表示从矩形的哪个角开始绘制路径。0:左上角,1:右上角,2:右下角,3:左下角。 | 10433 10434 10435### OH_Drawing_PathAddRoundRect() 10436 10437``` 10438void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection ) 10439``` 10440 10441**描述** 10442 10443按指定方向,向路径添加圆角矩形轮廓。 10444 10445本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10446 10447OH_Drawing_Path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10448 10449OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10450 10451**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10452 10453**起始版本:** 12 10454 10455**参数:** 10456 10457| 名称 | 描述 | 10458| -------- | -------- | 10459| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10460| roundRect | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针。 | 10461| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10462 10463 10464### OH_Drawing_PathArcTo() 10465 10466``` 10467void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg ) 10468``` 10469 10470**描述** 10471 10472用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 10473 10474本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10475 10476OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10477 10478**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10479 10480**起始版本:** 8 10481 10482**参数:** 10483 10484| 名称 | 描述 | 10485| -------- | -------- | 10486| OH_Drawing_Path | 指向路径对象的指针。 | 10487| x1 | 包围椭圆的矩形左上角点位置的横坐标。 | 10488| y1 | 包围椭圆的矩形左上角点位置的纵坐标。 | 10489| x2 | 包围椭圆的矩形右下角点位置的横坐标。 | 10490| y2 | 包围椭圆的矩形右下角点位置的纵坐标。 | 10491| startDeg | 起始的角度。角度的起始方向(0°)为x轴正方向。 | 10492| sweepDeg | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 | 10493 10494 10495### OH_Drawing_PathClose() 10496 10497``` 10498void OH_Drawing_PathClose (OH_Drawing_Path* ) 10499``` 10500 10501**描述** 10502 10503用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 10504 10505本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10506 10507OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10508 10509**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10510 10511**起始版本:** 8 10512 10513**参数:** 10514 10515| 名称 | 描述 | 10516| -------- | -------- | 10517| OH_Drawing_Path | 指向路径对象的指针。 | 10518 10519 10520### OH_Drawing_PathConicTo() 10521 10522``` 10523void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10524``` 10525 10526**描述** 10527 10528在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。 10529 10530本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10531 10532OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10533 10534**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10535 10536**起始版本:** 12 10537 10538**参数:** 10539 10540| 名称 | 描述 | 10541| -------- | -------- | 10542| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10543| ctrlX | 控制点位置的横坐标。 | 10544| ctrlY | 控制点位置的纵坐标。 | 10545| endX | 结束点位置的横坐标。 | 10546| endY | 结束点位置的纵坐标。 | 10547| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathLineTo](#oh_drawing_pathlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathQuadTo](#oh_drawing_pathquadto)。 | 10548 10549 10550### OH_Drawing_PathContains() 10551 10552``` 10553bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y ) 10554``` 10555 10556**描述** 10557 10558判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1)。 10559 10560本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10561 10562OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10563 10564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10565 10566**起始版本:** 12 10567 10568**参数:** 10569 10570| 名称 | 描述 | 10571| -------- | -------- | 10572| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10573| x | x轴上坐标点。 | 10574| y | y轴上坐标点。 | 10575 10576**返回:** 10577 10578函数返回true表示点在路径内,函数返回false表示点在路径外。 10579 10580 10581### OH_Drawing_PathCopy() 10582 10583``` 10584OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* ) 10585``` 10586 10587**描述** 10588 10589创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 10590 10591本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10592 10593OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10594 10595**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10596 10597**起始版本:** 12 10598 10599**参数:** 10600 10601| 名称 | 描述 | 10602| -------- | -------- | 10603| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10604 10605**返回:** 10606 10607函数返回一个指针,指针指向创建的路径对象副本[OH_Drawing_Path](#oh_drawing_path)。 10608 10609 10610### OH_Drawing_PathCreate() 10611 10612``` 10613OH_Drawing_Path* OH_Drawing_PathCreate (void ) 10614``` 10615 10616**描述** 10617 10618用于创建一个路径对象。 10619 10620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10621 10622**起始版本:** 8 10623 10624**返回:** 10625 10626函数会返回一个指针,指针指向创建的路径对象。 10627 10628 10629### OH_Drawing_PathCubicTo() 10630 10631``` 10632void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 10633``` 10634 10635**描述** 10636 10637用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 10638 10639本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10640 10641OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10642 10643**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10644 10645**起始版本:** 8 10646 10647**参数:** 10648 10649| 名称 | 描述 | 10650| -------- | -------- | 10651| OH_Drawing_Path | 指向路径对象的指针。 | 10652| ctrlX1 | 第一个控制点位置的横坐标。 | 10653| ctrlY1 | 第一个控制点位置的纵坐标。 | 10654| ctrlX2 | 第二个控制点位置的横坐标。 | 10655| ctrlY2 | 第二个控制点位置的纵坐标。 | 10656| endX | 目标点位置的横坐标。 | 10657| endY | 目标点位置的纵坐标。 | 10658 10659 10660### OH_Drawing_PathDestroy() 10661 10662``` 10663void OH_Drawing_PathDestroy (OH_Drawing_Path* ) 10664``` 10665 10666**描述** 10667 10668用于销毁路径对象并回收该对象占有的内存。 10669 10670**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10671 10672**起始版本:** 8 10673 10674**参数:** 10675 10676| 名称 | 描述 | 10677| -------- | -------- | 10678| OH_Drawing_Path | 指向路径对象的指针。 | 10679 10680 10681### OH_Drawing_PathEffectDestroy() 10682 10683``` 10684void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* ) 10685``` 10686 10687**描述** 10688 10689销毁路径效果对象并回收该对象占有内存。 10690 10691**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10692 10693**起始版本:** 12 10694 10695**参数:** 10696 10697| 名称 | 描述 | 10698| -------- | -------- | 10699| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。 | 10700 10701 10702### OH_Drawing_PathGetLength() 10703 10704``` 10705float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed ) 10706``` 10707 10708**描述** 10709 10710获取当前路径的长度。 10711 10712本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10713 10714OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10715 10716**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10717 10718**起始版本:** 12 10719 10720**参数:** 10721 10722| 名称 | 描述 | 10723| -------- | -------- | 10724| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10725| forceClosed | 表示调用后是否可以自由修改/删除路径。true表示可以自由修改/删除路径。false表示不能自由修改/删除路径。 | 10726 10727**返回:** 10728 10729函数返回当前路径的长度。 10730 10731 10732### OH_Drawing_PathLineTo() 10733 10734``` 10735void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y ) 10736``` 10737 10738**描述** 10739 10740用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 10741 10742本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10743 10744OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10745 10746**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10747 10748**起始版本:** 8 10749 10750**参数:** 10751 10752| 名称 | 描述 | 10753| -------- | -------- | 10754| OH_Drawing_Path | 指向路径对象的指针。 | 10755| x | 目标点的横坐标。 | 10756| y | 目标点的纵坐标。 | 10757 10758 10759### OH_Drawing_PathMoveTo() 10760 10761``` 10762void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y ) 10763``` 10764 10765**描述** 10766 10767用于设置自定义路径的起始点位置。 10768 10769本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10770 10771OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10772 10773**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10774 10775**起始版本:** 8 10776 10777**参数:** 10778 10779| 名称 | 描述 | 10780| -------- | -------- | 10781| OH_Drawing_Path | 指向路径对象的指针。 | 10782| x | 起始点的横坐标。 | 10783| y | 起始点的纵坐标。 | 10784 10785 10786### OH_Drawing_PathOffset() 10787 10788``` 10789void OH_Drawing_PathOffset (OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy ) 10790``` 10791 10792**描述** 10793 10794将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。 10795 10796本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10797 10798path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10799 10800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10801 10802**起始版本:** 12 10803 10804**参数:** 10805 10806| 名称 | 描述 | 10807| -------- | -------- | 10808| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10809| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,为NULL时会将结果存储到当前路径对象中。 | 10810| dx | x轴方向的偏移量。 | 10811| dy | y轴方向的偏移量。 | 10812 10813 10814### OH_Drawing_PathQuadTo() 10815 10816``` 10817void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 10818``` 10819 10820**描述** 10821 10822用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 10823 10824本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10825 10826OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10827 10828**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10829 10830**起始版本:** 8 10831 10832**参数:** 10833 10834| 名称 | 描述 | 10835| -------- | -------- | 10836| OH_Drawing_Path | 指向路径对象的指针。 | 10837| ctrlX | 控制点位置的横坐标。 | 10838| ctrlY | 控制点位置的纵坐标。 | 10839| endX | 目标点位置的横坐标。 | 10840| endY | 目标点位置的纵坐标。 | 10841 10842 10843### OH_Drawing_PathRConicTo() 10844 10845``` 10846void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10847``` 10848 10849**描述** 10850 10851使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线。 10852 10853本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10854 10855OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10856 10857**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10858 10859**起始版本:** 12 10860 10861**参数:** 10862 10863| 名称 | 描述 | 10864| -------- | -------- | 10865| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10866| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 | 10867| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 | 10868| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 10869| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 10870| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto)。 | 10871 10872 10873### OH_Drawing_PathRCubicTo() 10874 10875``` 10876void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 10877``` 10878 10879**描述** 10880 10881使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 10882 10883本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10884 10885OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10886 10887**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10888 10889**起始版本:** 12 10890 10891**参数:** 10892 10893| 名称 | 描述 | 10894| -------- | -------- | 10895| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10896| ctrlX1 | 相对于路径终点的x轴偏移量,用于指定第一个控制点的横坐标。 | 10897| ctrlY1 | 相对于路径终点的y轴偏移量,用于指定第一个控制点的纵坐标。 | 10898| ctrlX2 | 相对于路径终点的x轴偏移量,用于指定第二个控制点的横坐标。 | 10899| ctrlY2 | 相对于路径终点的y轴偏移量,用于指定第二个控制点的纵坐标。 | 10900| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 10901| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 10902 10903 10904### OH_Drawing_PathReset() 10905 10906``` 10907void OH_Drawing_PathReset (OH_Drawing_Path* ) 10908``` 10909 10910**描述** 10911 10912用于重置自定义路径数据。 10913 10914本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10915 10916OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10917 10918**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10919 10920**起始版本:** 8 10921 10922**参数:** 10923 10924| 名称 | 描述 | 10925| -------- | -------- | 10926| OH_Drawing_Path | 指向路径对象的指针。 | 10927 10928 10929### OH_Drawing_PathRLineTo() 10930 10931``` 10932void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y ) 10933``` 10934 10935**描述** 10936 10937使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 10938 10939本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10940 10941OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10942 10943**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10944 10945**起始版本:** 12 10946 10947**参数:** 10948 10949| 名称 | 描述 | 10950| -------- | -------- | 10951| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10952| x | 相对于当前路径终点的x轴偏移量,用于指定目标点的横坐标。 | 10953| y | 相对于当前路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 10954 10955 10956### OH_Drawing_PathRMoveTo() 10957 10958``` 10959void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y ) 10960``` 10961 10962**描述** 10963 10964用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 10965 10966本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10967 10968OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10969 10970**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10971 10972**起始版本:** 12 10973 10974**参数:** 10975 10976| 名称 | 描述 | 10977| -------- | -------- | 10978| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10979| x | 相对于当前路径终点的x轴偏移量,用于指定新的路径起始点的横坐标。 | 10980| y | 相对于当前路径终点的y轴偏移量,用于指定新的路径起始点的纵坐标。 | 10981 10982 10983### OH_Drawing_PathRQuadTo() 10984 10985``` 10986void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 10987``` 10988 10989**描述** 10990 10991使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 10992 10993本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10994 10995OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10996 10997**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10998 10999**起始版本:** 12 11000 11001**参数:** 11002 11003| 名称 | 描述 | 11004| -------- | -------- | 11005| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11006| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 | 11007| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 | 11008| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 11009| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 11010 11011 11012### OH_Drawing_PathSetFillType() 11013 11014``` 11015void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType ) 11016``` 11017 11018**描述** 11019 11020设置填充路径的规则。 11021 11022本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11023 11024OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11025 11026OH_Drawing_PathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11027 11028**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11029 11030**起始版本:** 12 11031 11032**参数:** 11033 11034| 名称 | 描述 | 11035| -------- | -------- | 11036| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11037| OH_Drawing_PathFillType | 路径填充规则[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 | 11038 11039 11040### OH_Drawing_PathTransform() 11041 11042``` 11043void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix* ) 11044``` 11045 11046**描述** 11047 11048对路径进行矩阵变换。 11049 11050本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11051 11052OH_Drawing_Path、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11053 11054**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11055 11056**起始版本:** 12 11057 11058**参数:** 11059 11060| 名称 | 描述 | 11061| -------- | -------- | 11062| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11063| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 11064 11065 11066### OH_Drawing_PathTransformWithPerspectiveClip() 11067 11068``` 11069void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip ) 11070``` 11071 11072**描述** 11073 11074对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为空,则替换源路径。 11075 11076本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11077 11078src、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11079 11080**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11081 11082**起始版本:** 12 11083 11084**参数:** 11085 11086| 名称 | 描述 | 11087| -------- | -------- | 11088| src | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11089| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 11090| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11091| applyPerspectiveClip | 表示变换路径是否应用透视裁剪。true表示应用透视裁剪,false表示不用透视裁剪。 | 11092 11093 11094### OH_Drawing_PenCreate() 11095 11096``` 11097OH_Drawing_Pen* OH_Drawing_PenCreate (void ) 11098``` 11099 11100**描述** 11101 11102用于创建一个画笔对象。 11103 11104**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11105 11106**起始版本:** 8 11107 11108**返回:** 11109 11110函数会返回一个指针,指针指向创建的画笔对象。 11111 11112 11113### OH_Drawing_PenDestroy() 11114 11115``` 11116void OH_Drawing_PenDestroy (OH_Drawing_Pen* ) 11117``` 11118 11119**描述** 11120 11121用于销毁画笔对象并回收该对象占有的内存。 11122 11123**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11124 11125**起始版本:** 8 11126 11127**参数:** 11128 11129| 名称 | 描述 | 11130| -------- | -------- | 11131| OH_Drawing_Pen | 指向画笔对象的指针。 | 11132 11133 11134### OH_Drawing_PenGetAlpha() 11135 11136``` 11137uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* ) 11138``` 11139 11140**描述** 11141 11142获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 11143 11144本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11145 11146OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11147 11148**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11149 11150**起始版本:** 11 11151 11152**参数:** 11153 11154| 名称 | 描述 | 11155| -------- | -------- | 11156| OH_Drawing_Pen | 表示指向画笔对象的指针。 | 11157 11158**返回:** 11159 11160返回一个8比特的值表示透明度。 11161 11162 11163### OH_Drawing_PenGetCap() 11164 11165``` 11166OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* ) 11167``` 11168 11169**描述** 11170 11171用于获取画笔笔帽的样式。 11172 11173本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11174 11175OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11176 11177**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11178 11179**起始版本:** 8 11180 11181**参数:** 11182 11183| 名称 | 描述 | 11184| -------- | -------- | 11185| OH_Drawing_Pen | 指向画笔对象的指针。 | 11186 11187**返回:** 11188 11189函数返回画笔笔帽样式。 11190 11191 11192### OH_Drawing_PenGetColor() 11193 11194``` 11195uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* ) 11196``` 11197 11198**描述** 11199 11200用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 11201 11202本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11203 11204OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11205 11206**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11207 11208**起始版本:** 8 11209 11210**参数:** 11211 11212| 名称 | 描述 | 11213| -------- | -------- | 11214| OH_Drawing_Pen | 指向画笔对象的指针。 | 11215 11216**返回:** 11217 11218函数返回一个描述颜色的32位(ARGB)变量。 11219 11220 11221### OH_Drawing_PenGetFilter() 11222 11223``` 11224void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11225``` 11226 11227**描述** 11228 11229从画笔获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 11230 11231本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11232 11233OH_Drawing_Pen、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11234 11235**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11236 11237**起始版本:** 12 11238 11239**参数:** 11240 11241| 名称 | 描述 | 11242| -------- | -------- | 11243| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11244| OH_Drawing_Filter | 指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 11245 11246 11247### OH_Drawing_PenGetJoin() 11248 11249``` 11250OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* ) 11251``` 11252 11253**描述** 11254 11255用于获取画笔绘制折线转角的样式。 11256 11257本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11258 11259OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11260 11261**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11262 11263**起始版本:** 8 11264 11265**参数:** 11266 11267| 名称 | 描述 | 11268| -------- | -------- | 11269| OH_Drawing_Pen | 指向画笔对象的指针。 | 11270 11271**返回:** 11272 11273函数返回折线转角的样式。 11274 11275### OH_Drawing_PenGetMiterLimit() 11276 11277``` 11278float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* ) 11279``` 11280 11281**描述** 11282 11283用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 11284 11285本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11286 11287OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11288 11289**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11290 11291**起始版本:** 8 11292 11293**参数:** 11294 11295| 名称 | 描述 | 11296| -------- | -------- | 11297| OH_Drawing_Pen | 指向画笔对象的指针。 | 11298 11299**返回:** 11300 11301函数返回尖角的限制值。 11302 11303 11304### OH_Drawing_PenGetWidth() 11305 11306``` 11307float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* ) 11308``` 11309 11310**描述** 11311 11312获取画笔的线宽,线宽描述了画笔绘制图形轮廓的宽度。 11313 11314本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11315 11316OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11317 11318**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11319 11320**起始版本:** 8 11321 11322**参数:** 11323 11324| 名称 | 描述 | 11325| -------- | -------- | 11326| OH_Drawing_Pen | 指向画笔对象的指针。 | 11327 11328**返回:** 11329 11330函数返回画笔的线宽。 11331 11332 11333### OH_Drawing_PenIsAntiAlias() 11334 11335``` 11336bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* ) 11337``` 11338 11339**描述** 11340 11341用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 11342 11343本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11344 11345OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11346 11347**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11348 11349**起始版本:** 8 11350 11351**参数:** 11352 11353| 名称 | 描述 | 11354| -------- | -------- | 11355| OH_Drawing_Pen | 指向画笔对象的指针。 | 11356 11357**返回:** 11358 11359函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 11360 11361 11362### OH_Drawing_PenReset() 11363 11364``` 11365void OH_Drawing_PenReset (OH_Drawing_Pen* ) 11366``` 11367 11368**描述** 11369 11370将画笔重置至初始值。 11371 11372本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11373 11374OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11375 11376**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11377 11378**起始版本:** 12 11379 11380**参数:** 11381 11382| 名称 | 描述 | 11383| -------- | -------- | 11384| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11385 11386 11387### OH_Drawing_PenSetAlpha() 11388 11389``` 11390void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha ) 11391``` 11392 11393**描述** 11394 11395为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 11396 11397本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11398 11399OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11400 11401**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11402 11403**起始版本:** 11 11404 11405**参数:** 11406 11407| 名称 | 描述 | 11408| -------- | -------- | 11409| OH_Drawing_Pen | 表示指向画笔对象的指针。 | 11410| alpha | 表示要设置的透明度值,是一个8比特的变量。 | 11411 11412 11413### OH_Drawing_PenSetAntiAlias() 11414 11415``` 11416void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool ) 11417``` 11418 11419**描述** 11420 11421用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 11422 11423本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11424 11425OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11426 11427**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11428 11429**起始版本:** 8 11430 11431**参数:** 11432 11433| 名称 | 描述 | 11434| -------- | -------- | 11435| OH_Drawing_Pen | 指向画笔对象的指针。 | 11436| bool | 真为抗锯齿,假则不做抗锯齿处理。 | 11437 11438 11439### OH_Drawing_PenSetBlendMode() 11440 11441``` 11442void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode ) 11443``` 11444 11445**描述** 11446 11447为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 11448 11449本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11450 11451OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11452 11453OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11454 11455**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11456 11457**起始版本:** 12 11458 11459**参数:** 11460 11461| 名称 | 描述 | 11462| -------- | -------- | 11463| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11464| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 11465 11466 11467### OH_Drawing_PenSetCap() 11468 11469``` 11470void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle ) 11471``` 11472 11473**描述** 11474 11475用于设置画笔笔帽样式。 11476 11477本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11478 11479OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11480 11481OH_Drawing_PenLineCapStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11482 11483**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11484 11485**起始版本:** 8 11486 11487**参数:** 11488 11489| 名称 | 描述 | 11490| -------- | -------- | 11491| OH_Drawing_Pen | 指向画笔对象的指针。 | 11492| OH_Drawing_PenLineCapStyle | 描述画笔笔帽样式的变量。 | 11493 11494 11495### OH_Drawing_PenSetColor() 11496 11497``` 11498void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color ) 11499``` 11500 11501**描述** 11502 11503用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 11504 11505本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11506 11507OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11508 11509**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11510 11511**起始版本:** 8 11512 11513**参数:** 11514 11515| 名称 | 描述 | 11516| -------- | -------- | 11517| OH_Drawing_Pen | 指向画笔对象的指针。 | 11518| color | 描述颜色的32位(ARGB)变量。 | 11519 11520 11521### OH_Drawing_PenSetFilter() 11522 11523``` 11524void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11525``` 11526 11527**描述** 11528 11529设置画笔滤波器。 11530 11531本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11532 11533OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11534 11535**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11536 11537**起始版本:** 11 11538 11539**参数:** 11540 11541| 名称 | 描述 | 11542| -------- | -------- | 11543| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11544| OH_Drawing_Filter | 指向滤波器[OH_Drawing_Filter](#oh_drawing_filter)的指针,为NULL表示清空画笔滤波器。 | 11545 11546 11547### OH_Drawing_PenSetJoin() 11548 11549``` 11550void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle ) 11551``` 11552 11553**描述** 11554 11555用于设置画笔绘制转角的样式。 11556 11557本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11558 11559OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11560 11561OH_Drawing_PenLineJoinStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11562 11563**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11564 11565**起始版本:** 8 11566 11567**参数:** 11568 11569| 名称 | 描述 | 11570| -------- | -------- | 11571| OH_Drawing_Pen | 指向画笔对象的指针。 | 11572| OH_Drawing_PenLineJoinStyle | 折线转角样式。 | 11573 11574 11575### OH_Drawing_PenSetMiterLimit() 11576 11577``` 11578void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter ) 11579``` 11580 11581**描述** 11582 11583用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 11584 11585本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11586 11587OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11588 11589**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11590 11591**起始版本:** 8 11592 11593**参数:** 11594 11595| 名称 | 描述 | 11596| -------- | -------- | 11597| OH_Drawing_Pen | 指向画笔对象的指针。 | 11598| miter | 描述尖角限制值的变量。 | 11599 11600 11601### OH_Drawing_PenSetPathEffect() 11602 11603``` 11604void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect* ) 11605``` 11606 11607**描述** 11608 11609设置画笔路径效果。 11610 11611本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11612 11613OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11614 11615**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11616 11617**起始版本:** 12 11618 11619**参数:** 11620 11621| 名称 | 描述 | 11622| -------- | -------- | 11623| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11624| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针,为NULL表示清空路径效果。 | 11625 11626 11627### OH_Drawing_PenSetShaderEffect() 11628 11629``` 11630void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect* ) 11631``` 11632 11633**描述** 11634 11635设置画笔着色器效果。 11636 11637本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11638 11639OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11640 11641**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11642 11643**起始版本:** 11 11644 11645**参数:** 11646 11647| 名称 | 描述 | 11648| -------- | -------- | 11649| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11650| OH_Drawing_ShaderEffect | 指向着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)的指针,为NULL表示清空着色器效果。 | 11651 11652 11653### OH_Drawing_PenSetWidth() 11654 11655``` 11656void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width ) 11657``` 11658 11659**描述** 11660 11661用于设置画笔的线宽。0线宽被视作特殊的极细线宽,在绘制时始终会被绘制为1像素,不随画布的缩放而改变;负数线宽在实际绘制时会被视作0线宽。 11662 11663本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11664 11665OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11666 11667**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11668 11669**起始版本:** 8 11670 11671**参数:** 11672 11673| 名称 | 描述 | 11674| -------- | -------- | 11675| OH_Drawing_Pen | 指向画笔对象的指针。 | 11676| width | 描述画笔线宽的变量。 | 11677 11678 11679### OH_Drawing_PointCreate() 11680 11681``` 11682OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y ) 11683``` 11684 11685**描述** 11686 11687用于创建一个坐标点对象。 11688 11689**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11690 11691**起始版本:** 11 11692 11693**参数:** 11694 11695| 名称 | 描述 | 11696| -------- | -------- | 11697| x | X轴坐标。 | 11698| y | Y轴坐标。 | 11699 11700**返回:** 11701 11702函数会返回一个指针,指针指向创建的坐标点对象。 11703 11704 11705### OH_Drawing_PointDestroy() 11706 11707``` 11708void OH_Drawing_PointDestroy (OH_Drawing_Point* ) 11709``` 11710 11711**描述** 11712 11713用于销毁坐标点对象并回收该对象占有的内存。 11714 11715**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11716 11717**起始版本:** 11 11718 11719**参数:** 11720 11721| 名称 | 描述 | 11722| -------- | -------- | 11723| OH_Drawing_Point | 指向坐标点对象的指针。 | 11724 11725 11726### OH_Drawing_RectCopy() 11727 11728``` 11729void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect ) 11730``` 11731 11732**描述** 11733 11734用于将源矩形对象复制到目标矩形对象。 11735 11736本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11737 11738sRect、dRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11739 11740**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11741 11742**起始版本:** 12 11743 11744**参数:** 11745 11746| 名称 | 描述 | 11747| -------- | -------- | 11748| sRect | 指向源矩形对象的指针。 | 11749| dRect | 指向目标矩形对象的指针。 | 11750 11751 11752### OH_Drawing_RectCreate() 11753 11754``` 11755OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom ) 11756``` 11757 11758**描述** 11759 11760用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 11761 11762**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11763 11764**起始版本:** 11 11765 11766**参数:** 11767 11768| 名称 | 描述 | 11769| -------- | -------- | 11770| left | 矩形左上角的横坐标。 | 11771| top | 矩形左上角的纵坐标。 | 11772| right | 矩形右下角的横坐标。 | 11773| bottom | 矩形右下角的纵坐标。 | 11774 11775**返回:** 11776 11777函数会返回一个指针,指针指向创建的矩形对象。 11778 11779 11780### OH_Drawing_RectDestroy() 11781 11782``` 11783void OH_Drawing_RectDestroy (OH_Drawing_Rect* ) 11784``` 11785 11786**描述** 11787 11788用于销毁矩形对象并回收该对象占有的内存。 11789 11790**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11791 11792**起始版本:** 11 11793 11794**参数:** 11795 11796| 名称 | 描述 | 11797| -------- | -------- | 11798| OH_Drawing_Rect | 指向矩形对象的指针。 | 11799 11800 11801### OH_Drawing_RectGetBottom() 11802 11803``` 11804float OH_Drawing_RectGetBottom (OH_Drawing_Rect* ) 11805``` 11806 11807**描述** 11808 11809用于获取给矩形设置的右下角的纵坐标。 11810 11811本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11812 11813OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11814 11815**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11816 11817**起始版本:** 12 11818 11819**参数:** 11820 11821| 名称 | 描述 | 11822| -------- | -------- | 11823| OH_Drawing_Rect | 指向矩形对象的指针。 | 11824 11825**返回:** 11826 11827矩形右下角的纵坐标。 11828 11829 11830### OH_Drawing_RectGetHeight() 11831 11832``` 11833float OH_Drawing_RectGetHeight (OH_Drawing_Rect* ) 11834``` 11835 11836**描述** 11837 11838用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 11839 11840本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11841 11842OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11843 11844**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11845 11846**起始版本:** 12 11847 11848**参数:** 11849 11850| 名称 | 描述 | 11851| -------- | -------- | 11852| OH_Drawing_Rect | 指向矩形对象的指针。 | 11853 11854**返回:** 11855 11856返回矩形对象的高度。 11857 11858 11859### OH_Drawing_RectGetLeft() 11860 11861``` 11862float OH_Drawing_RectGetLeft (OH_Drawing_Rect* ) 11863``` 11864 11865**描述** 11866 11867用于获取给矩形设置的左上角的横坐标。 11868 11869本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11870 11871OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11872 11873**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11874 11875**起始版本:** 12 11876 11877**参数:** 11878 11879| 名称 | 描述 | 11880| -------- | -------- | 11881| OH_Drawing_Rect | 指向矩形对象的指针。 | 11882 11883**返回:** 11884 11885矩形左上角的横坐标。 11886 11887 11888### OH_Drawing_RectGetRight() 11889 11890``` 11891float OH_Drawing_RectGetRight (OH_Drawing_Rect* ) 11892``` 11893 11894**描述** 11895 11896用于获取给矩形设置的右下角的横坐标。 11897 11898本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11899 11900OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11901 11902**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11903 11904**起始版本:** 12 11905 11906**参数:** 11907 11908| 名称 | 描述 | 11909| -------- | -------- | 11910| OH_Drawing_Rect | 指向矩形对象的指针。 | 11911 11912**返回:** 11913 11914矩形右下角的横坐标。 11915 11916 11917### OH_Drawing_RectGetTop() 11918 11919``` 11920float OH_Drawing_RectGetTop (OH_Drawing_Rect* ) 11921``` 11922 11923**描述** 11924 11925用于获取给矩形设置的左上角的纵坐标。 11926 11927本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11928 11929OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11930 11931**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11932 11933**起始版本:** 12 11934 11935**参数:** 11936 11937| 名称 | 描述 | 11938| -------- | -------- | 11939| OH_Drawing_Rect | 指向矩形对象的指针。 | 11940 11941**返回:** 11942 11943矩形左上角的纵坐标。 11944 11945 11946### OH_Drawing_RectGetWidth() 11947 11948``` 11949float OH_Drawing_RectGetWidth (OH_Drawing_Rect* ) 11950``` 11951 11952**描述** 11953 11954用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 11955 11956本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11957 11958OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11959 11960**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11961 11962**起始版本:** 12 11963 11964**参数:** 11965 11966| 名称 | 描述 | 11967| -------- | -------- | 11968| OH_Drawing_Rect | 指向矩形对象的指针。 | 11969 11970**返回:** 11971 11972返回矩形对象的宽度。 11973 11974 11975### OH_Drawing_RectIntersect() 11976 11977``` 11978bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 11979``` 11980 11981**描述** 11982 11983用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 11984 11985本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11986 11987rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11988 11989**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11990 11991**起始版本:** 12 11992 11993**参数:** 11994 11995| 名称 | 描述 | 11996| -------- | -------- | 11997| rect | 指向矩形对象的指针。 | 11998| other | 指向矩形对象的指针。 | 11999 12000**返回:** 12001 12002返回两个矩形是否相交的结果。true表示这两个矩形相交,rect被设置为两个矩形的交集;false表示不相交,rect保持不变。 12003 12004 12005### OH_Drawing_RectSetBottom() 12006 12007``` 12008void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom ) 12009``` 12010 12011**描述** 12012 12013用于设置矩形右下角的纵坐标。 12014 12015本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12016 12017rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12018 12019**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12020 12021**起始版本:** 12 12022 12023**参数:** 12024 12025| 名称 | 描述 | 12026| -------- | -------- | 12027| rect | 指向矩形对象的指针。 | 12028| bottom | 矩形右下角的纵坐标。 | 12029 12030 12031### OH_Drawing_RectSetLeft() 12032 12033``` 12034void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left ) 12035``` 12036 12037**描述** 12038 12039用于设置矩形左上角的横坐标。 12040 12041本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12042 12043rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12044 12045**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12046 12047**起始版本:** 12 12048 12049**参数:** 12050 12051| 名称 | 描述 | 12052| -------- | -------- | 12053| rect | 指向矩形对象的指针。 | 12054| left | 矩形左上角的横坐标。 | 12055 12056 12057### OH_Drawing_RectSetRight() 12058 12059``` 12060void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right ) 12061``` 12062 12063**描述** 12064 12065用于设置矩形右下角的横坐标。 12066 12067本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12068 12069rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12070 12071**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12072 12073**起始版本:** 12 12074 12075**参数:** 12076 12077| 名称 | 描述 | 12078| -------- | -------- | 12079| rect | 指向矩形对象的指针。 | 12080| right | 矩形右下角的横坐标。 | 12081 12082 12083### OH_Drawing_RectSetTop() 12084 12085``` 12086void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top ) 12087``` 12088 12089**描述** 12090 12091用于设置矩形左上角的纵坐标。 12092 12093本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12094 12095rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12096 12097**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12098 12099**起始版本:** 12 12100 12101**参数:** 12102 12103| 名称 | 描述 | 12104| -------- | -------- | 12105| rect | 指向矩形对象的指针。 | 12106| top | 矩形左上角的纵坐标。 | 12107 12108 12109### OH_Drawing_RegionCreate() 12110 12111``` 12112OH_Drawing_Region* OH_Drawing_RegionCreate (void ) 12113``` 12114 12115**描述** 12116 12117用于创建一个区域对象,实现更精确的图形控制。 12118 12119**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12120 12121**起始版本:** 12 12122 12123**返回:** 12124 12125函数会返回一个指针,指针指向创建的区域对象。 12126 12127 12128### OH_Drawing_RegionDestroy() 12129 12130``` 12131void OH_Drawing_RegionDestroy (OH_Drawing_Region* ) 12132``` 12133 12134**描述** 12135 12136用于销毁区域对象并回收该对象占有的内存。 12137 12138**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12139 12140**起始版本:** 12 12141 12142**参数:** 12143 12144| 名称 | 描述 | 12145| -------- | -------- | 12146| OH_Drawing_Region | 指向区域对象的指针。 | 12147 12148 12149### OH_Drawing_RegionSetRect() 12150 12151``` 12152bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect ) 12153``` 12154 12155**描述** 12156 12157用于尝试给区域对象设置矩形边界。 12158 12159本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12160 12161region、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12162 12163**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12164 12165**起始版本:** 12 12166 12167**参数:** 12168 12169| 名称 | 描述 | 12170| -------- | -------- | 12171| region | 指向区域对象的指针。 | 12172| rect | 指向矩形对象的指针。 | 12173 12174**返回:** 12175 12176返回区域对象设置矩形边界是否成功的结果。true表示设置矩形边界成功,false表示设置矩形边界失败。 12177 12178 12179### OH_Drawing_RegisterFont() 12180 12181``` 12182uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc ) 12183``` 12184 12185**描述** 12186 12187用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 12188 12189**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12190 12191**起始版本:** 11 12192 12193**参数:** 12194 12195| 名称 | 描述 | 12196| -------- | -------- | 12197| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 | 12198| fontFamily | 指需要注册的字体的字体名称。 | 12199| familySrc | 指需要注册的字体文件的路径。 | 12200 12201**返回:** 12202 12203返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败,9文件损坏。 12204 12205 12206### OH_Drawing_RegisterFontBuffer() 12207 12208``` 12209uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length ) 12210``` 12211 12212**描述** 12213 12214用于在字体管理器中注册字体缓冲区。 12215 12216**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12217 12218**起始版本:** 11 12219 12220**参数:** 12221 12222| 名称 | 描述 | 12223| -------- | -------- | 12224| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 | 12225| fontFamily | 指需要注册的字体的字体名称。 | 12226| fontBuffer | 指需要注册的字体文件的缓冲区。 | 12227| length | 指需要注册的字体文件的长度。 | 12228 12229**返回:** 12230 12231返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空,9文件损坏。 12232 12233 12234### OH_Drawing_RoundRectCreate() 12235 12236``` 12237OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad ) 12238``` 12239 12240**描述** 12241 12242用于创建一个圆角矩形对象。 12243 12244本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12245 12246OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12247 12248**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12249 12250**起始版本:** 11 12251 12252**参数:** 12253 12254| 名称 | 描述 | 12255| -------- | -------- | 12256| OH_Drawing_Rect | 指向矩形对象的指针。 | 12257| xRad | X轴上的圆角半径。 | 12258| yRad | Y轴上的圆角半径。 | 12259 12260**返回:** 12261 12262函数会返回一个指针,指针指向创建的圆角矩形对象。 12263 12264 12265### OH_Drawing_RoundRectDestroy() 12266 12267``` 12268void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* ) 12269``` 12270 12271**描述** 12272 12273用于销毁圆角矩形对象并回收该对象占有的内存。 12274 12275**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12276 12277**起始版本:** 11 12278 12279**参数:** 12280 12281| 名称 | 描述 | 12282| -------- | -------- | 12283| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12284 12285 12286### OH_Drawing_RoundRectGetCorner() 12287 12288``` 12289OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos ) 12290``` 12291 12292**描述** 12293 12294用于获取圆角矩形中指定圆角位置的圆角半径。 12295 12296本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12297 12298OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12299 12300**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12301 12302**起始版本:** 12 12303 12304**参数:** 12305 12306| 名称 | 描述 | 12307| -------- | -------- | 12308| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12309| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 | 12310 12311**返回:** 12312 12313返回指定圆角位置的圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。 12314 12315 12316### OH_Drawing_RoundRectSetCorner() 12317 12318``` 12319void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii ) 12320``` 12321 12322**描述** 12323 12324用于设置圆角矩形中指定圆角位置的圆角半径。 12325 12326本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12327 12328OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12329 12330**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12331 12332**起始版本:** 12 12333 12334**参数:** 12335 12336| 名称 | 描述 | 12337| -------- | -------- | 12338| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12339| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 | 12340| OH_Drawing_Corner_Radii | 圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。 | 12341 12342 12343### OH_Drawing_SamplingOptionsCreate() 12344 12345``` 12346OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode ) 12347``` 12348 12349**描述** 12350 12351创建一个采样选项对象。 12352 12353本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12354 12355OH_Drawing_MipmapMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 12356 12357**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12358 12359**起始版本:** 12 12360 12361**参数:** 12362 12363| 名称 | 描述 | 12364| -------- | -------- | 12365| OH_Drawing_FilterMode | 过滤采样模式[OH_Drawing_FilterMode](#oh_drawing_filtermode) | 12366| OH_Drawing_MipmapMode | 多级渐远纹理采样模式[OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)。 | 12367 12368**返回:** 12369 12370函数会返回一个指针,指针指向创建的采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)。 12371 12372 12373### OH_Drawing_SamplingOptionsDestroy() 12374 12375``` 12376void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* ) 12377``` 12378 12379**描述** 12380 12381销毁采样选项对象并回收该对象占有内存。 12382 12383**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12384 12385**起始版本:** 12 12386 12387**参数:** 12388 12389| 名称 | 描述 | 12390| -------- | -------- | 12391| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 | 12392 12393 12394### OH_Drawing_SetTextStyleBackgroundBrush() 12395 12396``` 12397void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12398``` 12399 12400**描述** 12401 12402设置背景色画刷。 12403 12404**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12405 12406**起始版本:** 12 12407 12408**参数:** 12409 12410| 名称 | 描述 | 12411| -------- | -------- | 12412| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12413| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 12414 12415 12416### OH_Drawing_SetTextStyleBackgroundPen() 12417 12418``` 12419void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12420``` 12421 12422**描述** 12423 12424设置背景色画笔。 12425 12426**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12427 12428**起始版本:** 12 12429 12430**参数:** 12431 12432| 名称 | 描述 | 12433| -------- | -------- | 12434| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12435| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 12436 12437 12438### OH_Drawing_SetTextStyleBaseLine() 12439 12440``` 12441void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int ) 12442``` 12443 12444**描述** 12445 12446设置字体基线位置。 12447 12448**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12449 12450**起始版本:** 8 12451 12452**参数:** 12453 12454| 名称 | 描述 | 12455| -------- | -------- | 12456| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12457| int | 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 | 12458 12459 12460### OH_Drawing_SetTextStyleColor() 12461 12462``` 12463void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t ) 12464``` 12465 12466**描述** 12467 12468设置文本颜色。 12469 12470**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12471 12472**起始版本:** 8 12473 12474**参数:** 12475 12476| 名称 | 描述 | 12477| -------- | -------- | 12478| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12479| uint32_t | 颜色。 | 12480 12481 12482### OH_Drawing_SetTextStyleDecoration() 12483 12484``` 12485void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int ) 12486``` 12487 12488**描述** 12489 12490设置装饰。 12491 12492**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12493 12494**起始版本:** 8 12495 12496**参数:** 12497 12498| 名称 | 描述 | 12499| -------- | -------- | 12500| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12501| int | 设置装饰,设置1为下划线,设置2为上划线,设置3为删除线,设置0或其它为无装饰,具体可见[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举。 | 12502 12503 12504### OH_Drawing_SetTextStyleDecorationColor() 12505 12506``` 12507void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t ) 12508``` 12509 12510**描述** 12511 12512设置装饰颜色。 12513 12514**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12515 12516**起始版本:** 8 12517 12518**参数:** 12519 12520| 名称 | 描述 | 12521| -------- | -------- | 12522| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12523| uint32_t | 颜色。 | 12524 12525 12526### OH_Drawing_SetTextStyleDecorationStyle() 12527 12528``` 12529void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int ) 12530``` 12531 12532**描述** 12533 12534设置文本装饰样式。 12535 12536**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12537 12538**起始版本:** 11 12539 12540**参数:** 12541 12542| 名称 | 描述 | 12543| -------- | -------- | 12544| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12545| int | 设置的文本装饰样式,支持可选的装饰样式具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 | 12546 12547 12548### OH_Drawing_SetTextStyleDecorationThicknessScale() 12549 12550``` 12551void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double ) 12552``` 12553 12554**描述** 12555 12556设置文本装饰线的厚度缩放比例。 12557 12558**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12559 12560**起始版本:** 11 12561 12562**参数:** 12563 12564| 名称 | 描述 | 12565| -------- | -------- | 12566| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12567| double | 缩放比例。 | 12568 12569 12570### OH_Drawing_SetTextStyleEllipsis() 12571 12572``` 12573void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char* ) 12574``` 12575 12576**描述** 12577 12578设置文本的省略号内容。 12579 12580**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12581 12582**起始版本:** 11 12583 12584**参数:** 12585 12586| 名称 | 描述 | 12587| -------- | -------- | 12588| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12589| char\* | 设置省略号内容,数据类型为指向char的指针。 | 12590 12591 12592### OH_Drawing_SetTextStyleEllipsisModal() 12593 12594``` 12595void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int ) 12596``` 12597 12598**描述** 12599 12600设置文本的省略号样式。 12601 12602**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12603 12604**起始版本:** 11 12605 12606**参数:** 12607 12608| 名称 | 描述 | 12609| -------- | -------- | 12610| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12611| int | 设置省略号样式,支持可选的省略号样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 | 12612 12613 12614### OH_Drawing_SetTextStyleFontFamilies() 12615 12616``` 12617void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] ) 12618``` 12619 12620**描述** 12621 12622设置字体类型。 12623 12624**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12625 12626**起始版本:** 8 12627 12628**参数:** 12629 12630| 名称 | 描述 | 12631| -------- | -------- | 12632| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12633| int | 字体名称数量。 | 12634| char | 指向字体类型的指针。 | 12635 12636 12637### OH_Drawing_SetTextStyleFontHeight() 12638 12639``` 12640void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double ) 12641``` 12642 12643**描述** 12644 12645设置行高,按当前字体大小的倍数进行设置。 12646 12647**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12648 12649**起始版本:** 8 12650 12651**参数:** 12652 12653| 名称 | 描述 | 12654| -------- | -------- | 12655| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12656| double | 当前字体大小的倍数。 | 12657 12658 12659### OH_Drawing_SetTextStyleFontSize() 12660 12661``` 12662void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double ) 12663``` 12664 12665**描述** 12666 12667设置字号。 12668 12669**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12670 12671**起始版本:** 8 12672 12673**参数:** 12674 12675| 名称 | 描述 | 12676| -------- | -------- | 12677| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12678| double | 字号。 | 12679 12680 12681### OH_Drawing_SetTextStyleFontStyle() 12682 12683``` 12684void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int ) 12685``` 12686 12687**描述** 12688 12689设置字体风格。 12690 12691**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12692 12693**起始版本:** 8 12694 12695**参数:** 12696 12697| 名称 | 描述 | 12698| -------- | -------- | 12699| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12700| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 12701 12702 12703### OH_Drawing_SetTextStyleFontStyleStruct() 12704 12705``` 12706void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle ) 12707``` 12708 12709**描述** 12710 12711设置字体样式,包括字体字重、字体宽度和字体斜度。 12712 12713**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12714 12715**起始版本:** 12 12716 12717**参数:** 12718 12719| 名称 | 描述 | 12720| -------- | -------- | 12721| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12722| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 12723 12724 12725### OH_Drawing_SetTextStyleFontWeight() 12726 12727``` 12728void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int ) 12729``` 12730 12731**描述** 12732 12733设置字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 12734 12735**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12736 12737**起始版本:** 8 12738 12739**参数:** 12740 12741| 名称 | 描述 | 12742| -------- | -------- | 12743| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12744| int | 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。 | 12745 12746 12747### OH_Drawing_SetTextStyleForegroundBrush() 12748 12749``` 12750void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12751``` 12752 12753**描述** 12754 12755设置前景色画刷。 12756 12757**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12758 12759**起始版本:** 12 12760 12761**参数:** 12762 12763| 名称 | 描述 | 12764| -------- | -------- | 12765| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12766| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 12767 12768 12769### OH_Drawing_SetTextStyleForegroundPen() 12770 12771``` 12772void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12773``` 12774 12775**描述** 12776 12777设置前景色画笔。 12778 12779**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12780 12781**起始版本:** 12 12782 12783**参数:** 12784 12785| 名称 | 描述 | 12786| -------- | -------- | 12787| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12788| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 12789 12790 12791### OH_Drawing_SetTextStyleHalfLeading() 12792 12793``` 12794void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool ) 12795``` 12796 12797**描述** 12798 12799设置文本为一半行间距。 12800 12801**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12802 12803**起始版本:** 11 12804 12805**参数:** 12806 12807| 名称 | 描述 | 12808| -------- | -------- | 12809| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12810| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 12811 12812 12813### OH_Drawing_SetTextStyleLetterSpacing() 12814 12815``` 12816void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double ) 12817``` 12818 12819**描述** 12820 12821设置文本的字符间距。 12822 12823**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12824 12825**起始版本:** 11 12826 12827**参数:** 12828 12829| 名称 | 描述 | 12830| -------- | -------- | 12831| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12832| double | 间距大小。 | 12833 12834 12835### OH_Drawing_SetTextStyleLocale() 12836 12837``` 12838void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char* ) 12839``` 12840 12841**描述** 12842 12843设置文本语言类型。 12844 12845**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12846 12847**起始版本:** 8 12848 12849**参数:** 12850 12851| 名称 | 描述 | 12852| -------- | -------- | 12853| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12854| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。| 12855 12856 12857### OH_Drawing_SetTextStyleWordSpacing() 12858 12859``` 12860void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double ) 12861``` 12862 12863**描述** 12864 12865设置文本的单词间距。 12866 12867**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12868 12869**起始版本:** 11 12870 12871**参数:** 12872 12873| 名称 | 描述 | 12874| -------- | -------- | 12875| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12876| double | 间距大小。 | 12877 12878 12879### OH_Drawing_SetTypographyStyleFontStyleStruct() 12880 12881``` 12882void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle ) 12883``` 12884 12885**描述** 12886 12887设置文本字体样式,包括字体字重、字体宽度和字体斜度。 12888 12889**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12890 12891**起始版本:** 12 12892 12893**参数:** 12894 12895| 名称 | 描述 | 12896| -------- | -------- | 12897| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 12898| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 12899 12900 12901### OH_Drawing_SetTypographyStyleTextStrutStyle() 12902 12903``` 12904void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle* ) 12905``` 12906 12907**描述** 12908 12909设置文本支柱样式。 12910 12911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12912 12913**起始版本:** 12 12914 12915**参数:** 12916 12917| 名称 | 描述 | 12918| -------- | -------- | 12919| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 12920| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 | 12921 12922 12923### OH_Drawing_SetTypographyTextAlign() 12924 12925``` 12926void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int ) 12927``` 12928 12929**描述** 12930 12931设置文本对齐方式。 12932 12933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12934 12935**起始版本:** 8 12936 12937**参数:** 12938 12939| 名称 | 描述 | 12940| -------- | -------- | 12941| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 12942| int | 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 | 12943 12944 12945### OH_Drawing_SetTypographyTextBreakStrategy() 12946 12947``` 12948void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int ) 12949``` 12950 12951**描述** 12952 12953设置文本的中断策略。 12954 12955**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12956 12957**起始版本:** 11 12958 12959**参数:** 12960 12961| 名称 | 描述 | 12962| -------- | -------- | 12963| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 12964| int | 设置中断策略,支持可选的中断策略具体可见[OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)枚举。 | 12965 12966 12967### OH_Drawing_SetTypographyTextDirection() 12968 12969``` 12970void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int ) 12971``` 12972 12973**描述** 12974 12975设置文本方向。 12976 12977**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12978 12979**起始版本:** 8 12980 12981**参数:** 12982 12983| 名称 | 描述 | 12984| -------- | -------- | 12985| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 12986| int | 设置文本方向,设置1为从左到右,设置0或其它为从右到左,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 | 12987 12988 12989### OH_Drawing_SetTypographyTextEllipsis() 12990 12991``` 12992void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis ) 12993``` 12994 12995**描述** 12996 12997设置省略号样式。 12998 12999**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13000 13001**起始版本:** 12 13002 13003**参数:** 13004 13005| 名称 | 描述 | 13006| -------- | -------- | 13007| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13008| char | 省略号样式。 | 13009 13010 13011### OH_Drawing_SetTypographyTextEllipsisModal() 13012 13013``` 13014void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int ) 13015``` 13016 13017**描述** 13018 13019设置文本的省略号样式。 13020 13021**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13022 13023**起始版本:** 11 13024 13025**参数:** 13026 13027| 名称 | 描述 | 13028| -------- | -------- | 13029| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13030| int | 设置省略号样式,支持可选的省略号样式样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 | 13031 13032 13033### OH_Drawing_SetTypographyTextFontFamily() 13034 13035``` 13036void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char* ) 13037``` 13038 13039**描述** 13040 13041设置字体家族的名称。 13042 13043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13044 13045**起始版本:** 12 13046 13047**参数:** 13048 13049| 名称 | 描述 | 13050| -------- | -------- | 13051| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13052| char | 字体家族的名称,数据类型为指向char的指针。 | 13053 13054 13055### OH_Drawing_SetTypographyTextFontHeight() 13056 13057``` 13058void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double ) 13059``` 13060 13061**描述** 13062 13063设置文本排版字体高度。 13064 13065**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13066 13067**起始版本:** 12 13068 13069**参数:** 13070 13071| 名称 | 描述 | 13072| -------- | -------- | 13073| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13074| double | 字体高度。 | 13075 13076 13077### OH_Drawing_SetTypographyTextFontSize() 13078 13079``` 13080void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double ) 13081``` 13082 13083**描述** 13084 13085设置文本排版字号。 13086 13087**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13088 13089**起始版本:** 12 13090 13091**参数:** 13092 13093| 名称 | 描述 | 13094| -------- | -------- | 13095| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13096| double | 字号(大于0)。 | 13097 13098 13099### OH_Drawing_SetTypographyTextFontStyle() 13100 13101``` 13102void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int ) 13103``` 13104 13105**描述** 13106 13107设置字体风格。 13108 13109**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13110 13111**起始版本:** 12 13112 13113**参数:** 13114 13115| 名称 | 描述 | 13116| -------- | -------- | 13117| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13118| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 13119 13120 13121### OH_Drawing_SetTypographyTextFontWeight() 13122 13123``` 13124void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int ) 13125``` 13126 13127**描述** 13128 13129设置文本排版字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 13130 13131**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13132 13133**起始版本:** 12 13134 13135**参数:** 13136 13137| 名称 | 描述 | 13138| -------- | -------- | 13139| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13140| int | 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。 | 13141 13142 13143### OH_Drawing_SetTypographyTextHalfLeading() 13144 13145``` 13146void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13147``` 13148 13149**描述** 13150 13151设置文本排版是否为一半行间距。 13152 13153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13154 13155**起始版本:** 12 13156 13157**参数:** 13158 13159| 名称 | 描述 | 13160| -------- | -------- | 13161| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13162| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 13163 13164 13165### OH_Drawing_SetTypographyTextLineStyleFontFamilies() 13166 13167``` 13168void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] ) 13169``` 13170 13171**描述** 13172 13173设置文本排版行样式字体类型。 13174 13175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13176 13177**起始版本:** 12 13178 13179**参数:** 13180 13181| 名称 | 描述 | 13182| -------- | -------- | 13183| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13184| int | 字体名称数量。 | 13185| char | 指向字体类型的指针。 | 13186 13187 13188### OH_Drawing_SetTypographyTextLineStyleFontHeight() 13189 13190``` 13191void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double ) 13192``` 13193 13194**描述** 13195 13196设置文本排版行样式字体高度。 13197 13198**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13199 13200**起始版本:** 12 13201 13202**参数:** 13203 13204| 名称 | 描述 | 13205| -------- | -------- | 13206| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13207| double | 字体高度。 | 13208 13209 13210### OH_Drawing_SetTypographyTextLineStyleFontSize() 13211 13212``` 13213void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double ) 13214``` 13215 13216**描述** 13217 13218设置文本排版行样式字号。 13219 13220**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13221 13222**起始版本:** 12 13223 13224**参数:** 13225 13226| 名称 | 描述 | 13227| -------- | -------- | 13228| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13229| double | 字号(大于0)。 | 13230 13231 13232### OH_Drawing_SetTypographyTextLineStyleFontStyle() 13233 13234``` 13235void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int ) 13236``` 13237 13238**描述** 13239 13240设置文本排版行样式风格。 13241 13242**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13243 13244**起始版本:** 12 13245 13246**参数:** 13247 13248| 名称 | 描述 | 13249| -------- | -------- | 13250| OH_Drawing_TypographyStyle | 指向文本风格指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13251| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 13252 13253 13254### OH_Drawing_SetTypographyTextLineStyleFontWeight() 13255 13256``` 13257void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int ) 13258``` 13259 13260**描述** 13261 13262设置文本排版行样式字重。目前只有系统默认字体支持字重的调节,其他字体设置字重值小于semi-bold时字体粗细无变化,当设置字重值大于等于semi-bold时可能会触发伪加粗效果。 13263 13264**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13265 13266**起始版本:** 12 13267 13268**参数:** 13269 13270| 名称 | 描述 | 13271| -------- | -------- | 13272| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13273| int | 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。 | 13274 13275 13276### OH_Drawing_SetTypographyTextLineStyleHalfLeading() 13277 13278``` 13279void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13280``` 13281 13282**描述** 13283 13284设置文本排版行样式是否为一半行间距。 13285 13286**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13287 13288**起始版本:** 12 13289 13290**参数:** 13291 13292| 名称 | 描述 | 13293| -------- | -------- | 13294| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13295| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 13296 13297 13298### OH_Drawing_SetTypographyTextLineStyleOnly() 13299 13300``` 13301void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool ) 13302``` 13303 13304**描述** 13305 13306设置文本排版是否仅启用行样式。 13307 13308**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13309 13310**起始版本:** 12 13311 13312**参数:** 13313 13314| 名称 | 描述 | 13315| -------- | -------- | 13316| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13317| bool | 设置仅启用行样式是否生效,true表示生效,false表示不生效。 | 13318 13319 13320### OH_Drawing_SetTypographyTextLineStyleSpacingScale() 13321 13322``` 13323void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double ) 13324``` 13325 13326**描述** 13327 13328设置文本排版行样式间距比例。 13329 13330**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13331 13332**起始版本:** 12 13333 13334**参数:** 13335 13336| 名称 | 描述 | 13337| -------- | -------- | 13338| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13339| double | 间距比例。 | 13340 13341 13342### OH_Drawing_SetTypographyTextLocale() 13343 13344``` 13345void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale ) 13346``` 13347 13348**描述** 13349 13350设置段落语言类型。 13351 13352**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13353 13354**起始版本:** 12 13355 13356**参数:** 13357 13358| 名称 | 描述 | 13359| -------- | -------- | 13360| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13361| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。 | 13362 13363 13364### OH_Drawing_SetTypographyTextMaxLines() 13365 13366``` 13367void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int ) 13368``` 13369 13370**描述** 13371 13372设置文本最大行数。 13373 13374**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13375 13376**起始版本:** 8 13377 13378**参数:** 13379 13380| 名称 | 描述 | 13381| -------- | -------- | 13382| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13383| int | 最大行数。 | 13384 13385### OH_Drawing_SetTypographyTextSplitRatio() 13386 13387``` 13388void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio ) 13389``` 13390 13391**描述** 13392 13393设置文本划分比率。 13394 13395**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13396 13397**起始版本:** 12 13398 13399**参数:** 13400 13401| 名称 | 描述 | 13402| -------- | -------- | 13403| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13404| float | 文本划分比率。 | 13405 13406 13407### OH_Drawing_SetTypographyTextStyle() 13408 13409``` 13410void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle* ) 13411``` 13412 13413**描述** 13414 13415设置段落样式。 13416 13417**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13418 13419**起始版本:** 12 13420 13421**参数:** 13422 13423| 名称 | 描述 | 13424| -------- | -------- | 13425| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13426| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13427 13428 13429### OH_Drawing_SetTypographyTextUseLineStyle() 13430 13431``` 13432void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool ) 13433``` 13434 13435**描述** 13436 13437设置文本排版是否启用行样式。 13438 13439**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13440 13441**起始版本:** 12 13442 13443**参数:** 13444 13445| 名称 | 描述 | 13446| -------- | -------- | 13447| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13448| bool | 设置行样式是否启用,true表示启用,false表示不启用。 | 13449 13450 13451### OH_Drawing_SetTypographyTextWordBreakType() 13452 13453``` 13454void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int ) 13455``` 13456 13457**描述** 13458 13459设置单词的断词方式。 13460 13461**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13462 13463**起始版本:** 11 13464 13465**参数:** 13466 13467| 名称 | 描述 | 13468| -------- | -------- | 13469| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13470| int | 设置断词方式,支持可选的断词方式样式具体可见[OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)枚举。 | 13471 13472 13473### OH_Drawing_ShaderEffectCreateImageShader() 13474 13475``` 13476OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix* ) 13477``` 13478 13479**描述** 13480 13481创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 13482 13483本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13484 13485OH_Drawing_Image、OH_Drawing_SamplingOptions任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13486 13487tileX、tileY任意一个不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13488 13489**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13490 13491**起始版本:** 12 13492 13493**参数:** 13494 13495| 名称 | 描述 | 13496| -------- | -------- | 13497| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 13498| tileX | 水平方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13499| tileY | 垂直方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13500| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 | 13501| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。如果矩阵指针为空,默认传入单位矩阵。 | 13502 13503**返回:** 13504 13505返回创建的着色器对象的指针。 13506 13507 13508### OH_Drawing_ShaderEffectCreateLinearGradient() 13509 13510``` 13511OH_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 ) 13512``` 13513 13514**描述** 13515 13516创建着色器,在两个指定点之间生成线性渐变。 13517 13518本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13519 13520startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13521 13522OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13523 13524**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13525 13526**起始版本:** 11 13527 13528**参数:** 13529 13530| 名称 | 描述 | 13531| -------- | -------- | 13532| startPt | 表示渐变的起点。 | 13533| endPt | 表示渐变的终点。 | 13534| colors | 表示在两个点之间分布的颜色。 | 13535| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在起点和终点之间。 | 13536| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13537| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13538 13539**返回:** 13540 13541返回创建的着色器对象的指针。 13542 13543 13544### OH_Drawing_ShaderEffectCreateRadialGradient() 13545 13546``` 13547OH_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 ) 13548``` 13549 13550**描述** 13551 13552创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 13553 13554本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13555 13556centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13557 13558OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13559 13560**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13561 13562**起始版本:** 11 13563 13564**参数:** 13565 13566| 名称 | 描述 | 13567| -------- | -------- | 13568| centerPt | 表示渐变的圆心。 | 13569| radius | 表示渐变的圆半径。 | 13570| colors | 表示在径向上分布的颜色。 | 13571| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在径向上。 | 13572| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13573| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13574 13575**返回:** 13576 13577返回创建的着色器对象的指针。 13578 13579 13580### OH_Drawing_ShaderEffectCreateSweepGradient() 13581 13582``` 13583OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode ) 13584``` 13585 13586**描述** 13587 13588创建着色器,在给定中心的情况下生成扇形渐变。颜色从0°到360°渐变被称为扇形渐变。 13589 13590本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13591 13592centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13593 13594OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13595 13596**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13597 13598**起始版本:** 11 13599 13600**参数:** 13601 13602| 名称 | 描述 | 13603| -------- | -------- | 13604| centerPt | 表示渐变的圆心。 | 13605| colors | 表示在两个点之间分布的颜色。 | 13606| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在0°和360°之间。 | 13607| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13608| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13609 13610**返回:** 13611 13612返回创建的着色器对象的指针。 13613 13614 13615### OH_Drawing_ShaderEffectDestroy() 13616 13617``` 13618void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* ) 13619``` 13620 13621**描述** 13622 13623销毁着色器对象,并收回该对象占用的内存。 13624 13625**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13626 13627**起始版本:** 11 13628 13629**参数:** 13630 13631| 名称 | 描述 | 13632| -------- | -------- | 13633| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 | 13634 13635 13636### OH_Drawing_SurfaceCreateFromGpuContext() 13637 13638``` 13639OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info ) 13640``` 13641 13642**描述** 13643 13644使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。 13645 13646本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13647 13648OH_Drawing_GpuContext为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13649 13650**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13651 13652**起始版本:** 12 13653 13654**参数:** 13655 13656| 名称 | 描述 | 13657| -------- | -------- | 13658| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 | 13659| budgeted | 用于控制内存分配是否计入缓存预算,true则计入高速缓存预算,false则不计入高速缓存预算。 | 13660| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。 | 13661 13662**返回:** 13663 13664返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。 13665 13666 13667### OH_Drawing_SurfaceDestroy() 13668 13669``` 13670void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* ) 13671``` 13672 13673**描述** 13674 13675销毁surface对象并回收该对象占用的内存。 13676 13677**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13678 13679**起始版本:** 12 13680 13681**参数:** 13682 13683| 名称 | 描述 | 13684| -------- | -------- | 13685| OH_Drawing_Surface | 指向创建的surface对象的指针。 | 13686 13687 13688### OH_Drawing_SurfaceGetCanvas() 13689 13690``` 13691OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* ) 13692``` 13693 13694**描述** 13695 13696通过surface对象获取画布对象。 13697 13698本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13699 13700OH_Drawing_Surface为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13701 13702**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13703 13704**起始版本:** 12 13705 13706**参数:** 13707 13708| 名称 | 描述 | 13709| -------- | -------- | 13710| OH_Drawing_Surface | 指向创建的surface对象的指针。 | 13711 13712**返回:** 13713 13714返回一个指针,指针指向创建的画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)。返回的指针不需要由调用者管理。 13715 13716 13717### OH_Drawing_TextBlobBuilderAllocRunPos() 13718 13719``` 13720const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect* ) 13721``` 13722 13723**描述** 13724 13725申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。 13726 13727本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13728 13729OH_Drawing_TextBlobBuilder、OH_Drawing_Font任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13730 13731**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13732 13733**起始版本:** 11 13734 13735**参数:** 13736 13737| 名称 | 描述 | 13738| -------- | -------- | 13739| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 13740| OH_Drawing_Font | 指向字体对象的指针。 | 13741| count | 文字的数量。 | 13742| OH_Drawing_Rect | 文本的边界框,为NULL表示不设置边界框。 | 13743 13744 13745### OH_Drawing_TextBlobBuilderCreate() 13746 13747``` 13748OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void ) 13749``` 13750 13751**描述** 13752 13753用于创建一个文本构造器对象。 13754 13755**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13756 13757**起始版本:** 11 13758 13759**返回:** 13760 13761函数会返回一个指针,指针指向创建的文本构造器对象。 13762 13763 13764### OH_Drawing_TextBlobBuilderDestroy() 13765 13766``` 13767void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* ) 13768``` 13769 13770**描述** 13771 13772用于销毁文本构造器对象并回收该对象占有的内存。 13773 13774**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13775 13776**起始版本:** 11 13777 13778**参数:** 13779 13780| 名称 | 描述 | 13781| -------- | -------- | 13782| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 13783 13784 13785### OH_Drawing_TextBlobBuilderMake() 13786 13787``` 13788OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* ) 13789``` 13790 13791**描述** 13792 13793用于从文本构造器中创建文本对象。 13794 13795本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13796 13797OH_Drawing_TextBlobBuilder为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13798 13799**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13800 13801**起始版本:** 11 13802 13803**参数:** 13804 13805| 名称 | 描述 | 13806| -------- | -------- | 13807| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 13808 13809**返回:** 13810 13811返回一个指针,指针指向创建的文本对象。 13812 13813 13814### OH_Drawing_TextBlobCreateFromPosText() 13815 13816``` 13817OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 13818``` 13819 13820**描述** 13821 13822使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。 13823 13824本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13825 13826text、OH_Drawing_Point2D、OH_Drawing_Font任意一个为NULL或byteLength等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 13827 13828OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13829 13830**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13831 13832**起始版本:** 12 13833 13834**参数:** 13835 13836| 名称 | 描述 | 13837| -------- | -------- | 13838| text | 指向文本的指针。 | 13839| byteLength | 文本的字节长度。 | 13840| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 二维点[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)数组首地址,数组个数由[OH_Drawing_FontCountText](#oh_drawing_fontcounttext)计算结果决定。 | 13841| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 13842| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 13843 13844**返回:** 13845 13846函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 13847 13848 13849### OH_Drawing_TextBlobCreateFromString() 13850 13851``` 13852OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 13853``` 13854 13855**描述** 13856 13857使用字符串创建文本对象。 13858 13859本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13860 13861str、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 13862 13863OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13864 13865**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13866 13867**起始版本:** 12 13868 13869**参数:** 13870 13871| 名称 | 描述 | 13872| -------- | -------- | 13873| str | 指向字符串的指针。 | 13874| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 13875| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。当前只有TEXT_ENCODING_UTF8生效,其余编码类型也会被视为TEXT_ENCODING_UTF8。 | 13876 13877**返回:** 13878 13879函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 13880 13881 13882### OH_Drawing_TextBlobCreateFromText() 13883 13884``` 13885OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 13886``` 13887 13888**描述** 13889 13890使用文本创建一个文本对象。 13891 13892本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13893 13894text、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 13895 13896OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13897 13898**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13899 13900**起始版本:** 12 13901 13902**参数:** 13903 13904| 名称 | 描述 | 13905| -------- | -------- | 13906| text | 指向文本的指针。 | 13907| byteLength | 文本的字节长度。 | 13908| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 13909| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 13910 13911**返回:** 13912 13913函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 13914 13915 13916### OH_Drawing_TextBlobDestroy() 13917 13918``` 13919void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* ) 13920``` 13921 13922**描述** 13923 13924用于销毁文本对象并回收该对象占有的内存。 13925 13926**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13927 13928**起始版本:** 11 13929 13930**参数:** 13931 13932| 名称 | 描述 | 13933| -------- | -------- | 13934| OH_Drawing_TextBlob | 指向文本对象的指针。 | 13935 13936 13937### OH_Drawing_TextBlobGetBounds() 13938 13939``` 13940void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect* ) 13941``` 13942 13943**描述** 13944 13945获取文本对象的边界范围。 13946 13947本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13948 13949OH_Drawing_TextBlob、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13950 13951**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13952 13953**起始版本:** 12 13954 13955**参数:** 13956 13957| 名称 | 描述 | 13958| -------- | -------- | 13959| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 | 13960| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 | 13961 13962 13963### OH_Drawing_TextStyleAddFontFeature() 13964 13965``` 13966void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value ) 13967``` 13968 13969**描述** 13970 13971添加文本字体特征。 13972 13973**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13974 13975**起始版本:** 12 13976 13977**参数:** 13978 13979| 名称 | 描述 | 13980| -------- | -------- | 13981| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13982| char | 指向字体特征键值对中关键字所标识的字符串。 | 13983| int | 要设置的字体特征键值对的值。 | 13984 13985 13986### OH_Drawing_TextStyleAddFontVariation() 13987 13988``` 13989void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* , const float ) 13990``` 13991 13992**描述** 13993 13994添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 13995 13996**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13997 13998**起始版本:** 12 13999 14000**参数:** 14001 14002| 名称 | 描述 | 14003| -------- | -------- | 14004| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14005| char\* | 可变字体属性键值对中的键。目前仅支持'wght',表示字重属性。 | 14006| float | 设置的可变字体属性键值对的值。目前默认字体下字重属性支持的取值范围为[0,900]。 | 14007 14008 14009### OH_Drawing_TextStyleAddShadow() 14010 14011``` 14012void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow* ) 14013``` 14014 14015**描述** 14016 14017字体阴影容器中添加字体阴影元素。 14018 14019**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14020 14021**起始版本:** 12 14022 14023**参数:** 14024 14025| 名称 | 描述 | 14026| -------- | -------- | 14027| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14028| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 14029 14030 14031### OH_Drawing_TextStyleClearFontFeature() 14032 14033``` 14034void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* ) 14035``` 14036 14037**描述** 14038 14039清除字体特征map容器中的所有内容。 14040 14041**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14042 14043**起始版本:** 12 14044 14045**参数:** 14046 14047| 名称 | 描述 | 14048| -------- | -------- | 14049| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14050 14051 14052### OH_Drawing_TextStyleClearShadows() 14053 14054``` 14055void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* ) 14056``` 14057 14058**描述** 14059 14060清除字体阴影容器中的所有元素。 14061 14062**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14063 14064**起始版本:** 12 14065 14066**参数:** 14067 14068| 名称 | 描述 | 14069| -------- | -------- | 14070| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14071 14072 14073### OH_Drawing_TextStyleDestroyFontFamilies() 14074 14075``` 14076void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num ) 14077``` 14078 14079**描述** 14080 14081释放字体类型名称列表占用的内存。 14082 14083**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14084 14085**起始版本:** 12 14086 14087**参数:** 14088 14089| 名称 | 描述 | 14090| -------- | -------- | 14091| char\*\* | 指向字体类型名称列表的指针。 | 14092| size_t | 字体类型名称列表的数量。 | 14093 14094 14095### OH_Drawing_TextStyleDestroyFontFeatures() 14096 14097``` 14098void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize ) 14099``` 14100 14101**描述** 14102 14103释放存放字体特征所有内容的结构体数组所占用的空间。 14104 14105**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14106 14107**起始版本:** 12 14108 14109**参数:** 14110 14111| 名称 | 描述 | 14112| -------- | -------- | 14113| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 指向存放容器所有键值对的结构体数组指针,由[OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures)获取。 | 14114| fontFeatureSize | 存放容器所有键值对的结构体数组的大小。 | 14115 14116 14117### OH_Drawing_TextStyleGetBackgroundBrush() 14118 14119``` 14120void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14121``` 14122 14123**描述** 14124 14125返回设置的背景色画刷。 14126 14127**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14128 14129**起始版本:** 12 14130 14131**参数:** 14132 14133| 名称 | 描述 | 14134| -------- | -------- | 14135| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14136| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 14137 14138 14139### OH_Drawing_TextStyleGetBackgroundPen() 14140 14141``` 14142void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14143``` 14144 14145**描述** 14146 14147返回设置的背景色画笔。 14148 14149**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14150 14151**起始版本:** 12 14152 14153**参数:** 14154 14155| 名称 | 描述 | 14156| -------- | -------- | 14157| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14158| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 14159 14160 14161### OH_Drawing_TextStyleGetBaseline() 14162 14163``` 14164OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* ) 14165``` 14166 14167**描述** 14168 14169获取字体基线位置。 14170 14171**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14172 14173**起始版本:** 12 14174 14175**参数:** 14176 14177| 名称 | 描述 | 14178| -------- | -------- | 14179| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14180 14181**返回:** 14182 14183返回字体基线位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 14184 14185 14186### OH_Drawing_TextStyleGetBaselineShift() 14187 14188``` 14189double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle* ) 14190``` 14191 14192**描述** 14193 14194获取文本的基线漂移。 14195 14196**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14197 14198**起始版本:** 12 14199 14200**参数:** 14201 14202| 名称 | 描述 | 14203| -------- | -------- | 14204| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14205 14206**返回:** 14207 14208double 基线漂移的值。 14209 14210 14211### OH_Drawing_TextStyleGetColor() 14212 14213``` 14214uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* ) 14215``` 14216 14217**描述** 14218 14219获取文本颜色。 14220 14221**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14222 14223**起始版本:** 12 14224 14225**参数:** 14226 14227| 名称 | 描述 | 14228| -------- | -------- | 14229| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14230 14231**返回:** 14232 14233uint32_t 返回文本颜色。 14234 14235 14236### OH_Drawing_TextStyleGetDecorationStyle() 14237 14238``` 14239OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* ) 14240``` 14241 14242**描述** 14243 14244获取文本装饰样式。 14245 14246**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14247 14248**起始版本:** 12 14249 14250**参数:** 14251 14252| 名称 | 描述 | 14253| -------- | -------- | 14254| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14255 14256**返回:** 14257 14258返回文本装饰样式,具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 14259 14260 14261### OH_Drawing_TextStyleGetFontFamilies() 14262 14263``` 14264char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num ) 14265``` 14266 14267**描述** 14268 14269获取字体类型名称列表。 14270 14271**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14272 14273**起始版本:** 12 14274 14275**参数:** 14276 14277| 名称 | 描述 | 14278| -------- | -------- | 14279| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14280| size_t | 指向字体名称数量的指针。 | 14281 14282**返回:** 14283 14284返回获取到的字体类型列表。 14285 14286 14287### OH_Drawing_TextStyleGetFontFeatures() 14288 14289``` 14290OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* ) 14291``` 14292 14293**描述** 14294 14295获取字体特征map容器中的所有内容。 14296 14297**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14298 14299**起始版本:** 12 14300 14301**参数:** 14302 14303| 名称 | 描述 | 14304| -------- | -------- | 14305| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14306 14307**返回:** 14308 14309[OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) 要获取的字体特征容器的所有内容,指向存放容器所有键值对的一个结构体数组。 14310 14311 14312### OH_Drawing_TextStyleGetFontFeatureSize() 14313 14314``` 14315size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* ) 14316``` 14317 14318**描述** 14319 14320获取字体特征map容器的大小。 14321 14322**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14323 14324**起始版本:** 12 14325 14326**参数:** 14327 14328| 名称 | 描述 | 14329| -------- | -------- | 14330| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14331 14332**返回:** 14333 14334size_t 字体特征map容器的大小。 14335 14336 14337### OH_Drawing_TextStyleGetFontHeight() 14338 14339``` 14340double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* ) 14341``` 14342 14343**描述** 14344 14345获取字体高度。 14346 14347**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14348 14349**起始版本:** 12 14350 14351**参数:** 14352 14353| 名称 | 描述 | 14354| -------- | -------- | 14355| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14356 14357**返回:** 14358 14359double 返回字体高度。 14360 14361 14362### OH_Drawing_TextStyleGetFontMetrics() 14363 14364``` 14365bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics* ) 14366``` 14367 14368**描述** 14369 14370获取文本字体属性。 14371 14372**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14373 14374**起始版本:** 12 14375 14376**参数:** 14377 14378| 名称 | 描述 | 14379| -------- | -------- | 14380| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 14381| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14382| OH_Drawing_Font_Metrics | 指向字体属性对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针,由[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)获取。 | 14383 14384**返回:** 14385 14386是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。 14387 14388 14389### OH_Drawing_TextStyleGetFontSize() 14390 14391``` 14392double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle* ) 14393``` 14394 14395**描述** 14396 14397获取字号。 14398 14399**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14400 14401**起始版本:** 12 14402 14403**参数:** 14404 14405| 名称 | 描述 | 14406| -------- | -------- | 14407| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14408 14409**返回:** 14410 14411double 返回字号。 14412 14413 14414### OH_Drawing_TextStyleGetFontStyle() 14415 14416``` 14417OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* ) 14418``` 14419 14420**描述** 14421 14422获取字体风格。 14423 14424**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14425 14426**起始版本:** 12 14427 14428**参数:** 14429 14430| 名称 | 描述 | 14431| -------- | -------- | 14432| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14433 14434**返回:** 14435 14436返回字体风格,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 14437 14438 14439### OH_Drawing_TextStyleGetFontStyleStruct() 14440 14441``` 14442OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle) 14443``` 14444 14445**描述** 14446 14447获取字体样式,包括字体字重、字体宽度和字体斜度。 14448 14449**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14450 14451**起始版本:** 12 14452 14453**参数:** 14454 14455| 名称 | 描述 | 14456| -------- | -------- | 14457| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14458 14459**返回:** 14460 14461返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。 14462 14463 14464### OH_Drawing_TextStyleGetFontWeight() 14465 14466``` 14467OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle* ) 14468``` 14469 14470**描述** 14471 14472获取字重。 14473 14474**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14475 14476**起始版本:** 12 14477 14478**参数:** 14479 14480| 名称 | 描述 | 14481| -------- | -------- | 14482| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14483 14484**返回:** 14485 14486返回字重,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。 14487 14488 14489### OH_Drawing_TextStyleGetForegroundBrush() 14490 14491``` 14492void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14493``` 14494 14495**描述** 14496 14497返回设置的前景色画刷。 14498 14499**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14500 14501**起始版本:** 12 14502 14503**参数:** 14504 14505| 名称 | 描述 | 14506| -------- | -------- | 14507| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14508| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 14509 14510 14511### OH_Drawing_TextStyleGetForegroundPen() 14512 14513``` 14514void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14515``` 14516 14517**描述** 14518 14519返回设置的前景色画笔。 14520 14521**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14522 14523**起始版本:** 12 14524 14525**参数:** 14526 14527| 名称 | 描述 | 14528| -------- | -------- | 14529| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14530| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 14531 14532 14533### OH_Drawing_TextStyleGetHalfLeading() 14534 14535``` 14536bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle* ) 14537``` 14538 14539**描述** 14540 14541获取当前文档是否设置为一半行间距。 14542 14543**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14544 14545**起始版本:** 12 14546 14547**参数:** 14548 14549| 名称 | 描述 | 14550| -------- | -------- | 14551| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14552 14553**返回:** 14554 14555bool 返回当前文档设置为一半行间距的结果,true表示设置为一半行间距,false表示未设置为一半行间距。 14556 14557 14558### OH_Drawing_TextStyleGetLetterSpacing() 14559 14560``` 14561double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle* ) 14562``` 14563 14564**描述** 14565 14566获取文本的字符间距。 14567 14568**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14569 14570**起始版本:** 12 14571 14572**参数:** 14573 14574| 名称 | 描述 | 14575| -------- | -------- | 14576| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14577 14578**返回:** 14579 14580double 返回字符间距大小。 14581 14582 14583### OH_Drawing_TextStyleGetLocale() 14584 14585``` 14586const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle* ) 14587``` 14588 14589**描述** 14590 14591获取文本语言类型。 14592 14593**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14594 14595**起始版本:** 12 14596 14597**参数:** 14598 14599| 名称 | 描述 | 14600| -------- | -------- | 14601| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14602 14603**返回:** 14604 14605char 返回语言区域,数据类型为指向char的指针。语言区域格式为:语言-国家。如zh-CN表示中文(中国),en-US表示英语(美国)等。具体参考BCP 47语言标签标准。 14606 14607 14608### OH_Drawing_TextStyleGetShadowCount() 14609 14610``` 14611int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* ) 14612``` 14613 14614**描述** 14615 14616获取字体阴影容器的大小。 14617 14618**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14619 14620**起始版本:** 12 14621 14622**参数:** 14623 14624| 名称 | 描述 | 14625| -------- | -------- | 14626| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14627 14628**返回:** 14629 14630int 返回字体阴影容器的大小。 14631 14632 14633### OH_Drawing_TextStyleGetShadows() 14634 14635``` 14636OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* ) 14637``` 14638 14639**描述** 14640 14641获取字体阴影容器。 14642 14643**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14644 14645**起始版本:** 12 14646 14647**参数:** 14648 14649| 名称 | 描述 | 14650| -------- | -------- | 14651| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14652 14653**返回:** 14654 14655返回指向字体阴影容器[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。 14656 14657 14658### OH_Drawing_TextStyleGetShadowWithIndex() 14659 14660``` 14661OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int ) 14662``` 14663 14664**描述** 14665 14666根据下标获取字体阴影容器中的元素。 14667 14668**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14669 14670**起始版本:** 12 14671 14672**参数:** 14673 14674| 名称 | 描述 | 14675| -------- | -------- | 14676| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14677| int | 下标索引。 | 14678 14679**返回:** 14680 14681返回指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。 14682 14683 14684### OH_Drawing_TextStyleGetWordSpacing() 14685 14686``` 14687double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle* ) 14688``` 14689 14690**描述** 14691 14692获取文本的单词间距。 14693 14694**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14695 14696**起始版本:** 12 14697 14698**参数:** 14699 14700| 名称 | 描述 | 14701| -------- | -------- | 14702| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14703 14704**返回:** 14705 14706double 返回单词间距大小。 14707 14708 14709### OH_Drawing_TextStyleIsAttributeMatched() 14710 14711``` 14712bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType ) 14713``` 14714 14715**描述** 14716 14717判断两个字体风格对象是否有一样的文本样式类型。 14718 14719**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14720 14721**起始版本:** 12 14722 14723**参数:** 14724 14725| 名称 | 描述 | 14726| -------- | -------- | 14727| style | 比较的字体风格对象。 | 14728| comparedStyle | 比较的字体风格对象。 | 14729| textStyleType | 文本样式类型枚举[OH_Drawing_TextStyleType](#oh_drawing_textstyletype)。 | 14730 14731**返回:** 14732 14733返回两个TextStyle对象是否有对应的文本样式类型一样的结果,true表示其文本样式类型一样,false表示不一样。 14734 14735 14736### OH_Drawing_TextStyleIsEqual() 14737 14738``` 14739bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 14740``` 14741 14742**描述** 14743 14744判断两个字体风格对象是否相等。 14745 14746**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14747 14748**起始版本:** 12 14749 14750**参数:** 14751 14752| 名称 | 描述 | 14753| -------- | -------- | 14754| style | 比较的字体风格对象。 | 14755| comparedStyle | 比较的字体风格对象。 | 14756 14757**返回:** 14758 14759返回两个字体风格对象是否相等的结果,true表示相等,false表示不相等。 14760 14761 14762### OH_Drawing_TextStyleIsEqualByFont() 14763 14764``` 14765bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 14766``` 14767 14768**描述** 14769 14770判断两个字体风格对象的字体样式属性是否相等。 14771 14772**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14773 14774**起始版本:** 12 14775 14776**参数:** 14777 14778| 名称 | 描述 | 14779| -------- | -------- | 14780| style | 比较的字体风格对象。 | 14781| comparedStyle | 比较的字体风格对象。 | 14782 14783**返回:** 14784 14785返回两个字体风格对象的字体样式属性是否相等的结果。 14786 14787 14788### OH_Drawing_TextStyleIsPlaceholder() 14789 14790``` 14791bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style) 14792``` 14793 14794**描述** 14795 14796返回是否有设置文本占位符。 14797 14798**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14799 14800**起始版本:** 12 14801 14802**参数:** 14803 14804| 名称 | 描述 | 14805| -------- | -------- | 14806| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14807 14808**返回:** 14809 14810返回是否有设置文本占位符,true表示有设置文本占位符,false表示未设置文本占位符。 14811 14812 14813### OH_Drawing_TextStyleSetBackgroundRect() 14814 14815``` 14816void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId ) 14817``` 14818 14819**描述** 14820 14821设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。 14822 14823**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14824 14825**起始版本:** 12 14826 14827**参数:** 14828 14829| 名称 | 描述 | 14830| -------- | -------- | 14831| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14832| [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 指向[OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)对象的指针。 | 14833| int | 要设置的样式id,仅当背景框为圆角矩形时有效。文本处理时会被划分为多个分段,每个分段都有自己的TextStyle,id标识着这个分段将被绘制于第几个背景矩形框中。 若一行中每个分段的id全为0,表示所有分段绘制在同一个圆角矩形背景框中; 若一行中的id为0, 1,则id为0的分段绘制在一个圆角矩形背景框内,id为1的分段绘制在另一个圆角矩形背景框内,以此类推。 | 14834 14835 14836### OH_Drawing_TextStyleSetBaselineShift() 14837 14838``` 14839void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle* , double lineShift ) 14840``` 14841 14842**描述** 14843 14844设置文本的基线漂移。 14845 14846**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14847 14848**起始版本:** 12 14849 14850**参数:** 14851 14852| 名称 | 描述 | 14853| -------- | -------- | 14854| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14855| double | 文本的基线漂移。 | 14856 14857 14858### OH_Drawing_TextStyleSetPlaceholder() 14859 14860``` 14861void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style) 14862``` 14863 14864**描述** 14865 14866设置占位符。 14867 14868**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14869 14870**起始版本:** 12 14871 14872**参数:** 14873 14874| 名称 | 描述 | 14875| -------- | -------- | 14876| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14877 14878 14879### OH_Drawing_TypefaceCreateDefault() 14880 14881``` 14882OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void ) 14883``` 14884 14885**描述** 14886 14887用于创建一个默认的字形对象。 14888 14889**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14890 14891**起始版本:** 11 14892 14893**返回:** 14894 14895返回一个指针,指针指向创建的字形对象。 14896 14897 14898### OH_Drawing_TypefaceCreateFromFile() 14899 14900``` 14901OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index ) 14902``` 14903 14904**描述** 14905 14906通过文件创建一个字形对象。 14907 14908本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14909 14910path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 14911 14912**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14913 14914**起始版本:** 12 14915 14916**参数:** 14917 14918| 名称 | 描述 | 14919| -------- | -------- | 14920| path | 指向文件路径的指针。 | 14921| index | 文件索引。 | 14922 14923**返回:** 14924 14925函数返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 14926 14927 14928### OH_Drawing_TypefaceCreateFromStream() 14929 14930``` 14931OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index ) 14932``` 14933 14934**描述** 14935 14936通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 14937 14938本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14939 14940OH_Drawing_MemoryStream为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 14941 14942**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14943 14944**起始版本:** 12 14945 14946**参数:** 14947 14948| 名称 | 描述 | 14949| -------- | -------- | 14950| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 | 14951| index | 内存流索引。 | 14952 14953**返回:** 14954 14955返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 14956 14957 14958### OH_Drawing_TypefaceDestroy() 14959 14960``` 14961void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* ) 14962``` 14963 14964**描述** 14965 14966用于销毁字形对象并回收该对象占有的内存。 14967 14968**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14969 14970**起始版本:** 11 14971 14972**参数:** 14973 14974| 名称 | 描述 | 14975| -------- | -------- | 14976| OH_Drawing_Typeface | 指向字形对象的指针。 | 14977 14978 14979### OH_Drawing_TypographyDestroyEllipsis() 14980 14981``` 14982void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis) 14983``` 14984 14985**描述** 14986 14987释放省略号名称列表占用的内存。 14988 14989**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14990 14991**起始版本:** 12 14992 14993**参数:** 14994 14995| 名称 | 描述 | 14996| -------- | -------- | 14997| ellipsis | 表示指向省略号名称列表的指针。 | 14998 14999 15000### OH_Drawing_TypographyDestroyLineFontMetrics() 15001 15002``` 15003void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* ) 15004``` 15005 15006**描述** 15007 15008释放指定行所有字体度量结构体集合所占用的所有空间。 15009 15010**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15011 15012**起始版本:** 12 15013 15014**参数:** 15015 15016| 名称 | 描述 | 15017| -------- | -------- | 15018| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 指示要释放空间的指定行所有字体度量结构体集合的第一个地址。 | 15019 15020 15021### OH_Drawing_TypographyDidExceedMaxLines() 15022 15023``` 15024bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* ) 15025``` 15026 15027**描述** 15028 15029获取文本是否超过最大行。 15030 15031**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15032 15033**起始版本:** 11 15034 15035**参数:** 15036 15037| 名称 | 描述 | 15038| -------- | -------- | 15039| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15040 15041**返回:** 15042 15043返回文本是否超过最大行,true表示超过,false表示未超过。 15044 15045 15046### OH_Drawing_TypographyGetAlphabeticBaseline() 15047 15048``` 15049double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* ) 15050``` 15051 15052**描述** 15053 15054获取字母文字基线。 15055 15056**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15057 15058**起始版本:** 9 15059 15060**参数:** 15061 15062| 名称 | 描述 | 15063| -------- | -------- | 15064| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15065 15066**返回:** 15067 15068返回字母文字基线。 15069 15070 15071### OH_Drawing_TypographyGetEffectiveAlignment() 15072 15073``` 15074int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 15075``` 15076 15077**描述** 15078 15079获取文字对齐方式。 15080 15081**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15082 15083**起始版本:** 12 15084 15085**参数:** 15086 15087| 名称 | 描述 | 15088| -------- | -------- | 15089| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15090 15091**返回:** 15092 15093返回文字对齐方式。 15094 15095 15096### OH_Drawing_TypographyGetGlyphPositionAtCoordinate() 15097 15098``` 15099OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double ) 15100``` 15101 15102**描述** 15103 15104获取坐标处文本的索引位置和亲和性。 15105 15106**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15107 15108**起始版本:** 11 15109 15110**参数:** 15111 15112| 名称 | 描述 | 15113| -------- | -------- | 15114| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15115| double | 光标的x坐标。 | 15116| double | 光标的y坐标。 | 15117 15118**返回:** 15119 15120返回坐标处字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。 15121 15122 15123### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster() 15124 15125``` 15126OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double ) 15127``` 15128 15129**描述** 15130 15131获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 15132 15133**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15134 15135**起始版本:** 11 15136 15137**参数:** 15138 15139| 名称 | 描述 | 15140| -------- | -------- | 15141| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15142| double | 光标的x坐标。 | 15143| double | 光标的y坐标。 | 15144 15145**返回:** 15146 15147返回坐标处指定类型字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。 15148 15149 15150### OH_Drawing_TypographyGetHeight() 15151 15152``` 15153double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* ) 15154``` 15155 15156**描述** 15157 15158获取高度。 15159 15160**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15161 15162**起始版本:** 9 15163 15164**参数:** 15165 15166| 名称 | 描述 | 15167| -------- | -------- | 15168| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15169 15170**返回:** 15171 15172返回高度。 15173 15174 15175### OH_Drawing_TypographyGetIdeographicBaseline() 15176 15177``` 15178double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* ) 15179``` 15180 15181**描述** 15182 15183获取表意文字基线。 15184 15185**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15186 15187**起始版本:** 9 15188 15189**参数:** 15190 15191| 名称 | 描述 | 15192| -------- | -------- | 15193| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15194 15195**返回:** 15196 15197返回表意文字基线。 15198 15199 15200### OH_Drawing_TypographyGetIndentsWithIndex() 15201 15202``` 15203float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int ) 15204``` 15205 15206**描述** 15207 15208根据下标获取排版缩进容器中的元素。 15209 15210**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15211 15212**起始版本:** 12 15213 15214**参数:** 15215 15216| 名称 | 描述 | 15217| -------- | -------- | 15218| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15219| int | 下标索引。 | 15220 15221**返回:** 15222 15223float 返回索引对应的元素值。 15224 15225 15226### OH_Drawing_TypographyGetLineCount() 15227 15228``` 15229size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* ) 15230``` 15231 15232**描述** 15233 15234获取文本行数。 15235 15236**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15237 15238**起始版本:** 11 15239 15240**参数:** 15241 15242| 名称 | 描述 | 15243| -------- | -------- | 15244| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15245 15246**返回:** 15247 15248返回行数。 15249 15250 15251### OH_Drawing_TypographyGetLineFontMetrics() 15252 15253``` 15254OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize ) 15255``` 15256 15257**描述** 15258 15259从目标行获取所有字体指标。 15260 15261**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15262 15263**起始版本:** 12 15264 15265**参数:** 15266 15267| 名称 | 描述 | 15268| -------- | -------- | 15269| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15270| lineNumber | 指定行数,取值为整数,最小有效值为1,最大行取决于文本输入后字体引擎解析出来的行数,若输入值大于最大行会返回错误值并打印错误消息。 | 15271| fontMetricsSize | 指示从当前行返回的字体度量结构的大小。 | 15272 15273**返回:** 15274 15275返回当前行的所有字符度量。 15276 15277 15278### OH_Drawing_TypographyGetLineHeight() 15279 15280``` 15281double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int ) 15282``` 15283 15284**描述** 15285 15286获取指定行的行高 15287 15288**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15289 15290**起始版本:** 11 15291 15292**参数:** 15293 15294| 名称 | 描述 | 15295| -------- | -------- | 15296| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15297| int | 要指定的行数。 | 15298 15299**返回:** 15300 15301返回指定行的行高。 15302 15303 15304### OH_Drawing_TypographyGetLineInfo() 15305 15306``` 15307bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics* ) 15308``` 15309 15310**描述** 15311 15312获取指定行的位置信息或指定行第一个字符的位置信息。 15313 15314**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15315 15316**起始版本:** 12 15317 15318**参数:** 15319 15320| 名称 | 描述 | 15321| -------- | -------- | 15322| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15323| int | 行号。 | 15324| bool | true为获取整行的位置信息,false为获取第一个字符的位置信息。 | 15325| bool | 文字宽度是否包含空白符,true表示不包含空白符,false表示包含空白符。 | 15326| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 15327 15328**返回:** 15329 15330指定行的行位置信息或第一个字符的位置信息是否成功获取,true表示成功获取,false表示未成功获取。 15331 15332 15333### OH_Drawing_TypographyGetLineMetrics() 15334 15335``` 15336OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* ) 15337``` 15338 15339**描述** 15340 15341获取行位置信息。 15342 15343**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15344 15345**起始版本:** 12 15346 15347**参数:** 15348 15349| 名称 | 描述 | 15350| -------- | -------- | 15351| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15352 15353**返回:** 15354 15355返回指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针。 15356 15357 15358### OH_Drawing_TypographyGetLineMetricsAt() 15359 15360``` 15361bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics* ) 15362``` 15363 15364**描述** 15365 15366获取指定行位置信息对象。 15367 15368**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15369 15370**起始版本:** 12 15371 15372**参数:** 15373 15374| 名称 | 描述 | 15375| -------- | -------- | 15376| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15377| int | 要获取的行数。 | 15378| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 15379 15380**返回:** 15381 15382行位置信息对象是否成功获取,true表示成功获取,false表示未成功获取。 15383 15384 15385### OH_Drawing_TypographyGetLineTextRange() 15386 15387``` 15388OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool ) 15389``` 15390 15391**描述** 15392 15393获取行的边界。 15394 15395**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15396 15397**起始版本:** 12 15398 15399**参数:** 15400 15401| 名称 | 描述 | 15402| -------- | -------- | 15403| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15404| int | 行索引 | 15405| bool | 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 | 15406 15407**返回:** 15408 15409返回指向行边界对象的指针[OH_Drawing_Range](#oh_drawing_range)。 15410 15411 15412### OH_Drawing_TypographyGetLineWidth() 15413 15414``` 15415double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int ) 15416``` 15417 15418**描述** 15419 15420获取指定行的行宽。 15421 15422**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15423 15424**起始版本:** 11 15425 15426**参数:** 15427 15428| 名称 | 描述 | 15429| -------- | -------- | 15430| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15431| int | 要指定的行数。 | 15432 15433**返回:** 15434 15435返回指定行的行宽。 15436 15437 15438### OH_Drawing_TypographyGetLongestLine() 15439 15440``` 15441double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* ) 15442``` 15443 15444**描述** 15445 15446获取最长行的宽度,建议实际使用时将返回值向上取整。当文本内容为空时,返回float的最小值, 即:-340282346638528859811704183484516925440.000000。 15447 15448**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15449 15450**起始版本:** 9 15451 15452**参数:** 15453 15454| 名称 | 描述 | 15455| -------- | -------- | 15456| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15457 15458**返回:** 15459 15460返回最长行的宽度。 15461 15462 15463### OH_Drawing_TypographyGetMaxIntrinsicWidth() 15464 15465``` 15466double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* ) 15467``` 15468 15469**描述** 15470 15471获取最大固有宽度。 15472 15473**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15474 15475**起始版本:** 9 15476 15477**参数:** 15478 15479| 名称 | 描述 | 15480| -------- | -------- | 15481| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15482 15483**返回:** 15484 15485返回最大固有宽度。 15486 15487 15488### OH_Drawing_TypographyGetMaxWidth() 15489 15490``` 15491double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* ) 15492``` 15493 15494**描述** 15495 15496获取最大宽度。 15497 15498**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15499 15500**起始版本:** 9 15501 15502**参数:** 15503 15504| 名称 | 描述 | 15505| -------- | -------- | 15506| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15507 15508**返回:** 15509 15510返回最大宽度。 15511 15512 15513### OH_Drawing_TypographyGetMinIntrinsicWidth() 15514 15515``` 15516double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* ) 15517``` 15518 15519**描述** 15520 15521获取最小固有宽度。 15522 15523**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15524 15525**起始版本:** 9 15526 15527**参数:** 15528 15529| 名称 | 描述 | 15530| -------- | -------- | 15531| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15532 15533**返回:** 15534 15535返回最小固有宽度。 15536 15537 15538### OH_Drawing_TypographyGetRectsForPlaceholders() 15539 15540``` 15541OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* ) 15542``` 15543 15544**描述** 15545 15546获取占位符的文本框。 15547 15548**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15549 15550**起始版本:** 11 15551 15552**参数:** 15553 15554| 名称 | 描述 | 15555| -------- | -------- | 15556| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15557 15558**返回:** 15559 15560返回占位符的文本框,返回类型为[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。 15561 15562### OH_Drawing_TypographyGetRectsForRange() 15563 15564``` 15565OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle ) 15566``` 15567 15568**描述** 15569 15570获取指定范围内的文本框。 15571 15572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15573 15574**起始版本:** 11 15575 15576**参数:** 15577 15578| 名称 | 描述 | 15579| -------- | -------- | 15580| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15581| size_t | 设置开始位置。 | 15582| size_t | 设置结束位置。 | 15583| OH_Drawing_RectHeightStyle | 设置高度样式,支持可选的高度样式具体可见[OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)枚举。 | 15584| OH_Drawing_RectWidthStyle | 设置宽度样式,支持可选的宽度样式具体可见[OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)枚举。 | 15585 15586**返回:** 15587 15588返回指定范围内的文本框,具体可见[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。 15589 15590 15591### OH_Drawing_TypographyGetTextAlign() 15592 15593``` 15594OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* ) 15595``` 15596 15597**描述** 15598 15599获取文本对齐方式。 15600 15601**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15602 15603**起始版本:** 12 15604 15605**参数:** 15606 15607| 名称 | 描述 | 15608| -------- | -------- | 15609| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15610 15611**返回:** 15612 15613返回文本对齐方式。1为右对齐,2为居中对齐,3为两端对齐,4为与文字方向相同,5为文字方向相反,0或其它为左对齐, 具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 15614 15615 15616### OH_Drawing_TypographyGetTextDirection() 15617 15618``` 15619OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* ) 15620``` 15621 15622**描述** 15623 15624获取文本方向。 15625 15626**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15627 15628**起始版本:** 12 15629 15630**参数:** 15631 15632| 名称 | 描述 | 15633| -------- | -------- | 15634| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15635 15636**返回:** 15637 15638返回文本方向。1为从左到右,0或其它为从右到左,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 15639 15640 15641### OH_Drawing_TypographyGetTextEllipsis() 15642 15643``` 15644char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* ) 15645``` 15646 15647**描述** 15648 15649获取设置的省略号内容。 15650 15651**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15652 15653**起始版本:** 12 15654 15655**参数:** 15656 15657| 名称 | 描述 | 15658| -------- | -------- | 15659| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15660 15661**返回:** 15662 15663返回设置的省略号内容。 15664 15665 15666### OH_Drawing_TypographyGetTextMaxLines() 15667 15668``` 15669size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* ) 15670``` 15671 15672**描述** 15673 15674获取文本的最大行数。 15675 15676**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15677 15678**起始版本:** 12 15679 15680**参数:** 15681 15682| 名称 | 描述 | 15683| -------- | -------- | 15684| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15685 15686**返回:** 15687 15688返回结果为文本最大行数。 15689 15690 15691### OH_Drawing_TypographyGetTextStyle() 15692 15693``` 15694OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style) 15695``` 15696 15697**描述** 15698 15699获取字体风格。 15700 15701**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15702 15703**起始版本:** 12 15704 15705**参数:** 15706 15707| 名称 | 描述 | 15708| -------- | -------- | 15709| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15710 15711**返回:** 15712 15713返回指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针。 15714 15715 15716### OH_Drawing_TypographyGetUnresolvedGlyphsCount() 15717 15718``` 15719int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* ) 15720``` 15721 15722**描述** 15723 15724获取文本中尚未解析的字形的数量。 15725 15726**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15727 15728**起始版本:** 12 15729 15730**参数:** 15731 15732| 名称 | 描述 | 15733| -------- | -------- | 15734| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15735 15736**返回:** 15737 15738返回文本中尚未解析的字形的数量。 15739 15740 15741### OH_Drawing_TypographyGetWordBoundary() 15742 15743``` 15744OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t ) 15745``` 15746 15747**描述** 15748 15749获取单词的边界。 15750 15751**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15752 15753**起始版本:** 11 15754 15755**参数:** 15756 15757| 名称 | 描述 | 15758| -------- | -------- | 15759| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15760| size_t | 单词索引。 | 15761 15762**返回:** 15763 15764返回单词边界,返回类型为[OH_Drawing_Range](#oh_drawing_range)结构体。 15765 15766 15767### OH_Drawing_TypographyHandlerAddPlaceholder() 15768 15769``` 15770void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan* ) 15771``` 15772 15773**描述** 15774 15775设置占位符。 15776 15777**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15778 15779**起始版本:** 11 15780 15781**参数:** 15782 15783| 名称 | 描述 | 15784| -------- | -------- | 15785| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 15786| [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 指向OH_Drawing_PlaceholderSpan对象的指针。 | 15787 15788 15789### OH_Drawing_TypographyHandlerAddSymbol() 15790 15791``` 15792void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol ) 15793``` 15794 15795**描述** 15796 15797设置排版创建过程中的符号。 15798 15799**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15800 15801**起始版本:** 12 15802 15803**参数:** 15804 15805| 名称 | 描述 | 15806| -------- | -------- | 15807| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 15808| uint32_t | 要设置的符号,可支持设置的符号参见下面链接json文件中的value值。 [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) | 15809 15810 15811### OH_Drawing_TypographyHandlerAddText() 15812 15813``` 15814void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char* ) 15815``` 15816 15817**描述** 15818 15819设置文本内容。 15820 15821**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15822 15823**起始版本:** 8 15824 15825**参数:** 15826 15827| 名称 | 描述 | 15828| -------- | -------- | 15829| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 15830| char | 指向文本内容的指针。 | 15831 15832 15833### OH_Drawing_TypographyHandlerPopTextStyle() 15834 15835``` 15836void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* ) 15837``` 15838 15839**描述** 15840 15841排版弹出。 15842 15843**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15844 15845**起始版本:** 8 15846 15847**参数:** 15848 15849| 名称 | 描述 | 15850| -------- | -------- | 15851| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 15852 15853 15854### OH_Drawing_TypographyHandlerPushTextStyle() 15855 15856``` 15857void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle* ) 15858``` 15859 15860**描述** 15861 15862设置排版风格。 15863 15864**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15865 15866**起始版本:** 8 15867 15868**参数:** 15869 15870| 名称 | 描述 | 15871| -------- | -------- | 15872| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 15873| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 15874 15875 15876### OH_Drawing_TypographyIsEllipsized() 15877 15878``` 15879bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style) 15880``` 15881 15882**描述** 15883 15884获取文本是否有省略号。 15885 15886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15887 15888**起始版本:** 12 15889 15890**参数:** 15891 15892| 名称 | 描述 | 15893| -------- | -------- | 15894| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15895 15896**返回:** 15897 15898返回文本是否有省略号,true表示有省略号,false表示无省略号。 15899 15900 15901### OH_Drawing_TypographyIsLineUnlimited() 15902 15903``` 15904bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style) 15905``` 15906 15907**描述** 15908 15909获取文本是否有最大行数限制。 15910 15911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15912 15913**起始版本:** 12 15914 15915**参数:** 15916 15917| 名称 | 描述 | 15918| -------- | -------- | 15919| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15920 15921**返回:** 15922 15923返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。 15924 15925 15926### OH_Drawing_TypographyLayout() 15927 15928``` 15929void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double ) 15930``` 15931 15932**描述** 15933 15934排版布局。 15935 15936**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15937 15938**起始版本:** 8 15939 15940**参数:** 15941 15942| 名称 | 描述 | 15943| -------- | -------- | 15944| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15945| double | 文本最大宽度 | 15946 15947 15948### OH_Drawing_TypographyMarkDirty() 15949 15950``` 15951void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* ) 15952``` 15953 15954**描述** 15955 15956将排版标记为脏数据,用于初始化排版状态。 15957 15958**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15959 15960**起始版本:** 12 15961 15962**参数:** 15963 15964| 名称 | 描述 | 15965| -------- | -------- | 15966| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15967 15968 15969### OH_Drawing_TypographyPaint() 15970 15971``` 15972void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double ) 15973``` 15974 15975**描述** 15976 15977显示文本。 15978 15979**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15980 15981**起始版本:** 8 15982 15983**参数:** 15984 15985| 名称 | 描述 | 15986| -------- | -------- | 15987| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15988| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由OH_Drawing_CanvasCreate()获取。 | 15989| double | x坐标。 | 15990| double | y坐标。 | 15991 15992 15993### OH_Drawing_TypographySetIndents() 15994 15995``` 15996void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] ) 15997``` 15998 15999**描述** 16000 16001设置文本的排版缩进,不调用此接口默认文本无缩进。 16002 16003**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16004 16005**起始版本:** 12 16006 16007**参数:** 16008 16009| 名称 | 描述 | 16010| -------- | -------- | 16011| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16012| int | 为段落设置的缩进数量。该值应小于或等于 indents 数组的长度,以避免访问数组越界导致的显示异常。| 16013| float | 指向浮点类型数组的指针,每个数组元素表示一个缩进宽度,单位为物理像素(px)。在应用[OH_Drawing_Typography](#oh_drawing_typography)接口时,需要先声明并初始化该浮点数组。 | 16014 16015 16016### OH_Drawing_TypographyStyleDestroyStrutStyle() 16017 16018``` 16019void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* ) 16020``` 16021 16022**描述** 16023 16024释放被支柱样式对象占据的内存。 16025 16026**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16027 16028**起始版本:** 12 16029 16030**参数:** 16031 16032| 名称 | 描述 | 16033| -------- | -------- | 16034| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 | 16035 16036 16037### OH_Drawing_TypographyStyleEquals() 16038 16039``` 16040bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to ) 16041``` 16042 16043**描述** 16044 16045判断排版样式是否相同。 16046 16047**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16048 16049**起始版本:** 12 16050 16051**参数:** 16052 16053| 名称 | 描述 | 16054| -------- | -------- | 16055| from | 被比较的排版样式。 | 16056| to | 用于比较的排版样式。 | 16057 16058**返回:** 16059 16060返回排版样式是否相同。true表示相同,false表示不相同。 16061 16062 16063### OH_Drawing_TypographyStyleGetEffectiveAlignment() 16064 16065``` 16066OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 16067``` 16068 16069**描述** 16070 16071获取文本对齐模式。 16072 16073**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16074 16075**起始版本:** 12 16076 16077**参数:** 16078 16079| 名称 | 描述 | 16080| -------- | -------- | 16081| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16082 16083**返回:** 16084 16085返回文本对齐模式的枚举值[OH_Drawing_TextAlign](#oh_drawing_textalign)。 16086 16087 16088### OH_Drawing_TypographyStyleGetFontStyleStruct() 16089 16090``` 16091OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle) 16092``` 16093 16094**描述** 16095 16096获取文本字体样式,包括字体字重、字体宽度和字体斜度。 16097 16098**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16099 16100**起始版本:** 12 16101 16102**参数:** 16103 16104| 名称 | 描述 | 16105| -------- | -------- | 16106| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16107 16108**返回:** 16109 16110返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。 16111 16112 16113### OH_Drawing_TypographyStyleGetStrutStyle() 16114 16115``` 16116OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* ) 16117``` 16118 16119**描述** 16120 16121获取文本支柱样式。 16122 16123**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16124 16125**起始版本:** 12 16126 16127**参数:** 16128 16129| 名称 | 描述 | 16130| -------- | -------- | 16131| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16132 16133**返回:** 16134 16135返回指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针。 16136 16137 16138### OH_Drawing_TypographyStyleIsHintEnabled() 16139 16140``` 16141bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style) 16142``` 16143 16144**描述** 16145 16146获取文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 16147 16148**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16149 16150**起始版本:** 12 16151 16152**参数:** 16153 16154| 名称 | 描述 | 16155| -------- | -------- | 16156| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16157 16158**返回:** 16159 16160返回文本是否启用字体提示,true表示启用,false表示不启用。 16161 16162 16163### OH_Drawing_TypographyStyleSetHintsEnabled() 16164 16165``` 16166void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled ) 16167``` 16168 16169**描述** 16170 16171设置文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 16172 16173**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16174 16175**起始版本:** 12 16176 16177**参数:** 16178 16179| 名称 | 描述 | 16180| -------- | -------- | 16181| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16182| hintsEnabled | 是否启用字体提示,true表示启用,false表示不启用。 | 16183 16184 16185### OH_Drawing_TypographyStyleStrutStyleEquals() 16186 16187``` 16188bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to ) 16189``` 16190 16191**描述** 16192 16193判断支柱样式结构体是否相同。 16194 16195**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16196 16197**起始版本:** 12 16198 16199**参数:** 16200 16201| 名称 | 描述 | 16202| -------- | -------- | 16203| from | 被比较的支柱样式结构体。 | 16204| to | 用于比较的支柱样式结构体。 | 16205 16206**返回:** 16207 16208返回支柱样式结构体是否相同,true表示相同,false表示不相同。 16209 16210### OH_Drawing_TypographyTextGetHeightBehavior() 16211 16212``` 16213OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* ) 16214``` 16215 16216**描述** 16217 16218获取文本高度修饰符模式。 16219 16220**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16221 16222**起始版本:** 12 16223 16224**参数:** 16225 16226| 名称 | 描述 | 16227| -------- | -------- | 16228| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16229 16230**返回:** 16231 16232返回文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 16233 16234 16235### OH_Drawing_TypographyTextGetLineStyle() 16236 16237``` 16238bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* ) 16239``` 16240 16241**描述** 16242 16243获取文本排版是否启用行样式。 16244 16245**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16246 16247**起始版本:** 12 16248 16249**参数:** 16250 16251| 名称 | 描述 | 16252| -------- | -------- | 16253| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16254 16255**返回:** 16256 16257返回行样式是否启用的结果,true表示启用,false表示不启用。 16258 16259 16260### OH_Drawing_TypographyTextlineGetStyleOnly() 16261 16262``` 16263bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* ) 16264``` 16265 16266**描述** 16267 16268获取文本排版是否仅启用行样式。 16269 16270**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16271 16272**起始版本:** 12 16273 16274**参数:** 16275 16276| 名称 | 描述 | 16277| -------- | -------- | 16278| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16279 16280**返回:** 16281 16282返回文本排版是否仅启用行样式,true表示启用,false表示不启用。 16283 16284 16285### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies() 16286 16287``` 16288void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum ) 16289``` 16290 16291**描述** 16292 16293释放字体类型占用的内存。 16294 16295**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16296 16297**起始版本:** 12 16298 16299**参数:** 16300 16301| 名称 | 描述 | 16302| -------- | -------- | 16303| fontFamilies | 表示指向字体字体类型的指针。 | 16304| fontFamiliesNum | 字体名称的数量。 | 16305 16306 16307### OH_Drawing_TypographyTextlineStyleGetFontFamilies() 16308 16309``` 16310char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* ) 16311``` 16312 16313**描述** 16314 16315获取文本排版行样式字体家族名。 16316 16317**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16318 16319**起始版本:** 12 16320 16321**参数:** 16322 16323| 名称 | 描述 | 16324| -------- | -------- | 16325| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16326 16327**返回:** 16328 16329返回文本排版行样式字体家族名。 16330 16331 16332### OH_Drawing_TypographyTextlineStyleGetFontSize() 16333 16334``` 16335double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* ) 16336``` 16337 16338**描述** 16339 16340获取文本排版行样式字号。 16341 16342**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16343 16344**起始版本:** 12 16345 16346**参数:** 16347 16348| 名称 | 描述 | 16349| -------- | -------- | 16350| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16351 16352**返回:** 16353 16354返回文本排版行样式字号。 16355 16356 16357### OH_Drawing_TypographyTextlineStyleGetFontStyle() 16358 16359``` 16360OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* ) 16361``` 16362 16363**描述** 16364 16365获取文本排版行样式风格。 16366 16367**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16368 16369**起始版本:** 12 16370 16371**参数:** 16372 16373| 名称 | 描述 | 16374| -------- | -------- | 16375| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16376 16377**返回:** 16378 16379返回获取文本排版行样式风格。1为斜体,0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 16380 16381 16382### OH_Drawing_TypographyTextlineStyleGetFontWeight() 16383 16384``` 16385OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle* ) 16386``` 16387 16388**描述** 16389 16390获取文本排版行样式字重。 16391 16392**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16393 16394**起始版本:** 12 16395 16396**参数:** 16397 16398| 名称 | 描述 | 16399| -------- | -------- | 16400| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16401 16402**返回:** 16403 16404返回文本排版行样式字重。 0字重为thin,1字重为extra-light,2字重为light,4字重为medium,5字重为semi-bold, 6字重为bold,7字重为extra-bold,8字重为black,3或其它字重为normal/regular,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举 16405 16406 16407### OH_Drawing_TypographyTextlineStyleGetHalfLeading() 16408 16409``` 16410bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* ) 16411``` 16412 16413**描述** 16414 16415获取文本排版行样式是否为一半行间距。 16416 16417**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16418 16419**起始版本:** 12 16420 16421**参数:** 16422 16423| 名称 | 描述 | 16424| -------- | -------- | 16425| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16426 16427**返回:** 16428 16429文本排版行样式是否为一半行间距,true表示是一半行间距,false表示不是。 16430 16431 16432### OH_Drawing_TypographyTextlineStyleGetHeightOnly() 16433 16434``` 16435bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* ) 16436``` 16437 16438**描述** 16439 16440获取字体渲染过程中计算字体块高度相关参数的方法。 16441 16442**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16443 16444**起始版本:** 12 16445 16446**参数:** 16447 16448| 名称 | 描述 | 16449| -------- | -------- | 16450| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16451 16452**返回:** 16453 16454返回计算字体块高度相关参数的方法,true表示以字号为准计算,false表示以行距计算。 16455 16456 16457### OH_Drawing_TypographyTextlineStyleGetHeightScale() 16458 16459``` 16460double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* ) 16461``` 16462 16463**描述** 16464 16465获取文本排版中字体高度规模。 16466 16467**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16468 16469**起始版本:** 12 16470 16471**参数:** 16472 16473| 名称 | 描述 | 16474| -------- | -------- | 16475| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16476 16477**返回:** 16478 16479返回文本排版中字体高度规模。 16480 16481 16482### OH_Drawing_TypographyTextlineStyleGetSpacingScale() 16483 16484``` 16485double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* ) 16486``` 16487 16488**描述** 16489 16490获取文本排版行样式间距比例。 16491 16492**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16493 16494**起始版本:** 12 16495 16496**参数:** 16497 16498| 名称 | 描述 | 16499| -------- | -------- | 16500| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16501 16502**返回:** 16503 16504返回文本排版行样式间距比例。 16505 16506 16507### OH_Drawing_TypographyTextSetHeightBehavior() 16508 16509``` 16510void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode ) 16511``` 16512 16513**描述** 16514 16515设置文本高度修饰符模式。 16516 16517**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16518 16519**起始版本:** 12 16520 16521**参数:** 16522 16523| 名称 | 描述 | 16524| -------- | -------- | 16525| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16526| heightMode | 文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 | 16527 16528 16529### OH_Drawing_TypographyUpdateFontSize() 16530 16531``` 16532void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize ) 16533``` 16534 16535**描述** 16536 16537更新文本中的字体大小。 16538 16539**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16540 16541**起始版本:** 12 16542 16543**参数:** 16544 16545| 名称 | 描述 | 16546| -------- | -------- | 16547| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16548| from | 表示原来的字体大小。 | 16549| to | 表示更新后字体大小。 | 16550| fontSize | 表示字体的大小。 |