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_typography.h](drawing__text__typography_8h.md) | 定义绘制模块中排版相关的函数。 | 54| [drawing_typeface.h](drawing__typeface_8h.md) | 文件中定义了与字形相关的功能函数。 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 | 55| [drawing_types.h](drawing__types_8h.md) | 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 | 56 57 58### 结构体 59 60| 名称 | 描述 | 61| -------- | -------- | 62| struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | 63| struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 定义字体度量信息的结构体。 | 64| struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) | 定义有关图形处理器上下文的选项。 | 65| struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) | 结构体用于描述一块内存,描述文字和位置信息。 | 66| struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 用于描述位占位符跨度的结构体 | 67| struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 描述系统字体详细信息的结构体。 | 68| struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) | 文字行位置信息。 | 69| struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) | 备用字体信息结构体。 | 70| struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) | 备用字体集信息结构体。 | 71| struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) | 字重映射信息结构体。 | 72| struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) | 别名字体信息结构体。 | 73| struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) | 系统所支持的通用字体集信息结构体。 | 74| struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) | 系统字体配置信息结构体。 | 75| struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 定义字体样式信息的结构体。 | 76| struct [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 描述文本字体特征结构体。 | 77| struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 | 78| struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 定义一个二维的坐标点。 | 79| struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) | 定义一个三维的坐标点。 | 80| struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 定义图片信息结构体。 | 81| struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 定义矩形框样式结构体。 | 82 83 84### 类型定义 85 86| 名称 | 描述 | 87| -------- | -------- | 88| typedef struct [OH_Drawing_FontArguments](#oh_drawing_fontarguments) [OH_Drawing_FontArguments](#oh_drawing_fontarguments) | 用于描述字型参数。 | 89| typedef struct [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) | 定义指令录制工具,用于生成录制指令。 | 90| typedef struct [OH_Drawing_RecordCmd](#oh_drawing_recordcmd)[OH_Drawing_RecordCmd](#oh_drawing_recordcmd) | 定义录制指令类, 用于存储录制指令的集合。 | 91| typedef enum [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCode](#oh_drawing_errorcode) | 枚举本模块可能产生的错误码。 | 92| typedef enum [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | 路径操作类型枚举。 | 93| typedef enum [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | 路径测量获取相应矩阵信息维度枚举。 | 94| typedef enum [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) | 区域操作类型枚举。 | 95| typedef struct [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) | 定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 | 96| typedef struct [OH_Drawing_Filter](#oh_drawing_filter) [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器,模板滤波器和图像滤波器。 | 97| typedef struct [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) [OH_Drawing_BitmapFormat](#oh_drawing_bitmapformat) | 结构体用于描述位图像素的格式,包括颜色类型和透明度类型 | 98| typedef enum [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint) | 源矩形区域约束类型枚举。 | 99| typedef enum [OH_Drawing_PointMode](#oh_drawing_pointmode) [OH_Drawing_PointMode](#oh_drawing_pointmode) | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 | 100| typedef enum [OH_Drawing_VertexMode](#oh_drawing_vertexmode) [OH_Drawing_VertexMode](#oh_drawing_vertexmode) | 用于指定如何解释给定顶点的几何形状的枚举类型。 | 101| typedef enum [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) | 画布裁剪方式的枚举集合。 | 102| typedef enum [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontEdging](#oh_drawing_fontedging) | 字形边缘效果类型枚举。 | 103| typedef enum [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontHinting](#oh_drawing_fonthinting) | 字形轮廓效果类型枚举。 | 104| typedef struct [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) [OH_Drawing_Font_Metrics](#oh_drawing_font_metrics) | 定义字体度量信息的结构体。 | 105| typedef struct [OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md) [OH_Drawing_GpuContextOptions](#oh_drawing_gpucontextoptions) | 定义有关图形处理器上下文的选项。 | 106| typedef enum [OH_Drawing_BlurType](#oh_drawing_blurtype) [OH_Drawing_BlurType](#oh_drawing_blurtype) | 蒙版滤波器模糊操作类型的枚举。 | 107| typedef enum [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) | 矩阵缩放方式枚举。 | 108| typedef enum [OH_Drawing_PathDirection](#oh_drawing_pathdirection) [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | 添加闭合轮廓方向枚举。 | 109| typedef enum [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | 定义路径的填充类型枚举。 | 110| typedef enum [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | 用于指定路径添加模式的枚举类型。 | 111| typedef enum [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 | 112| typedef enum [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 | 113| typedef enum [OH_Drawing_CornerPos](#oh_drawing_cornerpos) [OH_Drawing_CornerPos](#oh_drawing_cornerpos) | 用于描述圆角位置的枚举。 | 114| typedef enum [OH_Drawing_FilterMode](#oh_drawing_filtermode) [OH_Drawing_FilterMode](#oh_drawing_filtermode) | 过滤模式枚举。 | 115| typedef enum [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode) | 多级渐远纹理模式枚举。 | 116| typedef enum [OH_Drawing_TileMode](#oh_drawing_tilemode) [OH_Drawing_TileMode](#oh_drawing_tilemode) | 着色器效果平铺模式的枚举。 | 117| typedef struct [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) [OH_Drawing_RunBuffer](#oh_drawing_runbuffer) | 结构体用于描述一块内存,描述文字和位置信息。 | 118| typedef struct [OH_Drawing_FontCollection](#oh_drawing_fontcollection) [OH_Drawing_FontCollection](#oh_drawing_fontcollection) | 用于加载字体。 | 119| typedef struct [OH_Drawing_Typography](#oh_drawing_typography) [OH_Drawing_Typography](#oh_drawing_typography) | 用于管理排版的布局和显示等。 | 120| typedef struct [OH_Drawing_TextStyle](#oh_drawing_textstyle) [OH_Drawing_TextStyle](#oh_drawing_textstyle) | 用于管理字体颜色、装饰等。 | 121| typedef struct [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) | 用于管理排版风格,如文字方向等。 | 122| typedef struct [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) | 用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 | 123| typedef struct [OH_Drawing_TextBox](#oh_drawing_textbox) [OH_Drawing_TextBox](#oh_drawing_textbox) | 用于接收文本框的矩形大小、方向和数量大小 | 124| typedef struct [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) | 用于接收字体的位置和亲和性 | 125| typedef struct [OH_Drawing_Range](#oh_drawing_range) [OH_Drawing_Range](#oh_drawing_range) | 用于接收字体的起始位置和结束位置 | 126| typedef struct [OH_Drawing_TextShadow](#oh_drawing_textshadow) [OH_Drawing_TextShadow](#oh_drawing_textshadow) | 用于管理文本阴影。 | 127| typedef struct [OH_Drawing_FontParser](#oh_drawing_fontparser) [OH_Drawing_FontParser](#oh_drawing_fontparser) | 用来解析系统字体文件。 | 128| typedef enum [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment) | 占位符垂直对齐枚举 | 129| typedef struct [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) [OH_Drawing_PlaceholderSpan](#oh_drawing_placeholderspan) | 用于描述位占位符跨度的结构体 | 130| typedef enum [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) | 文本装饰样式枚举 | 131| typedef enum [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal) | 省略号样式枚举 | 132| typedef enum [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy) | 文本的中断策略枚举 | 133| typedef enum [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype) | 单词的断词方式枚举 | 134| typedef enum [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle) | 矩形框高度样式枚举 | 135| typedef enum [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle) | 矩形框宽度样式枚举 | 136| typedef struct [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) [OH_Drawing_FontDescriptor](#oh_drawing_fontdescriptor) | 描述系统字体详细信息的结构体。 | 137| typedef struct [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) [OH_Drawing_LineMetrics](#oh_drawing_linemetrics) | 文字行位置信息。 | 138| typedef struct [OH_Drawing_FontFallbackInfo](_o_h___drawing___font_fallback_info.md) [OH_Drawing_FontFallbackInfo](#oh_drawing_fontfallbackinfo) | 备用字体信息结构体。 | 139| typedef struct [OH_Drawing_FontFallbackGroup](_o_h___drawing___font_fallback_group.md) [OH_Drawing_FontFallbackGroup](#oh_drawing_fontfallbackgroup) | 备用字体集信息结构体。 | 140| typedef struct [OH_Drawing_FontAdjustInfo](_o_h___drawing___font_adjust_info.md) [OH_Drawing_FontAdjustInfo](#oh_drawing_fontadjustinfo) | 字重映射信息结构体。 | 141| typedef struct [OH_Drawing_FontAliasInfo](_o_h___drawing___font_alias_info.md) [OH_Drawing_FontAliasInfo](#oh_drawing_fontaliasinfo) | 别名字体信息结构体。 | 142| typedef struct [OH_Drawing_FontGenericInfo](_o_h___drawing___font_generic_info.md) [OH_Drawing_FontGenericInfo](#oh_drawing_fontgenericinfo) | 系统所支持的通用字体集信息结构体。 | 143| typedef struct [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) [OH_Drawing_FontConfigInfo](#oh_drawing_fontconfiginfo) | 系统字体配置信息结构体。 | 144| typedef struct [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_FontStyleStruct](#oh_drawing_fontstylestruct) | 定义字体样式信息的结构体。 | 145| typedef struct [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) [OH_Drawing_StrutStyle](#oh_drawing_strutstyle) | 用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 | 146| typedef struct [OH_Drawing_Canvas](#oh_drawing_canvas) [OH_Drawing_Canvas](#oh_drawing_canvas) | 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 | 147| typedef struct [OH_Drawing_Pen](#oh_drawing_pen) [OH_Drawing_Pen](#oh_drawing_pen) | 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 | 148| typedef struct [OH_Drawing_Region](#oh_drawing_region) [OH_Drawing_Region](#oh_drawing_region) | 定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 | 149| typedef struct [OH_Drawing_Brush](#oh_drawing_brush) [OH_Drawing_Brush](#oh_drawing_brush) | 定义为画刷,画刷用于描述填充图形的样式和颜色。 | 150| typedef struct [OH_Drawing_Path](#oh_drawing_path) [OH_Drawing_Path](#oh_drawing_path) | 定义为路径,路径用于自定义各种形状。 | 151| typedef struct [OH_Drawing_PixelMap](#oh_drawing_pixelmap) [OH_Drawing_PixelMap](#oh_drawing_pixelmap) | 定义像素图,用于包装图像框架支持的真实像素图。 | 152| typedef struct [OH_Drawing_Bitmap](#oh_drawing_bitmap) [OH_Drawing_Bitmap](#oh_drawing_bitmap) | 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 | 153| typedef struct [OH_Drawing_Point](#oh_drawing_point) [OH_Drawing_Point](#oh_drawing_point) | 定义一个点,用于描述坐标点。 | 154| typedef struct [OH_Drawing_ColorSpace](#oh_drawing_colorspace) [OH_Drawing_ColorSpace](#oh_drawing_colorspace) | 定义色彩空间,用于解释颜色信息。 | 155| typedef struct [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) [OH_Drawing_Point2D](#oh_drawing_point2d) | 定义一个二维的坐标点。 | 156| typedef [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) | 定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 | 157| typedef struct [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) [OH_Drawing_Point3D](#oh_drawing_point3d) | 定义一个三维的坐标点。 | 158| typedef struct [OH_Drawing_PathEffect](#oh_drawing_patheffect) [OH_Drawing_PathEffect](#oh_drawing_patheffect) | 定义一个路径效果,用于影响描边路径。 | 159| typedef struct [OH_Drawing_Rect](#oh_drawing_rect) [OH_Drawing_Rect](#oh_drawing_rect) | 用于描述矩形。 | 160| typedef struct [OH_Drawing_RoundRect](#oh_drawing_roundrect) [OH_Drawing_RoundRect](#oh_drawing_roundrect) | 用于描述圆角矩形。 | 161| typedef struct [OH_Drawing_Matrix](#oh_drawing_matrix) [OH_Drawing_Matrix](#oh_drawing_matrix) | 定义一个矩阵,用于描述坐标变换。 | 162| typedef struct [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) | 定义一个着色器,用于描述绘制内容的源颜色。 | 163| typedef struct [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) | 定义一个阴影层,用于描述绘制内容的阴影层。 | 164| typedef struct [OH_Drawing_Filter](#oh_drawing_filter) [OH_Drawing_Filter](#oh_drawing_filter) | 定义一个滤波器,用于存储颜色滤波器和模板滤波器。 | 165| typedef struct [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) | 定义模板滤波器,用于在绘制模板前对其进行转换。 | 166| typedef struct [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) | 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 | 167| typedef struct [OH_Drawing_Font](#oh_drawing_font) [OH_Drawing_Font](#oh_drawing_font) | 用于描述字体。 | 168| typedef struct [OH_Drawing_MemoryStream](#oh_drawing_memorystream) [OH_Drawing_MemoryStream](#oh_drawing_memorystream) | 用于描述内存流。 | 169| typedef struct [OH_Drawing_Typeface](#oh_drawing_typeface) [OH_Drawing_Typeface](#oh_drawing_typeface) | 用于描述字形。 | 170| typedef struct [OH_Drawing_TextBlob](#oh_drawing_textblob) [OH_Drawing_TextBlob](#oh_drawing_textblob) | 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 | 171| typedef struct [OH_Drawing_Image](#oh_drawing_image) [OH_Drawing_Image](#oh_drawing_image) | 定义一个用于描述绘制二维像素数组的图片。 | 172| typedef struct [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) | 定义一个采样选项,用于描述图片、位图等图像的采样方法。 | 173| typedef struct [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) | 定义文本构建器,用于构建文本。 | 174| typedef struct [OH_Drawing_GpuContext](#oh_drawing_gpucontext) [OH_Drawing_GpuContext](#oh_drawing_gpucontext) | 定义图形处理器上下文,用于描述图形处理器后端上下文。 | 175| typedef struct [OH_Drawing_Surface](#oh_drawing_surface) [OH_Drawing_Surface](#oh_drawing_surface) | 定义surface,用于管理画布绘制的内容。 | 176| typedef enum [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_ColorFormat](#oh_drawing_colorformat) | 用于描述位图像素的存储格式。 | 177| typedef enum [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) | 用于描述位图像素的透明度分量。 | 178| typedef enum [OH_Drawing_BlendMode](#oh_drawing_blendmode) [OH_Drawing_BlendMode](#oh_drawing_blendmode) | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 | 179| typedef struct [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) [OH_Drawing_Image_Info](#oh_drawing_image_info) | 定义图片信息结构体。 | 180| typedef struct [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) [OH_Drawing_RectStyle_Info](#oh_drawing_rectstyle_info) | 定义矩形框样式结构体。 | 181| typedef enum [OH_Drawing_TextEncoding](#oh_drawing_textencoding) [OH_Drawing_TextEncoding](#oh_drawing_textencoding) | 文本编码类型枚举。 | 182| typedef struct [OH_Drawing_FontMgr](#oh_drawing_fontmgr) [OH_Drawing_FontMgr](#oh_drawing_fontmgr) | 定义字体管理类, 用于字体管理。 | 183| typedef struct [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) | 定义字体样式集, 用于字体样式族匹配。 | 184| typedef enum [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) | 阴影标志枚举。 | 185 186### 枚举 187 188| 名称 | 描述 | 189| -------- | -------- | 190| [OH_Drawing_ErrorCode](#oh_drawing_errorcode-1) { OH_DRAWING_SUCCESS = 0, OH_DRAWING_ERROR_NO_PERMISSION = 201, OH_DRAWING_ERROR_INVALID_PARAMETER = 401, OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE = 26200001,OH_DRAWING_ERROR_ALLOCATION_FAILED = 26200002 } | 枚举本模块可能产生的错误码。 | 191| [OH_Drawing_PathOpMode](#oh_drawing_pathopmode-1) {<br/>PATH_OP_MODE_DIFFERENCE, PATH_OP_MODE_INTERSECT, PATH_OP_MODE_UNION, PATH_OP_MODE_XOR,<br/>PATH_OP_MODE_REVERSE_DIFFERENCE<br/>} | 路径操作类型枚举。 | 192| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags-1) { GET_POSITION_MATRIX, GET_TANGENT_MATRIX, GET_POSITION_AND_TANGENT_MATRIX } | 路径测量获取相应矩阵信息维度枚举。 | 193| [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode-1) {<br/>REGION_OP_MODE_DIFFERENCE, REGION_OP_MODE_INTERSECT, REGION_OP_MODE_UNION, REGION_OP_MODE_XOR,<br/>REGION_OP_MODE_REVERSE_DIFFERENCE, REGION_OP_MODE_REPLACE<br/>} | 区域操作类型枚举。 | 194| [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1) { STRICT_SRC_RECT_CONSTRAINT, FAST_SRC_RECT_CONSTRAINT } | 源矩形区域约束类型枚举。 | 195| [OH_Drawing_PointMode](#oh_drawing_pointmode-1) { POINT_MODE_POINTS, POINT_MODE_LINES, POINT_MODE_POLYGON } | 绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 | 196| [OH_Drawing_VertexMode](#oh_drawing_vertexmode-1) { VERTEX_MODE_TRIANGLES, VERTEX_MODE_TRIANGLESSTRIP, VERTEX_MODE_TRIANGLEFAN } | 用于指定如何解释给定顶点的几何形状的枚举类型。 | 197| [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop-1) { DIFFERENCE, INTERSECT } | 画布裁剪方式的枚举集合。 | 198| [OH_Drawing_FontEdging](#oh_drawing_fontedging-1) { FONT_EDGING_ALIAS, FONT_EDGING_ANTI_ALIAS, FONT_EDGING_SUBPIXEL_ANTI_ALIAS } | 字形边缘效果类型枚举。 | 199| [OH_Drawing_FontHinting](#oh_drawing_fonthinting-1) { FONT_HINTING_NONE, FONT_HINTING_SLIGHT, FONT_HINTING_NORMAL, FONT_HINTING_FULL } | 字形轮廓效果类型枚举。 | 200| [OH_Drawing_BlurType](#oh_drawing_blurtype-1) { NORMAL, SOLID, OUTER, INNER } | 蒙版滤波器模糊操作类型的枚举。 | 201| [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit-1) { SCALE_TO_FIT_FILL, SCALE_TO_FIT_START, SCALE_TO_FIT_CENTER, SCALE_TO_FIT_END } | 矩阵缩放方式枚举。 | 202| [OH_Drawing_PathDirection](#oh_drawing_pathdirection-1) { PATH_DIRECTION_CW, PATH_DIRECTION_CCW } | 添加闭合轮廓方向枚举。 | 203| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1) { PATH_FILL_TYPE_WINDING, PATH_FILL_TYPE_EVEN_ODD, PATH_FILL_TYPE_INVERSE_WINDING, PATH_FILL_TYPE_INVERSE_EVEN_ODD } | 定义路径的填充类型枚举。 | 204| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode-1) { PATH_ADD_MODE_APPEND, PATH_ADD_MODE_EXTEND } | 用于指定路径添加模式的枚举类型。 | 205| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle-1) { LINE_FLAT_CAP, LINE_SQUARE_CAP, LINE_ROUND_CAP } | 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 | 206| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle-1) { LINE_MITER_JOIN, LINE_ROUND_JOIN, LINE_BEVEL_JOIN } | 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 | 207| [OH_Drawing_CornerPos](#oh_drawing_cornerpos-1) { CORNER_POS_TOP_LEFT, CORNER_POS_TOP_RIGHT, CORNER_POS_BOTTOM_RIGHT, CORNER_POS_BOTTOM_LEFT } | 用于描述圆角位置的枚举。 | 208| [OH_Drawing_FilterMode](#oh_drawing_filtermode-1) { FILTER_MODE_NEAREST, FILTER_MODE_LINEAR } | 过滤模式枚举。 | 209| [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode-1) { MIPMAP_MODE_NONE, MIPMAP_MODE_NEAREST, MIPMAP_MODE_LINEAR } | 多级渐远纹理模式枚举。 | 210| [OH_Drawing_TileMode](#oh_drawing_tilemode-1) { CLAMP, REPEAT, MIRROR, DECAL } | 着色器效果平铺模式的枚举。 | 211| [OH_Drawing_TextDirection](#oh_drawing_textdirection) { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } | 文字方向 | 212| [OH_Drawing_TextAlign](#oh_drawing_textalign) {<br/>TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY,<br/>TEXT_ALIGN_START, TEXT_ALIGN_END<br/>} | 文字对齐方式 | 213| [OH_Drawing_FontWeight](#oh_drawing_fontweight) {<br/>FONT_WEIGHT_100, FONT_WEIGHT_200, FONT_WEIGHT_300, FONT_WEIGHT_400,<br/>FONT_WEIGHT_500, FONT_WEIGHT_600, FONT_WEIGHT_700, FONT_WEIGHT_800,<br/>FONT_WEIGHT_900<br/>} | 字重 | 214| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } | 基线位置 | 215| [OH_Drawing_TextDecoration](#oh_drawing_textdecoration) { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } | 文本装饰 | 216| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } | 区分字体是否为斜体 | 217| [OH_Drawing_PlaceholderVerticalAlignment](#oh_drawing_placeholderverticalalignment-1) {<br/>ALIGNMENT_OFFSET_AT_BASELINE, ALIGNMENT_ABOVE_BASELINE, ALIGNMENT_BELOW_BASELINE, ALIGNMENT_TOP_OF_ROW_BOX,<br/>ALIGNMENT_BOTTOM_OF_ROW_BOX, ALIGNMENT_CENTER_OF_ROW_BOX<br/>} | 占位符垂直对齐枚举 | 218| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle-1) {<br/>TEXT_DECORATION_STYLE_SOLID, TEXT_DECORATION_STYLE_DOUBLE, TEXT_DECORATION_STYLE_DOTTED, TEXT_DECORATION_STYLE_DASHED,<br/>TEXT_DECORATION_STYLE_WAVY<br/>} | 文本装饰样式枚举 | 219| [OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal-1) { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } | 省略号样式枚举 | 220| [OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy-1) { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } | 文本的中断策略枚举 | 221| [OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype-1) { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2 } | 单词的断词方式枚举 | 222| [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle-1) {<br/>RECT_HEIGHT_STYLE_TIGHT, RECT_HEIGHT_STYLE_MAX, RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,<br/>RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, RECT_HEIGHT_STYLE_STRUCT<br/>} | 矩形框高度样式枚举 | 223| [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle-1) { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } | 矩形框宽度样式枚举 | 224| [OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) {<br/>SUCCESS_FONT_CONFIG_INFO = 0, ERROR_FONT_CONFIG_INFO_UNKNOWN = 1, ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2, ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3,<br/>ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4<br/>} | 获取系统字体配置信息列表结果枚举。 | 225| [OH_Drawing_FontWidth](#oh_drawing_fontwidth) {<br/>ULTRA_CONDENSED_WIDTH = 1, EXTRA_CONDENSED_WIDTH = 2, CONDENSED_WIDTH = 3, SEMI_CONDENSED_WIDTH = 4,<br/>NORMAL_WIDTH = 5, SEMI_EXPANDED_WIDTH = 6, EXPANDED_WIDTH = 7, EXTRA_EXPANDED_WIDTH = 8,<br/>ULTRA_EXPANDED_WIDTH = 9<br/>} | 字体宽度的枚举。 | 226| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) { TEXT_HEIGHT_ALL = 0x0, TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, TEXT_HEIGHT_DISABLE_ALL = 0x1 \| 0x2 } | 文本高度修饰符模式枚举。 | 227| [OH_Drawing_TextStyleType](#oh_drawing_textstyletype) {<br/>TEXT_STYLE_NONE, TEXT_STYLE_ALL_ATTRIBUTES, TEXT_STYLE_FONT, TEXT_STYLE_FOREGROUND,<br/>TEXT_STYLE_BACKGROUND, TEXT_STYLE_SHADOW, TEXT_STYLE_DECORATIONS, TEXT_STYLE_LETTER_SPACING,<br/>TEXT_STYLE_WORD_SPACING<br/>} | 文本样式类型枚举。 | 228| [OH_Drawing_ColorFormat](#oh_drawing_colorformat-1) {<br/>COLOR_FORMAT_UNKNOWN, COLOR_FORMAT_ALPHA_8, COLOR_FORMAT_RGB_565, COLOR_FORMAT_ARGB_4444,<br/>COLOR_FORMAT_RGBA_8888, COLOR_FORMAT_BGRA_8888<br/>} | 用于描述位图像素的存储格式。 | 229| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat-1) { ALPHA_FORMAT_UNKNOWN, ALPHA_FORMAT_OPAQUE, ALPHA_FORMAT_PREMUL, ALPHA_FORMAT_UNPREMUL } | 用于描述位图像素的透明度分量。 | 230| [OH_Drawing_BlendMode](#oh_drawing_blendmode-1) {<br/>BLEND_MODE_CLEAR, BLEND_MODE_SRC, BLEND_MODE_DST, BLEND_MODE_SRC_OVER,<br/>BLEND_MODE_DST_OVER, BLEND_MODE_SRC_IN, BLEND_MODE_DST_IN, BLEND_MODE_SRC_OUT,<br/>BLEND_MODE_DST_OUT, BLEND_MODE_SRC_ATOP, BLEND_MODE_DST_ATOP, BLEND_MODE_XOR,<br/>BLEND_MODE_PLUS, BLEND_MODE_MODULATE, BLEND_MODE_SCREEN, BLEND_MODE_OVERLAY,<br/>BLEND_MODE_DARKEN, BLEND_MODE_LIGHTEN, BLEND_MODE_COLOR_DODGE, BLEND_MODE_COLOR_BURN,<br/>BLEND_MODE_HARD_LIGHT, BLEND_MODE_SOFT_LIGHT, BLEND_MODE_DIFFERENCE, BLEND_MODE_EXCLUSION,<br/>BLEND_MODE_MULTIPLY, BLEND_MODE_HUE, BLEND_MODE_SATURATION, BLEND_MODE_COLOR,<br/>BLEND_MODE_LUMINOSITY<br/>} | 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 | 231| [OH_Drawing_TextEncoding](#oh_drawing_textencoding-1) { TEXT_ENCODING_UTF8, TEXT_ENCODING_UTF16, TEXT_ENCODING_UTF32, TEXT_ENCODING_GLYPH_ID } | 文本编码类型枚举。 | 232| [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags-1) { SHADOW_FLAGS_NONE, SHADOW_FLAGS_TRANSPARENT_OCCLUDER, SHADOW_FLAGS_GEOMETRIC_ONLY, SHADOW_FLAGS_ALL } | 阴影标志枚举。 | 233 234 235### 函数 236 237| 名称 | 描述 | 238| -------- | -------- | 239| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFileWithArguments](#oh_drawing_typefacecreatefromfilewitharguments) (const char \*path, const [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。 | 240| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromCurrent](#oh_drawing_typefacecreatefromcurrent) (const [OH_Drawing_Typeface](#oh_drawing_typeface) \*current, const [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 通过已存在的字体对象创建带有字型参数的字体对象。 | 241| [OH_Drawing_FontArguments](#oh_drawing_fontarguments) \* [OH_Drawing_FontArgumentsCreate](#oh_drawing_fontargumentscreate) (void) | 用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 | 242| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsAddVariation](#oh_drawing_fontargumentsaddvariation) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments, const char \*axis, float value) | 给字型参数对象添加可变维度。 | 243| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontArgumentsDestroy](#oh_drawing_fontargumentsdestroy) ([OH_Drawing_FontArguments](#oh_drawing_fontarguments) \*fontArguments) | 用于销毁一个字型参数对象。 | 244| double [OH_Drawing_TypographyGetLongestLineWithIndent](#oh_drawing_typographygetlongestlinewithindent) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最长行的宽度(该宽度包含当前行缩进的宽度),建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 | 245| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | 用于绘制录制指令对象。 | 246| [OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \* [OH_Drawing_RecordCmdUtilsCreate](#oh_drawing_recordcmdutilscreate) (void) | 创建一个录制指令工具对象。 | 247| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)[OH_Drawing_RecordCmdUtilsDestroy](#oh_drawing_recordcmdutilsdestroy) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils) | 销毁一个录制指令工具对象,并回收该对象占有的内存。 | 248| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils, int32_t width, int32_t height, [OH_Drawing_Canvas](#oh_drawing_canvas) \*\*canvas) | 开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。<br/>指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。 | 249| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording) ([OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils) \*recordCmdUtils, [OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*\*recordCmd) | 结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。<br/>指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 | 250| [OH_Drawing_ErrorCode](#oh_drawing_errorcode)[OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy) ([OH_Drawing_RecordCmd](#oh_drawing_recordcmd) \*recordCmd) | 销毁录制指令对象,并回收该对象占有的内存。 | 251| void [OH_Drawing_TypographyDestroyTextBox](#oh_drawing_typographydestroytextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 释放文本框占用的内存。 | 252| void [OH_Drawing_SetTextShadow](#oh_drawing_settextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*shadow, uint32_t color, [OH_Drawing_Point](#oh_drawing_point) \*offset, double blurRadius) | 设置字体阴影对象的参数。 | 253| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawSingleCharacter](#oh_drawing_canvasdrawsinglecharacter) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const char \*str, const [OH_Drawing_Font](#oh_drawing_font) \*font, float x, float y) | 用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 | 254| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontMeasureSingleCharacter](#oh_drawing_fontmeasuresinglecharacter) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const char \*str, float \*textWidth) | 用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 | 255| void [OH_Drawing_TypographyPaintOnPath](#oh_drawing_typographypaintonpath) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Path](#oh_drawing_path) \*, double, double) | 沿路径绘制文本。 | 256| [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轴方向平移指定距离。 | 257| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetX](#oh_drawing_pointgetx) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*x) | 用于获取点的x轴坐标。 | 258| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_PointGetY](#oh_drawing_pointgety) (const [OH_Drawing_Point](#oh_drawing_point) \*point, float \*y) | 用于获取点的y轴坐标。 | 259| [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轴坐标。 | 260| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_FontMeasureText](#oh_drawing_fontmeasuretext) (const [OH_Drawing_Font](#oh_drawing_font) \*font, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, [OH_Drawing_Rect](#oh_drawing_rect) \*bounds, float \*textWidth) | 用于获取文本的宽度和边界框。 | 261| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasClipRegion](#oh_drawing_canvasclipregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Region](#oh_drawing_region) \*region, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp) | 用于裁剪一个区域。 | 262| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawColor](#oh_drawing_canvasdrawcolor) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode) blendMode) | 用于使用指定的颜色及混合模式来填充整个画布。 | 263| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasGetImageInfo](#oh_drawing_canvasgetimageinfo) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*imageInfo) | 用于获取画布的图像信息。 | 264| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasIsClipEmpty](#oh_drawing_canvasisclipempty) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, bool \*isClipEmpty) | 用于判断裁剪后可绘制区域是否为空。 | 265| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_CanvasDrawPoint](#oh_drawing_canvasdrawpoint) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*canvas, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*point) | 用于画一个点。 | 266| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_MatrixGetAll](#oh_drawing_matrixgetall) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, float value[9]) | 获取矩阵所有元素值。 | 267| [OH_Drawing_ErrorCode](#oh_drawing_errorcode) [OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget) () | 获取本模块的错误码。 | 268| [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),用于拷贝一个已有画刷对象。 | 269| void [OH_Drawing_FilterSetImageFilter](#oh_drawing_filtersetimagefilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 为滤波器对象设置图像滤波器对象。 | 270| [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \* [OH_Drawing_ImageFilterCreateBlur](#oh_drawing_imagefiltercreateblur) (float sigmaX, float sigmaY, [OH_Drawing_TileMode](#oh_drawing_tilemode), [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*input) | 创建具有模糊效果的图像滤波器。 | 271| [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \* [OH_Drawing_ImageFilterCreateFromColorFilter](#oh_drawing_imagefiltercreatefromcolorfilter) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter, [OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*input) | 创建具有颜色变换效果的图像滤波器。 | 272| void [OH_Drawing_ImageFilterDestroy](#oh_drawing_imagefilterdestroy) ([OH_Drawing_ImageFilter](#oh_drawing_imagefilter) \*) | 销毁图像滤波器对象并回收该对象占有内存。 | 273| void [OH_Drawing_MatrixMapPoints](#oh_drawing_matrixmappoints) (const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*src, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*dst, int count) | 通过矩阵变换将源点数组映射到目标点数组。 | 274| bool [OH_Drawing_MatrixMapRect](#oh_drawing_matrixmaprect) (const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, [OH_Drawing_Rect](#oh_drawing_rect) \*dst) | 将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 | 275| void [OH_Drawing_PathAddPolygon](#oh_drawing_pathaddpolygon) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*points, uint32_t count, bool isClosed) | 向路径添加多边形。 | 276| void [OH_Drawing_PathAddCircle](#oh_drawing_pathaddcircle) ([OH_Drawing_Path](#oh_drawing_path) \*path, float x, float y, float radius, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | 按指定方向,向路径添加圆形。 | 277| bool [OH_Drawing_PathBuildFromSvgString](#oh_drawing_pathbuildfromsvgstring) ([OH_Drawing_Path](#oh_drawing_path) \*path, const char \*str) | 解析SVG字符串表示的路径。 | 278| void [OH_Drawing_PathGetBounds](#oh_drawing_pathgetbounds) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取包含路径的最小边界框。 | 279| bool [OH_Drawing_PathIsClosed](#oh_drawing_pathisclosed) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed) | 获取路径是否闭合。 | 280| bool [OH_Drawing_PathGetPositionTangent](#oh_drawing_pathgetpositiontangent) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float distance, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*position, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*tangent) | 获取距路径起始点指定距离的坐标点和切线值。 | 281| bool [OH_Drawing_PathOp](#oh_drawing_pathop) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*other, [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) op) | 将两个路径按照指定的路径操作类型合并。 | 282| bool [OH_Drawing_PathGetMatrix](#oh_drawing_pathgetmatrix) ([OH_Drawing_Path](#oh_drawing_path) \*path, bool forceClosed, float distance, [OH_Drawing_Matrix](#oh_drawing_matrix) \*matrix, [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) flag) | 获取距路径起始点指定距离的相应变换矩阵。 | 283| bool [OH_Drawing_PenGetFillPath](#oh_drawing_pengetfillpath) ([OH_Drawing_Pen](#oh_drawing_pen) \*, const [OH_Drawing_Path](#oh_drawing_path) \*src, [OH_Drawing_Path](#oh_drawing_path) \*dst, const [OH_Drawing_Rect](#oh_drawing_rect) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 获取使用画笔绘制的源路径轮廓,并用目标路径表示。 | 284| [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),用于拷贝一个已有画笔对象。 | 285| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap) (NativePixelMap_ \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 | 286| [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \* [OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative) (OH_PixelmapNative \*) | 从图像框架定义的像素图对象中获取本模块定义的像素图对象。 | 287| 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)建立。 | 288| bool [OH_Drawing_RectJoin](#oh_drawing_rectjoin) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 将两个矩形取并集。 | 289| bool [OH_Drawing_RegionContains](#oh_drawing_regioncontains) ([OH_Drawing_Region](#oh_drawing_region) \*region, int32_t x, int32_t y) | 判断区域是否包含指定坐标点。 | 290| bool [OH_Drawing_RegionOp](#oh_drawing_regionop) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Region](#oh_drawing_region) \*other, [OH_Drawing_RegionOpMode](#oh_drawing_regionopmode) op) | 将两个区域按照指定的区域操作类型合并。 | 291| bool [OH_Drawing_RegionSetPath](#oh_drawing_regionsetpath) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Region](#oh_drawing_region) \*clip) | 给区域对象设置为指定区域内路径表示的范围。 | 292| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateColorShader](#oh_drawing_shadereffectcreatecolorshader) (const uint32_t color) | 创建具有单一颜色的着色器。 | 293| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix](#oh_drawing_shadereffectcreatelineargradientwithlocalmatrix) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*startPt, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*endPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 创建着色器,在两个指定点之间生成线性渐变。 | 294| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix](#oh_drawing_shadereffectcreateradialgradientwithlocalmatrix) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*centerPt, float radius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 | 295| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateTwoPointConicalGradient](#oh_drawing_shadereffectcreatetwopointconicalgradient) (const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*startPt, float startRadius, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*endPt, float endRadius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode), const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 创建着色器,在给定两个圆之间生成渐变。 | 296| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreate](#oh_drawing_bitmapcreate) (void) | 用于创建一个位图对象。 | 297| void [OH_Drawing_BitmapDestroy](#oh_drawing_bitmapdestroy) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于销毁位图对象并回收该对象占有内存。 | 298| [OH_Drawing_Bitmap](#oh_drawing_bitmap) \* [OH_Drawing_BitmapCreateFromPixels](#oh_drawing_bitmapcreatefrompixels) ([OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*, void \*pixels, uint32_t rowBytes) | 用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 | 299| void [OH_Drawing_BitmapBuild](#oh_drawing_bitmapbuild) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const uint32_t width, const uint32_t height, const [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) \*) | 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 | 300| uint32_t [OH_Drawing_BitmapGetWidth](#oh_drawing_bitmapgetwidth) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的宽度。 | 301| uint32_t [OH_Drawing_BitmapGetHeight](#oh_drawing_bitmapgetheight) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的高度。 | 302| [OH_Drawing_ColorFormat](#oh_drawing_colorformat) [OH_Drawing_BitmapGetColorFormat](#oh_drawing_bitmapgetcolorformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素存储格式。 | 303| [OH_Drawing_AlphaFormat](#oh_drawing_alphaformat) [OH_Drawing_BitmapGetAlphaFormat](#oh_drawing_bitmapgetalphaformat) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素透明度分量。 | 304| void \* [OH_Drawing_BitmapGetPixels](#oh_drawing_bitmapgetpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 | 305| void [OH_Drawing_BitmapGetImageInfo](#oh_drawing_bitmapgetimageinfo) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 用于获取指定位图的信息。 | 306| bool [OH_Drawing_BitmapReadPixels](#oh_drawing_bitmapreadpixels) ([OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*dstInfo, void \*dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY) | 将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 | 307| [OH_Drawing_Brush](#oh_drawing_brush) \* [OH_Drawing_BrushCreate](#oh_drawing_brushcreate) (void) | 用于创建一个画刷对象。 | 308| void [OH_Drawing_BrushDestroy](#oh_drawing_brushdestroy) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于销毁画刷对象并回收该对象占有的内存。 | 309| bool [OH_Drawing_BrushIsAntiAlias](#oh_drawing_brushisantialias) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 310| void [OH_Drawing_BrushSetAntiAlias](#oh_drawing_brushsetantialias) ([OH_Drawing_Brush](#oh_drawing_brush) \*, bool) | 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 311| uint32_t [OH_Drawing_BrushGetColor](#oh_drawing_brushgetcolor) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | 312| void [OH_Drawing_BrushSetColor](#oh_drawing_brushsetcolor) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint32_t color) | 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 | 313| uint8_t [OH_Drawing_BrushGetAlpha](#oh_drawing_brushgetalpha) (const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 | 314| void [OH_Drawing_BrushSetAlpha](#oh_drawing_brushsetalpha) ([OH_Drawing_Brush](#oh_drawing_brush) \*, uint8_t alpha) | 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 | 315| void [OH_Drawing_BrushSetShaderEffect](#oh_drawing_brushsetshadereffect) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 为画刷设置着色器效果。 | 316| void [OH_Drawing_BrushSetShadowLayer](#oh_drawing_brushsetshadowlayer) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 | 317| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 318| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 319| void [OH_Drawing_BrushSetBlendMode](#oh_drawing_brushsetblendmode) ([OH_Drawing_Brush](#oh_drawing_brush) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 | 320| void [OH_Drawing_BrushReset](#oh_drawing_brushreset) ([OH_Drawing_Brush](#oh_drawing_brush) \*) | 将画刷重置至初始状态,清空所有已设置的属性。 | 321| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_CanvasCreate](#oh_drawing_canvascreate) (void) | 用于创建一个画布对象。 | 322| void [OH_Drawing_CanvasDestroy](#oh_drawing_canvasdestroy) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于销毁画布对象并回收该对象占有的内存。 | 323| void [OH_Drawing_CanvasBind](#oh_drawing_canvasbind) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 | 324| void [OH_Drawing_CanvasAttachPen](#oh_drawing_canvasattachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 | 325| void [OH_Drawing_CanvasDetachPen](#oh_drawing_canvasdetachpen) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 | 326| void [OH_Drawing_CanvasAttachBrush](#oh_drawing_canvasattachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 | 327| void [OH_Drawing_CanvasDetachBrush](#oh_drawing_canvasdetachbrush) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 | 328| void [OH_Drawing_CanvasSave](#oh_drawing_canvassave) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于保存当前画布的状态(画布矩阵)到一个栈顶。 | 329| void [OH_Drawing_CanvasSaveLayer](#oh_drawing_canvassavelayer) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 | 330| void [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于恢复保存在栈顶的画布状态(画布矩阵)。 | 331| uint32_t [OH_Drawing_CanvasGetSaveCount](#oh_drawing_canvasgetsavecount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 用于获取栈中保存的画布状态(画布矩阵)的数量。 | 332| void [OH_Drawing_CanvasRestoreToCount](#oh_drawing_canvasrestoretocount) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t saveCount) | 用于恢复到指定数量的画布状态(画布矩阵)。 | 333| void [OH_Drawing_CanvasDrawLine](#oh_drawing_canvasdrawline) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float x1, float y1, float x2, float y2) | 用于画一条直线段。 | 334| void [OH_Drawing_CanvasDrawPath](#oh_drawing_canvasdrawpath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*) | 用于画一个自定义路径。 | 335| void [OH_Drawing_CanvasDrawPixelMapRect](#oh_drawing_canvasdrawpixelmaprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_PixelMap](#oh_drawing_pixelmap) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 用于将像素图的指定区域绘制到画布的指定区域。 | 336| void [OH_Drawing_CanvasDrawBackground](#oh_drawing_canvasdrawbackground) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Brush](#oh_drawing_brush) \*) | 用于画一个背景,此背景以画刷填充。 | 337| void [OH_Drawing_CanvasDrawRegion](#oh_drawing_canvasdrawregion) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Region](#oh_drawing_region) \*) | 用于画一块区域。 | 338| void [OH_Drawing_CanvasDrawPoints](#oh_drawing_canvasdrawpoints) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_PointMode](#oh_drawing_pointmode) mode, uint32_t count, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*) | 用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 | 339| void [OH_Drawing_CanvasDrawBitmap](#oh_drawing_canvasdrawbitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, float left, float top) | 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 | 340| void [OH_Drawing_CanvasDrawBitmapRect](#oh_drawing_canvasdrawbitmaprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 将位图的指定区域绘制到画布的指定区域。 | 341| void [OH_Drawing_CanvasSetMatrix](#oh_drawing_canvassetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 设置画布的矩阵状态。 | 342| void [OH_Drawing_CanvasResetMatrix](#oh_drawing_canvasresetmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 重置当前画布的矩阵为单位矩阵。 | 343| void [OH_Drawing_CanvasDrawImageRectWithSrc](#oh_drawing_canvasdrawimagerectwithsrc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Image](#oh_drawing_image) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*, [OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint)) | 将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 | 344| void [OH_Drawing_CanvasDrawImageRect](#oh_drawing_canvasdrawimagerect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 将图片绘制到画布的指定区域上。 | 345| void [OH_Drawing_CanvasDrawVertices](#oh_drawing_canvasdrawvertices) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_VertexMode](#oh_drawing_vertexmode) vertexMmode, int32_t vertexCount, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*positions, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*texs, const uint32_t \*colors, int32_t indexCount, const uint16_t \*indices, [OH_Drawing_BlendMode](#oh_drawing_blendmode) mode) | 用于画顶点数组描述的三角网格。 | 346| bool [OH_Drawing_CanvasReadPixels](#oh_drawing_canvasreadpixels) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*, void \*dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY) | 从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 | 347| bool [OH_Drawing_CanvasReadPixelsToBitmap](#oh_drawing_canvasreadpixelstobitmap) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*, int32_t srcX, int32_t srcY) | 从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 | 348| void [OH_Drawing_CanvasDrawRect](#oh_drawing_canvasdrawrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个矩形。 | 349| void [OH_Drawing_CanvasDrawCircle](#oh_drawing_canvasdrawcircle) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Point](#oh_drawing_point) \*, float radius) | 用于画一个圆形。 | 350| void [OH_Drawing_CanvasDrawOval](#oh_drawing_canvasdrawoval) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于画一个椭圆。 | 351| void [OH_Drawing_CanvasDrawArc](#oh_drawing_canvasdrawarc) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 用于画一个弧。 | 352| void [OH_Drawing_CanvasDrawRoundRect](#oh_drawing_canvasdrawroundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于画一个圆角矩形。 | 353| void [OH_Drawing_CanvasDrawTextBlob](#oh_drawing_canvasdrawtextblob) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*, float x, float y) | 用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。 | 354| uint32_t [OH_Drawing_ColorSetArgb](#oh_drawing_colorsetargb) (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue) | 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 | 355| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateBlendMode](#oh_drawing_colorfiltercreateblendmode) (uint32_t color, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 创建具有混合模式的颜色滤波器。 | 356| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateCompose](#oh_drawing_colorfiltercreatecompose) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter1, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*colorFilter2) | 将两个颜色滤波器合成一个新的颜色滤波器。 | 357| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateMatrix](#oh_drawing_colorfiltercreatematrix) (const float matrix[20]) | 创建具有5x4颜色矩阵的颜色滤波器。 | 358| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLinearToSrgbGamma](#oh_drawing_colorfiltercreatelineartosrgbgamma) (void) | 创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 | 359| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateSrgbGammaToLinear](#oh_drawing_colorfiltercreatesrgbgammatolinear) (void) | 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 | 360| [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \* [OH_Drawing_ColorFilterCreateLuma](#oh_drawing_colorfiltercreateluma) (void) | 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 | 361| void [OH_Drawing_ColorFilterDestroy](#oh_drawing_colorfilterdestroy) ([OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 销毁颜色滤波器对象,并收回该对象占用的内存。 | 362| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgb](#oh_drawing_colorspacecreatesrgb) (void) | 创建一个标准颜色空间。 | 363| [OH_Drawing_ColorSpace](#oh_drawing_colorspace) \* [OH_Drawing_ColorSpaceCreateSrgbLinear](#oh_drawing_colorspacecreatesrgblinear) (void) | 创建一个Gamma 1.0空间上的颜色空间。 | 364| void [OH_Drawing_ColorSpaceDestroy](#oh_drawing_colorspacedestroy) ([OH_Drawing_ColorSpace](#oh_drawing_colorspace) \*) | 销毁颜色空间对象,并回收该对象占有内存。 | 365| [OH_Drawing_Filter](#oh_drawing_filter) \* [OH_Drawing_FilterCreate](#oh_drawing_filtercreate) (void) | 创建一个滤波器对象。 | 366| void [OH_Drawing_FilterSetMaskFilter](#oh_drawing_filtersetmaskfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 为滤波器对象设置蒙板滤波器对象。 | 367| void [OH_Drawing_FilterSetColorFilter](#oh_drawing_filtersetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 为滤波器对象设置颜色滤波器对象。 | 368| void [OH_Drawing_FilterGetColorFilter](#oh_drawing_filtergetcolorfilter) ([OH_Drawing_Filter](#oh_drawing_filter) \*, [OH_Drawing_ColorFilter](#oh_drawing_colorfilter) \*) | 从滤波器对象获取颜色滤波器对象。 | 369| void [OH_Drawing_FilterDestroy](#oh_drawing_filterdestroy) ([OH_Drawing_Filter](#oh_drawing_filter) \*) | 销毁滤波器对象,并收回该对象占用的内存。 | 370| void [OH_Drawing_FontSetBaselineSnap](#oh_drawing_fontsetbaselinesnap) ([OH_Drawing_Font](#oh_drawing_font) \*, bool baselineSnap) | 当前画布矩阵轴对齐时,将字形基线设置为是否与像素对齐。 | 371| bool [OH_Drawing_FontIsBaselineSnap](#oh_drawing_fontisbaselinesnap) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 当前画布矩阵轴对齐时,获取字形基线是否与像素对齐。 | 372| void [OH_Drawing_FontSetEdging](#oh_drawing_fontsetedging) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontEdging](#oh_drawing_fontedging)) | 用于设置字形边缘效果。 | 373| [OH_Drawing_FontEdging](#oh_drawing_fontedging) [OH_Drawing_FontGetEdging](#oh_drawing_fontgetedging) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形边缘效果。 | 374| void [OH_Drawing_FontSetForceAutoHinting](#oh_drawing_fontsetforceautohinting) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isForceAutoHinting) | 用于设置是否自动调整字形轮廓。 | 375| bool [OH_Drawing_FontIsForceAutoHinting](#oh_drawing_fontisforceautohinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形轮廓是否自动调整。 | 376| void [OH_Drawing_FontSetSubpixel](#oh_drawing_fontsetsubpixel) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isSubpixel) | 设置字形是否使用次像素渲染。 | 377| bool [OH_Drawing_FontIsSubpixel](#oh_drawing_fontissubpixel) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否使用次像素渲染。 | 378| [OH_Drawing_Font](#oh_drawing_font) \* [OH_Drawing_FontCreate](#oh_drawing_fontcreate) (void) | 用于创建一个字体对象。 | 379| void [OH_Drawing_FontSetTypeface](#oh_drawing_fontsettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于给字体设置字形。 | 380| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontGetTypeface](#oh_drawing_fontgettypeface) ([OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形对象。 | 381| void [OH_Drawing_FontSetTextSize](#oh_drawing_fontsettextsize) ([OH_Drawing_Font](#oh_drawing_font) \*, float textSize) | 用于给字体设置文字大小。 | 382| float [OH_Drawing_FontGetTextSize](#oh_drawing_fontgettextsize) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形文本大小。 | 383| int [OH_Drawing_FontCountText](#oh_drawing_fontcounttext) ([OH_Drawing_Font](#oh_drawing_font) \*, const void \*text, size_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding) | 获取文本所表示的字符数量。 | 384| uint32_t [OH_Drawing_FontTextToGlyphs](#oh_drawing_fonttexttoglyphs) (const [OH_Drawing_Font](#oh_drawing_font) \*, const void \*text, uint32_t byteLength, [OH_Drawing_TextEncoding](#oh_drawing_textencoding) encoding, uint16_t \*glyphs, int maxGlyphCount) | 用于将文本转换为字形索引。 | 385| void [OH_Drawing_FontGetWidths](#oh_drawing_fontgetwidths) (const [OH_Drawing_Font](#oh_drawing_font) \*, const uint16_t \*glyphs, int count, float \*widths) | 用于获取字符串中每个字符的宽度。 | 386| void [OH_Drawing_FontSetLinearText](#oh_drawing_fontsetlineartext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isLinearText) | 用于设置线性可缩放字体。 | 387| bool [OH_Drawing_FontIsLinearText](#oh_drawing_fontislineartext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否使用线性缩放。 | 388| void [OH_Drawing_FontSetTextSkewX](#oh_drawing_fontsettextskewx) ([OH_Drawing_Font](#oh_drawing_font) \*, float skewX) | 用于给字体设置文本倾斜。 | 389| float [OH_Drawing_FontGetTextSkewX](#oh_drawing_fontgettextskewx) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形文本在x轴上的倾斜度。 | 390| void [OH_Drawing_FontSetFakeBoldText](#oh_drawing_fontsetfakeboldtext) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isFakeBoldText) | 用于设置增加描边宽度以近似粗体字体效果。 | 391| bool [OH_Drawing_FontIsFakeBoldText](#oh_drawing_fontisfakeboldtext) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取是否增加笔画宽度以接近粗体字形。 | 392| void [OH_Drawing_FontSetScaleX](#oh_drawing_fontsetscalex) ([OH_Drawing_Font](#oh_drawing_font) \*, float scaleX) | 用于设置字形对象在x轴上的缩放比例。 | 393| float [OH_Drawing_FontGetScaleX](#oh_drawing_fontgetscalex) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形对象在x轴上的缩放比例。 | 394| void [OH_Drawing_FontSetHinting](#oh_drawing_fontsethinting) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_FontHinting](#oh_drawing_fonthinting)) | 用于设置字形轮廓效果。 | 395| [OH_Drawing_FontHinting](#oh_drawing_fonthinting) [OH_Drawing_FontGetHinting](#oh_drawing_fontgethinting) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形轮廓效果枚举类型。 | 396| void [OH_Drawing_FontSetEmbeddedBitmaps](#oh_drawing_fontsetembeddedbitmaps) ([OH_Drawing_Font](#oh_drawing_font) \*, bool isEmbeddedBitmaps) | 用于设置字形是否转换成位图处理。 | 397| bool [OH_Drawing_FontIsEmbeddedBitmaps](#oh_drawing_fontisembeddedbitmaps) (const [OH_Drawing_Font](#oh_drawing_font) \*) | 获取字形是否转换成位图处理。 | 398| void [OH_Drawing_FontDestroy](#oh_drawing_fontdestroy) ([OH_Drawing_Font](#oh_drawing_font) \*) | 用于销毁字体对象并回收该对象占有的内存。 | 399| float [OH_Drawing_FontGetMetrics](#oh_drawing_fontgetmetrics) ([OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 获取字体度量信息。 | 400| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection) (void) | 创建字体集对象[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)对象。| 401| void [OH_Drawing_DestroyFontCollection](#oh_drawing_destroyfontcollection) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 释放被字体集对象占据的内存。 | 402| void [OH_Drawing_DisableFontCollectionFallback](#oh_drawing_disablefontcollectionfallback) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用备用字体。 | 403| void [OH_Drawing_DisableFontCollectionSystemFont](#oh_drawing_disablefontcollectionsystemfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*fontCollection) | 禁用系统字体。 | 404| [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \* [OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection) (void) | 创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 | 405| void [OH_Drawing_ClearFontCaches](#oh_drawing_clearfontcaches) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 | 406| [OH_Drawing_FontMgr](#oh_drawing_fontmgr) \* [OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate) (void) | 构造字体管理对象。 | 407| void [OH_Drawing_FontMgrDestroy](#oh_drawing_fontmgrdestroy) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 释放字体管理对象占用的内存。 | 408| int [OH_Drawing_FontMgrGetFamilyCount](#oh_drawing_fontmgrgetfamilycount) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*) | 获取字体家族的数量。 | 409| char \* [OH_Drawing_FontMgrGetFamilyName](#oh_drawing_fontmgrgetfamilyname) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由索引值获取字体家族名称。 | 410| void [OH_Drawing_FontMgrDestroyFamilyName](#oh_drawing_fontmgrdestroyfamilyname) (char \*familyName) | 释放指定字体家族名称占用的内存。 | 411| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrCreateFontStyleSet](#oh_drawing_fontmgrcreatefontstyleset) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, int index) | 由字体管理对象构造字体样式集对象。 | 412| void [OH_Drawing_FontMgrDestroyFontStyleSet](#oh_drawing_fontmgrdestroyfontstyleset) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 释放字体样式集对象占用的内存。 | 413| [OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \* [OH_Drawing_FontMgrMatchFamily](#oh_drawing_fontmgrmatchfamily) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName) | 由指定的字体家族名称,获取字体样式集对象。 | 414| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontMgrMatchFamilyStyle](#oh_drawing_fontmgrmatchfamilystyle) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md)) | 根据指定的字体样式信息和字体家族名称,获取字型对象。 | 415| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontMgrMatchFamilyStyleCharacter](#oh_drawing_fontmgrmatchfamilystylecharacter) ([OH_Drawing_FontMgr](#oh_drawing_fontmgr) \*, const char \*familyName, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md), const char \*bcp47[], int bcp47Count, int32_t character) | 为指定字符获取字型对象。 | 416| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetCreateTypeface](#oh_drawing_fontstylesetcreatetypeface) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int index) | 为指定索引获取字型对象。 | 417| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_FontStyleSetGetStyle](#oh_drawing_fontstylesetgetstyle) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, int32_t index, char \*\*styleName) | 获取字体样式。 | 418| void [OH_Drawing_FontStyleSetFreeStyleName](#oh_drawing_fontstylesetfreestylename) (char \*\*styleName) | 释放指定字体样式的内存。 | 419| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_FontStyleSetMatchStyle](#oh_drawing_fontstylesetmatchstyle) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyleStruct) | 获取最接近字体样式的字型对象。 | 420| int [OH_Drawing_FontStyleSetCount](#oh_drawing_fontstylesetcount) ([OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset) \*) | 获取字体样式集中字体的个数。 | 421| [OH_Drawing_GpuContext](#oh_drawing_gpucontext) \* [OH_Drawing_GpuContextCreateFromGL](#oh_drawing_gpucontextcreatefromgl) ([OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)) | 用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 | 422| void [OH_Drawing_GpuContextDestroy](#oh_drawing_gpucontextdestroy) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*) | 用于销毁图形处理器上下文对象并回收该对象占用的内存。 | 423| [OH_Drawing_Image](#oh_drawing_image) \* [OH_Drawing_ImageCreate](#oh_drawing_imagecreate) (void) | 创建一个图片对象,描述了要绘制的二维像素数组。 | 424| void [OH_Drawing_ImageDestroy](#oh_drawing_imagedestroy) ([OH_Drawing_Image](#oh_drawing_image) \*) | 销毁图片对象并回收该对象占有内存。 | 425| bool [OH_Drawing_ImageBuildFromBitmap](#oh_drawing_imagebuildfrombitmap) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Bitmap](#oh_drawing_bitmap) \*) | 从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 | 426| int32_t [OH_Drawing_ImageGetWidth](#oh_drawing_imagegetwidth) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片宽度,即每行的像素个数。 | 427| int32_t [OH_Drawing_ImageGetHeight](#oh_drawing_imagegetheight) ([OH_Drawing_Image](#oh_drawing_image) \*) | 获取图片高度,即像素行数。 | 428| void [OH_Drawing_ImageGetImageInfo](#oh_drawing_imagegetimageinfo) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) \*) | 获取图片信息。调用该接口后,传入的图片信息对象被填充。 | 429| [OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \* [OH_Drawing_MaskFilterCreateBlur](#oh_drawing_maskfiltercreateblur) ([OH_Drawing_BlurType](#oh_drawing_blurtype) blurType, float sigma, bool respectCTM) | 创建具有模糊效果的模板滤波器。 | 430| void [OH_Drawing_MaskFilterDestroy](#oh_drawing_maskfilterdestroy) ([OH_Drawing_MaskFilter](#oh_drawing_maskfilter) \*) | 销毁模板滤波器对象,并收回该对象占用的内存。 | 431| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate) (void) | 用于创建一个矩阵对象。 | 432| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateRotation](#oh_drawing_matrixcreaterotation) (float deg, float x, float y) | 创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 | 433| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateScale](#oh_drawing_matrixcreatescale) (float sx, float sy, float px, float py) | 创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 | 434| [OH_Drawing_Matrix](#oh_drawing_matrix) \* [OH_Drawing_MatrixCreateTranslation](#oh_drawing_matrixcreatetranslation) (float dx, float dy) | 创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 | 435| void [OH_Drawing_MatrixSetMatrix](#oh_drawing_matrixsetmatrix) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2) | 用于给矩阵对象设置参数。 | 436| bool [OH_Drawing_MatrixSetRectToRect](#oh_drawing_matrixsetrecttorect) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*src, const [OH_Drawing_Rect](#oh_drawing_rect) \*dst, [OH_Drawing_ScaleToFit](#oh_drawing_scaletofit) stf) | 将矩阵以缩放方式适配目标矩阵。 | 437| void [OH_Drawing_MatrixPreRotate](#oh_drawing_matrixprerotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 例如给定的矩阵: | 438| void [OH_Drawing_MatrixPreScale](#oh_drawing_matrixprescale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 | 439| void [OH_Drawing_MatrixPreTranslate](#oh_drawing_matrixpretranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 | 440| void [OH_Drawing_MatrixPostRotate](#oh_drawing_matrixpostrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 | 441| void [OH_Drawing_MatrixPostScale](#oh_drawing_matrixpostscale) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float sx, float sy, float px, float py) | 将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 | 442| void [OH_Drawing_MatrixPostTranslate](#oh_drawing_matrixposttranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 例如给定的矩阵: | 443| void [OH_Drawing_MatrixReset](#oh_drawing_matrixreset) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 重置当前矩阵为单位矩阵。 | 444| void [OH_Drawing_MatrixConcat](#oh_drawing_matrixconcat) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*total, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*a, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*b) | 将矩阵total设置为矩阵a乘以矩阵b。 | 445| float [OH_Drawing_MatrixGetValue](#oh_drawing_matrixgetvalue) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, int index) | 获取矩阵给定索引位的值。索引范围0-8。 | 446| void [OH_Drawing_MatrixRotate](#oh_drawing_matrixrotate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float degree, float px, float py) | 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 | 447| void [OH_Drawing_MatrixTranslate](#oh_drawing_matrixtranslate) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, float dx, float dy) | 设置矩阵为单位矩阵,并平移(dx, dy)。 | 448| 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进行缩放。 | 449| bool [OH_Drawing_MatrixInvert](#oh_drawing_matrixinvert) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*inverse) | 将矩阵inverse设置为矩阵的倒数,并返回结果。 | 450| bool [OH_Drawing_MatrixSetPolyToPoly](#oh_drawing_matrixsetpolytopoly) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*src, const [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*dst, uint32_t count) | 通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。 | 451| bool [OH_Drawing_MatrixIsEqual](#oh_drawing_matrixisequal) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*other) | 判断两个矩阵是否相等。 | 452| bool [OH_Drawing_MatrixIsIdentity](#oh_drawing_matrixisidentity) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 判断矩阵是否是单位矩阵。 | 453| void [OH_Drawing_MatrixDestroy](#oh_drawing_matrixdestroy) ([OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 用于销毁矩阵对象并回收该对象占有的内存。 | 454| [OH_Drawing_MemoryStream](#oh_drawing_memorystream) \* [OH_Drawing_MemoryStreamCreate](#oh_drawing_memorystreamcreate) (const void \*data, size_t length, bool copyData) | 创建一个内存流对象。 | 455| void [OH_Drawing_MemoryStreamDestroy](#oh_drawing_memorystreamdestroy) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*) | 销毁内存流对象并回收该对象占有内存。 | 456| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCreate](#oh_drawing_pathcreate) (void) | 用于创建一个路径对象。 | 457| [OH_Drawing_Path](#oh_drawing_path) \* [OH_Drawing_PathCopy](#oh_drawing_pathcopy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 | 458| void [OH_Drawing_PathDestroy](#oh_drawing_pathdestroy) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于销毁路径对象并回收该对象占有的内存。 | 459| void [OH_Drawing_PathMoveTo](#oh_drawing_pathmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置自定义路径的起始点位置。 | 460| void [OH_Drawing_PathLineTo](#oh_drawing_pathlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 | 461| void [OH_Drawing_PathArcTo](#oh_drawing_patharcto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数, 从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 | 462| void [OH_Drawing_PathQuadTo](#oh_drawing_pathquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 | 463| 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)。 | 464| void [OH_Drawing_PathCubicTo](#oh_drawing_pathcubicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 | 465| void [OH_Drawing_PathRMoveTo](#oh_drawing_pathrmoveto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 | 466| void [OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 | 467| void [OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX, float ctrlY, float endX, float endY) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 | 468| 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))到目标点位置的圆锥曲线,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。 | 469| void [OH_Drawing_PathRCubicTo](#oh_drawing_pathrcubicto) ([OH_Drawing_Path](#oh_drawing_path) \*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 | 470| void [OH_Drawing_PathAddRect](#oh_drawing_pathaddrect) ([OH_Drawing_Path](#oh_drawing_path) \*, float left, float top, float right, float bottom, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | 按指定方向,向路径添加矩形轮廓。 | 471| void [OH_Drawing_PathAddRectWithInitialCorner](#oh_drawing_pathaddrectwithinitialcorner) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_PathDirection](#oh_drawing_pathdirection), uint32_t start) | 按指定方向,向路径添加矩形轮廓。 | 472| void [OH_Drawing_PathAddRoundRect](#oh_drawing_pathaddroundrect) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*roundRect, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | 按指定方向,向路径添加圆角矩形轮廓。 | 473| void [OH_Drawing_PathAddOvalWithInitialPoint](#oh_drawing_pathaddovalwithinitialpoint) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, uint32_t start, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | 将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 | 474| void [OH_Drawing_PathAddArc](#oh_drawing_pathaddarc) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, float startAngle, float sweepAngle) | 将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫描角度添加弧,添加的弧是矩形内切椭圆的一部分,如果扫描角度<= -360°,或>= 360°,并且起始角度对90取模接近于0,则添加椭圆而不是弧。 | 475| void [OH_Drawing_PathAddPath](#oh_drawing_pathaddpath) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 将源路径矩阵变换后,添加到当前路径中。 | 476| void [OH_Drawing_PathAddPathWithMatrixAndMode](#oh_drawing_pathaddpathwithmatrixandmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | 将源路径矩阵变换后,以规定模式添加到当前路径中。 | 477| void [OH_Drawing_PathAddPathWithMode](#oh_drawing_pathaddpathwithmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | 将源路径以规定模式添加到当前路径中。 | 478| void [OH_Drawing_PathAddPathWithOffsetAndMode](#oh_drawing_pathaddpathwithoffsetandmode) ([OH_Drawing_Path](#oh_drawing_path) \*path, const [OH_Drawing_Path](#oh_drawing_path) \*src, float dx, float dy, [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)) | 将源路径偏移后,以规定模式添加到当前路径中。 | 479| void [OH_Drawing_PathAddOval](#oh_drawing_pathaddoval) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_PathDirection](#oh_drawing_pathdirection)) | 按指定方向,向路径添加椭圆。 | 480| bool [OH_Drawing_PathContains](#oh_drawing_pathcontains) ([OH_Drawing_Path](#oh_drawing_path) \*, float x, float y) | 判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1)。 | 481| void [OH_Drawing_PathTransform](#oh_drawing_pathtransform) ([OH_Drawing_Path](#oh_drawing_path) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 对路径进行矩阵变换。 | 482| void [OH_Drawing_PathTransformWithPerspectiveClip](#oh_drawing_pathtransformwithperspectiveclip) ([OH_Drawing_Path](#oh_drawing_path) \*src, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*, [OH_Drawing_Path](#oh_drawing_path) \*dst, bool applyPerspectiveClip) | 对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为NULL,则替换源路径。 | 483| void [OH_Drawing_PathSetFillType](#oh_drawing_pathsetfilltype) ([OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)) | 设置填充路径的规则。 | 484| float [OH_Drawing_PathGetLength](#oh_drawing_pathgetlength) ([OH_Drawing_Path](#oh_drawing_path) \*, bool forceClosed) | 获取当前路径的长度。 | 485| void [OH_Drawing_PathClose](#oh_drawing_pathclose) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 | 486| void [OH_Drawing_PathOffset](#oh_drawing_pathoffset) ([OH_Drawing_Path](#oh_drawing_path) \*path, [OH_Drawing_Path](#oh_drawing_path) \*dst, float dx, float dy) | 将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。 | 487| void [OH_Drawing_PathReset](#oh_drawing_pathreset) ([OH_Drawing_Path](#oh_drawing_path) \*) | 用于重置自定义路径数据。 | 488| [OH_Drawing_PathEffect](#oh_drawing_patheffect) \* [OH_Drawing_CreateDashPathEffect](#oh_drawing_createdashpatheffect) (float \*intervals, int count, float phase) | 创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 | 489| void [OH_Drawing_PathEffectDestroy](#oh_drawing_patheffectdestroy) ([OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 销毁路径效果对象并回收该对象占有内存。 | 490| [OH_Drawing_Pen](#oh_drawing_pen) \* [OH_Drawing_PenCreate](#oh_drawing_pencreate) (void) | 用于创建一个画笔对象。 | 491| void [OH_Drawing_PenDestroy](#oh_drawing_pendestroy) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于销毁画笔对象并回收该对象占有的内存。 | 492| bool [OH_Drawing_PenIsAntiAlias](#oh_drawing_penisantialias) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 493| void [OH_Drawing_PenSetAntiAlias](#oh_drawing_pensetantialias) ([OH_Drawing_Pen](#oh_drawing_pen) \*, bool) | 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 | 494| uint32_t [OH_Drawing_PenGetColor](#oh_drawing_pengetcolor) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | 495| void [OH_Drawing_PenSetColor](#oh_drawing_pensetcolor) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint32_t color) | 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 | 496| uint8_t [OH_Drawing_PenGetAlpha](#oh_drawing_pengetalpha) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 | 497| void [OH_Drawing_PenSetAlpha](#oh_drawing_pensetalpha) ([OH_Drawing_Pen](#oh_drawing_pen) \*, uint8_t alpha) | 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 | 498| float [OH_Drawing_PenGetWidth](#oh_drawing_pengetwidth) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 获取画笔的线宽,线宽描述了画笔绘制图形轮廓的宽度。 | 499| void [OH_Drawing_PenSetWidth](#oh_drawing_pensetwidth) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float width) | 设置画笔的线宽。0线宽被视作特殊的极细线宽,在绘制时始终会被绘制为1像素,不随画布的缩放而改变;负数线宽在实际绘制时会被视作0线宽。 | 500| float [OH_Drawing_PenGetMiterLimit](#oh_drawing_pengetmiterlimit) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | 501| void [OH_Drawing_PenSetMiterLimit](#oh_drawing_pensetmiterlimit) ([OH_Drawing_Pen](#oh_drawing_pen) \*, float miter) | 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 | 502| [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle) [OH_Drawing_PenGetCap](#oh_drawing_pengetcap) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔笔帽的样式。 | 503| void [OH_Drawing_PenSetCap](#oh_drawing_pensetcap) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineCapStyle](#oh_drawing_penlinecapstyle)) | 用于设置画笔笔帽样式。 | 504| [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle) [OH_Drawing_PenGetJoin](#oh_drawing_pengetjoin) (const [OH_Drawing_Pen](#oh_drawing_pen) \*) | 用于获取画笔绘制折线转角的样式。 | 505| void [OH_Drawing_PenSetJoin](#oh_drawing_pensetjoin) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PenLineJoinStyle](#oh_drawing_penlinejoinstyle)) | 用于设置画笔绘制转角的样式。 | 506| void [OH_Drawing_PenSetShaderEffect](#oh_drawing_pensetshadereffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 设置画笔着色器效果。 | 507| void [OH_Drawing_PenSetShadowLayer](#oh_drawing_pensetshadowlayer) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \*) | 设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 | 508| void [OH_Drawing_PenSetPathEffect](#oh_drawing_pensetpatheffect) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_PathEffect](#oh_drawing_patheffect) \*) | 设置画笔路径效果。 | 509| void [OH_Drawing_PenSetFilter](#oh_drawing_pensetfilter) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_Filter](#oh_drawing_filter) \*) | 设置画笔滤波器。 | 510| 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)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 | 511| void [OH_Drawing_PenSetBlendMode](#oh_drawing_pensetblendmode) ([OH_Drawing_Pen](#oh_drawing_pen) \*, [OH_Drawing_BlendMode](#oh_drawing_blendmode)) | 为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 | 512| void [OH_Drawing_PenReset](#oh_drawing_penreset) ([OH_Drawing_Pen](#oh_drawing_pen) \*) | 将画笔重置至初始值。 | 513| [OH_Drawing_Point](#oh_drawing_point) \* [OH_Drawing_PointCreate](#oh_drawing_pointcreate) (float x, float y) | 用于创建一个坐标点对象。 | 514| void [OH_Drawing_PointDestroy](#oh_drawing_pointdestroy) ([OH_Drawing_Point](#oh_drawing_point) \*) | 用于销毁坐标点对象并回收该对象占有的内存。 | 515| [OH_Drawing_Rect](#oh_drawing_rect) \* [OH_Drawing_RectCreate](#oh_drawing_rectcreate) (float left, float top, float right, float bottom) | 用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 | 516| float [OH_Drawing_RectGetHeight](#oh_drawing_rectgetheight) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 | 517| float [OH_Drawing_RectGetWidth](#oh_drawing_rectgetwidth) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 | 518| float [OH_Drawing_RectGetLeft](#oh_drawing_rectgetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的横坐标。 | 519| float [OH_Drawing_RectGetTop](#oh_drawing_rectgettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的左上角的纵坐标。 | 520| float [OH_Drawing_RectGetRight](#oh_drawing_rectgetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的横坐标。 | 521| float [OH_Drawing_RectGetBottom](#oh_drawing_rectgetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于获取给矩形设置的右下角的纵坐标。 | 522| bool [OH_Drawing_RectIntersect](#oh_drawing_rectintersect) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, const [OH_Drawing_Rect](#oh_drawing_rect) \*other) | 用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 | 523| void [OH_Drawing_RectSetLeft](#oh_drawing_rectsetleft) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float left) | 用于设置矩形左上角的横坐标。 | 524| void [OH_Drawing_RectSetTop](#oh_drawing_rectsettop) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float top) | 用于设置矩形左上角的纵坐标。 | 525| void [OH_Drawing_RectSetRight](#oh_drawing_rectsetright) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float right) | 用于设置矩形右下角的横坐标。 | 526| void [OH_Drawing_RectSetBottom](#oh_drawing_rectsetbottom) ([OH_Drawing_Rect](#oh_drawing_rect) \*rect, float bottom) | 用于设置矩形右下角的纵坐标。 | 527| void [OH_Drawing_RectCopy](#oh_drawing_rectcopy) ([OH_Drawing_Rect](#oh_drawing_rect) \*sRect, [OH_Drawing_Rect](#oh_drawing_rect) \*dRect) | 用于将源矩形对象复制到目标矩形对象。 | 528| void [OH_Drawing_RectDestroy](#oh_drawing_rectdestroy) ([OH_Drawing_Rect](#oh_drawing_rect) \*) | 用于销毁矩形对象并回收该对象占有的内存。 | 529| [OH_Drawing_Region](#oh_drawing_region) \* [OH_Drawing_RegionCreate](#oh_drawing_regioncreate) (void) | 用于创建一个区域对象,实现更精确的图形控制。 | 530| bool [OH_Drawing_RegionSetRect](#oh_drawing_regionsetrect) ([OH_Drawing_Region](#oh_drawing_region) \*region, const [OH_Drawing_Rect](#oh_drawing_rect) \*rect) | 用于尝试给区域对象设置矩形边界。 | 531| void [OH_Drawing_RegionDestroy](#oh_drawing_regiondestroy) ([OH_Drawing_Region](#oh_drawing_region) \*) | 用于销毁区域对象并回收该对象占有的内存。 | 532| uint32_t [OH_Drawing_RegisterFont](#oh_drawing_registerfont) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, const char \*familySrc) | 用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 | 533| uint32_t [OH_Drawing_RegisterFontBuffer](#oh_drawing_registerfontbuffer) ([OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*, const char \*fontFamily, uint8_t \*fontBuffer, size_t length) | 用于在字体管理器中注册字体缓冲区。 | 534| [OH_Drawing_RoundRect](#oh_drawing_roundrect) \* [OH_Drawing_RoundRectCreate](#oh_drawing_roundrectcreate) (const [OH_Drawing_Rect](#oh_drawing_rect) \*, float xRad, float yRad) | 用于创建一个圆角矩形对象。 | 535| void [OH_Drawing_RoundRectSetCorner](#oh_drawing_roundrectsetcorner) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CornerPos](#oh_drawing_cornerpos) pos, [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii)) | 用于设置圆角矩形中指定圆角位置的圆角半径。 | 536| [OH_Drawing_Corner_Radii](#oh_drawing_corner_radii) [OH_Drawing_RoundRectGetCorner](#oh_drawing_roundrectgetcorner) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CornerPos](#oh_drawing_cornerpos) pos) | 用于获取圆角矩形中指定圆角位置的圆角半径。 | 537| void [OH_Drawing_RoundRectDestroy](#oh_drawing_roundrectdestroy) ([OH_Drawing_RoundRect](#oh_drawing_roundrect) \*) | 用于销毁圆角矩形对象并回收该对象占有的内存。 | 538| [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \* [OH_Drawing_SamplingOptionsCreate](#oh_drawing_samplingoptionscreate) ([OH_Drawing_FilterMode](#oh_drawing_filtermode), [OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)) | 创建一个采样选项对象。 | 539| void [OH_Drawing_SamplingOptionsDestroy](#oh_drawing_samplingoptionsdestroy) ([OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*) | 销毁采样选项对象并回收该对象占有内存。 | 540| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateLinearGradient](#oh_drawing_shadereffectcreatelineargradient) (const [OH_Drawing_Point](#oh_drawing_point) \*startPt, const [OH_Drawing_Point](#oh_drawing_point) \*endPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | 创建着色器,在两个指定点之间生成线性渐变。 | 541| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateRadialGradient](#oh_drawing_shadereffectcreateradialgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, float radius, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | 创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 | 542| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateSweepGradient](#oh_drawing_shadereffectcreatesweepgradient) (const [OH_Drawing_Point](#oh_drawing_point) \*centerPt, const uint32_t \*colors, const float \*pos, uint32_t size, [OH_Drawing_TileMode](#oh_drawing_tilemode)) | 创建着色器,在给定中心的情况下生成扇形渐变。 | 543| [OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \* [OH_Drawing_ShaderEffectCreateImageShader](#oh_drawing_shadereffectcreateimageshader) ([OH_Drawing_Image](#oh_drawing_image) \*, [OH_Drawing_TileMode](#oh_drawing_tilemode) tileX, [OH_Drawing_TileMode](#oh_drawing_tilemode) tileY, const [OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions) \*, const [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 | 544| void [OH_Drawing_ShaderEffectDestroy](#oh_drawing_shadereffectdestroy) ([OH_Drawing_ShaderEffect](#oh_drawing_shadereffect) \*) | 销毁着色器对象,并收回该对象占用的内存。 | 545| [OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer) \* [OH_Drawing_ShadowLayerCreate](#oh_drawing_shadowlayercreate) (float blurRadius, float x, float y, uint32_t color) | 创建一个阴影层对象。 | 546| void [OH_Drawing_ShadowLayerDestroy](#oh_drawing_shadowlayerdestroy) ([OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)\*) | 销毁阴影层对象,并收回该对象占用的内存。 | 547| [OH_Drawing_Surface](#oh_drawing_surface) \* [OH_Drawing_SurfaceCreateFromGpuContext](#oh_drawing_surfacecreatefromgpucontext) ([OH_Drawing_GpuContext](#oh_drawing_gpucontext) \*, bool budgeted, [OH_Drawing_Image_Info](_o_h___drawing___image___info.md)) | 使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。 | 548| [OH_Drawing_Canvas](#oh_drawing_canvas) \* [OH_Drawing_SurfaceGetCanvas](#oh_drawing_surfacegetcanvas) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 通过surface对象获取画布对象。 | 549| void [OH_Drawing_SurfaceDestroy](#oh_drawing_surfacedestroy) ([OH_Drawing_Surface](#oh_drawing_surface) \*) | 销毁surface对象并回收该对象占用的内存。 | 550| [OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \* [OH_Drawing_TextBlobBuilderCreate](#oh_drawing_textblobbuildercreate) (void) | 用于创建一个文本构造器对象。 | 551| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromText](#oh_drawing_textblobcreatefromtext) (const void \*text, size_t byteLength, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | 使用文本创建一个文本对象。 | 552| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromPosText](#oh_drawing_textblobcreatefrompostext) (const void \*text, size_t byteLength, [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) \*, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | 使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。 | 553| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobCreateFromString](#oh_drawing_textblobcreatefromstring) (const char \*str, const [OH_Drawing_Font](#oh_drawing_font) \*, [OH_Drawing_TextEncoding](#oh_drawing_textencoding)) | 使用字符串创建文本对象。 | 554| void [OH_Drawing_TextBlobGetBounds](#oh_drawing_textblobgetbounds) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取文本对象的边界范围。 | 555| uint32_t [OH_Drawing_TextBlobUniqueID](#oh_drawing_textblobuniqueid) (const [OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 获取文本的标识符,该标识符是唯一的非零值。 | 556| const [OH_Drawing_RunBuffer](_o_h___drawing___run_buffer.md) \* [OH_Drawing_TextBlobBuilderAllocRunPos](#oh_drawing_textblobbuilderallocrunpos) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*, const [OH_Drawing_Font](#oh_drawing_font) \*, int32_t count, const [OH_Drawing_Rect](#oh_drawing_rect) \*) | 申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。 | 557| [OH_Drawing_TextBlob](#oh_drawing_textblob) \* [OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于从文本构造器中创建文本对象。 | 558| void [OH_Drawing_TextBlobDestroy](#oh_drawing_textblobdestroy) ([OH_Drawing_TextBlob](#oh_drawing_textblob) \*) | 用于销毁文本对象并回收该对象占有的内存。 | 559| void [OH_Drawing_TextBlobBuilderDestroy](#oh_drawing_textblobbuilderdestroy) ([OH_Drawing_TextBlobBuilder](#oh_drawing_textblobbuilder) \*) | 用于销毁文本构造器对象并回收该对象占有的内存。 | 560| [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \* [OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle) (void) | 创建指向OH_Drawing_TypographyStyle对象的指针。 | 561| void [OH_Drawing_DestroyTypographyStyle](#oh_drawing_destroytypographystyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 释放被OH_Drawing_TypographyStyle对象占据的内存。 | 562| void [OH_Drawing_SetTypographyTextDirection](#oh_drawing_settypographytextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本方向。 | 563| void [OH_Drawing_SetTypographyTextAlign](#oh_drawing_settypographytextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本对齐方式。 | 564| int [OH_Drawing_TypographyGetEffectiveAlignment](#oh_drawing_typographygeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文字对齐方式。 | 565| void [OH_Drawing_SetTypographyTextMaxLines](#oh_drawing_settypographytextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本最大行数。 | 566| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle) (void) | 创建指向OH_Drawing_TextStyle对象的指针。 | 567| [OH_Drawing_TextStyle](#oh_drawing_textstyle) \* [OH_Drawing_TypographyGetTextStyle](#oh_drawing_typographygettextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取字体风格。 | 568| void [OH_Drawing_DestroyTextStyle](#oh_drawing_destroytextstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 释放被OH_Drawing_TextStyle对象占据的内存。 | 569| void [OH_Drawing_SetTextStyleColor](#oh_drawing_settextstylecolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置文本颜色。 | 570| void [OH_Drawing_SetTextStyleFontSize](#oh_drawing_settextstylefontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置字号。 | 571| void [OH_Drawing_SetTextStyleFontWeight](#oh_drawing_settextstylefontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字重。 | 572| void [OH_Drawing_SetTextStyleBaseLine](#oh_drawing_settextstylebaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体基线位置。 | 573| void [OH_Drawing_SetTextStyleDecoration](#oh_drawing_settextstyledecoration) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置装饰。 | 574| void [OH_Drawing_SetTextStyleDecorationColor](#oh_drawing_settextstyledecorationcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, uint32_t) | 设置装饰颜色。 | 575| void [OH_Drawing_SetTextStyleFontHeight](#oh_drawing_settextstylefontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置行高,按当前字体大小的倍数进行设置。 | 576| void [OH_Drawing_SetTextStyleFontFamilies](#oh_drawing_settextstylefontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int, const char \*fontFamilies[]) | 设置字体类型。 | 577| void [OH_Drawing_SetTextStyleFontStyle](#oh_drawing_settextstylefontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置字体风格。 | 578| void [OH_Drawing_SetTextStyleLocale](#oh_drawing_settextstylelocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本语言类型。 | 579| void [OH_Drawing_SetTextStyleForegroundBrush](#oh_drawing_settextstyleforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置前景色画刷。 | 580| void [OH_Drawing_TextStyleGetForegroundBrush](#oh_drawing_textstylegetforegroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的前景色画刷。 | 581| void [OH_Drawing_SetTextStyleForegroundPen](#oh_drawing_settextstyleforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置前景色画笔。 | 582| void [OH_Drawing_TextStyleGetForegroundPen](#oh_drawing_textstylegetforegroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的前景色画笔。 | 583| void [OH_Drawing_SetTextStyleBackgroundBrush](#oh_drawing_settextstylebackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 设置背景色画刷。 | 584| void [OH_Drawing_TextStyleGetBackgroundBrush](#oh_drawing_textstylegetbackgroundbrush) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Brush](#oh_drawing_brush) \*) | 返回设置的背景色画刷。 | 585| void [OH_Drawing_SetTextStyleBackgroundPen](#oh_drawing_settextstylebackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 设置背景色画笔。 | 586| void [OH_Drawing_TextStyleGetBackgroundPen](#oh_drawing_textstylegetbackgroundpen) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Pen](#oh_drawing_pen) \*) | 返回设置的背景色画笔。 | 587| [OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \* [OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_FontCollection](#oh_drawing_fontcollection) \*) | 创建指向OH_Drawing_TypographyCreate对象的指针。 | 588| void [OH_Drawing_DestroyTypographyHandler](#oh_drawing_destroytypographyhandler) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 释放被OH_Drawing_TypographyCreate对象占据的内存。 | 589| void [OH_Drawing_TypographyHandlerPushTextStyle](#oh_drawing_typographyhandlerpushtextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置排版风格。 | 590| void [OH_Drawing_TypographyHandlerAddText](#oh_drawing_typographyhandleraddtext) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, const char \*) | 设置文本内容。 | 591| void [OH_Drawing_TypographyHandlerPopTextStyle](#oh_drawing_typographyhandlerpoptextstyle) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 排版弹出。 | 592| [OH_Drawing_Typography](#oh_drawing_typography) \* [OH_Drawing_CreateTypography](#oh_drawing_createtypography) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*) | 创建指向OH_Drawing_Typography对象的指针。 | 593| void [OH_Drawing_DestroyTypography](#oh_drawing_destroytypography) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 释放OH_Drawing_Typography对象占据的内存。 | 594| void [OH_Drawing_TypographyLayout](#oh_drawing_typographylayout) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double) | 排版布局。 | 595| void [OH_Drawing_TypographyPaint](#oh_drawing_typographypaint) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_Canvas](#oh_drawing_canvas) \*, 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_TypographyGetMinIntrinsicWidth](#oh_drawing_typographygetminintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最小固有宽度。 | 600| double [OH_Drawing_TypographyGetMaxIntrinsicWidth](#oh_drawing_typographygetmaxintrinsicwidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取最大固有宽度。 | 601| double [OH_Drawing_TypographyGetAlphabeticBaseline](#oh_drawing_typographygetalphabeticbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取字母文字基线。 | 602| double [OH_Drawing_TypographyGetIdeographicBaseline](#oh_drawing_typographygetideographicbaseline) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取表意文字基线。 | 603| void [OH_Drawing_TypographyHandlerAddPlaceholder](#oh_drawing_typographyhandleraddplaceholder) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) \*) | 设置占位符。 | 604| bool [OH_Drawing_TypographyDidExceedMaxLines](#oh_drawing_typographydidexceedmaxlines) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本是否超过最大行。 | 605| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t, size_t, [OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle), [OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)) | 获取指定范围内的文本框。 | 606| [OH_Drawing_TextBox](#oh_drawing_textbox) \* [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取占位符的文本框。 | 607| float [OH_Drawing_GetLeftFromTextBox](#oh_drawing_getleftfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框左侧位置。 | 608| float [OH_Drawing_GetRightFromTextBox](#oh_drawing_getrightfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框右侧位置。 | 609| float [OH_Drawing_GetTopFromTextBox](#oh_drawing_gettopfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框顶部位置。 | 610| float [OH_Drawing_GetBottomFromTextBox](#oh_drawing_getbottomfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框底部位置。 | 611| int [OH_Drawing_GetTextDirectionFromTextBox](#oh_drawing_gettextdirectionfromtextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*, int) | 获取文本框方向。 | 612| size_t [OH_Drawing_GetSizeOfTextBox](#oh_drawing_getsizeoftextbox) ([OH_Drawing_TextBox](#oh_drawing_textbox) \*) | 获取文本框数量大小。 | 613| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本的索引位置和亲和性。 | 614| [OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \* [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster) ([OH_Drawing_Typography](#oh_drawing_typography) \*, double, double) | 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 | 615| size_t [OH_Drawing_GetPositionFromPositionAndAffinity](#oh_drawing_getpositionfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的位置属性。 | 616| int [OH_Drawing_GetAffinityFromPositionAndAffinity](#oh_drawing_getaffinityfrompositionandaffinity) ([OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity) \*) | 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 | 617| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t) | 获取单词的边界。 | 618| size_t [OH_Drawing_GetStartFromRange](#oh_drawing_getstartfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象开始位置。 | 619| size_t [OH_Drawing_GetEndFromRange](#oh_drawing_getendfromrange) ([OH_Drawing_Range](#oh_drawing_range) \*) | 获取OH_Drawing_Range对象结束位置。 | 620| size_t [OH_Drawing_TypographyGetLineCount](#oh_drawing_typographygetlinecount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本行数。 | 621| void [OH_Drawing_SetTextStyleDecorationStyle](#oh_drawing_settextstyledecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本装饰样式。 | 622| void [OH_Drawing_SetTextStyleDecorationThicknessScale](#oh_drawing_settextstyledecorationthicknessscale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本装饰线的厚度缩放比例。 | 623| void [OH_Drawing_SetTextStyleLetterSpacing](#oh_drawing_settextstyleletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的字符间距。 | 624| void [OH_Drawing_SetTextStyleWordSpacing](#oh_drawing_settextstylewordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double) | 设置文本的单词间距。 | 625| void [OH_Drawing_SetTextStyleHalfLeading](#oh_drawing_settextstylehalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, bool) | 设置文本为一半行间距。 | 626| void [OH_Drawing_SetTextStyleEllipsis](#oh_drawing_settextstyleellipsis) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*) | 设置文本的省略号内容。 | 627| void [OH_Drawing_SetTextStyleEllipsisModal](#oh_drawing_settextstyleellipsismodal) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 设置文本的省略号样式。 | 628| void [OH_Drawing_SetTypographyTextBreakStrategy](#oh_drawing_settypographytextbreakstrategy) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的中断策略。 | 629| void [OH_Drawing_SetTypographyTextWordBreakType](#oh_drawing_settypographytextwordbreaktype) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置单词的断词方式。 | 630| void [OH_Drawing_SetTypographyTextEllipsisModal](#oh_drawing_settypographytextellipsismodal) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本的省略号样式。 | 631| void [OH_Drawing_SetTypographyTextEllipsis](#oh_drawing_settypographytextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*ellipsis) | 设置省略号样式。 | 632| double [OH_Drawing_TypographyGetLineHeight](#oh_drawing_typographygetlineheight) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行高 | 633| double [OH_Drawing_TypographyGetLineWidth](#oh_drawing_typographygetlinewidth) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 获取指定行的行宽。 | 634| void [OH_Drawing_SetTypographyTextSplitRatio](#oh_drawing_settypographytextsplitratio) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, float textSplitRatio) | 设置文本划分比率。 | 635| bool [OH_Drawing_TypographyIsLineUnlimited](#oh_drawing_typographyislineunlimited) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有最大行数限制。 | 636| bool [OH_Drawing_TypographyIsEllipsized](#oh_drawing_typographyisellipsized) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否有省略号。 | 637| void [OH_Drawing_SetTypographyTextLocale](#oh_drawing_settypographytextlocale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, const char \*locale) |设置段落语言类型。 | 638| bool [OH_Drawing_TextStyleGetFontMetrics](#oh_drawing_textstylegetfontmetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 获取文本字体属性。 | 639| void [OH_Drawing_SetTypographyTextStyle](#oh_drawing_settypographytextstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 设置段落样式。 | 640| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor) (void) | 构造字体描述对象,用于描述系统字体详细信息。 | 641| void [OH_Drawing_DestroyFontDescriptor](#oh_drawing_destroyfontdescriptor) ([OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \*) | 释放字体描述对象占用的内存。 | 642| [OH_Drawing_FontParser](#oh_drawing_fontparser) \* [OH_Drawing_CreateFontParser](#oh_drawing_createfontparser) (void) | 构造字体解析对象,用于解析系统字体。 | 643| void [OH_Drawing_DestroyFontParser](#oh_drawing_destroyfontparser) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*) | 释放字体解析对象占用的内存。 | 644| char \*\* [OH_Drawing_FontParserGetSystemFontList](#oh_drawing_fontparsergetsystemfontlist) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, size_t \*) | 获取系统字体名称列表,此接口仅在2in1设备上可用。 | 645| void [OH_Drawing_DestroySystemFontList](#oh_drawing_destroysystemfontlist) (char \*\*, size_t) | 释放系统字体名称列表占用的内存。 | 646| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) \* [OH_Drawing_FontParserGetFontByName](#oh_drawing_fontparsergetfontbyname) ([OH_Drawing_FontParser](#oh_drawing_fontparser) \*, const char \*) | 根据传入的系统字体名称获取系统字体的相关信息。 | 647| [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \* [OH_Drawing_TypographyGetLineMetrics](#oh_drawing_typographygetlinemetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取行位置信息。 | 648| size_t [OH_Drawing_LineMetricsGetSize](#oh_drawing_linemetricsgetsize) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取行数量。 | 649| void [OH_Drawing_DestroyLineMetrics](#oh_drawing_destroylinemetrics) ([OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 释放行位置信息对象占用的内存。 | 650| bool [OH_Drawing_TypographyGetLineMetricsAt](#oh_drawing_typographygetlinemetricsat) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取指定行位置信息对象。 | 651| bool [OH_Drawing_TypographyGetLineInfo](#oh_drawing_typographygetlineinfo) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool, bool, [OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md) \*) | 获取指定行的位置信息或指定行第一个字符的位置信息。 | 652| void [OH_Drawing_SetTypographyTextFontWeight](#oh_drawing_settypographytextfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版字重。 | 653| void [OH_Drawing_SetTypographyTextFontStyle](#oh_drawing_settypographytextfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置字体风格。 | 654| void [OH_Drawing_SetTypographyTextFontFamily](#oh_drawing_settypographytextfontfamily) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, const char \*) | 设置字体家族的名称。 | 655| void [OH_Drawing_SetTypographyTextFontSize](#oh_drawing_settypographytextfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字号。 | 656| void [OH_Drawing_SetTypographyTextFontHeight](#oh_drawing_settypographytextfontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版字体高度。 | 657| void [OH_Drawing_SetTypographyTextHalfLeading](#oh_drawing_settypographytexthalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否为一半行间距。 | 658| void [OH_Drawing_SetTypographyTextUseLineStyle](#oh_drawing_settypographytextuselinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否启用行样式。 | 659| void [OH_Drawing_SetTypographyTextLineStyleFontWeight](#oh_drawing_settypographytextlinestylefontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式字重。 | 660| void [OH_Drawing_SetTypographyTextLineStyleFontStyle](#oh_drawing_settypographytextlinestylefontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int) | 设置文本排版行样式风格。 | 661| void [OH_Drawing_SetTypographyTextLineStyleFontFamilies](#oh_drawing_settypographytextlinestylefontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, int, const char \*fontFamilies[]) | 设置文本排版行样式字体类型。 | 662| void [OH_Drawing_SetTypographyTextLineStyleFontSize](#oh_drawing_settypographytextlinestylefontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字号。 | 663| void [OH_Drawing_SetTypographyTextLineStyleFontHeight](#oh_drawing_settypographytextlinestylefontheight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式字体高度。 | 664| void [OH_Drawing_SetTypographyTextLineStyleHalfLeading](#oh_drawing_settypographytextlinestylehalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版行样式是否为一半行间距。 | 665| void [OH_Drawing_SetTypographyTextLineStyleSpacingScale](#oh_drawing_settypographytextlinestylespacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, double) | 设置文本排版行样式间距比例。 | 666| void [OH_Drawing_SetTypographyTextLineStyleOnly](#oh_drawing_settypographytextlinestyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, bool) | 设置文本排版是否仅启用行样式。 | 667| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow) (void) | 创建指向字体阴影对象的指针。 | 668| void [OH_Drawing_DestroyTextShadow](#oh_drawing_destroytextshadow) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放被字体阴影对象占据的内存。 | 669| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadows](#oh_drawing_textstylegetshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器。 | 670| int [OH_Drawing_TextStyleGetShadowCount](#oh_drawing_textstylegetshadowcount) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体阴影容器的大小。 | 671| void [OH_Drawing_TextStyleAddShadow](#oh_drawing_textstyleaddshadow) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 字体阴影容器中添加字体阴影元素。 | 672| void [OH_Drawing_TextStyleClearShadows](#oh_drawing_textstyleclearshadows) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体阴影容器中的所有元素。 | 673| [OH_Drawing_TextShadow](#oh_drawing_textshadow) \* [OH_Drawing_TextStyleGetShadowWithIndex](#oh_drawing_textstylegetshadowwithindex) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, int) | 根据下标获取字体阴影容器中的元素。 | 674| void [OH_Drawing_TypographySetIndents](#oh_drawing_typographysetindents) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, const float indents[]) | 设置文本的排版缩进,不调用此接口默认文本无缩进。 | 675| float [OH_Drawing_TypographyGetIndentsWithIndex](#oh_drawing_typographygetindentswithindex) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int) | 根据下标获取排版缩进容器中的元素。 | 676| [OH_Drawing_Range](#oh_drawing_range) \* [OH_Drawing_TypographyGetLineTextRange](#oh_drawing_typographygetlinetextrange) ([OH_Drawing_Typography](#oh_drawing_typography) \*, int, bool) | 获取行的边界。 | 677| void [OH_Drawing_DestroyTextShadows](#oh_drawing_destroytextshadows) ([OH_Drawing_TextShadow](#oh_drawing_textshadow) \*) | 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 | 678| [OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \* [OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo) ([OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode) \*) | 获取系统字体配置信息。 | 679| void [OH_Drawing_DestroySystemFontConfigInfo](#oh_drawing_destroysystemfontconfiginfo) ([OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md) \*) | 释放系统字体配置信息占用的的内存。 | 680| void [OH_Drawing_SetTextStyleFontStyleStruct](#oh_drawing_settextstylefontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyle) | 设置字体样式,包括字体字重、字体宽度和字体斜度。 | 681| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TextStyleGetFontStyleStruct](#oh_drawing_textstylegetfontstylestruct) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*drawingTextStyle) | 获取字体样式,包括字体字重、字体宽度和字体斜度。 | 682| void [OH_Drawing_SetTypographyStyleFontStyleStruct](#oh_drawing_settypographystylefontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle, [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) fontStyle) | 设置文本字体样式,包括字体字重、字体宽度和字体斜度。 | 683| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) [OH_Drawing_TypographyStyleGetFontStyleStruct](#oh_drawing_typographystylegetfontstylestruct) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*drawingStyle) | 获取文本字体样式,包括字体字重、字体宽度和字体斜度。 | 684| void [OH_Drawing_TextStyleSetBackgroundRect](#oh_drawing_textstylesetbackgroundrect) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) \*, int styleId) | 设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。 | 685| void [OH_Drawing_TypographyHandlerAddSymbol](#oh_drawing_typographyhandleraddsymbol) ([OH_Drawing_TypographyCreate](#oh_drawing_typographycreate) \*, uint32_t symbol) | 设置排版创建过程中的符号。 | 686| void [OH_Drawing_TextStyleAddFontFeature](#oh_drawing_textstyleaddfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*tag, int value) | 添加文本字体特征。 | 687| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \* [OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器中的所有内容。 | 688| void [OH_Drawing_TextStyleDestroyFontFeatures](#oh_drawing_textstyledestroyfontfeatures) ([OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) \*, size_t fontFeatureSize) | 释放存放字体特征所有内容的结构体数组所占用的空间。 | 689| size_t [OH_Drawing_TextStyleGetFontFeatureSize](#oh_drawing_textstylegetfontfeaturesize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体特征map容器的大小。 | 690| void [OH_Drawing_TextStyleClearFontFeature](#oh_drawing_textstyleclearfontfeature) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 清除字体特征map容器中的所有内容。 | 691| void [OH_Drawing_TextStyleAddFontVariation](#oh_drawing_textstyleaddfontvariation) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, const char \*axis, int value) | 添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 | 692| double [OH_Drawing_TextStyleGetBaselineShift](#oh_drawing_textstylegetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的基线漂移。 | 693| void [OH_Drawing_TextStyleSetBaselineShift](#oh_drawing_textstylesetbaselineshift) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, double lineShift) | 设置文本的基线漂移。 | 694| void [OH_Drawing_TypographyTextSetHeightBehavior](#oh_drawing_typographytextsetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) heightMode) | 设置文本高度修饰符模式。 | 695| [OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior) [OH_Drawing_TypographyTextGetHeightBehavior](#oh_drawing_typographytextgetheightbehavior) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本高度修饰符模式。 | 696| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \* [OH_Drawing_TypographyGetLineFontMetrics](#oh_drawing_typographygetlinefontmetrics) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t lineNumber, size_t \*fontMetricsSize) | 从目标行获取所有字体指标。 | 697| void [OH_Drawing_TypographyDestroyLineFontMetrics](#oh_drawing_typographydestroylinefontmetrics) ([OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) \*) | 释放指定行所有字体度量结构体集合所占用的所有空间。 | 698| bool [OH_Drawing_TextStyleIsEqual](#oh_drawing_textstyleisequal) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象是否相等。 | 699| bool [OH_Drawing_TextStyleIsEqualByFont](#oh_drawing_textstyleisequalbyfont) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle) | 判断两个字体风格对象的字体样式属性是否相等。 | 700| bool [OH_Drawing_TextStyleIsAttributeMatched](#oh_drawing_textstyleisattributematched) (const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style, const [OH_Drawing_TextStyle](#oh_drawing_textstyle) \*comparedStyle, [OH_Drawing_TextStyleType](#oh_drawing_textstyletype) textStyleType) | 判断两个字体风格对象是否有一样的文本样式类型。 | 701| void [OH_Drawing_TextStyleSetPlaceholder](#oh_drawing_textstylesetplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 设置占位符。 | 702| bool [OH_Drawing_TextStyleIsPlaceholder](#oh_drawing_textstyleisplaceholder) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*style) | 返回是否有设置文本占位符。 | 703| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyStyleGetEffectiveAlignment](#oh_drawing_typographystylegeteffectivealignment) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本对齐模式。 | 704| bool [OH_Drawing_TypographyStyleIsHintEnabled](#oh_drawing_typographystyleishintenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style) | 获取文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 | 705| void [OH_Drawing_SetTypographyStyleTextStrutStyle](#oh_drawing_settypographystyletextstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 设置文本支柱样式。 | 706| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \* [OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本支柱样式。 | 707| void [OH_Drawing_TypographyStyleDestroyStrutStyle](#oh_drawing_typographystyledestroystrutstyle) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*) | 释放被支柱样式对象占据的内存。 | 708| bool [OH_Drawing_TypographyStyleStrutStyleEquals](#oh_drawing_typographystylestrutstyleequals) ([OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*from, [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) \*to) | 判断支柱样式结构体是否相同。 | 709| void [OH_Drawing_TypographyStyleSetHintsEnabled](#oh_drawing_typographystylesethintsenabled) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*style, bool hintsEnabled) | 设置文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 | 710| void [OH_Drawing_TypographyMarkDirty](#oh_drawing_typographymarkdirty) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 将排版标记为脏数据,用于初始化排版状态。 | 711| int32_t [OH_Drawing_TypographyGetUnresolvedGlyphsCount](#oh_drawing_typographygetunresolvedglyphscount) ([OH_Drawing_Typography](#oh_drawing_typography) \*) | 获取文本中尚未解析的字形的数量。 | 712| void [OH_Drawing_TypographyUpdateFontSize](#oh_drawing_typographyupdatefontsize) ([OH_Drawing_Typography](#oh_drawing_typography) \*, size_t from, size_t to, float fontSize) | 更新文本中的字体大小。 | 713| bool [OH_Drawing_TypographyTextGetLineStyle](#oh_drawing_typographytextgetlinestyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否启用行样式。 | 714| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TypographyTextlineStyleGetFontWeight](#oh_drawing_typographytextlinestylegetfontweight) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字重。 | 715| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TypographyTextlineStyleGetFontStyle](#oh_drawing_typographytextlinestylegetfontstyle) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式风格。 | 716| char \*\* [OH_Drawing_TypographyTextlineStyleGetFontFamilies](#oh_drawing_typographytextlinestylegetfontfamilies) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字体家族名。 | 717| void [OH_Drawing_TypographyTextlineStyleDestroyFontFamilies](#oh_drawing_typographytextlinestyledestroyfontfamilies) (char \*\*fontFamilies, size_t fontFamiliesNum) | 释放字体类型占用的内存。 | 718| double [OH_Drawing_TypographyTextlineStyleGetFontSize](#oh_drawing_typographytextlinestylegetfontsize) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式字号。 | 719| double [OH_Drawing_TypographyTextlineStyleGetHeightScale](#oh_drawing_typographytextlinestylegetheightscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版中字体高度规模。 | 720| bool [OH_Drawing_TypographyTextlineStyleGetHeightOnly](#oh_drawing_typographytextlinestylegetheightonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取字体渲染过程中计算字体块高度相关参数的方法。 | 721| bool [OH_Drawing_TypographyTextlineStyleGetHalfLeading](#oh_drawing_typographytextlinestylegethalfleading) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式是否为一半行间距。 | 722| double [OH_Drawing_TypographyTextlineStyleGetSpacingScale](#oh_drawing_typographytextlinestylegetspacingscale) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版行样式间距比例。 | 723| bool [OH_Drawing_TypographyTextlineGetStyleOnly](#oh_drawing_typographytextlinegetstyleonly) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本排版是否仅启用行样式。 | 724| [OH_Drawing_TextAlign](#oh_drawing_textalign) [OH_Drawing_TypographyGetTextAlign](#oh_drawing_typographygettextalign) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本对齐方式。 | 725| [OH_Drawing_TextDirection](#oh_drawing_textdirection) [OH_Drawing_TypographyGetTextDirection](#oh_drawing_typographygettextdirection) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本方向。 | 726| size_t [OH_Drawing_TypographyGetTextMaxLines](#oh_drawing_typographygettextmaxlines) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取文本的最大行数。 | 727| char \* [OH_Drawing_TypographyGetTextEllipsis](#oh_drawing_typographygettextellipsis) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*) | 获取设置的省略号内容。 | 728| void [OH_Drawing_TypographyDestroyEllipsis](#oh_drawing_typographydestroyellipsis) (char \*ellipsis) | 释放省略号名称列表占用的内存。 | 729| bool [OH_Drawing_TypographyStyleEquals](#oh_drawing_typographystyleequals) ([OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*from, [OH_Drawing_TypographyStyle](#oh_drawing_typographystyle) \*to) | 判断排版样式是否相同。 | 730| uint32_t [OH_Drawing_TextStyleGetColor](#oh_drawing_textstylegetcolor) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本颜色。 | 731| [OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle) [OH_Drawing_TextStyleGetDecorationStyle](#oh_drawing_textstylegetdecorationstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本装饰样式。 | 732| [OH_Drawing_FontWeight](#oh_drawing_fontweight) [OH_Drawing_TextStyleGetFontWeight](#oh_drawing_textstylegetfontweight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字重。 | 733| [OH_Drawing_FontStyle](#oh_drawing_fontstyle) [OH_Drawing_TextStyleGetFontStyle](#oh_drawing_textstylegetfontstyle) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体风格。 | 734| [OH_Drawing_TextBaseline](#oh_drawing_textbaseline) [OH_Drawing_TextStyleGetBaseline](#oh_drawing_textstylegetbaseline) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体基线位置。 | 735| char \*\* [OH_Drawing_TextStyleGetFontFamilies](#oh_drawing_textstylegetfontfamilies) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*, size_t \*num) | 获取字体类型名称列表。 | 736| void [OH_Drawing_TextStyleDestroyFontFamilies](#oh_drawing_textstyledestroyfontfamilies) (char \*\*fontFamilies, size_t num) | 释放字体类型名称列表占用的内存。 | 737| double [OH_Drawing_TextStyleGetFontSize](#oh_drawing_textstylegetfontsize) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字号。 | 738| double [OH_Drawing_TextStyleGetLetterSpacing](#oh_drawing_textstylegetletterspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的字符间距。 | 739| double [OH_Drawing_TextStyleGetWordSpacing](#oh_drawing_textstylegetwordspacing) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本的单词间距。 | 740| double [OH_Drawing_TextStyleGetFontHeight](#oh_drawing_textstylegetfontheight) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取字体高度。 | 741| bool [OH_Drawing_TextStyleGetHalfLeading](#oh_drawing_textstylegethalfleading) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取当前文档是否设置为一半行间距。 | 742| const char \* [OH_Drawing_TextStyleGetLocale](#oh_drawing_textstylegetlocale) ([OH_Drawing_TextStyle](#oh_drawing_textstyle) \*) | 获取文本语言类型。 | 743| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateDefault](#oh_drawing_typefacecreatedefault) (void) | 用于创建一个默认的字形对象。 | 744| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile) (const char \*path, int index) | 通过文件创建一个字形对象。 | 745| [OH_Drawing_Typeface](#oh_drawing_typeface) \* [OH_Drawing_TypefaceCreateFromStream](#oh_drawing_typefacecreatefromstream) ([OH_Drawing_MemoryStream](#oh_drawing_memorystream) \*, int32_t index) | 通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 | 746| void [OH_Drawing_TypefaceDestroy](#oh_drawing_typefacedestroy) ([OH_Drawing_Typeface](#oh_drawing_typeface) \*) | 用于销毁字形对象并回收该对象占有的内存。 | 747| void [OH_Drawing_CanvasClipRect](#oh_drawing_canvascliprect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Rect](#oh_drawing_rect) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | 用于裁剪一个矩形。 | 748| void [OH_Drawing_CanvasClipRoundRect](#oh_drawing_canvascliproundrect) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_RoundRect](#oh_drawing_roundrect) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | 用于裁剪一个圆角矩形。 | 749| void [OH_Drawing_CanvasClipPath](#oh_drawing_canvasclippath) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, const [OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop) clipOp, bool doAntiAlias) | 用于裁剪一个自定义路径。 | 750| void [OH_Drawing_CanvasRotate](#oh_drawing_canvasrotate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float degrees, float px, float py) | 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 | 751| void [OH_Drawing_CanvasTranslate](#oh_drawing_canvastranslate) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float dx, float dy) | 用于平移画布一段距离。 | 752| void [OH_Drawing_CanvasScale](#oh_drawing_canvasscale) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, float sx, float sy) | 用于画布缩放。 | 753| 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\|。 | 754| void [OH_Drawing_CanvasClear](#oh_drawing_canvasclear) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, uint32_t color) | 用于使用指定颜色去清空画布。 | 755| int32_t [OH_Drawing_CanvasGetWidth](#oh_drawing_canvasgetwidth) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布宽度。 | 756| int32_t [OH_Drawing_CanvasGetHeight](#oh_drawing_canvasgetheight) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*) | 获取画布高度。 | 757| void [OH_Drawing_CanvasGetLocalClipBounds](#oh_drawing_canvasgetlocalclipbounds) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Rect](#oh_drawing_rect) \*) | 获取画布裁剪区域的边界。该接口不可用于录制类型画布。 | 758| void [OH_Drawing_CanvasGetTotalMatrix](#oh_drawing_canvasgettotalmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 获取画布3x3矩阵。 | 759| void [OH_Drawing_CanvasConcatMatrix](#oh_drawing_canvasconcatmatrix) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Matrix](#oh_drawing_matrix) \*) | 画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 | 760| void [OH_Drawing_CanvasDrawShadow](#oh_drawing_canvasdrawshadow) ([OH_Drawing_Canvas](#oh_drawing_canvas) \*, [OH_Drawing_Path](#oh_drawing_path) \*, [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) planeParams, [OH_Drawing_Point3D](_o_h___drawing___point3_d.md) devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, [OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags) flag) | 绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 | 761 762 763## 类型定义说明 764 765### OH_Drawing_FontArguments 766 767``` 768typedef struct OH_Drawing_FontArguments OH_Drawing_FontArguments 769``` 770 771**描述** 772 773用于描述字型参数。 774 775**起始版本:** 13 776 777### OH_Drawing_RecordCmd 778 779``` 780typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd 781``` 782 783**描述** 784 785定义录制指令类, 用于存储录制指令的集合。 786 787**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 788 789**起始版本:** 13 790 791 792### OH_Drawing_RecordCmdUtils 793 794``` 795typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils 796``` 797 798**描述** 799 800定义指令录制工具,用于生成录制指令。 801 802**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 803 804**起始版本:** 13 805 806 807### OH_Drawing_ErrorCode 808 809``` 810typedef enum OH_Drawing_ErrorCode OH_Drawing_ErrorCode 811``` 812 813 814**描述** 815 816枚举本模块可能产生的错误码。 817 818**起始版本:** 12 819 820 821### OH_Drawing_PathOpMode 822 823``` 824typedef enum OH_Drawing_PathOpMode OH_Drawing_PathOpMode 825``` 826 827**描述** 828 829路径操作类型枚举。 830 831**起始版本:** 12 832 833 834### OH_Drawing_PathMeasureMatrixFlags 835 836``` 837typedef enum OH_Drawing_PathMeasureMatrixFlags OH_Drawing_PathMeasureMatrixFlags 838``` 839 840**描述** 841 842路径测量获取相应矩阵信息维度枚举。 843 844**起始版本:** 12 845 846 847### OH_Drawing_RegionOpMode 848 849``` 850typedef enum OH_Drawing_RegionOpMode OH_Drawing_RegionOpMode 851``` 852 853**描述** 854 855区域操作类型枚举。 856 857**起始版本:** 12 858 859 860### OH_Drawing_ImageFilter 861 862``` 863typedef struct OH_Drawing_ImageFilter OH_Drawing_ImageFilter 864``` 865 866**描述** 867 868定义图像滤波器, 用于对构成图像像素的所有颜色位进行操作。 869 870**起始版本:** 12 871 872 873### OH_Drawing_Filter 874 875``` 876typedef struct OH_Drawing_Filter OH_Drawing_Filter 877``` 878 879**描述** 880 881定义一个滤波器,用于存储颜色滤波器,模板滤波器和图像滤波器。 882 883**起始版本:** 11 884 885### OH_Drawing_AlphaFormat 886 887``` 888typedef enum OH_Drawing_AlphaFormat OH_Drawing_AlphaFormat 889``` 890 891**描述** 892 893用于描述位图像素的透明度分量。 894 895**起始版本:** 8 896 897 898### OH_Drawing_Bitmap 899 900``` 901typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap 902``` 903 904**描述** 905 906定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 907 908**起始版本:** 8 909 910 911### OH_Drawing_BitmapFormat 912 913``` 914typedef struct OH_Drawing_BitmapFormat OH_Drawing_BitmapFormat 915``` 916 917**描述** 918 919结构体用于描述位图像素的格式,包括颜色类型和透明度类型 920 921**起始版本:** 8 922 923 924### OH_Drawing_BlendMode 925 926``` 927typedef enum OH_Drawing_BlendMode OH_Drawing_BlendMode 928``` 929 930**描述** 931 932混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 933 934为简洁起见,我们使用以下缩写: 935 936s : source,源的缩写。 937 938d : destination,目标的缩写。 939 940sa : source alpha,源透明度的缩写。 941 942da : destination alpha,目标透明度的缩写。 943 944计算结果用如下缩写表示: 945 946r : 如果4个通道的计算方式相同,用r表示。 947 948ra : 如果只操作透明度通道,用ra表示。 949 950rc : 如果操作3个颜色通道,用rc表示。 951 952**起始版本:** 11 953 954 955### OH_Drawing_BlurType 956 957``` 958typedef enum OH_Drawing_BlurType OH_Drawing_BlurType 959``` 960 961**描述** 962 963蒙版滤波器模糊操作类型的枚举。 964 965**起始版本:** 11 966 967 968### OH_Drawing_BreakStrategy 969 970``` 971typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy 972``` 973 974**描述** 975 976文本的中断策略枚举 977 978**起始版本:** 11 979 980 981### OH_Drawing_Brush 982 983``` 984typedef struct OH_Drawing_Brush OH_Drawing_Brush 985``` 986 987**描述** 988 989定义为画刷,画刷用于描述填充图形的样式和颜色。 990 991**起始版本:** 8 992 993 994### OH_Drawing_Canvas 995 996``` 997typedef struct OH_Drawing_Canvas OH_Drawing_Canvas 998``` 999 1000**描述** 1001 1002定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 1003 1004**起始版本:** 8 1005 1006 1007### OH_Drawing_CanvasClipOp 1008 1009``` 1010typedef enum OH_Drawing_CanvasClipOp OH_Drawing_CanvasClipOp 1011``` 1012 1013**描述** 1014 1015画布裁剪方式的枚举集合。 1016 1017**起始版本:** 11 1018 1019 1020### OH_Drawing_CanvasShadowFlags 1021 1022``` 1023typedef enum OH_Drawing_CanvasShadowFlags OH_Drawing_CanvasShadowFlags 1024``` 1025 1026**描述** 1027 1028阴影标志枚举。 1029 1030**起始版本:** 12 1031 1032 1033### OH_Drawing_ColorFilter 1034 1035``` 1036typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter 1037``` 1038 1039**描述** 1040 1041定义颜色滤波器,传入一个颜色并返回一个新的颜色。 1042 1043**起始版本:** 11 1044 1045 1046### OH_Drawing_ColorFormat 1047 1048``` 1049typedef enum OH_Drawing_ColorFormat OH_Drawing_ColorFormat 1050``` 1051 1052**描述** 1053 1054用于描述位图像素的存储格式。 1055 1056**起始版本:** 8 1057 1058 1059### OH_Drawing_ColorSpace 1060 1061``` 1062typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace 1063``` 1064 1065**描述** 1066 1067定义色彩空间,用于解释颜色信息。 1068 1069**起始版本:** 12 1070 1071 1072### OH_Drawing_Corner_Radii 1073 1074``` 1075typedef OH_Drawing_Point2D OH_Drawing_Corner_Radii 1076``` 1077 1078**描述** 1079 1080定义一个圆角半径,该圆角半径由x轴方向和y轴方向上的半径组成。 1081 1082**起始版本:** 12 1083 1084 1085### OH_Drawing_CornerPos 1086 1087``` 1088typedef enum OH_Drawing_CornerPos OH_Drawing_CornerPos 1089``` 1090 1091**描述** 1092 1093用于描述圆角位置的枚举。 1094 1095**起始版本:** 12 1096 1097 1098### OH_Drawing_EllipsisModal 1099 1100``` 1101typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal 1102``` 1103 1104**描述** 1105 1106省略号样式枚举 1107 1108**起始版本:** 11 1109 1110 1111### OH_Drawing_FilterMode 1112 1113``` 1114typedef enum OH_Drawing_FilterMode OH_Drawing_FilterMode 1115``` 1116 1117**描述** 1118 1119过滤模式枚举。 1120 1121**起始版本:** 12 1122 1123 1124### OH_Drawing_Font 1125 1126``` 1127typedef struct OH_Drawing_Font OH_Drawing_Font 1128``` 1129 1130**描述** 1131 1132用于描述字体。 1133 1134**起始版本:** 11 1135 1136 1137### OH_Drawing_Font_Metrics 1138 1139``` 1140typedef struct OH_Drawing_Font_Metrics OH_Drawing_Font_Metrics 1141``` 1142 1143**描述** 1144 1145定义字体度量信息的结构体。 1146 1147**起始版本:** 12 1148 1149 1150### OH_Drawing_FontAdjustInfo 1151 1152``` 1153typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo 1154``` 1155 1156**描述** 1157 1158字重映射信息结构体。 1159 1160**起始版本:** 12 1161 1162 1163### OH_Drawing_FontAliasInfo 1164 1165``` 1166typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo 1167``` 1168 1169**描述** 1170 1171别名字体信息结构体。 1172 1173**起始版本:** 12 1174 1175 1176### OH_Drawing_FontCollection 1177 1178``` 1179typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection 1180``` 1181 1182**描述** 1183 1184用于加载字体。 1185 1186**起始版本:** 8 1187 1188 1189### OH_Drawing_FontConfigInfo 1190 1191``` 1192typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo 1193``` 1194 1195**描述** 1196 1197系统字体配置信息结构体。 1198 1199**起始版本:** 12 1200 1201 1202### OH_Drawing_FontDescriptor 1203 1204``` 1205typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor 1206``` 1207 1208**描述** 1209 1210描述系统字体详细信息的结构体。 1211 1212**起始版本:** 12 1213 1214 1215### OH_Drawing_FontEdging 1216 1217``` 1218typedef enum OH_Drawing_FontEdging OH_Drawing_FontEdging 1219``` 1220 1221**描述** 1222 1223字形边缘效果类型枚举。 1224 1225**起始版本:** 12 1226 1227 1228### OH_Drawing_FontFallbackGroup 1229 1230``` 1231typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup 1232``` 1233 1234**描述** 1235 1236备用字体集信息结构体。 1237 1238**起始版本:** 12 1239 1240 1241### OH_Drawing_FontFallbackInfo 1242 1243``` 1244typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo 1245``` 1246 1247**描述** 1248 1249备用字体信息结构体。 1250 1251**起始版本:** 12 1252 1253 1254### OH_Drawing_FontGenericInfo 1255 1256``` 1257typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo 1258``` 1259 1260**描述** 1261 1262系统所支持的通用字体集信息结构体。 1263 1264**起始版本:** 12 1265 1266 1267### OH_Drawing_FontHinting 1268 1269``` 1270typedef enum OH_Drawing_FontHinting OH_Drawing_FontHinting 1271``` 1272 1273**描述** 1274 1275字形轮廓效果类型枚举。 1276 1277**起始版本:** 12 1278 1279 1280### OH_Drawing_FontMgr 1281 1282``` 1283typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr 1284``` 1285 1286**描述** 1287 1288定义字体管理类, 用于字体管理。 1289 1290**起始版本:** 12 1291 1292 1293### OH_Drawing_FontParser 1294 1295``` 1296typedef struct OH_Drawing_FontParser OH_Drawing_FontParser 1297``` 1298 1299**描述** 1300 1301用来解析系统字体文件。 1302 1303**起始版本:** 12 1304 1305 1306### OH_Drawing_FontStyleSet 1307 1308``` 1309typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet 1310``` 1311 1312**描述** 1313 1314定义字体样式集, 用于字体样式族匹配。 1315 1316**起始版本:** 12 1317 1318 1319### OH_Drawing_FontStyleStruct 1320 1321``` 1322typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct 1323``` 1324 1325**描述** 1326 1327定义字体样式信息的结构体。 1328 1329**起始版本:** 12 1330 1331 1332### OH_Drawing_GpuContext 1333 1334``` 1335typedef struct OH_Drawing_GpuContext OH_Drawing_GpuContext 1336``` 1337 1338**描述** 1339 1340定义图形处理器上下文,用于描述图形处理器后端上下文。 1341 1342**起始版本:** 12 1343 1344 1345### OH_Drawing_GpuContextOptions 1346 1347``` 1348typedef struct OH_Drawing_GpuContextOptions OH_Drawing_GpuContextOptions 1349``` 1350 1351**描述** 1352 1353定义有关图形处理器上下文的选项。 1354 1355**起始版本:** 12 1356 1357 1358### OH_Drawing_Image 1359 1360``` 1361typedef struct OH_Drawing_Image OH_Drawing_Image 1362``` 1363 1364**描述** 1365 1366定义一个用于描述绘制二维像素数组的图片。 1367 1368**起始版本:** 12 1369 1370 1371### OH_Drawing_Image_Info 1372 1373``` 1374typedef struct OH_Drawing_Image_Info OH_Drawing_Image_Info 1375``` 1376 1377**描述** 1378 1379定义图片信息结构体。 1380 1381**起始版本:** 12 1382 1383 1384### OH_Drawing_LineMetrics 1385 1386``` 1387typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics 1388``` 1389 1390**描述** 1391 1392文字行位置信息。 1393 1394**起始版本:** 12 1395 1396 1397### OH_Drawing_MaskFilter 1398 1399``` 1400typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter 1401``` 1402 1403**描述** 1404 1405定义模板滤波器,用于在绘制模板前对其进行转换。 1406 1407**起始版本:** 11 1408 1409 1410### OH_Drawing_Matrix 1411 1412``` 1413typedef struct OH_Drawing_Matrix OH_Drawing_Matrix 1414``` 1415 1416**描述** 1417 1418定义一个矩阵,用于描述坐标变换。 1419 1420**起始版本:** 11 1421 1422 1423### OH_Drawing_MemoryStream 1424 1425``` 1426typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream 1427``` 1428 1429**描述** 1430 1431用于描述内存流。 1432 1433**起始版本:** 12 1434 1435 1436### OH_Drawing_MipmapMode 1437 1438``` 1439typedef enum OH_Drawing_MipmapMode OH_Drawing_MipmapMode 1440``` 1441 1442**描述** 1443 1444多级渐远纹理模式枚举。 1445 1446**起始版本:** 12 1447 1448 1449### OH_Drawing_Path 1450 1451``` 1452typedef struct OH_Drawing_Path OH_Drawing_Path 1453``` 1454 1455**描述** 1456 1457定义为路径,路径用于自定义各种形状。 1458 1459**起始版本:** 8 1460 1461 1462### OH_Drawing_PathAddMode 1463 1464``` 1465typedef enum OH_Drawing_PathAddMode OH_Drawing_PathAddMode 1466``` 1467 1468**描述** 1469 1470用于指定路径添加模式的枚举类型。 1471 1472**起始版本:** 12 1473 1474 1475### OH_Drawing_PathDirection 1476 1477``` 1478typedef enum OH_Drawing_PathDirection OH_Drawing_PathDirection 1479``` 1480 1481**描述** 1482 1483添加闭合轮廓方向枚举。 1484 1485**起始版本:** 12 1486 1487 1488### OH_Drawing_PathEffect 1489 1490``` 1491typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect 1492``` 1493 1494**描述** 1495 1496定义一个路径效果,用于影响描边路径。 1497 1498**起始版本:** 12 1499 1500 1501### OH_Drawing_PathFillType 1502 1503``` 1504typedef enum OH_Drawing_PathFillType OH_Drawing_PathFillType 1505``` 1506 1507**描述** 1508 1509定义路径的填充类型枚举。 1510 1511**起始版本:** 12 1512 1513 1514### OH_Drawing_Pen 1515 1516``` 1517typedef struct OH_Drawing_Pen OH_Drawing_Pen 1518``` 1519 1520**描述** 1521 1522定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 1523 1524**起始版本:** 8 1525 1526 1527### OH_Drawing_PenLineCapStyle 1528 1529``` 1530typedef enum OH_Drawing_PenLineCapStyle OH_Drawing_PenLineCapStyle 1531``` 1532 1533**描述** 1534 1535枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 1536 1537**起始版本:** 8 1538 1539 1540### OH_Drawing_PenLineJoinStyle 1541 1542``` 1543typedef enum OH_Drawing_PenLineJoinStyle OH_Drawing_PenLineJoinStyle 1544``` 1545 1546**描述** 1547 1548枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 1549 1550**起始版本:** 8 1551 1552 1553### OH_Drawing_PixelMap 1554 1555``` 1556typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap 1557``` 1558 1559**描述** 1560 1561定义像素图,用于包装图像框架支持的真实像素图。 1562 1563**起始版本:** 12 1564 1565 1566### OH_Drawing_PlaceholderSpan 1567 1568``` 1569typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan 1570``` 1571 1572**描述** 1573 1574用于描述位占位符跨度的结构体 1575 1576**起始版本:** 11 1577 1578 1579### OH_Drawing_PlaceholderVerticalAlignment 1580 1581``` 1582typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment 1583``` 1584 1585**描述** 1586 1587占位符垂直对齐枚举 1588 1589**起始版本:** 11 1590 1591 1592### OH_Drawing_Point 1593 1594``` 1595typedef struct OH_Drawing_Point OH_Drawing_Point 1596``` 1597 1598**描述** 1599 1600定义一个点,用于描述坐标点。 1601 1602**起始版本:** 11 1603 1604 1605### OH_Drawing_Point2D 1606 1607``` 1608typedef struct OH_Drawing_Point2D OH_Drawing_Point2D 1609``` 1610 1611**描述** 1612 1613定义一个二维的坐标点。 1614 1615**起始版本:** 12 1616 1617 1618### OH_Drawing_Point3D 1619 1620``` 1621typedef struct OH_Drawing_Point3D OH_Drawing_Point3D 1622``` 1623 1624**描述** 1625 1626定义一个三维的坐标点。 1627 1628**起始版本:** 12 1629 1630 1631### OH_Drawing_PointMode 1632 1633``` 1634typedef enum OH_Drawing_PointMode OH_Drawing_PointMode 1635``` 1636 1637**描述** 1638 1639绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 1640 1641**起始版本:** 12 1642 1643 1644### OH_Drawing_PositionAndAffinity 1645 1646``` 1647typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity 1648``` 1649 1650**描述** 1651 1652用于接收字体的位置和亲和性 1653 1654**起始版本:** 11 1655 1656 1657### OH_Drawing_Range 1658 1659``` 1660typedef struct OH_Drawing_Range OH_Drawing_Range 1661``` 1662 1663**描述** 1664 1665用于接收字体的起始位置和结束位置 1666 1667**起始版本:** 11 1668 1669 1670### OH_Drawing_Rect 1671 1672``` 1673typedef struct OH_Drawing_Rect OH_Drawing_Rect 1674``` 1675 1676**描述** 1677 1678用于描述矩形。 1679 1680**起始版本:** 11 1681 1682 1683### OH_Drawing_RectHeightStyle 1684 1685``` 1686typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle 1687``` 1688 1689**描述** 1690 1691矩形框高度样式枚举 1692 1693**起始版本:** 11 1694 1695 1696### OH_Drawing_RectStyle_Info 1697 1698``` 1699typedef struct OH_Drawing_RectStyle_Info OH_Drawing_RectStyle_Info 1700``` 1701 1702**描述** 1703 1704定义矩形框样式结构体。 1705 1706**起始版本:** 12 1707 1708 1709### OH_Drawing_RectWidthStyle 1710 1711``` 1712typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle 1713``` 1714 1715**描述** 1716 1717矩形框宽度样式枚举 1718 1719**起始版本:** 11 1720 1721 1722### OH_Drawing_Region 1723 1724``` 1725typedef struct OH_Drawing_Region OH_Drawing_Region 1726``` 1727 1728**描述** 1729 1730定义一个区域,用于表示画布上的封闭区域,实现更精确的图形控制。 1731 1732**起始版本:** 12 1733 1734 1735### OH_Drawing_RoundRect 1736 1737``` 1738typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect 1739``` 1740 1741**描述** 1742 1743用于描述圆角矩形。 1744 1745**起始版本:** 11 1746 1747 1748### OH_Drawing_RunBuffer 1749 1750``` 1751typedef struct OH_Drawing_RunBuffer OH_Drawing_RunBuffer 1752``` 1753 1754**描述** 1755 1756结构体用于描述一块内存,描述文字和位置信息。 1757 1758**起始版本:** 11 1759 1760 1761### OH_Drawing_SamplingOptions 1762 1763``` 1764typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions 1765``` 1766 1767**描述** 1768 1769定义一个采样选项,用于描述图片、位图等图像的采样方法。 1770 1771**起始版本:** 12 1772 1773 1774### OH_Drawing_ScaleToFit 1775 1776``` 1777typedef enum OH_Drawing_ScaleToFit OH_Drawing_ScaleToFit 1778``` 1779 1780**描述** 1781 1782矩阵缩放方式枚举。 1783 1784**起始版本:** 12 1785 1786 1787### OH_Drawing_ShaderEffect 1788 1789``` 1790typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect 1791``` 1792 1793**描述** 1794 1795定义一个着色器,用于描述绘制内容的源颜色。 1796 1797**起始版本:** 11 1798 1799 1800### OH_Drawing_ShadowLayer 1801 1802``` 1803typedef struct OH_Drawing_ShadowLayer OH_Drawing_ShadowLayer 1804``` 1805 1806**描述** 1807 1808定义一个阴影层,用于描述绘制内容的阴影层。 1809 1810**起始版本:** 12 1811 1812 1813### OH_Drawing_SrcRectConstraint 1814 1815``` 1816typedef enum OH_Drawing_SrcRectConstraint OH_Drawing_SrcRectConstraint 1817``` 1818 1819**描述** 1820 1821源矩形区域约束类型枚举。 1822 1823**起始版本:** 12 1824 1825 1826### OH_Drawing_StrutStyle 1827 1828``` 1829typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle 1830``` 1831 1832**描述** 1833 1834用于描述支柱样式的结构体。支柱样式用于控制绘制文本时行之间的间距、基线对齐方式以及其他与行高相关的属性。 1835 1836**起始版本:** 12 1837 1838 1839### OH_Drawing_Surface 1840 1841``` 1842typedef struct OH_Drawing_Surface OH_Drawing_Surface 1843``` 1844 1845**描述** 1846 1847定义surface,用于管理画布绘制的内容。 1848 1849**起始版本:** 12 1850 1851 1852### OH_Drawing_TextBlob 1853 1854``` 1855typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob 1856``` 1857 1858**描述** 1859 1860定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 每个文本行由字形和位置组成。 1861 1862**起始版本:** 11 1863 1864 1865### OH_Drawing_TextBlobBuilder 1866 1867``` 1868typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder 1869``` 1870 1871**描述** 1872 1873定义文本构建器,用于构建文本。 1874 1875**起始版本:** 11 1876 1877 1878### OH_Drawing_TextBox 1879 1880``` 1881typedef struct OH_Drawing_TextBox OH_Drawing_TextBox 1882``` 1883 1884**描述** 1885 1886用于接收文本框的矩形大小、方向和数量大小 1887 1888**起始版本:** 11 1889 1890 1891### OH_Drawing_TextDecorationStyle 1892 1893``` 1894typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle 1895``` 1896 1897**描述** 1898 1899文本装饰样式枚举 1900 1901**起始版本:** 11 1902 1903 1904### OH_Drawing_TextEncoding 1905 1906``` 1907typedef enum OH_Drawing_TextEncoding OH_Drawing_TextEncoding 1908``` 1909 1910**描述** 1911 1912文本编码类型枚举。 1913 1914**起始版本:** 12 1915 1916 1917### OH_Drawing_TextShadow 1918 1919``` 1920typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow 1921``` 1922 1923**描述** 1924 1925用于管理文本阴影。 1926 1927**起始版本:** 12 1928 1929 1930### OH_Drawing_TextStyle 1931 1932``` 1933typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle 1934``` 1935 1936**描述** 1937 1938用于管理字体颜色、装饰等。 1939 1940**起始版本:** 8 1941 1942 1943### OH_Drawing_TileMode 1944 1945``` 1946typedef enum OH_Drawing_TileMode OH_Drawing_TileMode 1947``` 1948 1949**描述** 1950 1951着色器效果平铺模式的枚举。 1952 1953**起始版本:** 11 1954 1955 1956### OH_Drawing_Typeface 1957 1958``` 1959typedef struct OH_Drawing_Typeface OH_Drawing_Typeface 1960``` 1961 1962**描述** 1963 1964用于描述字形。 1965 1966**起始版本:** 11 1967 1968 1969### OH_Drawing_Typography 1970 1971``` 1972typedef struct OH_Drawing_Typography OH_Drawing_Typography 1973``` 1974 1975**描述** 1976 1977用于管理排版的布局和显示等。 1978 1979**起始版本:** 8 1980 1981 1982### OH_Drawing_TypographyCreate 1983 1984``` 1985typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate 1986``` 1987 1988**描述** 1989 1990用于创建[OH_Drawing_Typography](#oh_drawing_typography)。 1991 1992**起始版本:** 8 1993 1994 1995### OH_Drawing_TypographyStyle 1996 1997``` 1998typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle 1999``` 2000 2001**描述** 2002 2003用于管理排版风格,如文字方向等。 2004 2005**起始版本:** 8 2006 2007 2008### OH_Drawing_VertexMode 2009 2010``` 2011typedef enum OH_Drawing_VertexMode OH_Drawing_VertexMode 2012``` 2013 2014**描述** 2015 2016用于指定如何解释给定顶点的几何形状的枚举类型。 2017 2018**起始版本:** 12 2019 2020 2021### OH_Drawing_WordBreakType 2022 2023``` 2024typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType 2025``` 2026 2027**描述** 2028 2029单词的断词方式枚举 2030 2031**起始版本:** 11 2032 2033 2034## 枚举类型说明 2035 2036### OH_Drawing_ErrorCode 2037 2038``` 2039enum OH_Drawing_ErrorCode 2040``` 2041 2042**描述** 2043 2044枚举本模块可能产生的错误码。 2045 2046**起始版本:** 12 2047 2048| 枚举值 | 描述 | 2049| -------- | -------- | 2050| OH_DRAWING_SUCCESS | 操作成功完成。 | 2051| OH_DRAWING_ERROR_NO_PERMISSION | 权限校验失败。 | 2052| OH_DRAWING_ERROR_INVALID_PARAMETER | 无效的输入参数,如参数中传入了NULL。 | 2053| OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE | 输入参数不在有效的范围内。 | 2054| OH_DRAWING_ERROR_ALLOCATION_FAILED<sup>13+</sup> | 内存分配失败。 | 2055 2056### OH_Drawing_PathMeasureMatrixFlags 2057 2058``` 2059enum OH_Drawing_PathMeasureMatrixFlags 2060``` 2061 2062**描述** 2063 2064路径测量获取相应矩阵信息维度枚举。 2065 2066**起始版本:** 12 2067 2068| 枚举值 | 描述 | 2069| -------- | -------- | 2070| GET_POSITION_MATRIX | 获取位置信息对应的矩阵。 | 2071| GET_TANGENT_MATRIX | 获取切线信息对应的矩阵。 | 2072| GET_POSITION_AND_TANGENT_MATRIX | 获取位置和切线信息对应的矩阵。 | 2073 2074 2075### OH_Drawing_PathOpMode 2076 2077``` 2078enum OH_Drawing_PathOpMode 2079``` 2080 2081**描述** 2082 2083路径操作类型枚举。 2084 2085**起始版本:** 12 2086 2087| 枚举值 | 描述 | 2088| -------- | -------- | 2089| PATH_OP_MODE_DIFFERENCE | 差集操作。 | 2090| PATH_OP_MODE_INTERSECT | 交集操作。 | 2091| PATH_OP_MODE_UNION | 并集操作。 | 2092| PATH_OP_MODE_XOR | 异或操作。 | 2093| PATH_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 | 2094 2095 2096### OH_Drawing_RegionOpMode 2097 2098``` 2099enum OH_Drawing_RegionOpMode 2100``` 2101 2102**描述** 2103 2104区域操作类型枚举。 2105 2106**起始版本:** 12 2107 2108| 枚举值 | 描述 | 2109| -------- | -------- | 2110| REGION_OP_MODE_DIFFERENCE | 差集操作。 | 2111| REGION_OP_MODE_INTERSECT | 交集操作。 | 2112| REGION_OP_MODE_UNION | 并集操作。 | 2113| REGION_OP_MODE_XOR | 异或操作。 | 2114| REGION_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 | 2115| REGION_OP_MODE_REPLACE | 替换操作。 | 2116 2117 2118### OH_Drawing_AlphaFormat 2119 2120``` 2121enum OH_Drawing_AlphaFormat 2122``` 2123 2124**描述** 2125 2126用于描述位图像素的透明度分量。 2127 2128**起始版本:** 8 2129 2130| 枚举值 | 描述 | 2131| -------- | -------- | 2132| ALPHA_FORMAT_UNKNOWN | 未知格式 | 2133| ALPHA_FORMAT_OPAQUE | 位图无透明度 | 2134| ALPHA_FORMAT_PREMUL | 每个像素的颜色组件由透明度分量预先乘以 | 2135| ALPHA_FORMAT_UNPREMUL | 每个像素的颜色组件未由透明度分量预先乘以 | 2136 2137 2138### OH_Drawing_BlendMode 2139 2140``` 2141enum OH_Drawing_BlendMode 2142``` 2143 2144**描述** 2145 2146混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 2147 2148为简洁起见,我们使用以下缩写: 2149 2150s : source,源的缩写。 2151 2152d : destination,目标的缩写。 2153 2154sa : source alpha,源透明度的缩写。 2155 2156da : destination alpha,目标透明度的缩写。 2157 2158计算结果用如下缩写表示: 2159 2160r : 如果4个通道的计算方式相同,用r表示。 2161 2162ra : 如果只操作透明度通道,用ra表示。 2163 2164rc : 如果操作3个颜色通道,用rc表示。 2165 2166**起始版本:** 11 2167 2168| 枚举值 | 描述 | 2169| -------- | -------- | 2170| BLEND_MODE_CLEAR | 清除模式,r = 0. | 2171| BLEND_MODE_SRC | r = s(result的4个通道,都等于source的4个通道,即结果等于源。) | 2172| BLEND_MODE_DST | r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) | 2173| BLEND_MODE_SRC_OVER | r = s + (1 - sa) \* d. | 2174| BLEND_MODE_DST_OVER | r = d + (1 - da) \* s. | 2175| BLEND_MODE_SRC_IN | r = s \* da. | 2176| BLEND_MODE_DST_IN | r = d \* sa. | 2177| BLEND_MODE_SRC_OUT | r = s \* (1 - da). | 2178| BLEND_MODE_DST_OUT | r = d \* (1 - sa). | 2179| BLEND_MODE_SRC_ATOP | r = s \* da + d \* (1 - sa). | 2180| BLEND_MODE_DST_ATOP | r = d \* sa + s \* (1 - da). | 2181| BLEND_MODE_XOR | r = s \* (1 - da) + d \* (1 - sa). | 2182| BLEND_MODE_PLUS | r = min(s + d, 1). | 2183| BLEND_MODE_MODULATE | r = s \* d. | 2184| BLEND_MODE_SCREEN | 滤色模式,r = s + d - s \* d. | 2185| BLEND_MODE_OVERLAY | 叠加模式 | 2186| BLEND_MODE_DARKEN | 变暗模式,rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d. | 2187| BLEND_MODE_LIGHTEN | 变亮模式,rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d. | 2188| BLEND_MODE_COLOR_DODGE | 颜色减淡模式 | 2189| BLEND_MODE_COLOR_BURN | 颜色加深模式 | 2190| BLEND_MODE_HARD_LIGHT | 强光模式 | 2191| BLEND_MODE_SOFT_LIGHT | 柔光模式 | 2192| BLEND_MODE_DIFFERENCE | 差值模式,rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d. | 2193| BLEND_MODE_EXCLUSION | 排除模式,rc = s + d - two(s \* d), ra = s + (1 - sa) \* d. | 2194| BLEND_MODE_MULTIPLY | 正片叠底,r = s \* (1 - da) + d \* (1 - sa) + s \* d. | 2195| BLEND_MODE_HUE | 色相模式 | 2196| BLEND_MODE_SATURATION | 饱和度模式 | 2197| BLEND_MODE_COLOR | 颜色模式 | 2198| BLEND_MODE_LUMINOSITY | 亮度模式 | 2199 2200 2201### OH_Drawing_BlurType 2202 2203``` 2204enum OH_Drawing_BlurType 2205``` 2206 2207**描述** 2208 2209蒙版滤波器模糊操作类型的枚举。 2210 2211**起始版本:** 11 2212 2213| 枚举值 | 描述 | 2214| -------- | -------- | 2215| NORMAL | 内外模糊。 | 2216| SOLID | 内部实体,外部模糊。 | 2217| OUTER | 内部空白,外部模糊。 | 2218| INNER | 内部模糊,外部空白。 | 2219 2220 2221### OH_Drawing_BreakStrategy 2222 2223``` 2224enum OH_Drawing_BreakStrategy 2225``` 2226 2227**描述** 2228 2229文本的中断策略枚举 2230 2231**起始版本:** 11 2232 2233| 枚举值 | 描述 | 2234| -------- | -------- | 2235| BREAK_STRATEGY_GREEDY | 贪心策略,换行时尽可能填满每一行 | 2236| BREAK_STRATEGY_HIGH_QUALITY | 高质量策略,换行时优先考虑文本的连续性 | 2237| BREAK_STRATEGY_BALANCED | 平衡策略,换行时在单词边界换行 | 2238 2239 2240### OH_Drawing_CanvasClipOp 2241 2242``` 2243enum OH_Drawing_CanvasClipOp 2244``` 2245 2246**描述** 2247 2248画布裁剪方式的枚举集合。 2249 2250**起始版本:** 11 2251 2252| 枚举值 | 描述 | 2253| -------- | -------- | 2254| DIFFERENCE | 将指定区域裁剪(取差集)。 | 2255| INTERSECT | 将指定区域保留(取交集)。 | 2256 2257 2258### OH_Drawing_CanvasShadowFlags 2259 2260``` 2261enum OH_Drawing_CanvasShadowFlags 2262``` 2263 2264**描述** 2265 2266阴影标志枚举。 2267 2268**起始版本:** 12 2269 2270| 枚举值 | 描述 | 2271| -------- | -------- | 2272| SHADOW_FLAGS_NONE | 无阴影标志。 | 2273| SHADOW_FLAGS_TRANSPARENT_OCCLUDER | 遮挡物对象不透明标志。 | 2274| SHADOW_FLAGS_GEOMETRIC_ONLY | 不分析阴影标志。 | 2275| SHADOW_FLAGS_ALL | 使能以上所有阴影标志。 | 2276 2277 2278### OH_Drawing_ColorFormat 2279 2280``` 2281enum OH_Drawing_ColorFormat 2282``` 2283 2284**描述** 2285 2286用于描述位图像素的存储格式。 2287 2288**起始版本:** 8 2289 2290| 枚举值 | 描述 | 2291| -------- | -------- | 2292| COLOR_FORMAT_UNKNOWN | 未知格式. | 2293| COLOR_FORMAT_ALPHA_8 | 每个像素用一个8位的量表示,8个位比特位表示透明度 | 2294| COLOR_FORMAT_RGB_565 | 每个像素用一个16位的量表示,高位到低位依次是5个比特位表示红,6个比特位表示绿,5个比特位表示蓝 | 2295| COLOR_FORMAT_ARGB_4444 | 每个像素用一个16位的量表示,高位到低位依次是4个比特位表示透明度,4个比特位表示红,4个比特位表示绿,4个比特位表示蓝 | 2296| COLOR_FORMAT_RGBA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示透明度,8个比特位表示红,8个比特位表示绿,8个比特位表示蓝 | 2297| COLOR_FORMAT_BGRA_8888 | 每个像素用一个32位的量表示,高位到低位依次是8个比特位表示蓝,8个比特位表示绿,8个比特位表示红,8个比特位表示透明度 | 2298 2299 2300### OH_Drawing_CornerPos 2301 2302``` 2303enum OH_Drawing_CornerPos 2304``` 2305 2306**描述** 2307 2308用于描述圆角位置的枚举。 2309 2310**起始版本:** 12 2311 2312| 枚举值 | 描述 | 2313| -------- | -------- | 2314| CORNER_POS_TOP_LEFT | 左上角圆角位置。 | 2315| CORNER_POS_TOP_RIGHT | 右上角圆角位置。 | 2316| CORNER_POS_BOTTOM_RIGHT | 右下角圆角位置。 | 2317| CORNER_POS_BOTTOM_LEFT | 左下角圆角位置。 | 2318 2319 2320### OH_Drawing_EllipsisModal 2321 2322``` 2323enum OH_Drawing_EllipsisModal 2324``` 2325 2326**描述** 2327 2328省略号样式枚举 2329 2330**起始版本:** 11 2331 2332| 枚举值 | 描述 | 2333| -------- | -------- | 2334| ELLIPSIS_MODAL_HEAD | 头部模式,即省略号放在文本头部 | 2335| ELLIPSIS_MODAL_MIDDLE | 中部模式,即省略号放在文本中部 | 2336| ELLIPSIS_MODAL_TAIL | 尾部模式,即省略号放在文本尾部 | 2337 2338 2339### OH_Drawing_FilterMode 2340 2341``` 2342enum OH_Drawing_FilterMode 2343``` 2344 2345**描述** 2346 2347过滤模式枚举。 2348 2349**起始版本:** 12 2350 2351| 枚举值 | 描述 | 2352| -------- | -------- | 2353| FILTER_MODE_NEAREST | 邻近过滤模式 | 2354| FILTER_MODE_LINEAR | 线性过滤模式 | 2355 2356 2357### OH_Drawing_FontConfigInfoErrorCode 2358 2359``` 2360enum OH_Drawing_FontConfigInfoErrorCode 2361``` 2362 2363**描述** 2364 2365获取系统字体配置信息列表结果枚举。 2366 2367**起始版本:** 12 2368 2369| 枚举值 | 描述 | 2370| -------- | -------- | 2371| SUCCESS_FONT_CONFIG_INFO | 获取系统字体配置信息列表成功 | 2372| ERROR_FONT_CONFIG_INFO_UNKNOWN | 未知错误 | 2373| ERROR_FONT_CONFIG_INFO_PARSE_FILE | 解析系统配置文件失败 | 2374| ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY | 申请内存失败 | 2375| ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA | 拷贝字符串数据失败 | 2376 2377 2378### OH_Drawing_FontEdging 2379 2380``` 2381enum OH_Drawing_FontEdging 2382``` 2383 2384**描述** 2385 2386字形边缘效果类型枚举。 2387 2388**起始版本:** 12 2389 2390| 枚举值 | 描述 | 2391| -------- | -------- | 2392| FONT_EDGING_ALIAS | 无抗锯齿处理。 | 2393| FONT_EDGING_ANTI_ALIAS | 使用抗锯齿来平滑字形边缘。 | 2394| FONT_EDGING_SUBPIXEL_ANTI_ALIAS | 使用次像素级别的抗锯齿来平滑字形边缘,可以获得更加平滑的字形渲染效果。 | 2395 2396 2397### OH_Drawing_FontHinting 2398 2399``` 2400enum OH_Drawing_FontHinting 2401``` 2402 2403**描述** 2404 2405字形轮廓效果类型枚举。 2406 2407**起始版本:** 12 2408 2409| 枚举值 | 描述 | 2410| -------- | -------- | 2411| FONT_HINTING_NONE | 不修改字形轮廓。 | 2412| FONT_HINTING_SLIGHT | 最小限度修改字形轮廓以改善对比度。 | 2413| FONT_HINTING_NORMAL | 修改字形轮廓以提高对比度。 | 2414| FONT_HINTING_FULL | 修改字形轮廓以获得最大对比度。 | 2415 2416 2417### OH_Drawing_FontStyle 2418 2419``` 2420enum OH_Drawing_FontStyle 2421``` 2422 2423**描述** 2424 2425区分字体是否为斜体 2426 2427| 枚举值 | 描述 | 2428| -------- | -------- | 2429| FONT_STYLE_NORMAL | 非斜体 | 2430| FONT_STYLE_ITALIC | 斜体 | 2431| FONT_STYLE_OBLIQUE | 倾斜字体<br/>自从<br/>12 | 2432 2433 2434### OH_Drawing_FontWeight 2435 2436``` 2437enum OH_Drawing_FontWeight 2438``` 2439 2440**描述** 2441 2442字重 2443 2444| 枚举值 | 描述 | 2445| -------- | -------- | 2446| FONT_WEIGHT_100 | 字重为thin | 2447| FONT_WEIGHT_200 | 字重为extra-light | 2448| FONT_WEIGHT_300 | 字重为light | 2449| FONT_WEIGHT_400 | 字重为normal/regular | 2450| FONT_WEIGHT_500 | 字重为medium | 2451| FONT_WEIGHT_600 | 字重为semi-bold | 2452| FONT_WEIGHT_700 | 字重为bold | 2453| FONT_WEIGHT_800 | 字重为extra-bold | 2454| FONT_WEIGHT_900 | 字重为black | 2455 2456 2457### OH_Drawing_FontWidth 2458 2459``` 2460enum OH_Drawing_FontWidth 2461``` 2462 2463**描述** 2464 2465字体宽度的枚举。 2466 2467**起始版本:** 12 2468 2469 2470### OH_Drawing_MipmapMode 2471 2472``` 2473enum OH_Drawing_MipmapMode 2474``` 2475 2476**描述** 2477 2478多级渐远纹理模式枚举。 2479 2480**起始版本:** 12 2481 2482| 枚举值 | 描述 | 2483| -------- | -------- | 2484| MIPMAP_MODE_NONE | 忽略多级渐远纹理级别 | 2485| MIPMAP_MODE_NEAREST | 邻近多级渐远级别采样 | 2486| MIPMAP_MODE_LINEAR | 两个邻近多级渐远纹理之间,线性插值采样 | 2487 2488 2489### OH_Drawing_PathAddMode 2490 2491``` 2492enum OH_Drawing_PathAddMode 2493``` 2494 2495**描述** 2496 2497用于指定路径添加模式的枚举类型。 2498 2499**起始版本:** 12 2500 2501| 枚举值 | 描述 | 2502| -------- | -------- | 2503| PATH_ADD_MODE_APPEND | 以追加的方式添加路径 | 2504| PATH_ADD_MODE_EXTEND | 如果之前的路径未闭合,则添加直线闭合路径 | 2505 2506 2507### OH_Drawing_PathDirection 2508 2509``` 2510enum OH_Drawing_PathDirection 2511``` 2512 2513**描述** 2514 2515添加闭合轮廓方向枚举。 2516 2517**起始版本:** 12 2518 2519| 枚举值 | 描述 | 2520| -------- | -------- | 2521| PATH_DIRECTION_CW | 顺时针方向添加闭合轮廓 | 2522| PATH_DIRECTION_CCW | 逆时针方向添加闭合轮廓 | 2523 2524 2525### OH_Drawing_PathFillType 2526 2527``` 2528enum OH_Drawing_PathFillType 2529``` 2530 2531**描述** 2532 2533定义路径的填充类型枚举。 2534 2535**起始版本:** 12 2536 2537| 枚举值 | 描述 | 2538| -------- | -------- | 2539| PATH_FILL_TYPE_WINDING | 绘制区域中的任意一点,向任意方向射出一条射线,对于射线和路径的所有交点,初始计数为0,遇到每个顺时针的交点(路径从射线的左边向右穿过),计数加1,遇到每个逆时针的交点(路径从射线的右边向左穿过),计数减1,若最终的计数结果为0,则认为这个点在路径内部,需要被涂色;若计数为0则不被涂色 | 2540| PATH_FILL_TYPE_EVEN_ODD | 绘制区域中的任意一点,向任意方向射出一条射线,若这条射线和路径相交的次数是奇数,则这个点被认为在路径内部,需要被涂色;若是偶数则不被涂色 | 2541| PATH_FILL_TYPE_INVERSE_WINDING | PATH_FILL_TYPE_WINDING 涂色规则取反 | 2542| PATH_FILL_TYPE_INVERSE_EVEN_ODD | PATH_FILL_TYPE_EVEN_ODD 涂色规则取反 | 2543 2544 2545### OH_Drawing_PenLineCapStyle 2546 2547``` 2548enum OH_Drawing_PenLineCapStyle 2549``` 2550 2551**描述** 2552 2553枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 2554 2555**起始版本:** 8 2556 2557| 枚举值 | 描述 | 2558| -------- | -------- | 2559| LINE_FLAT_CAP | 没有笔帽样式,线条头尾端点处横切 | 2560| LINE_SQUARE_CAP | 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 | 2561| LINE_ROUND_CAP | 笔帽的样式为圆弧,线条的头尾端点处多出一个半圆弧,半圆的直径与线段厚度一致 | 2562 2563 2564### OH_Drawing_PenLineJoinStyle 2565 2566``` 2567enum OH_Drawing_PenLineJoinStyle 2568``` 2569 2570**描述** 2571 2572枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 2573 2574**起始版本:** 8 2575 2576| 枚举值 | 描述 | 2577| -------- | -------- | 2578| LINE_MITER_JOIN | 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 | 2579| LINE_ROUND_JOIN | 转角类型为圆头 | 2580| LINE_BEVEL_JOIN | 转角类型为平头 | 2581 2582 2583### OH_Drawing_PlaceholderVerticalAlignment 2584 2585``` 2586enum OH_Drawing_PlaceholderVerticalAlignment 2587``` 2588 2589**描述** 2590 2591占位符垂直对齐枚举 2592 2593**起始版本:** 11 2594 2595| 枚举值 | 描述 | 2596| -------- | -------- | 2597| ALIGNMENT_OFFSET_AT_BASELINE | 偏移于基线对齐 | 2598| ALIGNMENT_ABOVE_BASELINE | 高于基线对齐 | 2599| ALIGNMENT_BELOW_BASELINE | 低于基线对齐 | 2600| ALIGNMENT_TOP_OF_ROW_BOX | 行框顶部对齐 | 2601| ALIGNMENT_BOTTOM_OF_ROW_BOX | 行框底部对齐 | 2602| ALIGNMENT_CENTER_OF_ROW_BOX | 行框中心对齐 | 2603 2604 2605### OH_Drawing_PointMode 2606 2607``` 2608enum OH_Drawing_PointMode 2609``` 2610 2611**描述** 2612 2613绘制多个点的方式枚举,方式分为离散点、直线或开放多边形。 2614 2615**起始版本:** 12 2616 2617| 枚举值 | 描述 | 2618| -------- | -------- | 2619| POINT_MODE_POINTS | 分别绘制每个点。 | 2620| POINT_MODE_LINES | 将每两个点绘制为线段。 | 2621| POINT_MODE_POLYGON | 将点阵列绘制为开放多边形。 | 2622 2623 2624### OH_Drawing_RectHeightStyle 2625 2626``` 2627enum OH_Drawing_RectHeightStyle 2628``` 2629 2630**描述** 2631 2632矩形框高度样式枚举 2633 2634**起始版本:** 11 2635 2636| 枚举值 | 描述 | 2637| -------- | -------- | 2638| RECT_HEIGHT_STYLE_TIGHT | 紧密样式 | 2639| RECT_HEIGHT_STYLE_MAX | 最大样式 | 2640| RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE | 包含行间距中间样式 | 2641| RECT_HEIGHT_STYLE_INCLUDELINESPACETOP | 包含行间距顶部样式 | 2642| RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM | 包含行间距底部样式 | 2643| RECT_HEIGHT_STYLE_STRUCT | 结构样式 | 2644 2645 2646### OH_Drawing_RectWidthStyle 2647 2648``` 2649enum OH_Drawing_RectWidthStyle 2650``` 2651 2652**描述** 2653 2654矩形框宽度样式枚举 2655 2656**起始版本:** 11 2657 2658| 枚举值 | 描述 | 2659| -------- | -------- | 2660| RECT_WIDTH_STYLE_TIGHT | 紧密样式 | 2661| RECT_WIDTH_STYLE_MAX | 最大样式 | 2662 2663 2664### OH_Drawing_ScaleToFit 2665 2666``` 2667enum OH_Drawing_ScaleToFit 2668``` 2669 2670**描述** 2671 2672矩阵缩放方式枚举。 2673 2674**起始版本:** 12 2675 2676| 枚举值 | 描述 | 2677| -------- | -------- | 2678| SCALE_TO_FIT_FILL | 按水平轴和垂直轴缩放以填充目标矩形。 | 2679| SCALE_TO_FIT_START | 缩放并对齐到左侧和顶部。 | 2680| SCALE_TO_FIT_CENTER | 缩放并居中对齐。 | 2681| SCALE_TO_FIT_END | 缩放并向右和向下对齐。 | 2682 2683 2684### OH_Drawing_SrcRectConstraint 2685 2686``` 2687enum OH_Drawing_SrcRectConstraint 2688``` 2689 2690**描述** 2691 2692源矩形区域约束类型枚举。 2693 2694**起始版本:** 12 2695 2696| 枚举值 | 描述 | 2697| -------- | -------- | 2698| STRICT_SRC_RECT_CONSTRAINT | 严格约束,源矩形区域必须完全包含在图像中 | 2699| FAST_SRC_RECT_CONSTRAINT | 快速约束,源矩形区域可以部分位于图像之外 | 2700 2701 2702### OH_Drawing_TextAlign 2703 2704``` 2705enum OH_Drawing_TextAlign 2706``` 2707 2708**描述** 2709 2710文字对齐方式 2711 2712| 枚举值 | 描述 | 2713| -------- | -------- | 2714| TEXT_ALIGN_LEFT | 左对齐 | 2715| TEXT_ALIGN_RIGHT | 右对齐 | 2716| TEXT_ALIGN_CENTER | 居中对齐 | 2717| TEXT_ALIGN_JUSTIFY | 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 | 2718| 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相同。 | 2719| 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相同。 | 2720 2721 2722### OH_Drawing_TextBaseline 2723 2724``` 2725enum OH_Drawing_TextBaseline 2726``` 2727 2728**描述** 2729 2730基线位置 2731 2732| 枚举值 | 描述 | 2733| -------- | -------- | 2734| TEXT_BASELINE_ALPHABETIC | 用于表音文字,基线在中间偏下的位置 | 2735| TEXT_BASELINE_IDEOGRAPHIC | 用于表意文字,基线位于底部 | 2736 2737 2738### OH_Drawing_TextDecoration 2739 2740``` 2741enum OH_Drawing_TextDecoration 2742``` 2743 2744**描述** 2745 2746文本装饰 2747 2748| 枚举值 | 描述 | 2749| -------- | -------- | 2750| TEXT_DECORATION_NONE | 无装饰 | 2751| TEXT_DECORATION_UNDERLINE | 下划线 | 2752| TEXT_DECORATION_OVERLINE | 上划线 | 2753| TEXT_DECORATION_LINE_THROUGH | 删除线 | 2754 2755 2756### OH_Drawing_TextDecorationStyle 2757 2758``` 2759enum OH_Drawing_TextDecorationStyle 2760``` 2761 2762**描述** 2763 2764文本装饰样式枚举 2765 2766**起始版本:** 11 2767 2768| 枚举值 | 描述 | 2769| -------- | -------- | 2770| TEXT_DECORATION_STYLE_SOLID | 实心样式 | 2771| TEXT_DECORATION_STYLE_DOUBLE | 双重样式 | 2772| TEXT_DECORATION_STYLE_DOTTED | 圆点样式 | 2773| TEXT_DECORATION_STYLE_DASHED | 虚线样式 | 2774| TEXT_DECORATION_STYLE_WAVY | 波浪样式 | 2775 2776 2777### OH_Drawing_TextDirection 2778 2779``` 2780enum OH_Drawing_TextDirection 2781``` 2782 2783**描述** 2784 2785文字方向 2786 2787| 枚举值 | 描述 | 2788| -------- | -------- | 2789| TEXT_DIRECTION_RTL | 方向:从右到左 | 2790| TEXT_DIRECTION_LTR | 方向:从左到右 | 2791 2792 2793### OH_Drawing_TextEncoding 2794 2795``` 2796enum OH_Drawing_TextEncoding 2797``` 2798 2799**描述** 2800 2801文本编码类型枚举。 2802 2803**起始版本:** 12 2804 2805| 枚举值 | 描述 | 2806| -------- | -------- | 2807| TEXT_ENCODING_UTF8 | 单字节,表示UTF-8或ASCII | 2808| TEXT_ENCODING_UTF16 | 双字节,表示大部分Unicode | 2809| TEXT_ENCODING_UTF32 | 四字节,表示所有Unicode | 2810| TEXT_ENCODING_GLYPH_ID | 双字节,表示字形索引 | 2811 2812 2813### OH_Drawing_TextHeightBehavior 2814 2815``` 2816enum OH_Drawing_TextHeightBehavior 2817``` 2818 2819**描述** 2820 2821文本高度修饰符模式枚举。 2822 2823**起始版本:** 12 2824 2825| 枚举值 | 描述 | 2826| -------- | -------- | 2827| TEXT_HEIGHT_ALL | 高度修饰符设置为段落中第一行和最后一行都上升 | 2828| TEXT_HEIGHT_DISABLE_FIRST_ASCENT | 高度修饰符设置为禁止段落中第一行上升 | 2829| TEXT_HEIGHT_DISABLE_LAST_ASCENT | 高度修饰符设置为禁止段落中最后一行上升 | 2830| TEXT_HEIGHT_DISABLE_ALL | 高度修饰符设置为段落中第一行和最后一行都不上升 | 2831 2832 2833### OH_Drawing_TextStyleType 2834 2835``` 2836enum OH_Drawing_TextStyleType 2837``` 2838 2839**描述** 2840 2841文本样式类型枚举。 2842 2843**起始版本:** 12 2844 2845| 枚举值 | 描述 | 2846| -------- | -------- | 2847| TEXT_STYLE_NONE | 无文本样式 | 2848| TEXT_STYLE_ALL_ATTRIBUTES | 所有文本样式 | 2849| TEXT_STYLE_FONT | 字体样式 | 2850| TEXT_STYLE_FOREGROUND | 文本前景样式 | 2851| TEXT_STYLE_BACKGROUND | 文本背景样式 | 2852| TEXT_STYLE_SHADOW | 文本阴影样式 | 2853| TEXT_STYLE_DECORATIONS | 文本装饰样式 | 2854| TEXT_STYLE_LETTER_SPACING | 文本字符间距样式 | 2855| TEXT_STYLE_WORD_SPACING | 文本单词间距样式 | 2856 2857 2858### OH_Drawing_TileMode 2859 2860``` 2861enum OH_Drawing_TileMode 2862``` 2863 2864**描述** 2865 2866着色器效果平铺模式的枚举。 2867 2868**起始版本:** 11 2869 2870| 枚举值 | 描述 | 2871| -------- | -------- | 2872| CLAMP | 如果着色器效果超出其原始边界,则复制边缘颜色。 | 2873| REPEAT | 在水平和垂直方向上重复着色器效果图像。 | 2874| MIRROR | 水平和垂直重复着色器效果图像,交替镜像。 | 2875| DECAL | 只在原始区域内绘制,其他地方返回透明黑色。 | 2876 2877 2878### OH_Drawing_VertexMode 2879 2880``` 2881enum OH_Drawing_VertexMode 2882``` 2883 2884**描述** 2885 2886用于指定如何解释给定顶点的几何形状的枚举类型。 2887 2888**起始版本:** 12 2889 2890| 枚举值 | 描述 | 2891| -------- | -------- | 2892| VERTEX_MODE_TRIANGLES | 每三个顶点表示一个三角形,如果顶点数不是3的倍数,则多余的顶点会被忽略。 | 2893| VERTEX_MODE_TRIANGLESSTRIP | 相邻三个顶点表示一个三角形,每个新的顶点将与前两个顶点组成一个新的三角形。 | 2894| VERTEX_MODE_TRIANGLEFAN | 第一个顶点作为中心点,后续的每个顶点都与前一个顶点和中心点组成一个三角形。 | 2895 2896 2897### OH_Drawing_WordBreakType 2898 2899``` 2900enum OH_Drawing_WordBreakType 2901``` 2902 2903**描述** 2904 2905单词的断词方式枚举 2906 2907**起始版本:** 11 2908 2909| 枚举值 | 描述 | 2910| -------- | -------- | 2911| WORD_BREAK_TYPE_NORMAL | 常规方式 | 2912| WORD_BREAK_TYPE_BREAK_ALL | 全部中断方式 | 2913| WORD_BREAK_TYPE_BREAK_WORD | 单词中断方式 | 2914 2915 2916 2917## 函数说明 2918 2919 2920### OH_Drawing_TypefaceCreateFromFileWithArguments() 2921 2922``` 2923OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFileWithArguments (const char* path, const OH_Drawing_FontArguments* fontArguments ) 2924``` 2925 2926**描述** 2927 2928从指定文件路径创建带有字型参数的字体对象。 如果字体对象不支持字型参数中描述的可变维度,此函数将会创建默认字型参数的字体对象。 在这种情况下,此函数将提供与[OH_Drawing_TypefaceCreateFromFile](#oh_drawing_typefacecreatefromfile)相同的功能。 2929 2930**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 2931 2932**起始版本:** 13 2933 2934**参数:** 2935 2936| 名称 | 描述 | 2937| -------- | -------- | 2938| path | 指向字体对象所在文件路径的指针。 | 2939| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 2940 2941**返回:** 2942 2943函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的路径无效。 2944 2945 2946### OH_Drawing_TypefaceCreateFromCurrent() 2947 2948``` 2949OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent (const OH_Drawing_Typeface* current, const OH_Drawing_FontArguments* fontArguments ) 2950``` 2951 2952**描述** 2953 2954通过已存在的字体对象创建带有字型参数的字体对象。 2955 2956**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 2957 2958**起始版本:** 13 2959 2960**参数:** 2961 2962| 名称 | 描述 | 2963| -------- | -------- | 2964| current | 指向字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)的指针。 | 2965| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 2966 2967**返回:** 2968 2969函数返回一个指针,指针指向创建的字体对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 如果返回的对象指针为空,则表示字体对象创建失败。失败的原因可能为:没有可用的内存、 传入的文件路径对象指针或字型参数为空、传入的字体对象不支持字型参数对象中描述的可变维度。 2970 2971 2972### OH_Drawing_FontArgumentsAddVariation() 2973 2974``` 2975OH_Drawing_ErrorCode OH_Drawing_FontArgumentsAddVariation (OH_Drawing_FontArguments* fontArguments, const char* axis, float value ) 2976``` 2977 2978**描述** 2979 2980给字型参数对象添加可变维度。 2981 2982**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 2983 2984**起始版本:** 13 2985 2986**参数:** 2987 2988| 名称 | 描述 | 2989| -------- | -------- | 2990| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 2991| axis | 字型参数对象可变维度的标签,必须为4个ASCII字符。具体可支持的标签取决于加载的字体文件,如'wght'即为字重标签。 | 2992| value | 可变维度标签对应的取值。 | 2993 2994**返回:** 2995 2996函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments或axis任意一个为NULL或者axis的长度不为4。 2997 2998 2999### OH_Drawing_FontArgumentsCreate() 3000 3001``` 3002OH_Drawing_FontArguments* OH_Drawing_FontArgumentsCreate (void) 3003``` 3004 3005**描述** 3006 3007用于创建一个字型参数对象。字型参数用于创建带有自定义属性的字体对象。 3008 3009**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3010 3011**起始版本:** 13 3012 3013**返回:** 3014 3015返回一个指针,指针指向创建的字型参数对象。 3016 3017 3018### OH_Drawing_FontArgumentsDestroy() 3019 3020``` 3021OH_Drawing_ErrorCode OH_Drawing_FontArgumentsDestroy (OH_Drawing_FontArguments* fontArguments) 3022``` 3023 3024**描述** 3025 3026用于销毁一个字型参数对象。 3027 3028**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3029 3030**起始版本:** 13 3031 3032**参数:** 3033 3034| 名称 | 描述 | 3035| -------- | -------- | 3036| fontArguments | 指向字型参数对象[OH_Drawing_FontArguments](#oh_drawing_fontarguments)的指针。 | 3037 3038**返回:** 3039 3040函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数fontArguments为NULL。 3041 3042 3043### OH_Drawing_TypographyGetLongestLineWithIndent() 3044 3045``` 3046double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography* ) 3047``` 3048 3049**描述** 3050 3051获取最长行的宽度(该宽度包含当前行缩进的宽度),建议实际使用时将返回值向上取整。当文本内容为空时,返回0.0。 3052 3053**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3054 3055**起始版本:** 13 3056 3057**参数:** 3058 3059| 名称 | 描述 | 3060| -------- | -------- | 3061| OH_Drawing_Typography | 指向[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 3062 3063**返回:** 3064 3065返回最长行的宽度(该宽度包含当前行缩进的宽度),单位:物理像素px。 3066 3067 3068 3069### OH_Drawing_RecordCmdDestroy() 3070 3071``` 3072OH_Drawing_ErrorCode OH_Drawing_RecordCmdDestroy (OH_Drawing_RecordCmd* recordCmd) 3073``` 3074 3075**描述** 3076 3077销毁录制指令对象,并回收该对象占有的内存。 3078 3079**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3080 3081**起始版本:** 13 3082 3083**参数:** 3084 3085| 名称 | 描述 | 3086| -------- | -------- | 3087| recordCmd | 指向对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 | 3088 3089**返回:** 3090 3091函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmd为空。 3092 3093 3094### OH_Drawing_RecordCmdUtilsBeginRecording() 3095 3096``` 3097OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsBeginRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, int32_t width, int32_t height, OH_Drawing_Canvas** canvas ) 3098``` 3099 3100**描述** 3101 3102开始录制。此接口需要与[OH_Drawing_RecordCmdUtilsFinishRecording](#oh_drawing_recordcmdutilsfinishrecording)接口成对使用。 3103 3104指令录制工具生成录制类型的画布对象,可调用drawing的绘制接口,记录接下来所有的绘制指令。 3105 3106**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3107 3108**起始版本:** 13 3109 3110**参数:** 3111 3112| 名称 | 描述 | 3113| -------- | -------- | 3114| recordCmdUtils | 指向录制工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3115| width | 画布的宽度。 | 3116| height | 画布的高度。 | 3117| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的二级指针,作为出参,开发者无需释放。 该画布对象不支持嵌套调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口。 | 3118 3119**返回:** 3120 3121函数返回执行错误码。 返回OH_DRAWING_SUCCESS, 表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER, 表示参数recordCmdUtils或者canvas为空。 当width和height小于等于0的时,也会返回OH_DRAWING_ERROR_INVALID_PARAMETER。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。 3122 3123 3124### OH_Drawing_RecordCmdUtilsCreate() 3125 3126``` 3127OH_Drawing_RecordCmdUtils* OH_Drawing_RecordCmdUtilsCreate (void ) 3128``` 3129 3130**描述** 3131 3132创建一个录制指令工具对象。 3133 3134**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3135 3136**起始版本:** 13 3137 3138**返回:** 3139 3140返回用于录制指令的工具对象。 3141 3142 3143### OH_Drawing_RecordCmdUtilsDestroy() 3144 3145``` 3146OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsDestroy (OH_Drawing_RecordCmdUtils* recordCmdUtils) 3147``` 3148 3149**描述** 3150 3151销毁一个录制指令工具对象,并回收该对象占有的内存。 3152 3153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3154 3155**起始版本:** 13 3156 3157**参数:** 3158 3159| 名称 | 描述 | 3160| -------- | -------- | 3161| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3162 3163**返回:** 3164 3165函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils为空。 3166 3167 3168### OH_Drawing_RecordCmdUtilsFinishRecording() 3169 3170``` 3171OH_Drawing_ErrorCode OH_Drawing_RecordCmdUtilsFinishRecording (OH_Drawing_RecordCmdUtils* recordCmdUtils, OH_Drawing_RecordCmd** recordCmd ) 3172``` 3173 3174**描述** 3175 3176结束录制。在调用此接口前,需要先调用[OH_Drawing_RecordCmdUtilsBeginRecording](#oh_drawing_recordcmdutilsbeginrecording)接口。 3177 3178指令录制工具结束录制指令,将录制类型画布对象记录的绘制指令存入生成的录制指令对象。 3179 3180**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3181 3182**起始版本:** 13 3183 3184**参数:** 3185 3186| 名称 | 描述 | 3187| -------- | -------- | 3188| recordCmdUtils | 指向录制指令工具对象[OH_Drawing_RecordCmdUtils](#oh_drawing_recordcmdutils)的指针。 | 3189| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的二级指针,作为出参,开发者调用[OH_Drawing_CanvasDrawRecordCmd](#oh_drawing_canvasdrawrecordcmd)接口绘制该对象。 需要调用[OH_Drawing_RecordCmdDestroy](#oh_drawing_recordcmddestroy)接口释放。 | 3190 3191**返回:** 3192 3193函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数recordCmdUtils或者recordCmd为空。 返回OH_DRAWING_ERROR_ALLOCATION_FAILED,表示系统内存不足。 3194 3195 3196### OH_Drawing_CanvasDrawRecordCmd() 3197 3198``` 3199OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd (OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd ) 3200``` 3201 3202**描述** 3203 3204用于绘制录制指令对象。 3205 3206**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3207 3208**起始版本:** 13 3209 3210**参数:** 3211 3212| 名称 | 描述 | 3213| -------- | -------- | 3214| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针,仅支持录制类型画布。 | 3215| recordCmd | 指向录制指令对象[OH_Drawing_RecordCmd](#oh_drawing_recordcmd)的指针。 | 3216 3217**返回:** 3218 3219函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者recordCmd为空。 3220 3221 3222 3223### OH_Drawing_TypographyDestroyTextBox() 3224 3225``` 3226void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox* ) 3227``` 3228 3229**描述** 3230 3231释放文本框占用的内存。 3232 3233**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3234 3235**起始版本:** 12 3236 3237**参数:** 3238 3239| 名称 | 描述 | 3240| -------- | -------- | 3241| OH_Drawing_TextBox | 指向文本框对象[OH_Drawing_TextBox](#oh_drawing_textbox)的指针。 | 3242 3243 3244### OH_Drawing_SetTextShadow() 3245 3246``` 3247void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius ) 3248``` 3249 3250**描述** 3251 3252设置字体阴影对象的参数。 3253 3254**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3255 3256**起始版本:** 12 3257 3258**参数:** 3259 3260| 名称 | 描述 | 3261| -------- | -------- | 3262| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 3263| color | 字体阴影的颜色,例如入参为0xAABBCCDD,AA代表透明度,BB代表红色分量的值,CC代表绿色分量的值,DD代表蓝色分量的值。 | 3264| OH_Drawing_Point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针,字体阴影基于当前文本的偏移位置。 | 3265| blurRadius | 模糊半径,浮点数,没有单位,值为0.0时表示没有模糊效果。 | 3266 3267 3268 3269### OH_Drawing_CanvasDrawSingleCharacter() 3270 3271``` 3272OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter (OH_Drawing_Canvas* canvas, const char* str, const OH_Drawing_Font* font, float x, float y ) 3273``` 3274 3275**描述** 3276 3277用于绘制单个字符。当前字型中的字体不支持待绘制字符时,退化到使用系统字体绘制字符。 3278 3279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3280 3281**起始版本:** 12 3282 3283**参数:** 3284 3285| 名称 | 描述 | 3286| -------- | -------- | 3287| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3288| str | 待绘制的单个字符。可以传入字符串,但只会以UTF-8编码解析并绘制字符串中的首个字符。 | 3289| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3290| x | 字符对象基线左端点(靠近字符左下角)的横坐标。 | 3291| y | 字符对象基线左端点(靠近字符左下角)的纵坐标。 | 3292 3293**返回:** 3294 3295函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas、str、font任意一个为NULL或者str的长度为0。 3296 3297 3298 3299### OH_Drawing_FontMeasureSingleCharacter() 3300 3301``` 3302OH_Drawing_ErrorCode OH_Drawing_FontMeasureSingleCharacter (const OH_Drawing_Font* font, const char* str, float* textWidth ) 3303``` 3304 3305**描述** 3306 3307用于测量单个字符的宽度。当前字型中的字体不支持待测量字符时,退化到使用系统字体测量字符宽度。 3308 3309**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3310 3311**起始版本:** 12 3312 3313**参数:** 3314 3315| 名称 | 描述 | 3316| -------- | -------- | 3317| font | 指向字型对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3318| str | 待测量的单个字符。可以传入字符串,但只会以UTF-8编码解析并测量字符串中的首个字符。 | 3319| textWidth | 用于存储得到的字符宽度。 | 3320 3321**返回:** 3322 3323函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font、str、textWidth任意一个为NULL或者str的长度为0。 3324 3325 3326 3327### OH_Drawing_TypographyPaintOnPath() 3328 3329``` 3330void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography* , OH_Drawing_Canvas* , OH_Drawing_Path* , double , double ) 3331``` 3332 3333**描述** 3334 3335沿路径绘制文本。 3336 3337**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3338 3339**起始版本:** 12 3340 3341**参数:** 3342 3343| 名称 | 描述 | 3344| -------- | -------- | 3345| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 3346| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由[OH_Drawing_CanvasCreate](#oh_drawing_canvascreate)获取。 | 3347| OH_Drawing_Path | 指向OH_Drawing_Path对象的指针,由[OH_Drawing_PathCreate](#oh_drawing_pathcreate)获取。 | 3348| double | 沿路径方向偏置,从路径起点向前为正,向后为负。 | 3349| double | 沿路径垂直方向偏置,沿路径方向左侧为负,右侧为正。 | 3350 3351 3352### OH_Drawing_RoundRectOffset() 3353 3354``` 3355OH_Drawing_ErrorCode OH_Drawing_RoundRectOffset (OH_Drawing_RoundRect* roundRect, float dx, float dy ) 3356``` 3357 3358**描述** 3359 3360用于将圆角矩形沿x轴方向和y轴方向平移指定距离。 3361 3362**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3363 3364**起始版本:** 12 3365 3366**参数:** 3367 3368| 名称 | 描述 | 3369| -------- | -------- | 3370| roundRect | 指向圆角矩形对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 | 3371| dx | x轴方向偏移量。 | 3372| dy | y轴方向偏移量。 | 3373 3374**返回:** 3375 3376函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数roundRect为空。 3377 3378 3379### OH_Drawing_PointGetX() 3380 3381``` 3382OH_Drawing_ErrorCode OH_Drawing_PointGetX (const OH_Drawing_Point* point, float* x ) 3383``` 3384 3385**描述** 3386 3387用于获取点的x轴坐标。 3388 3389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3390 3391**起始版本:** 12 3392 3393**参数:** 3394 3395| 名称 | 描述 | 3396| -------- | -------- | 3397| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3398| x | 表示点的x轴坐标。 | 3399 3400**返回:** 3401 3402函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者x为空。 3403 3404 3405### OH_Drawing_PointGetY() 3406 3407``` 3408OH_Drawing_ErrorCode OH_Drawing_PointGetY (const OH_Drawing_Point* point, float* y ) 3409``` 3410 3411**描述** 3412 3413用于获取点的y轴坐标。 3414 3415**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3416 3417**起始版本:** 12 3418 3419**参数:** 3420 3421| 名称 | 描述 | 3422| -------- | -------- | 3423| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3424| y | 表示点的y轴坐标。 | 3425 3426**返回:** 3427 3428函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point或者y为空。 3429 3430 3431### OH_Drawing_PointSet() 3432 3433``` 3434OH_Drawing_ErrorCode OH_Drawing_PointSet (OH_Drawing_Point* point, float x, float y ) 3435``` 3436 3437**描述** 3438 3439用于设置点的x轴和y轴坐标。 3440 3441**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3442 3443**起始版本:** 12 3444 3445**参数:** 3446 3447| 名称 | 描述 | 3448| -------- | -------- | 3449| point | 指向坐标点对象[OH_Drawing_Point](#oh_drawing_point)的指针。 | 3450| x | 表示点的x轴坐标。 | 3451| y | 表示点的y轴坐标。 | 3452 3453**返回:** 3454 3455函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数point为空。 3456 3457 3458### OH_Drawing_FontMeasureText() 3459 3460``` 3461OH_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 ) 3462``` 3463 3464**描述** 3465 3466用于获取文本的宽度和边界框。 3467 3468**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3469 3470**起始版本:** 12 3471 3472**参数:** 3473 3474| 名称 | 描述 | 3475| -------- | -------- | 3476| font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 3477| text | 指向文本的指针。 | 3478| byteLength | 表示以字节为单位的文本长度。 | 3479| encoding | 文本编码类型。 | 3480| bounds | 用于承载获取的边界框,可以为NULL。 | 3481| textWidth | 表示文本宽度。 | 3482 3483**返回:** 3484 3485函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数font,text,textWidth至少有一个为空, 或者byteLength为0。 3486 3487 3488### OH_Drawing_CanvasClipRegion() 3489 3490``` 3491OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion (OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region, OH_Drawing_CanvasClipOp clipOp ) 3492``` 3493 3494**描述** 3495 3496用于裁剪一个区域。 3497 3498**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3499 3500**起始版本:** 12 3501 3502**参数:** 3503 3504| 名称 | 描述 | 3505| -------- | -------- | 3506| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3507| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 3508| clipOp | 表示裁剪类型。 | 3509 3510**返回:** 3511 3512函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者region为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示clipOp不在枚举范围内。 3513 3514 3515### OH_Drawing_CanvasDrawColor() 3516 3517``` 3518OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor (OH_Drawing_Canvas* canvas, uint32_t color, OH_Drawing_BlendMode blendMode ) 3519``` 3520 3521**描述** 3522 3523用于使用指定的颜色及混合模式来填充整个画布。 3524 3525**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3526 3527**起始版本:** 12 3528 3529**参数:** 3530 3531| 名称 | 描述 | 3532| -------- | -------- | 3533| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3534| color | 表示指定的颜色。 | 3535| blendMode | 表示指定的混合模式。 | 3536 3537**返回:** 3538 3539函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas为空。返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示blendMode不在枚举范围内。 3540 3541 3542### OH_Drawing_CanvasGetImageInfo() 3543 3544``` 3545OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo (OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo ) 3546``` 3547 3548**描述** 3549 3550用于获取画布的图像信息。 3551 3552**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3553 3554**起始版本:** 12 3555 3556**参数:** 3557 3558| 名称 | 描述 | 3559| -------- | -------- | 3560| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3561| imageInfo | 指向图像信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 3562 3563**返回:** 3564 3565函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者imageInfo为空。 3566 3567 3568### OH_Drawing_CanvasIsClipEmpty() 3569 3570``` 3571OH_Drawing_ErrorCode OH_Drawing_CanvasIsClipEmpty (OH_Drawing_Canvas* canvas, bool* isClipEmpty ) 3572``` 3573 3574**描述** 3575 3576用于判断裁剪后可绘制区域是否为空。 3577 3578**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3579 3580**起始版本:** 12 3581 3582**参数:** 3583 3584| 名称 | 描述 | 3585| -------- | -------- | 3586| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3587| isClipEmpty | 表示裁剪后可绘制区域是否为空。true表示为空,false表示不为空。 | 3588 3589**返回:** 3590 3591函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者isClipEmpty为空。 3592 3593 3594### OH_Drawing_CanvasDrawPoint() 3595 3596``` 3597OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint (OH_Drawing_Canvas* canvas, const OH_Drawing_Point2D* point ) 3598``` 3599 3600**描述** 3601 3602用于画一个点。 3603 3604**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3605 3606**起始版本:** 12 3607 3608**参数:** 3609 3610| 名称 | 描述 | 3611| -------- | -------- | 3612| canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 3613| point | 指向点对象[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)的指针。 | 3614 3615**返回:** 3616 3617函数返回执行错误码。 返回OH_DRAWING_SUCCESS,表示执行成功。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数canvas或者point为空。 3618 3619 3620### OH_Drawing_MatrixGetAll() 3621 3622``` 3623OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll (OH_Drawing_Matrix* matrix, float value[9] ) 3624``` 3625 3626**描述** 3627 3628获取矩阵所有元素值。 3629 3630**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3631 3632**起始版本:** 12 3633 3634**参数:** 3635 3636| 名称 | 描述 | 3637| -------- | -------- | 3638| matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 3639| value | 用于存储得到的矩阵元素值的数组。 | 3640 3641**返回:** 3642 3643返回错误码。 返回OH_DRAWING_SUCCESS,表示成功获取矩阵的所有元素值。 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示获取矩阵元素值失败,原因是矩阵对象或者存储矩阵元素值数组为空。 3644 3645 3646 3647### OH_Drawing_ErrorCodeGet() 3648 3649``` 3650OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet () 3651``` 3652 3653**描述** 3654 3655获取本模块的错误码。 3656 3657**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3658 3659**起始版本:** 12 3660 3661**返回:** 3662 3663函数返回错误码枚举值。 3664 3665### OH_Drawing_BrushCopy() 3666 3667``` 3668OH_Drawing_Brush* OH_Drawing_BrushCopy (OH_Drawing_Brush* brush) 3669``` 3670 3671**描述** 3672 3673创建一个画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush),用于拷贝一个已有画刷对象。 3674 3675本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3676 3677执行成功时返回OH_DRAWING_SUCCESS; 3678 3679brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3680 3681**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3682 3683**起始版本:** 12 3684 3685**参数:** 3686 3687| 名称 | 描述 | 3688| -------- | -------- | 3689| brush | 指向画刷对象的指针。 | 3690 3691**返回:** 3692 3693函数会返回一个指针,指针指向创建的画刷对象副本[OH_Drawing_Brush](#oh_drawing_brush)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是brush为NULL。 3694 3695 3696 3697### OH_Drawing_FilterSetImageFilter() 3698 3699``` 3700void OH_Drawing_FilterSetImageFilter (OH_Drawing_Filter* , OH_Drawing_ImageFilter* ) 3701``` 3702 3703**描述** 3704 3705为滤波器对象设置图像滤波器对象。 3706 3707本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3708 3709执行成功时返回OH_DRAWING_SUCCESS; 3710 3711OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3712 3713**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3714 3715**起始版本:** 12 3716 3717**参数:** 3718 3719| 名称 | 描述 | 3720| -------- | -------- | 3721| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 3722| OH_Drawing_ImageFilter | 指示指向图像滤波器[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)对象的指针,为NULL表示清空滤波器对象中的图像滤波器效果。 | 3723 3724 3725### OH_Drawing_ImageFilterCreateBlur() 3726 3727``` 3728OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur (float sigmaX, float sigmaY, OH_Drawing_TileMode , OH_Drawing_ImageFilter* input ) 3729``` 3730 3731**描述** 3732 3733创建具有模糊效果的图像滤波器。 3734 3735**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3736 3737**起始版本:** 12 3738 3739**参数:** 3740 3741| 名称 | 描述 | 3742| -------- | -------- | 3743| sigmaX | 表示沿x轴方向上高斯模糊的方差。 | 3744| sigmaY | 表示沿y轴方向上高斯模糊的方差。 | 3745| OH_Drawing_TileMode | 图像滤波器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 3746| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 | 3747 3748**返回:** 3749 3750函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。 3751 3752 3753### OH_Drawing_ImageFilterCreateFromColorFilter() 3754 3755``` 3756OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter (OH_Drawing_ColorFilter* colorFilter, OH_Drawing_ImageFilter* input ) 3757``` 3758 3759**描述** 3760 3761创建具有颜色变换效果的图像滤波器。 3762 3763本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3764 3765执行成功时返回OH_DRAWING_SUCCESS; 3766 3767colorFilter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3768 3769**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3770 3771**起始版本:** 12 3772 3773**参数:** 3774 3775| 名称 | 描述 | 3776| -------- | -------- | 3777| colorFilter | 指向具有颜色变换效果的颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)。 | 3778| input | 表示将要和当前图像滤波器叠加的输入滤波器, 如果为NULL,表示直接将当前图像滤波器作用于原始图像。 | 3779 3780**返回:** 3781 3782函数会返回一个指针,指针指向创建的图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是colorFilter为NULL。 3783 3784 3785### OH_Drawing_ImageFilterDestroy() 3786 3787``` 3788void OH_Drawing_ImageFilterDestroy (OH_Drawing_ImageFilter* ) 3789``` 3790 3791**描述** 3792 3793销毁图像滤波器对象并回收该对象占有内存。 3794 3795**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3796 3797**起始版本:** 12 3798 3799**参数:** 3800 3801| 名称 | 描述 | 3802| -------- | -------- | 3803| OH_Drawing_ImageFilter | 指向图像滤波器对象[OH_Drawing_ImageFilter](#oh_drawing_imagefilter)的指针。 | 3804 3805 3806### OH_Drawing_MatrixMapPoints() 3807 3808``` 3809void OH_Drawing_MatrixMapPoints (const OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count ) 3810``` 3811 3812**描述** 3813 3814通过矩阵变换将源点数组映射到目标点数组。 3815 3816本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3817 3818执行成功时返回OH_DRAWING_SUCCESS; 3819 3820OH_Drawing_Matrix、src、dst任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3821 3822**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3823 3824**起始版本:** 12 3825 3826**参数:** 3827 3828| 名称 | 描述 | 3829| -------- | -------- | 3830| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 3831| src | 源点数组。 | 3832| dst | 目标点数组,个数要与源点相等。 | 3833| count | 源点数组以及目标点数组的个数。 | 3834 3835 3836### OH_Drawing_MatrixMapRect() 3837 3838``` 3839bool OH_Drawing_MatrixMapRect (const OH_Drawing_Matrix* , const OH_Drawing_Rect* src, OH_Drawing_Rect* dst ) 3840``` 3841 3842**描述** 3843 3844将目标矩形设置为一个新的矩形,该矩形是能够包围源矩形的四个顶点通过矩阵变换映射后形成的新顶点的最小矩形。 3845 3846本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3847 3848执行成功时返回OH_DRAWING_SUCCESS; 3849 3850OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3851 3852**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3853 3854**起始版本:** 12 3855 3856**参数:** 3857 3858| 名称 | 描述 | 3859| -------- | -------- | 3860| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 3861| src | 源矩形。 | 3862| dst | 目标矩形。 | 3863 3864**返回:** 3865 3866函数返回源矩形与映射后的目标矩形是否相等。true表示相等,false表示不相等。 3867 3868 3869### OH_Drawing_PathAddPolygon() 3870 3871``` 3872void OH_Drawing_PathAddPolygon (OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed ) 3873``` 3874 3875**描述** 3876 3877向路径添加多边形。 3878 3879本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3880 3881执行成功时返回OH_DRAWING_SUCCESS; 3882 3883path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3884 3885**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3886 3887**起始版本:** 12 3888 3889**参数:** 3890 3891| 名称 | 描述 | 3892| -------- | -------- | 3893| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 3894| points | 表示多边形的顶点坐标数组。 | 3895| count | 表示多边形顶点坐标数组的大小。 | 3896| isClosed | 是否添加连接起始点和终止点的线,true表示添加,false表示不添加。 | 3897 3898 3899### OH_Drawing_PathAddCircle() 3900 3901``` 3902void OH_Drawing_PathAddCircle (OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection ) 3903``` 3904 3905**描述** 3906 3907按指定方向,向路径添加圆形。 3908 3909本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3910 3911执行成功时返回OH_DRAWING_SUCCESS; 3912 3913path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 3914 3915radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE; 3916 3917OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 3918 3919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3920 3921**起始版本:** 12 3922 3923**参数:** 3924 3925| 名称 | 描述 | 3926| -------- | -------- | 3927| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 3928| x | 表示圆心的x轴坐标。 | 3929| y | 表示圆心的y轴坐标。 | 3930| radius | 表示圆形的半径。 | 3931| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 3932 3933 3934### OH_Drawing_PathBuildFromSvgString() 3935 3936``` 3937bool OH_Drawing_PathBuildFromSvgString (OH_Drawing_Path* path, const char* str ) 3938``` 3939 3940**描述** 3941 3942解析SVG字符串表示的路径。 3943 3944本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3945 3946执行成功时返回OH_DRAWING_SUCCESS; 3947 3948path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3949 3950**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3951 3952**起始版本:** 12 3953 3954**参数:** 3955 3956| 名称 | 描述 | 3957| -------- | -------- | 3958| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 3959| str | 表示SVG字符串。 | 3960 3961**返回:** 3962 3963函数返回解析SVG字符串是否成功。true表示成功,false表示不成功。 3964 3965 3966### OH_Drawing_PathGetBounds() 3967 3968``` 3969void OH_Drawing_PathGetBounds (OH_Drawing_Path* , OH_Drawing_Rect* ) 3970``` 3971 3972**描述** 3973 3974获取包含路径的最小边界框。 3975 3976本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 3977 3978执行成功时返回OH_DRAWING_SUCCESS; 3979 3980OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 3981 3982**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 3983 3984**起始版本:** 12 3985 3986**参数:** 3987 3988| 名称 | 描述 | 3989| -------- | -------- | 3990| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 3991| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 3992 3993 3994### OH_Drawing_PathIsClosed() 3995 3996``` 3997bool OH_Drawing_PathIsClosed (OH_Drawing_Path* path, bool forceClosed ) 3998``` 3999 4000**描述** 4001 4002获取路径是否闭合。 4003 4004本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4005 4006执行成功时返回OH_DRAWING_SUCCESS; 4007 4008path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4009 4010**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4011 4012**起始版本:** 12 4013 4014**参数:** 4015 4016| 名称 | 描述 | 4017| -------- | -------- | 4018| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4019| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4020 4021**返回:** 4022 4023返回路径是否闭合。true表示路径的测量结果为已闭合,false表示路径的测量结果为未闭合。 4024 4025 4026### OH_Drawing_PathGetPositionTangent() 4027 4028``` 4029bool OH_Drawing_PathGetPositionTangent (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent ) 4030``` 4031 4032**描述** 4033 4034获取距路径起始点指定距离的坐标点和切线值。 4035 4036本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4037 4038执行成功时返回OH_DRAWING_SUCCESS; 4039 4040path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4041 4042**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4043 4044**起始版本:** 12 4045 4046**参数:** 4047 4048| 名称 | 描述 | 4049| -------- | -------- | 4050| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4051| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4052| distance | 表示距离起始点的距离。 | 4053| position | 表示距路径起始点指定距离的坐标点。 | 4054| tangent | 表示距路径起始点指定距离的切线值。 | 4055 4056**返回:** 4057 4058返回测量是否成功。true表示成功,false表示失败。 4059 4060 4061### OH_Drawing_PathOp() 4062 4063``` 4064bool OH_Drawing_PathOp (OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op ) 4065``` 4066 4067**描述** 4068 4069将两个路径按照指定的路径操作类型合并。 4070 4071本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4072 4073执行成功时返回OH_DRAWING_SUCCESS; 4074 4075path、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4076 4077op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4078 4079**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4080 4081**起始版本:** 12 4082 4083**参数:** 4084 4085| 名称 | 描述 | 4086| -------- | -------- | 4087| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,操作完成后的路径结果将会保存在此路径对象中。 | 4088| other | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4089| op | 路径操作枚举类型,支持可选的具体模式可见[OH_Drawing_PathOpMode](#oh_drawing_pathopmode)枚举。 | 4090 4091**返回:** 4092 4093返回操作后的路径是否为空。true表示路径不为空,false表示路径为空。 4094 4095 4096### OH_Drawing_PathGetMatrix() 4097 4098``` 4099bool OH_Drawing_PathGetMatrix (OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag ) 4100``` 4101 4102**描述** 4103 4104获取距路径起始点指定距离的相应变换矩阵。 4105 4106本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4107 4108执行成功时返回OH_DRAWING_SUCCESS; 4109 4110path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4111 4112flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4113 4114**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4115 4116**起始版本:** 12 4117 4118**参数:** 4119 4120| 名称 | 描述 | 4121| -------- | -------- | 4122| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4123| forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 | 4124| distance | 表示距离起始点的距离。 | 4125| matrix | 表示要获取的变换矩阵。 | 4126| flag | 矩阵信息维度枚举,支持可选的具体模式可见[OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags)枚举。 | 4127 4128**返回:** 4129 4130返回获取变换矩阵是否成功。true表示获取成功,false表示获取失败,失败的原因可能是path为NULL或者长度为0。 4131 4132 4133### OH_Drawing_PenGetFillPath() 4134 4135``` 4136bool OH_Drawing_PenGetFillPath (OH_Drawing_Pen* , const OH_Drawing_Path* src, OH_Drawing_Path* dst, const OH_Drawing_Rect* , const OH_Drawing_Matrix* ) 4137``` 4138 4139**描述** 4140 4141获取使用画笔绘制的源路径轮廓,并用目标路径表示。 4142 4143本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4144 4145执行成功时返回OH_DRAWING_SUCCESS; 4146 4147OH_Drawing_Pen、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4148 4149**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4150 4151**起始版本:** 12 4152 4153**参数:** 4154 4155| 名称 | 描述 | 4156| -------- | -------- | 4157| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 4158| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4159| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4160| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,推荐使用NULL。 | 4161| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,推荐使用NULL, 默认是一个单位矩阵。 | 4162 4163**返回:** 4164 4165获取目标路径是否成功。true表示获取成功,false表示获取失败。 4166 4167 4168### OH_Drawing_PenCopy() 4169 4170``` 4171OH_Drawing_Pen* OH_Drawing_PenCopy (OH_Drawing_Pen* pen) 4172``` 4173 4174**描述** 4175 4176创建一个画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen),用于拷贝一个已有画笔对象。 4177 4178本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4179 4180执行成功时返回OH_DRAWING_SUCCESS; 4181 4182pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4183 4184**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4185 4186**起始版本:** 12 4187 4188**参数:** 4189 4190| 名称 | 描述 | 4191| -------- | -------- | 4192| pen | 指向画笔对象的指针。 | 4193 4194**返回:** 4195 4196函数会返回一个指针,指针指向创建的画笔对象副本[OH_Drawing_Pen](#oh_drawing_pen)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是pen为NULL。 4197 4198 4199### OH_Drawing_PixelMapGetFromNativePixelMap() 4200 4201``` 4202OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap (NativePixelMap_* ) 4203``` 4204 4205**描述** 4206 4207从图像框架定义的像素图对象中获取本模块定义的像素图对象。 4208 4209**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4210 4211**起始版本:** 12 4212 4213**参数:** 4214 4215| 名称 | 描述 | 4216| -------- | -------- | 4217| NativePixelMap_ | 指向图像框架定义的像素图对象**NativePixelMap_**的指针。 | 4218 4219**返回:** 4220 4221函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是NativePixelMap_为NULL。 4222 4223 4224### OH_Drawing_PixelMapGetFromOhPixelMapNative() 4225 4226``` 4227OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative (OH_PixelmapNative* ) 4228``` 4229 4230**描述** 4231 4232从图像框架定义的像素图对象中获取本模块定义的像素图对象。 4233 4234**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4235 4236**起始版本:** 12 4237 4238**参数:** 4239 4240| 名称 | 描述 | 4241| -------- | -------- | 4242| OH_PixelmapNative | 指向图像框架定义的像素图对象**OH_PixelmapNative**的指针。 | 4243 4244**返回:** 4245 4246函数会返回一个指向本模块定义的像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。如果对象返回NULL,表示创建失败; 可能的原因是OH_PixelmapNative为NULL。 4247 4248 4249### OH_Drawing_PixelMapDissolve() 4250 4251``` 4252void OH_Drawing_PixelMapDissolve (OH_Drawing_PixelMap* ) 4253``` 4254 4255**描述** 4256 4257解除本模块定义的像素图对象和图像框架定义的像素图对象之间的关系,该关系通过调用 [OH_Drawing_PixelMapGetFromNativePixelMap](#oh_drawing_pixelmapgetfromnativepixelmap)或[OH_Drawing_PixelMapGetFromOhPixelMapNative](#oh_drawing_pixelmapgetfromohpixelmapnative)建立。 4258 4259**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4260 4261**起始版本:** 12 4262 4263**参数:** 4264 4265| 名称 | 描述 | 4266| -------- | -------- | 4267| OH_Drawing_PixelMap | 指向像素图对象[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 | 4268 4269 4270### OH_Drawing_RectJoin() 4271 4272``` 4273bool OH_Drawing_RectJoin (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 4274``` 4275 4276**描述** 4277 4278将两个矩形取并集。 4279 4280本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4281 4282执行成功时返回OH_DRAWING_SUCCESS; 4283 4284rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4285 4286**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4287 4288**起始版本:** 12 4289 4290**参数:** 4291 4292| 名称 | 描述 | 4293| -------- | -------- | 4294| rect | 指向矩形对象的指针。 | 4295| other | 指向矩形对象的指针。 | 4296 4297**返回:** 4298 4299返回两个矩形取并集的结果。true表示成功,false表示失败,失败的原因可能是两个矩形至少有一个为NULL或者other矩形大小为空。 4300 4301 4302### OH_Drawing_RegionContains() 4303 4304``` 4305bool OH_Drawing_RegionContains (OH_Drawing_Region* region, int32_t x, int32_t y ) 4306``` 4307 4308**描述** 4309 4310判断区域是否包含指定坐标点。 4311 4312本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4313 4314执行成功时返回OH_DRAWING_SUCCESS; 4315 4316region为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4317 4318**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4319 4320**起始版本:** 12 4321 4322**参数:** 4323 4324| 名称 | 描述 | 4325| -------- | -------- | 4326| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4327| int32_t | 表示指定坐标点的x轴坐标。 | 4328| int32_t | 表示指定坐标点的y轴坐标。 | 4329 4330**返回:** 4331 4332返回区域是否包含指定坐标点。true表示区域包含该坐标点,false表示区域不包含该坐标点。 4333 4334 4335### OH_Drawing_RegionOp() 4336 4337``` 4338bool OH_Drawing_RegionOp (OH_Drawing_Region* region, const OH_Drawing_Region* other, OH_Drawing_RegionOpMode op ) 4339``` 4340 4341**描述** 4342 4343将两个区域按照指定的区域操作类型合并。 4344 4345本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4346 4347执行成功时返回OH_DRAWING_SUCCESS; 4348 4349region、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4350 4351op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4352 4353**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4354 4355**起始版本:** 12 4356 4357**参数:** 4358 4359| 名称 | 描述 | 4360| -------- | -------- | 4361| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针,操作完成后的区域结果将会保存在此区域对象中。 | 4362| other | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4363| op | 区域操作枚举类型,支持可选的具体模式可见[OH_Drawing_RegionOpMode](#oh_drawing_regionopmode)枚举。 | 4364 4365**返回:** 4366 4367返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。 4368 4369 4370### OH_Drawing_RegionSetPath() 4371 4372``` 4373bool OH_Drawing_RegionSetPath (OH_Drawing_Region* region, const OH_Drawing_Path* path, const OH_Drawing_Region* clip ) 4374``` 4375 4376**描述** 4377 4378给区域对象设置为指定区域内路径表示的范围。 4379 4380本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4381 4382执行成功时返回OH_DRAWING_SUCCESS; 4383 4384region、path、clip任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4385 4386**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4387 4388**起始版本:** 12 4389 4390**参数:** 4391 4392| 名称 | 描述 | 4393| -------- | -------- | 4394| region | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4395| path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 4396| clip | 指向区域对象[OH_Drawing_Region](#oh_drawing_region)的指针。 | 4397 4398**返回:** 4399 4400返回操作后的区域是否为空。true表示区域不为空,false表示区域为空。 4401 4402 4403### OH_Drawing_ShaderEffectCreateColorShader() 4404 4405``` 4406OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader (const uint32_t color) 4407``` 4408 4409**描述** 4410 4411创建具有单一颜色的着色器。 4412 4413**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4414 4415**起始版本:** 12 4416 4417**参数:** 4418 4419| 名称 | 描述 | 4420| -------- | -------- | 4421| color | 表示着色器的颜色. | 4422 4423**返回:** 4424 4425函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空。 4426 4427 4428### OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix() 4429 4430``` 4431OH_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* ) 4432``` 4433 4434**描述** 4435 4436创建着色器,在两个指定点之间生成线性渐变。 4437 4438本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4439 4440执行成功时返回OH_DRAWING_SUCCESS; 4441 4442startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4443 4444OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4445 4446**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4447 4448**起始版本:** 12 4449 4450**参数:** 4451 4452| 名称 | 描述 | 4453| -------- | -------- | 4454| startPt | 表示渐变的起点。 | 4455| endPt | 表示渐变的终点。 | 4456| colors | 表示在两个点之间分布的颜色。 | 4457| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在起点和终点之间。 | 4458| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4459| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 4460| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4461 4462**返回:** 4463 4464函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。 4465 4466 4467### OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix() 4468 4469``` 4470OH_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* ) 4471``` 4472 4473**描述** 4474 4475创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 4476 4477本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4478 4479执行成功时返回OH_DRAWING_SUCCESS; 4480 4481centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4482 4483OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4484 4485**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4486 4487**起始版本:** 12 4488 4489**参数:** 4490 4491| 名称 | 描述 | 4492| -------- | -------- | 4493| centerPt | 表示渐变的圆心。 | 4494| radius | 表示渐变的半径。 | 4495| colors | 表示在径向上分布的颜色。 | 4496| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在径向上。 | 4497| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4498| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode)枚举。 | 4499| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4500 4501**返回:** 4502 4503函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是centerPt、colors至少一个为NULL。 4504 4505 4506### OH_Drawing_ShaderEffectCreateTwoPointConicalGradient() 4507 4508``` 4509OH_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* ) 4510``` 4511 4512**描述** 4513 4514创建着色器,在给定两个圆之间生成渐变。 4515 4516本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4517 4518执行成功时返回OH_DRAWING_SUCCESS; 4519 4520startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4521 4522OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4523 4524**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4525 4526**起始版本:** 12 4527 4528**参数:** 4529 4530| 名称 | 描述 | 4531| -------- | -------- | 4532| startPt | 表示渐变的起点圆心。 | 4533| startRadius | 表示渐变的起点半径。 | 4534| endPt | 表示渐变的终点圆心。 | 4535| endRadius | 表示渐变的终点半径。 | 4536| colors | 表示在两个圆之间分布的颜色。 | 4537| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL, 颜色均匀分布在两个圆之间。 | 4538| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 4539| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 4540| OH_Drawing_Matrix | 表示作用于着色器上的矩阵变换,如果matrix是NULL, 默认是一个单位矩阵。 | 4541 4542**返回:** 4543 4544函数会返回一个指针,指针指向创建的着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)。如果对象返回NULL,表示创建失败; 可能的原因是可用内存为空,或者是startPt、endPt、colors至少一个为NULL。 4545 4546 4547 4548### OH_Drawing_TextBlobUniqueID() 4549 4550``` 4551uint32_t OH_Drawing_TextBlobUniqueID (const OH_Drawing_TextBlob* ) 4552``` 4553 4554**描述** 4555 4556获取文本的标识符,该标识符是唯一的非零值。 4557 4558本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4559 4560执行成功时返回OH_DRAWING_SUCCESS; 4561 4562OH_Drawing_TextBlob为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4563 4564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4565 4566**起始版本:** 12 4567 4568**参数:** 4569 4570| 名称 | 描述 | 4571| -------- | -------- | 4572| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 | 4573 4574**返回:** 4575 4576返回文本对象的标识符。 4577 4578 4579### OH_Drawing_PenSetShadowLayer() 4580 4581``` 4582void OH_Drawing_PenSetShadowLayer (OH_Drawing_Pen* , OH_Drawing_ShadowLayer* ) 4583``` 4584 4585**描述** 4586 4587设置画笔阴影层效果,设置的阴影层效果当前仅在绘制文字时生效。 4588 4589本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4590 4591执行成功时返回OH_DRAWING_SUCCESS; 4592 4593OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4594 4595**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4596 4597**起始版本:** 12 4598 4599**参数:** 4600 4601| 名称 | 描述 | 4602| -------- | -------- | 4603| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 4604| OH_Drawing_ShadowLayer | 指向阴影层对象[OH_Drawing_ShadowLayer](#oh_drawing_shadowlayer)的指针,为NULL表示清空阴影层效果。 | 4605 4606 4607### OH_Drawing_BrushSetShadowLayer() 4608 4609``` 4610void OH_Drawing_BrushSetShadowLayer (OH_Drawing_Brush* , OH_Drawing_ShadowLayer* ) 4611``` 4612 4613**描述** 4614 4615为画刷设置阴影层,设置的阴影层效果当前仅在绘制文字时生效。 4616 4617本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4618 4619执行成功时返回OH_DRAWING_SUCCESS; 4620 4621OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4622 4623**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4624 4625**起始版本:** 12 4626 4627**参数:** 4628 4629| 名称 | 描述 | 4630| -------- | -------- | 4631| OH_Drawing_Brush | 指向画刷对象的指针。 | 4632| OH_Drawing_ShadowLayer | 表示指向阴影层的指针,为NULL表示清空画刷的阴影层效果。 | 4633 4634 4635### OH_Drawing_ShadowLayerCreate() 4636 4637``` 4638OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate (float blurRadius, float x, float y, uint32_t color ) 4639``` 4640 4641**描述** 4642 4643创建一个阴影层对象。 4644 4645本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4646 4647执行成功时返回OH_DRAWING_SUCCESS; 4648 4649blurRadius小于0等于时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4650 4651**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4652 4653**起始版本:** 12 4654 4655**参数:** 4656 4657| 名称 | 描述 | 4658| -------- | -------- | 4659| blurRadius | 表示阴影的半径,必须大于零。 | 4660| x | 表示x轴上的偏移点。 | 4661| y | 表示y轴上的偏移点。 | 4662| color | 表示阴影的颜色。 | 4663 4664**返回:** 4665 4666返回创建的阴影层对象的指针。 4667 4668 4669### OH_Drawing_ShadowLayerDestroy() 4670 4671``` 4672void OH_Drawing_ShadowLayerDestroy (OH_Drawing_ShadowLayer* ) 4673``` 4674 4675**描述** 4676 4677销毁阴影层对象,并收回该对象占用的内存。 4678 4679**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4680 4681**起始版本:** 12 4682 4683**参数:** 4684 4685| 名称 | 描述 | 4686| -------- | -------- | 4687| OH_Drawing_ShadowLayer | 表示指向阴影层对象的指针。 | 4688 4689 4690### OH_Drawing_FontSetBaselineSnap() 4691 4692``` 4693void OH_Drawing_FontSetBaselineSnap (OH_Drawing_Font* , bool baselineSnap ) 4694``` 4695 4696**描述** 4697 4698当前画布矩阵轴对齐时,将字形基线设置为是否与像素对齐。 4699 4700本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4701 4702执行成功时返回OH_DRAWING_SUCCESS; 4703 4704OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4705 4706**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4707 4708**起始版本:** 12 4709 4710**参数:** 4711 4712| 名称 | 描述 | 4713| -------- | -------- | 4714| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4715| baselineSnap | 指示字形基线是否和像素对齐,true表示对齐,false表示不对齐。 | 4716 4717 4718### OH_Drawing_FontIsBaselineSnap() 4719 4720``` 4721bool OH_Drawing_FontIsBaselineSnap (const OH_Drawing_Font* ) 4722``` 4723 4724**描述** 4725 4726当前画布矩阵轴对齐时,获取字形基线是否与像素对齐。 4727 4728本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4729 4730执行成功时返回OH_DRAWING_SUCCESS; 4731 4732OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4733 4734**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4735 4736**起始版本:** 12 4737 4738**参数:** 4739 4740| 名称 | 描述 | 4741| -------- | -------- | 4742| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4743 4744**返回:** 4745 4746返回字形基线是否与像素对齐,true为对齐,false为没有对齐。 4747 4748 4749### OH_Drawing_FontSetEdging() 4750 4751``` 4752void OH_Drawing_FontSetEdging (OH_Drawing_Font* , OH_Drawing_FontEdging ) 4753``` 4754 4755**描述** 4756 4757用于设置字形边缘效果。 4758 4759本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4760 4761执行成功时返回OH_DRAWING_SUCCESS; 4762 4763OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 4764 4765OH_Drawing_FontEdging不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 4766 4767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4768 4769**起始版本:** 12 4770 4771**参数:** 4772 4773| 名称 | 描述 | 4774| -------- | -------- | 4775| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4776| OH_Drawing_FontEdging | 字形边缘效果。 | 4777 4778 4779### OH_Drawing_FontGetEdging() 4780 4781``` 4782OH_Drawing_FontEdging OH_Drawing_FontGetEdging (const OH_Drawing_Font* ) 4783``` 4784 4785**描述** 4786 4787获取字形边缘效果。 4788 4789本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4790 4791执行成功时返回OH_DRAWING_SUCCESS; 4792 4793OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4794 4795**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4796 4797**起始版本:** 12 4798 4799**参数:** 4800 4801| 名称 | 描述 | 4802| -------- | -------- | 4803| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4804 4805**返回:** 4806 4807返回字形边缘效果。 4808 4809 4810 4811### OH_Drawing_FontSetForceAutoHinting() 4812 4813``` 4814void OH_Drawing_FontSetForceAutoHinting (OH_Drawing_Font* , bool isForceAutoHinting ) 4815``` 4816 4817**描述** 4818 4819用于设置是否自动调整字形轮廓。 4820 4821本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4822 4823执行成功时返回OH_DRAWING_SUCCESS; 4824 4825OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4826 4827**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4828 4829**起始版本:** 12 4830 4831**参数:** 4832 4833| 名称 | 描述 | 4834| -------- | -------- | 4835| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4836| isForceAutoHinting | 是否自动调整字形轮廓,true为自动调整,false为不自动调整。 | 4837 4838 4839### OH_Drawing_FontIsForceAutoHinting() 4840 4841``` 4842bool OH_Drawing_FontIsForceAutoHinting (const OH_Drawing_Font* ) 4843``` 4844 4845**描述** 4846 4847获取字形轮廓是否自动调整。 4848 4849本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4850 4851执行成功时返回OH_DRAWING_SUCCESS; 4852 4853OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4854 4855**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4856 4857**起始版本:** 12 4858 4859**参数:** 4860 4861| 名称 | 描述 | 4862| -------- | -------- | 4863| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4864 4865**返回:** 4866 4867返回字形轮廓是否自动调整,true为自动调整,false为不自动调整。 4868 4869 4870### OH_Drawing_FontSetSubpixel() 4871 4872``` 4873void OH_Drawing_FontSetSubpixel (OH_Drawing_Font* , bool isSubpixel ) 4874``` 4875 4876**描述** 4877 4878设置字形是否使用次像素渲染。 4879 4880本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4881 4882执行成功时返回OH_DRAWING_SUCCESS; 4883 4884OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4885 4886**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4887 4888**起始版本:** 12 4889 4890**参数:** 4891 4892| 名称 | 描述 | 4893| -------- | -------- | 4894| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4895| isSubpixel | 字形是否使用次像素渲染,true为使用,false为不使用。 | 4896 4897 4898### OH_Drawing_FontIsSubpixel() 4899 4900``` 4901bool OH_Drawing_FontIsSubpixel (const OH_Drawing_Font* ) 4902``` 4903 4904**描述** 4905 4906获取字形是否使用次像素渲染。 4907 4908本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4909 4910执行成功时返回OH_DRAWING_SUCCESS; 4911 4912OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4913 4914**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4915 4916**起始版本:** 12 4917 4918**参数:** 4919 4920| 名称 | 描述 | 4921| -------- | -------- | 4922| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4923 4924**返回:** 4925 4926返回字形是否使用次像素渲染,true为使用,false为不使用。 4927 4928 4929### OH_Drawing_FontGetTextSize() 4930 4931``` 4932float OH_Drawing_FontGetTextSize (const OH_Drawing_Font* ) 4933``` 4934 4935**描述** 4936 4937获取字形文本大小。 4938 4939本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4940 4941执行成功时返回OH_DRAWING_SUCCESS; 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### OH_Drawing_FontTextToGlyphs() 4961 4962``` 4963uint32_t OH_Drawing_FontTextToGlyphs (const OH_Drawing_Font* , const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount ) 4964``` 4965 4966**描述** 4967 4968用于将文本转换为字形索引。 4969 4970本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 4971 4972执行成功时返回OH_DRAWING_SUCCESS; 4973 4974OH_Drawing_Font、text、glyphs任意一个为NULL或者byteLength等于0或者maxGlyphCount小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 4975 4976**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 4977 4978**起始版本:** 12 4979 4980**参数:** 4981 4982| 名称 | 描述 | 4983| -------- | -------- | 4984| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 4985| text | 文本存储首地址。 | 4986| byteLength | 文本长度,单位为字节。 | 4987| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 4988| glyphs | 字形索引存储首地址,用于存储得到的字形索引。 | 4989| maxGlyphCount | 文本所表示的最大字符数量。 | 4990 4991**返回:** 4992 4993返回字形索引数量。 4994 4995 4996### OH_Drawing_FontGetWidths() 4997 4998``` 4999void OH_Drawing_FontGetWidths (const OH_Drawing_Font* , const uint16_t* glyphs, int count, float* widths ) 5000``` 5001 5002**描述** 5003 5004用于获取字符串中每个字符的宽度。 5005 5006本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5007 5008执行成功时返回OH_DRAWING_SUCCESS; 5009 5010OH_Drawing_Font、glyphs、widths任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5011 5012**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5013 5014**起始版本:** 12 5015 5016**参数:** 5017 5018| 名称 | 描述 | 5019| -------- | -------- | 5020| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5021| glyphs | 字形索引存储首地址。 | 5022| count | 字形索引的数量。 | 5023| widths | 字形宽度存储首地址,用于存储得到的字形宽度。 | 5024 5025 5026### OH_Drawing_FontIsLinearText() 5027 5028``` 5029bool OH_Drawing_FontIsLinearText (const OH_Drawing_Font* ) 5030``` 5031 5032**描述** 5033 5034获取字形是否使用线性缩放。 5035 5036本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5037 5038执行成功时返回OH_DRAWING_SUCCESS; 5039 5040OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5041 5042**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5043 5044**起始版本:** 12 5045 5046**参数:** 5047 5048| 名称 | 描述 | 5049| -------- | -------- | 5050| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5051 5052**返回:** 5053 5054返回字形是否使用线性缩放,true为使用,false为不使用。 5055 5056 5057### OH_Drawing_FontGetTextSkewX() 5058 5059``` 5060float OH_Drawing_FontGetTextSkewX (const OH_Drawing_Font* ) 5061``` 5062 5063**描述** 5064 5065获取字形文本在x轴上的倾斜度。 5066 5067本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5068 5069执行成功时返回OH_DRAWING_SUCCESS; 5070 5071OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5072 5073**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5074 5075**起始版本:** 12 5076 5077**参数:** 5078 5079| 名称 | 描述 | 5080| -------- | -------- | 5081| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5082 5083**返回:** 5084 5085返回一个浮点数,表示x轴上的文本倾斜度。 5086 5087 5088### OH_Drawing_FontIsFakeBoldText() 5089 5090``` 5091bool OH_Drawing_FontIsFakeBoldText (const OH_Drawing_Font* ) 5092``` 5093 5094**描述** 5095 5096获取是否增加笔画宽度以接近粗体字形。 5097 5098本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5099 5100执行成功时返回OH_DRAWING_SUCCESS; 5101 5102OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5103 5104**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5105 5106**起始版本:** 12 5107 5108**参数:** 5109 5110| 名称 | 描述 | 5111| -------- | -------- | 5112| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5113 5114**返回:** 5115 5116返回是否增加笔画宽度以接近粗体字形,true为增加,false为不增加。 5117 5118 5119### OH_Drawing_FontSetScaleX() 5120 5121``` 5122void OH_Drawing_FontSetScaleX (OH_Drawing_Font* , float scaleX ) 5123``` 5124 5125**描述** 5126 5127用于设置字形对象在x轴上的缩放比例。 5128 5129本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5130 5131执行成功时返回OH_DRAWING_SUCCESS; 5132 5133OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5134 5135**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5136 5137**起始版本:** 12 5138 5139**参数:** 5140 5141| 名称 | 描述 | 5142| -------- | -------- | 5143| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5144| scaleX | 文本在x轴上的缩放比例。 | 5145 5146 5147### OH_Drawing_FontGetScaleX() 5148 5149``` 5150float OH_Drawing_FontGetScaleX (const OH_Drawing_Font* ) 5151``` 5152 5153**描述** 5154 5155获取字形对象在x轴上的缩放比例。 5156 5157本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5158 5159执行成功时返回OH_DRAWING_SUCCESS; 5160 5161OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5162 5163**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5164 5165**起始版本:** 12 5166 5167**参数:** 5168 5169| 名称 | 描述 | 5170| -------- | -------- | 5171| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5172 5173**返回:** 5174 5175返回文本在x轴上的缩放比例。 5176 5177 5178### OH_Drawing_FontSetHinting() 5179 5180``` 5181void OH_Drawing_FontSetHinting (OH_Drawing_Font* , OH_Drawing_FontHinting ) 5182``` 5183 5184**描述** 5185 5186用于设置字形轮廓效果。 5187 5188本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5189 5190执行成功时返回OH_DRAWING_SUCCESS; 5191 5192OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 5193 5194OH_Drawing_FontHinting不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 5195 5196**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5197 5198**起始版本:** 12 5199 5200**参数:** 5201 5202| 名称 | 描述 | 5203| -------- | -------- | 5204| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5205| OH_Drawing_FontHinting | 字形轮廓枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 | 5206 5207 5208### OH_Drawing_FontGetHinting() 5209 5210``` 5211OH_Drawing_FontHinting OH_Drawing_FontGetHinting (const OH_Drawing_Font* ) 5212``` 5213 5214**描述** 5215 5216获取字形轮廓效果枚举类型。 5217 5218本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5219 5220执行成功时返回OH_DRAWING_SUCCESS; 5221 5222OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5223 5224**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5225 5226**起始版本:** 12 5227 5228**参数:** 5229 5230| 名称 | 描述 | 5231| -------- | -------- | 5232| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5233 5234**返回:** 5235 5236OH_Drawing_FontHinting 返回字形轮廓效果枚举类型[OH_Drawing_FontHinting](#oh_drawing_fonthinting)。 5237 5238 5239### OH_Drawing_FontSetEmbeddedBitmaps() 5240 5241``` 5242void OH_Drawing_FontSetEmbeddedBitmaps (OH_Drawing_Font* , bool isEmbeddedBitmaps ) 5243``` 5244 5245**描述** 5246 5247用于设置字形是否转换成位图处理。 5248 5249本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5250 5251执行成功时返回OH_DRAWING_SUCCESS; 5252 5253OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5254 5255**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5256 5257**起始版本:** 12 5258 5259**参数:** 5260 5261| 名称 | 描述 | 5262| -------- | -------- | 5263| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5264| isEmbeddedBitmaps | 设置字形是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 | 5265 5266 5267### OH_Drawing_FontIsEmbeddedBitmaps() 5268 5269``` 5270bool OH_Drawing_FontIsEmbeddedBitmaps (const OH_Drawing_Font* ) 5271``` 5272 5273**描述** 5274 5275获取字形是否转换成位图处理。 5276 5277本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5278 5279执行成功时返回OH_DRAWING_SUCCESS; 5280 5281OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5282 5283**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5284 5285**起始版本:** 12 5286 5287**参数:** 5288 5289| 名称 | 描述 | 5290| -------- | -------- | 5291| OH_Drawing_Font | 指向字形对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 5292 5293**返回:** 5294 5295返回字形是否转换成位图处理,true表示转换成位图处理,false表示不转换成位图处理。 5296 5297 5298### OH_Drawing_BitmapBuild() 5299 5300``` 5301void OH_Drawing_BitmapBuild (OH_Drawing_Bitmap* , const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat* ) 5302``` 5303 5304**描述** 5305 5306用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 5307 5308本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5309 5310执行成功时返回OH_DRAWING_SUCCESS; 5311 5312OH_Drawing_Bitmap、OH_Drawing_BitmapFormat任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5313 5314**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5315 5316**起始版本:** 8 5317 5318**参数:** 5319 5320| 名称 | 描述 | 5321| -------- | -------- | 5322| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5323| width | 位图要初始化设置的宽度。 | 5324| height | 位图要初始化设置的高度。 | 5325| [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md) | 位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 | 5326 5327 5328### OH_Drawing_BitmapCreate() 5329 5330``` 5331OH_Drawing_Bitmap* OH_Drawing_BitmapCreate (void ) 5332``` 5333 5334**描述** 5335 5336用于创建一个位图对象。 5337 5338**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5339 5340**起始版本:** 8 5341 5342**返回:** 5343 5344函数会返回一个指针,指针指向创建的位图对象。 5345 5346 5347### OH_Drawing_BitmapCreateFromPixels() 5348 5349``` 5350OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels (OH_Drawing_Image_Info* , void* pixels, uint32_t rowBytes ) 5351``` 5352 5353**描述** 5354 5355用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 5356 5357本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5358 5359执行成功时返回OH_DRAWING_SUCCESS; 5360 5361OH_Drawing_Image_Info、pixels任意一个为NULL或者rowBytes等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5362 5363**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5364 5365**起始版本:** 12 5366 5367**参数:** 5368 5369| 名称 | 描述 | 5370| -------- | -------- | 5371| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5372| pixels | 指向像素存储的内存首地址,内存由开发者申请,保证有效性。 | 5373| rowBytes | 每行像素的大小。 | 5374 5375**返回:** 5376 5377函数返回一个指针,指针指向创建的位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)。 5378 5379 5380### OH_Drawing_BitmapDestroy() 5381 5382``` 5383void OH_Drawing_BitmapDestroy (OH_Drawing_Bitmap* ) 5384``` 5385 5386**描述** 5387 5388用于销毁位图对象并回收该对象占有内存。 5389 5390**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5391 5392**起始版本:** 8 5393 5394**参数:** 5395 5396| 名称 | 描述 | 5397| -------- | -------- | 5398| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5399 5400 5401### OH_Drawing_BitmapGetAlphaFormat() 5402 5403``` 5404OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat (OH_Drawing_Bitmap* ) 5405``` 5406 5407**描述** 5408 5409用于获取指定位图的像素透明度分量。 5410 5411本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5412 5413执行成功时返回OH_DRAWING_SUCCESS; 5414 5415OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5416 5417**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5418 5419**起始版本:** 12 5420 5421**参数:** 5422 5423| 名称 | 描述 | 5424| -------- | -------- | 5425| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5426 5427**返回:** 5428 5429函数返回位图的像素透明度分量,支持格式参考[OH_Drawing_AlphaFormat](#oh_drawing_alphaformat)。 5430 5431 5432### OH_Drawing_BitmapGetColorFormat() 5433 5434``` 5435OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat (OH_Drawing_Bitmap* ) 5436``` 5437 5438**描述** 5439 5440用于获取指定位图的像素存储格式。 5441 5442本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5443 5444执行成功时返回OH_DRAWING_SUCCESS; 5445 5446OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5447 5448**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5449 5450**起始版本:** 12 5451 5452**参数:** 5453 5454| 名称 | 描述 | 5455| -------- | -------- | 5456| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5457 5458**返回:** 5459 5460函数返回位图的像素存储格式,支持格式参考[OH_Drawing_ColorFormat](#oh_drawing_colorformat)。 5461 5462 5463### OH_Drawing_BitmapGetHeight() 5464 5465``` 5466uint32_t OH_Drawing_BitmapGetHeight (OH_Drawing_Bitmap* ) 5467``` 5468 5469**描述** 5470 5471用于获取指定位图的高度。 5472 5473本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5474 5475执行成功时返回OH_DRAWING_SUCCESS; 5476 5477OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5478 5479**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5480 5481**起始版本:** 8 5482 5483**参数:** 5484 5485| 名称 | 描述 | 5486| -------- | -------- | 5487| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5488 5489**返回:** 5490 5491函数返回位图的高度。 5492 5493 5494### OH_Drawing_BitmapGetImageInfo() 5495 5496``` 5497void OH_Drawing_BitmapGetImageInfo (OH_Drawing_Bitmap* , OH_Drawing_Image_Info* ) 5498``` 5499 5500**描述** 5501 5502用于获取指定位图的信息。 5503 5504本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5505 5506执行成功时返回OH_DRAWING_SUCCESS; 5507 5508OH_Drawing_Bitmap、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5509 5510**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5511 5512**起始版本:** 12 5513 5514**参数:** 5515 5516| 名称 | 描述 | 5517| -------- | -------- | 5518| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 5519| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5520 5521 5522### OH_Drawing_BitmapGetPixels() 5523 5524``` 5525void* OH_Drawing_BitmapGetPixels (OH_Drawing_Bitmap* ) 5526``` 5527 5528**描述** 5529 5530用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 5531 5532本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5533 5534执行成功时返回OH_DRAWING_SUCCESS; 5535 5536OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5537 5538**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5539 5540**起始版本:** 8 5541 5542**参数:** 5543 5544| 名称 | 描述 | 5545| -------- | -------- | 5546| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5547 5548**返回:** 5549 5550函数返回位图的像素地址。 5551 5552 5553### OH_Drawing_BitmapGetWidth() 5554 5555``` 5556uint32_t OH_Drawing_BitmapGetWidth (OH_Drawing_Bitmap* ) 5557``` 5558 5559**描述** 5560 5561用于获取指定位图的宽度。 5562 5563本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5564 5565执行成功时返回OH_DRAWING_SUCCESS; 5566 5567OH_Drawing_Bitmap为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5568 5569**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5570 5571**起始版本:** 8 5572 5573**参数:** 5574 5575| 名称 | 描述 | 5576| -------- | -------- | 5577| OH_Drawing_Bitmap | 指向位图对象的指针。 | 5578 5579**返回:** 5580 5581函数返回位图的宽度。 5582 5583### OH_Drawing_BitmapReadPixels() 5584 5585``` 5586bool OH_Drawing_BitmapReadPixels (OH_Drawing_Bitmap* , const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY ) 5587``` 5588 5589**描述** 5590 5591将位图中的矩形区域像素数据读取到指定的内存缓冲区中。 5592 5593本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5594 5595执行成功时返回OH_DRAWING_SUCCESS; 5596 5597OH_Drawing_Bitmap、dstInfo、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5598 5599**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5600 5601**起始版本:** 12 5602 5603**参数:** 5604 5605| 名称 | 描述 | 5606| -------- | -------- | 5607| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 5608| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 5609| dstPixels | 目标像素存储区域。 | 5610| dstRowBytes | 目标像素数据每行的字节数,应大于或等于图片信息对象中的最小每行字节数。 | 5611| srcX | 源位图中读取像素数据的起始x轴坐标,应小于源位图的宽度。 | 5612| srcY | 源位图中读取像素数据的起始y轴坐标,应小于源位图的高度。 | 5613 5614**返回:** 5615 5616返回接口调用成功与否的结果。true表示复制成功,false表示复制失败。 5617 5618 5619### OH_Drawing_BrushCreate() 5620 5621``` 5622OH_Drawing_Brush* OH_Drawing_BrushCreate (void ) 5623``` 5624 5625**描述** 5626 5627用于创建一个画刷对象。 5628 5629**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5630 5631**起始版本:** 8 5632 5633**返回:** 5634 5635函数会返回一个指针,指针指向创建的画刷对象。 5636 5637 5638### OH_Drawing_BrushDestroy() 5639 5640``` 5641void OH_Drawing_BrushDestroy (OH_Drawing_Brush* ) 5642``` 5643 5644**描述** 5645 5646用于销毁画刷对象并回收该对象占有的内存。 5647 5648**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5649 5650**起始版本:** 8 5651 5652**参数:** 5653 5654| 名称 | 描述 | 5655| -------- | -------- | 5656| OH_Drawing_Brush | 指向画刷对象的指针。 | 5657 5658 5659### OH_Drawing_BrushGetAlpha() 5660 5661``` 5662uint8_t OH_Drawing_BrushGetAlpha (const OH_Drawing_Brush* ) 5663``` 5664 5665**描述** 5666 5667获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 5668 5669本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5670 5671执行成功时返回OH_DRAWING_SUCCESS; 5672 5673OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5674 5675**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5676 5677**起始版本:** 11 5678 5679**参数:** 5680 5681| 名称 | 描述 | 5682| -------- | -------- | 5683| OH_Drawing_Brush | 表示指向画刷对象的指针。 | 5684 5685**返回:** 5686 5687返回一个8位变量,用于表示透明度值。 5688 5689 5690### OH_Drawing_BrushGetColor() 5691 5692``` 5693uint32_t OH_Drawing_BrushGetColor (const OH_Drawing_Brush* ) 5694``` 5695 5696**描述** 5697 5698用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 5699 5700本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5701 5702执行成功时返回OH_DRAWING_SUCCESS; 5703 5704OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5705 5706**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5707 5708**起始版本:** 8 5709 5710**参数:** 5711 5712| 名称 | 描述 | 5713| -------- | -------- | 5714| OH_Drawing_Brush | 指向画刷对象的指针。 | 5715 5716**返回:** 5717 5718函数返回一个描述颜色的32位(ARGB)变量。 5719 5720 5721### OH_Drawing_BrushGetFilter() 5722 5723``` 5724void OH_Drawing_BrushGetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 5725``` 5726 5727**描述** 5728 5729从画刷获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 5730 5731本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5732 5733执行成功时返回OH_DRAWING_SUCCESS; 5734 5735OH_Drawing_Brush、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5736 5737**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5738 5739**起始版本:** 12 5740 5741**参数:** 5742 5743| 名称 | 描述 | 5744| -------- | -------- | 5745| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5746| OH_Drawing_Filter | 表示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 5747 5748 5749### OH_Drawing_BrushIsAntiAlias() 5750 5751``` 5752bool OH_Drawing_BrushIsAntiAlias (const OH_Drawing_Brush* ) 5753``` 5754 5755**描述** 5756 5757用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 5758 5759本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5760 5761执行成功时返回OH_DRAWING_SUCCESS; 5762 5763OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5764 5765**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5766 5767**起始版本:** 8 5768 5769**参数:** 5770 5771| 名称 | 描述 | 5772| -------- | -------- | 5773| OH_Drawing_Brush | 指向画刷对象的指针。 | 5774 5775**返回:** 5776 5777函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 5778 5779 5780### OH_Drawing_BrushReset() 5781 5782``` 5783void OH_Drawing_BrushReset (OH_Drawing_Brush* ) 5784``` 5785 5786**描述** 5787 5788将画刷重置至初始状态,清空所有已设置的属性。 5789 5790本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5791 5792执行成功时返回OH_DRAWING_SUCCESS; 5793 5794OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5795 5796**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5797 5798**起始版本:** 12 5799 5800**参数:** 5801 5802| 名称 | 描述 | 5803| -------- | -------- | 5804| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5805 5806 5807### OH_Drawing_BrushSetAlpha() 5808 5809``` 5810void OH_Drawing_BrushSetAlpha (OH_Drawing_Brush* , uint8_t alpha ) 5811``` 5812 5813**描述** 5814 5815为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 5816 5817本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5818 5819执行成功时返回OH_DRAWING_SUCCESS; 5820 5821OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5822 5823**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5824 5825**起始版本:** 11 5826 5827**参数:** 5828 5829| 名称 | 描述 | 5830| -------- | -------- | 5831| OH_Drawing_Brush | 指向画刷对象的指针。 | 5832| alpha | 表示要设置的透明度值,是一个8位变量。 | 5833 5834 5835### OH_Drawing_BrushSetAntiAlias() 5836 5837``` 5838void OH_Drawing_BrushSetAntiAlias (OH_Drawing_Brush* , bool ) 5839``` 5840 5841**描述** 5842 5843用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 5844 5845本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5846 5847执行成功时返回OH_DRAWING_SUCCESS; 5848 5849OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5850 5851**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5852 5853**起始版本:** 8 5854 5855**参数:** 5856 5857| 名称 | 描述 | 5858| -------- | -------- | 5859| OH_Drawing_Brush | 指向画刷对象的指针。 | 5860| bool | 真为抗锯齿,假则不做抗锯齿处理。 | 5861 5862 5863### OH_Drawing_BrushSetBlendMode() 5864 5865``` 5866void OH_Drawing_BrushSetBlendMode (OH_Drawing_Brush* , OH_Drawing_BlendMode ) 5867``` 5868 5869**描述** 5870 5871为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 5872 5873本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5874 5875执行成功时返回OH_DRAWING_SUCCESS; 5876 5877OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 5878 5879OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 5880 5881**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5882 5883**起始版本:** 12 5884 5885**参数:** 5886 5887| 名称 | 描述 | 5888| -------- | -------- | 5889| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针。 | 5890| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 5891 5892 5893### OH_Drawing_BrushSetColor() 5894 5895``` 5896void OH_Drawing_BrushSetColor (OH_Drawing_Brush* , uint32_t color ) 5897``` 5898 5899**描述** 5900 5901用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 5902 5903本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5904 5905执行成功时返回OH_DRAWING_SUCCESS; 5906 5907OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5908 5909**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5910 5911**起始版本:** 8 5912 5913**参数:** 5914 5915| 名称 | 描述 | 5916| -------- | -------- | 5917| OH_Drawing_Brush | 指向画刷对象的指针。 | 5918| color | 描述颜色的32位(ARGB)变量。 | 5919 5920 5921### OH_Drawing_BrushSetFilter() 5922 5923``` 5924void OH_Drawing_BrushSetFilter (OH_Drawing_Brush* , OH_Drawing_Filter* ) 5925``` 5926 5927**描述** 5928 5929为画刷设置滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 5930 5931本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5932 5933执行成功时返回OH_DRAWING_SUCCESS; 5934 5935OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5936 5937**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5938 5939**起始版本:** 11 5940 5941**参数:** 5942 5943| 名称 | 描述 | 5944| -------- | -------- | 5945| OH_Drawing_Brush | 指向画刷对象的指针。 | 5946| OH_Drawing_Filter | 表示指向滤波器对象的指针,为NULL表示清空画刷滤波器。 | 5947 5948 5949### OH_Drawing_BrushSetShaderEffect() 5950 5951``` 5952void OH_Drawing_BrushSetShaderEffect (OH_Drawing_Brush* , OH_Drawing_ShaderEffect* ) 5953``` 5954 5955**描述** 5956 5957为画刷设置着色器效果。 5958 5959本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5960 5961执行成功时返回OH_DRAWING_SUCCESS; 5962 5963OH_Drawing_Brush为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5964 5965**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5966 5967**起始版本:** 11 5968 5969**参数:** 5970 5971| 名称 | 描述 | 5972| -------- | -------- | 5973| OH_Drawing_Brush | 指向画刷对象的指针。 | 5974| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针,为NULL表示清空画刷的着色器效果。 | 5975 5976 5977### OH_Drawing_CanvasAttachBrush() 5978 5979``` 5980void OH_Drawing_CanvasAttachBrush (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 5981``` 5982 5983**描述** 5984 5985用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 5986 5987本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 5988 5989执行成功时返回OH_DRAWING_SUCCESS; 5990 5991OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 5992 5993**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 5994 5995**起始版本:** 8 5996 5997**参数:** 5998 5999| 名称 | 描述 | 6000| -------- | -------- | 6001| OH_Drawing_Canvas | 指向画布对象的指针。 | 6002| OH_Drawing_Brush | 指向画刷对象的指针。 | 6003 6004 6005### OH_Drawing_CanvasAttachPen() 6006 6007``` 6008void OH_Drawing_CanvasAttachPen (OH_Drawing_Canvas* , const OH_Drawing_Pen* ) 6009``` 6010 6011**描述** 6012 6013用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 6014 6015本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6016 6017执行成功时返回OH_DRAWING_SUCCESS; 6018 6019OH_Drawing_Canvas、OH_Drawing_Pen任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6020 6021**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6022 6023**起始版本:** 8 6024 6025**参数:** 6026 6027| 名称 | 描述 | 6028| -------- | -------- | 6029| OH_Drawing_Canvas | 指向画布对象的指针。 | 6030| OH_Drawing_Pen | 指向画笔对象的指针。 | 6031 6032 6033### OH_Drawing_CanvasBind() 6034 6035``` 6036void OH_Drawing_CanvasBind (OH_Drawing_Canvas* , OH_Drawing_Bitmap* ) 6037``` 6038 6039**描述** 6040 6041用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 6042 6043本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6044 6045执行成功时返回OH_DRAWING_SUCCESS; 6046 6047OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6048 6049**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6050 6051**起始版本:** 8 6052 6053**参数:** 6054 6055| 名称 | 描述 | 6056| -------- | -------- | 6057| OH_Drawing_Canvas | 指向画布对象的指针。 | 6058| OH_Drawing_Bitmap | 指向位图对象的指针。 | 6059 6060 6061### OH_Drawing_CanvasClear() 6062 6063``` 6064void OH_Drawing_CanvasClear (OH_Drawing_Canvas* , uint32_t color ) 6065``` 6066 6067**描述** 6068 6069用于使用指定颜色去清空画布。 6070 6071本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6072 6073执行成功时返回OH_DRAWING_SUCCESS; 6074 6075OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6076 6077**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6078 6079**起始版本:** 8 6080 6081**参数:** 6082 6083| 名称 | 描述 | 6084| -------- | -------- | 6085| OH_Drawing_Canvas | 指向画布对象的指针。 | 6086| color | 描述颜色的32位(ARGB)变量。 | 6087 6088 6089### OH_Drawing_CanvasClipPath() 6090 6091``` 6092void OH_Drawing_CanvasClipPath (OH_Drawing_Canvas* , const OH_Drawing_Path* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6093``` 6094 6095**描述** 6096 6097用于裁剪一个自定义路径。 6098 6099本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6100 6101执行成功时返回OH_DRAWING_SUCCESS; 6102 6103OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6104 6105clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6106 6107**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6108 6109**起始版本:** 11 6110 6111**参数:** 6112 6113| 名称 | 描述 | 6114| -------- | -------- | 6115| OH_Drawing_Canvas | 指向画布对象的指针。 | 6116| OH_Drawing_Path | 指向路径对象的指针。 | 6117| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6118| doAntiAlias | 真为抗锯齿,假则不做抗锯齿处理。 | 6119 6120 6121### OH_Drawing_CanvasClipRect() 6122 6123``` 6124void OH_Drawing_CanvasClipRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6125``` 6126 6127**描述** 6128 6129用于裁剪一个矩形。 6130 6131本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6132 6133执行成功时返回OH_DRAWING_SUCCESS; 6134 6135OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6136 6137clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6138 6139**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6140 6141**起始版本:** 11 6142 6143**参数:** 6144 6145| 名称 | 描述 | 6146| -------- | -------- | 6147| OH_Drawing_Canvas | 指向画布对象的指针。 | 6148| OH_Drawing_Rect | 指向矩形对象的指针。 | 6149| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6150| doAntiAlias | 值为true则做抗锯齿处理,反之不做。 | 6151 6152### OH_Drawing_CanvasClipRoundRect() 6153 6154``` 6155void OH_Drawing_CanvasClipRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* , OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias ) 6156``` 6157 6158**描述** 6159 6160用于裁剪一个圆角矩形。 6161 6162本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6163 6164执行成功时返回OH_DRAWING_SUCCESS; 6165 6166OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6167 6168clipOp不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6169 6170**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6171 6172**起始版本:** 12 6173 6174**参数:** 6175 6176| 名称 | 描述 | 6177| -------- | -------- | 6178| OH_Drawing_Canvas | 指向画布对象的指针。 | 6179| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 6180| clipOp | 裁剪方式。支持可选的具体裁剪方式可见[OH_Drawing_CanvasClipOp](#oh_drawing_canvasclipop)枚举。 | 6181| doAntiAlias | 表示是否需要做抗锯齿处理,值为true时为需要,为false时为不需要。 | 6182 6183### OH_Drawing_CanvasConcatMatrix() 6184 6185``` 6186void OH_Drawing_CanvasConcatMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 6187``` 6188 6189**描述** 6190 6191画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 6192 6193本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6194 6195执行成功时返回OH_DRAWING_SUCCESS; 6196 6197OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6198 6199**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6200 6201**起始版本:** 12 6202 6203**参数:** 6204 6205| 名称 | 描述 | 6206| -------- | -------- | 6207| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6208| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 6209 6210 6211### OH_Drawing_CanvasCreate() 6212 6213``` 6214OH_Drawing_Canvas* OH_Drawing_CanvasCreate (void ) 6215``` 6216 6217**描述** 6218 6219用于创建一个画布对象。 6220 6221**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6222 6223**起始版本:** 8 6224 6225**返回:** 6226 6227函数会返回一个指针,指针指向创建的画布对象。 6228 6229 6230### OH_Drawing_CanvasDestroy() 6231 6232``` 6233void OH_Drawing_CanvasDestroy (OH_Drawing_Canvas* ) 6234``` 6235 6236**描述** 6237 6238用于销毁画布对象并回收该对象占有的内存。 6239 6240**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6241 6242**起始版本:** 8 6243 6244**参数:** 6245 6246| 名称 | 描述 | 6247| -------- | -------- | 6248| OH_Drawing_Canvas | 指向画布对象的指针。 | 6249 6250 6251### OH_Drawing_CanvasDetachBrush() 6252 6253``` 6254void OH_Drawing_CanvasDetachBrush (OH_Drawing_Canvas* ) 6255``` 6256 6257**描述** 6258 6259用于去除掉画布中的画刷,使用后画布将不使用此前设置的画刷去填充图形形状。 6260 6261本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6262 6263执行成功时返回OH_DRAWING_SUCCESS; 6264 6265OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6266 6267**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6268 6269**起始版本:** 8 6270 6271**参数:** 6272 6273| 名称 | 描述 | 6274| -------- | -------- | 6275| OH_Drawing_Canvas | 指向画布对象的指针。 | 6276 6277 6278### OH_Drawing_CanvasDetachPen() 6279 6280``` 6281void OH_Drawing_CanvasDetachPen (OH_Drawing_Canvas* ) 6282``` 6283 6284**描述** 6285 6286用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 6287 6288本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6289 6290执行成功时返回OH_DRAWING_SUCCESS; 6291 6292OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6293 6294**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6295 6296**起始版本:** 8 6297 6298**参数:** 6299 6300| 名称 | 描述 | 6301| -------- | -------- | 6302| OH_Drawing_Canvas | 指向画布对象的指针。 | 6303 6304 6305### OH_Drawing_CanvasDrawArc() 6306 6307``` 6308void OH_Drawing_CanvasDrawArc (OH_Drawing_Canvas* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 6309``` 6310 6311**描述** 6312 6313用于画一个弧。 6314 6315本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6316 6317执行成功时返回OH_DRAWING_SUCCESS; 6318 6319OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6320 6321**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6322 6323**起始版本:** 11 6324 6325**参数:** 6326 6327| 名称 | 描述 | 6328| -------- | -------- | 6329| OH_Drawing_Canvas | 指向画布对象的指针。 | 6330| OH_Drawing_Rect | 指向矩形对象的指针。 | 6331| startAngle | 弧的起始角度。 | 6332| sweepAngle | 弧的扫描角度。 | 6333 6334 6335### OH_Drawing_CanvasDrawBackground() 6336 6337``` 6338void OH_Drawing_CanvasDrawBackground (OH_Drawing_Canvas* , const OH_Drawing_Brush* ) 6339``` 6340 6341**描述** 6342 6343用于画一个背景,此背景以画刷填充。 6344 6345本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6346 6347执行成功时返回OH_DRAWING_SUCCESS; 6348 6349OH_Drawing_Canvas、OH_Drawing_Brush任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6350 6351**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6352 6353**起始版本:** 12 6354 6355**参数:** 6356 6357| 名称 | 描述 | 6358| -------- | -------- | 6359| OH_Drawing_Canvas | 指向画布对象的指针。 | 6360| OH_Drawing_Brush | 指向画刷对象的指针。 | 6361 6362 6363### OH_Drawing_CanvasDrawBitmap() 6364 6365``` 6366void OH_Drawing_CanvasDrawBitmap (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , float left, float top ) 6367``` 6368 6369**描述** 6370 6371用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 6372 6373本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6374 6375执行成功时返回OH_DRAWING_SUCCESS; 6376 6377OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6378 6379**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6380 6381**起始版本:** 11 6382 6383**参数:** 6384 6385| 名称 | 描述 | 6386| -------- | -------- | 6387| OH_Drawing_Canvas | 指向画布对象的指针。 | 6388| OH_Drawing_Bitmap | 指向位图对象的指针。 | 6389| left | 位图对象左上角的横坐标。 | 6390| top | 位图对象左上角的纵坐标。 | 6391 6392 6393### OH_Drawing_CanvasDrawBitmapRect() 6394 6395``` 6396void OH_Drawing_CanvasDrawBitmapRect (OH_Drawing_Canvas* , const OH_Drawing_Bitmap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6397``` 6398 6399**描述** 6400 6401将位图的指定区域绘制到画布的指定区域。 6402 6403本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6404 6405执行成功时返回OH_DRAWING_SUCCESS; 6406 6407OH_Drawing_Canvas、OH_Drawing_Bitmap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6408 6409**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6410 6411**起始版本:** 12 6412 6413**参数:** 6414 6415| 名称 | 描述 | 6416| -------- | -------- | 6417| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6418| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 6419| src | 源位图指定矩形区域,为NULL将指定整个源位图区域。 | 6420| dst | 目标画布指定矩形区域。 | 6421| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6422 6423 6424### OH_Drawing_CanvasDrawCircle() 6425 6426``` 6427void OH_Drawing_CanvasDrawCircle (OH_Drawing_Canvas* , const OH_Drawing_Point* , float radius ) 6428``` 6429 6430**描述** 6431 6432用于画一个圆形。 6433 6434本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6435 6436执行成功时返回OH_DRAWING_SUCCESS; 6437 6438OH_Drawing_Canvas、OH_Drawing_Point任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6439 6440radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6441 6442**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6443 6444**起始版本:** 11 6445 6446**参数:** 6447 6448| 名称 | 描述 | 6449| -------- | -------- | 6450| OH_Drawing_Canvas | 指向画布对象的指针。 | 6451| OH_Drawing_Point | 指向坐标点对象的指针,表示圆心。 | 6452| radius | 圆形的半径。 | 6453 6454 6455### OH_Drawing_CanvasDrawImageRect() 6456 6457``` 6458void OH_Drawing_CanvasDrawImageRect (OH_Drawing_Canvas* , OH_Drawing_Image* , OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions* ) 6459``` 6460 6461**描述** 6462 6463将图片绘制到画布的指定区域上。 6464 6465本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6466 6467执行成功时返回OH_DRAWING_SUCCESS; 6468 6469OH_Drawing_Canvas、OH_Drawing_Image、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6470 6471**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6472 6473**起始版本:** 12 6474 6475**参数:** 6476 6477| 名称 | 描述 | 6478| -------- | -------- | 6479| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6480| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 6481| dst | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6482| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6483 6484 6485### OH_Drawing_CanvasDrawImageRectWithSrc() 6486 6487``` 6488void 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 ) 6489``` 6490 6491**描述** 6492 6493将图片绘制到画布的指定区域上,源矩形选定的区域会缩放平移到目标矩形。 6494 6495本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6496 6497执行成功时返回OH_DRAWING_SUCCESS; 6498 6499OH_Drawing_Canvas、OH_Drawing_Image、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6500 6501**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6502 6503**起始版本:** 12 6504 6505**参数:** 6506 6507| 名称 | 描述 | 6508| -------- | -------- | 6509| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6510| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 6511| src | 指向源矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6512| dst | 指向目标矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 6513| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6514| OH_Drawing_SrcRectConstraint | 约束类型,支持可选的具体类型可见[OH_Drawing_SrcRectConstraint](#oh_drawing_srcrectconstraint-1)枚举。 | 6515 6516 6517### OH_Drawing_CanvasDrawLine() 6518 6519``` 6520void OH_Drawing_CanvasDrawLine (OH_Drawing_Canvas* , float x1, float y1, float x2, float y2 ) 6521``` 6522 6523**描述** 6524 6525用于画一条直线段。 6526 6527本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6528 6529执行成功时返回OH_DRAWING_SUCCESS; 6530 6531OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6532 6533**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6534 6535**起始版本:** 8 6536 6537**参数:** 6538 6539| 名称 | 描述 | 6540| -------- | -------- | 6541| OH_Drawing_Canvas | 指向画布对象的指针。 | 6542| x1 | 线段起始点的横坐标。 | 6543| y1 | 线段起始点的纵坐标。 | 6544| x2 | 线段结束点的横坐标。 | 6545| y2 | 线段结束点的纵坐标。 | 6546 6547 6548### OH_Drawing_CanvasDrawOval() 6549 6550``` 6551void OH_Drawing_CanvasDrawOval (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6552``` 6553 6554**描述** 6555 6556用于画一个椭圆。 6557 6558本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6559 6560执行成功时返回OH_DRAWING_SUCCESS; 6561 6562OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6563 6564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6565 6566**起始版本:** 11 6567 6568**参数:** 6569 6570| 名称 | 描述 | 6571| -------- | -------- | 6572| OH_Drawing_Canvas | 指向画布对象的指针。 | 6573| OH_Drawing_Rect | 指向矩形对象的指针。 | 6574 6575 6576### OH_Drawing_CanvasDrawPath() 6577 6578``` 6579void OH_Drawing_CanvasDrawPath (OH_Drawing_Canvas* , const OH_Drawing_Path* ) 6580``` 6581 6582**描述** 6583 6584用于画一个自定义路径。 6585 6586本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6587 6588执行成功时返回OH_DRAWING_SUCCESS; 6589 6590OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6591 6592**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6593 6594**起始版本:** 8 6595 6596**参数:** 6597 6598| 名称 | 描述 | 6599| -------- | -------- | 6600| OH_Drawing_Canvas | 指向画布对象的指针。 | 6601| OH_Drawing_Path | 指向路径对象的指针。 | 6602 6603 6604### OH_Drawing_CanvasDrawPixelMapRect() 6605 6606``` 6607void OH_Drawing_CanvasDrawPixelMapRect (OH_Drawing_Canvas* , OH_Drawing_PixelMap* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* ) 6608``` 6609 6610**描述** 6611 6612用于将像素图的指定区域绘制到画布的指定区域。 6613 6614本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6615 6616执行成功时返回OH_DRAWING_SUCCESS; 6617 6618OH_Drawing_Canvas、OH_Drawing_PixelMap、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6619 6620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6621 6622**起始版本:** 12 6623 6624**参数:** 6625 6626| 名称 | 描述 | 6627| -------- | -------- | 6628| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6629| OH_Drawing_PixelMap | 指向像素图[OH_Drawing_PixelMap](#oh_drawing_pixelmap)的指针。 | 6630| src | 像素图指定矩形区域,为NULL将指定整个像素图区域。 | 6631| dst | 目标画布指定矩形区域。 | 6632| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针,为NULL将使用默认采样选项。 | 6633 6634 6635### OH_Drawing_CanvasDrawPoints() 6636 6637``` 6638void OH_Drawing_CanvasDrawPoints (OH_Drawing_Canvas* , OH_Drawing_PointMode mode, uint32_t count, const OH_Drawing_Point2D* ) 6639``` 6640 6641**描述** 6642 6643用于画多个点,绘制方式分为绘制单独的点、绘制成线段或绘制成开放多边形。 6644 6645本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6646 6647执行成功时返回OH_DRAWING_SUCCESS; 6648 6649OH_Drawing_Canvas、OH_Drawing_Point2D任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6650 6651mode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6652 6653**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6654 6655**起始版本:** 12 6656 6657**参数:** 6658 6659| 名称 | 描述 | 6660| -------- | -------- | 6661| OH_Drawing_Canvas | 指向画布对象的指针。 | 6662| mode | 绘制多个点的方式,支持方式参考[OH_Drawing_PointMode](#oh_drawing_pointmode)。 | 6663| count | 点的数量,即点数组中点的个数。 | 6664| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 指向多个点的数组。 | 6665 6666 6667### OH_Drawing_CanvasDrawRect() 6668 6669``` 6670void OH_Drawing_CanvasDrawRect (OH_Drawing_Canvas* , const OH_Drawing_Rect* ) 6671``` 6672 6673**描述** 6674 6675用于画一个矩形。 6676 6677本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6678 6679执行成功时返回OH_DRAWING_SUCCESS; 6680 6681OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6682 6683**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6684 6685**起始版本:** 11 6686 6687**参数:** 6688 6689| 名称 | 描述 | 6690| -------- | -------- | 6691| OH_Drawing_Canvas | 指向画布对象的指针。 | 6692| OH_Drawing_Rect | 指向矩形对象的指针。 | 6693 6694 6695### OH_Drawing_CanvasDrawRegion() 6696 6697``` 6698void OH_Drawing_CanvasDrawRegion (OH_Drawing_Canvas* , const OH_Drawing_Region* ) 6699``` 6700 6701**描述** 6702 6703用于画一块区域。 6704 6705本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6706 6707执行成功时返回OH_DRAWING_SUCCESS; 6708 6709OH_Drawing_Canvas、OH_Drawing_Region任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6710 6711**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6712 6713**起始版本:** 12 6714 6715**参数:** 6716 6717| 名称 | 描述 | 6718| -------- | -------- | 6719| OH_Drawing_Canvas | 指向画布对象的指针。 | 6720| OH_Drawing_Region | 指向区域对象的指针。 | 6721 6722 6723### OH_Drawing_CanvasDrawRoundRect() 6724 6725``` 6726void OH_Drawing_CanvasDrawRoundRect (OH_Drawing_Canvas* , const OH_Drawing_RoundRect* ) 6727``` 6728 6729**描述** 6730 6731用于画一个圆角矩形。 6732 6733本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6734 6735执行成功时返回OH_DRAWING_SUCCESS; 6736 6737OH_Drawing_Canvas、OH_Drawing_RoundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6738 6739**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6740 6741**起始版本:** 11 6742 6743**参数:** 6744 6745| 名称 | 描述 | 6746| -------- | -------- | 6747| OH_Drawing_Canvas | 指向画布对象的指针。 | 6748| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 6749 6750 6751### OH_Drawing_CanvasDrawShadow() 6752 6753``` 6754void 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 ) 6755``` 6756 6757**描述** 6758 6759绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 6760 6761本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6762 6763执行成功时返回OH_DRAWING_SUCCESS; 6764 6765OH_Drawing_Canvas、OH_Drawing_Path任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 6766 6767flag不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6768 6769**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6770 6771**起始版本:** 12 6772 6773**参数:** 6774 6775| 名称 | 描述 | 6776| -------- | -------- | 6777| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6778| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,用于生成阴影。 | 6779| planeParams | 基于x轴和y轴的遮挡器从画布返回z轴偏移量的函数值。 | 6780| devLightPos | 光线相对于画布的位置。 | 6781| lightRadius | 圆形灯半径。 | 6782| ambientColor | 环境阴影颜色。 | 6783| spotColor | 点阴影颜色。 | 6784| flag | 阴影标志枚举[OH_Drawing_CanvasShadowFlags](#oh_drawing_canvasshadowflags)。 | 6785 6786 6787### OH_Drawing_CanvasDrawTextBlob() 6788 6789``` 6790void OH_Drawing_CanvasDrawTextBlob (OH_Drawing_Canvas* , const OH_Drawing_TextBlob* , float x, float y ) 6791``` 6792 6793**描述** 6794 6795用于画一段文字。若构造OH_Drawing_TextBlob的字体不支持待绘制字符,则该部分字符无法绘制。 6796 6797本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6798 6799执行成功时返回OH_DRAWING_SUCCESS; 6800 6801OH_Drawing_Canvas、OH_Drawing_TextBlob任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6802 6803**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6804 6805**起始版本:** 11 6806 6807**参数:** 6808 6809| 名称 | 描述 | 6810| -------- | -------- | 6811| OH_Drawing_Canvas | 指向画布对象的指针。 | 6812| OH_Drawing_TextBlob | 指向文本对象的指针。 | 6813| x | 文本对象左下角的横坐标。 | 6814| y | 文本对象左下角的纵坐标。 | 6815 6816 6817### OH_Drawing_CanvasDrawVertices() 6818 6819``` 6820void 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 ) 6821``` 6822 6823**描述** 6824 6825用于画顶点数组描述的三角网格。 6826 6827本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6828 6829执行成功时设置错误码为OH_DRAWING_SUCCESS; 6830 6831OH_Drawing_Canvas或positions为NULL、vertexCount值小于3、indexCount值小于3且不为0,存在以上任意一种情况时设置错误码为OH_DRAWING_ERROR_INVALID_PARAMETER; 6832 6833vertexMmode、mode任意一个不在枚举范围内时设置错误码为OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 6834 6835**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6836 6837**起始版本:** 12 6838 6839**参数:** 6840 6841| 名称 | 描述 | 6842| -------- | -------- | 6843| OH_Drawing_Canvas | 指向画布对象的指针。 | 6844| vertexMmode | 绘制顶点的连接方式,支持方式参考[OH_Drawing_VertexMode](#oh_drawing_vertexmode)。 | 6845| vertexCount | 顶点数组元素的数量,值必须大于等于3。 | 6846| positions | 描述顶点位置的数组指针,不能为空,其长度必须等于vertexCount。 | 6847| texs | 描述顶点对应纹理空间坐标的数组指针,可以为空,若不为空其长度必须等于vertexCount。 | 6848| colors | 描述顶点对应颜色的数组指针,用于在三角形中进行插值,可以为空,若不为空其长度必须等于vertexCount。 | 6849| indexCount | 索引的数量,可以为0,若不为0则值必须大于等于3。 | 6850| indices | 描述顶点对应索引的数组指针,可以为空,若不为空其长度必须等于indexCount。 | 6851| mode | 混合模式枚举,支持方式参考[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 6852 6853 6854### OH_Drawing_CanvasGetHeight() 6855 6856``` 6857int32_t OH_Drawing_CanvasGetHeight (OH_Drawing_Canvas* ) 6858``` 6859 6860**描述** 6861 6862获取画布高度。 6863 6864本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6865 6866执行成功时返回OH_DRAWING_SUCCESS; 6867 6868OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6869 6870**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6871 6872**起始版本:** 12 6873 6874**参数:** 6875 6876| 名称 | 描述 | 6877| -------- | -------- | 6878| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6879 6880**返回:** 6881 6882函数返回画布高度,单位为像素。 6883 6884 6885### OH_Drawing_CanvasGetLocalClipBounds() 6886 6887``` 6888void OH_Drawing_CanvasGetLocalClipBounds (OH_Drawing_Canvas* , OH_Drawing_Rect* ) 6889``` 6890 6891**描述** 6892 6893获取画布裁剪区域的边界。该接口不可用于录制类型画布。 6894 6895本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6896 6897执行成功时返回OH_DRAWING_SUCCESS; 6898 6899OH_Drawing_Canvas、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6900 6901**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6902 6903**起始版本:** 12 6904 6905**参数:** 6906 6907| 名称 | 描述 | 6908| -------- | -------- | 6909| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6910| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 | 6911 6912 6913### OH_Drawing_CanvasGetSaveCount() 6914 6915``` 6916uint32_t OH_Drawing_CanvasGetSaveCount (OH_Drawing_Canvas* ) 6917``` 6918 6919**描述** 6920 6921用于获取栈中保存的画布状态(画布矩阵)的数量。 6922 6923本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6924 6925执行成功时返回OH_DRAWING_SUCCESS; 6926 6927OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6928 6929**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6930 6931**起始版本:** 11 6932 6933**参数:** 6934 6935| 名称 | 描述 | 6936| -------- | -------- | 6937| OH_Drawing_Canvas | 指向画布对象的指针。 | 6938 6939**返回:** 6940 6941函数会返回一个32位的值描述画布状态(画布矩阵)的数量,画布初始状态数量为1。 6942 6943 6944### OH_Drawing_CanvasGetTotalMatrix() 6945 6946``` 6947void OH_Drawing_CanvasGetTotalMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 6948``` 6949 6950**描述** 6951 6952获取画布3x3矩阵。 6953 6954本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6955 6956执行成功时返回OH_DRAWING_SUCCESS; 6957 6958OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6959 6960**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6961 6962**起始版本:** 12 6963 6964**参数:** 6965 6966| 名称 | 描述 | 6967| -------- | -------- | 6968| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6969| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 6970 6971 6972### OH_Drawing_CanvasGetWidth() 6973 6974``` 6975int32_t OH_Drawing_CanvasGetWidth (OH_Drawing_Canvas* ) 6976``` 6977 6978**描述** 6979 6980获取画布宽度。 6981 6982本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 6983 6984执行成功时返回OH_DRAWING_SUCCESS; 6985 6986OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 6987 6988**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 6989 6990**起始版本:** 12 6991 6992**参数:** 6993 6994| 名称 | 描述 | 6995| -------- | -------- | 6996| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 6997 6998**返回:** 6999 7000函数返回画布宽度,单位为像素。 7001 7002 7003### OH_Drawing_CanvasReadPixels() 7004 7005``` 7006bool OH_Drawing_CanvasReadPixels (OH_Drawing_Canvas* , OH_Drawing_Image_Info* , void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY ) 7007``` 7008 7009**描述** 7010 7011从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 7012 7013本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7014 7015执行成功时返回OH_DRAWING_SUCCESS; 7016 7017OH_Drawing_Canvas、OH_Drawing_Image_Info、dstPixels任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7018 7019**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7020 7021**起始版本:** 12 7022 7023**参数:** 7024 7025| 名称 | 描述 | 7026| -------- | -------- | 7027| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7028| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 指向图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针。 | 7029| dstPixels | 目标像素存储首地址。 | 7030| dstRowBytes | 一行像素的大小。 | 7031| srcX | 画布像素的x轴偏移量,单位为像素。 | 7032| srcY | 画布像素的y轴偏移量,单位为像素。 | 7033 7034**返回:** 7035 7036函数返回true表示像素成功拷贝到目标像素存储首地址,函数返回false表示拷贝失败。 7037 7038 7039### OH_Drawing_CanvasReadPixelsToBitmap() 7040 7041``` 7042bool OH_Drawing_CanvasReadPixelsToBitmap (OH_Drawing_Canvas* , OH_Drawing_Bitmap* , int32_t srcX, int32_t srcY ) 7043``` 7044 7045**描述** 7046 7047从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 7048 7049本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7050 7051执行成功时返回OH_DRAWING_SUCCESS; 7052 7053OH_Drawing_Canvas、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7054 7055**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7056 7057**起始版本:** 12 7058 7059**参数:** 7060 7061| 名称 | 描述 | 7062| -------- | -------- | 7063| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7064| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 7065| srcX | 画布像素的x轴偏移量,单位为像素。 | 7066| srcY | 画布像素的y轴偏移量,单位为像素。 | 7067 7068**返回:** 7069 7070函数返回true表示像素成功拷贝到位图,函数返回false表示拷贝失败。 7071 7072 7073### OH_Drawing_CanvasResetMatrix() 7074 7075``` 7076void OH_Drawing_CanvasResetMatrix (OH_Drawing_Canvas* ) 7077``` 7078 7079**描述** 7080 7081重置当前画布的矩阵为单位矩阵。 7082 7083本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7084 7085执行成功时返回OH_DRAWING_SUCCESS; 7086 7087OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7088 7089**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7090 7091**起始版本:** 12 7092 7093**参数:** 7094 7095| 名称 | 描述 | 7096| -------- | -------- | 7097| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7098 7099 7100### OH_Drawing_CanvasRestore() 7101 7102``` 7103void OH_Drawing_CanvasRestore (OH_Drawing_Canvas* ) 7104``` 7105 7106**描述** 7107 7108用于恢复保存在栈顶的画布状态(画布矩阵)。 7109 7110本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7111 7112执行成功时返回OH_DRAWING_SUCCESS; 7113 7114OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7115 7116**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7117 7118**起始版本:** 8 7119 7120**参数:** 7121 7122| 名称 | 描述 | 7123| -------- | -------- | 7124| OH_Drawing_Canvas | 指向画布对象的指针。 | 7125 7126 7127### OH_Drawing_CanvasRestoreToCount() 7128 7129``` 7130void OH_Drawing_CanvasRestoreToCount (OH_Drawing_Canvas* , uint32_t saveCount ) 7131``` 7132 7133**描述** 7134 7135用于恢复到指定数量的画布状态(画布矩阵)。 7136 7137本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7138 7139执行成功时返回OH_DRAWING_SUCCESS; 7140 7141OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7142 7143**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7144 7145**起始版本:** 11 7146 7147**参数:** 7148 7149| 名称 | 描述 | 7150| -------- | -------- | 7151| OH_Drawing_Canvas | 指向画布对象的指针。 | 7152| saveCount | 要恢复的画布状态深度。小于等于1时,恢复为初始状态;大于已保存的画布状态数量时,不执行任何操作。 | 7153 7154 7155### OH_Drawing_CanvasRotate() 7156 7157``` 7158void OH_Drawing_CanvasRotate (OH_Drawing_Canvas* , float degrees, float px, float py ) 7159``` 7160 7161**描述** 7162 7163用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 7164 7165本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7166 7167执行成功时返回OH_DRAWING_SUCCESS; 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 7197执行成功时返回OH_DRAWING_SUCCESS; 7198 7199OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7200 7201**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7202 7203**起始版本:** 8 7204 7205**参数:** 7206 7207| 名称 | 描述 | 7208| -------- | -------- | 7209| OH_Drawing_Canvas | 指向画布对象的指针。 | 7210 7211 7212### OH_Drawing_CanvasSaveLayer() 7213 7214``` 7215void OH_Drawing_CanvasSaveLayer (OH_Drawing_Canvas* , const OH_Drawing_Rect* , const OH_Drawing_Brush* ) 7216``` 7217 7218**描述** 7219 7220保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 [OH_Drawing_CanvasRestore](#oh_drawing_canvasrestore)将放弃对矩阵和剪切区域所做的更改,并绘制位图。 7221 7222本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7223 7224执行成功时返回OH_DRAWING_SUCCESS; 7225 7226OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7227 7228**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7229 7230**起始版本:** 12 7231 7232**参数:** 7233 7234| 名称 | 描述 | 7235| -------- | -------- | 7236| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7237| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针,用于限制图层大小,为NULL表示无限制。 | 7238| OH_Drawing_Brush | 指向画刷对象[OH_Drawing_Brush](#oh_drawing_brush)的指针,绘制位图时会应用画刷对象的透明度,滤波器效果,混合模式,为NULL表示不应用任何效果。 | 7239 7240 7241### OH_Drawing_CanvasScale() 7242 7243``` 7244void OH_Drawing_CanvasScale (OH_Drawing_Canvas* , float sx, float sy ) 7245``` 7246 7247**描述** 7248 7249用于画布缩放。 7250 7251本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7252 7253执行成功时返回OH_DRAWING_SUCCESS; 7254 7255OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7256 7257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7258 7259**起始版本:** 11 7260 7261**参数:** 7262 7263| 名称 | 描述 | 7264| -------- | -------- | 7265| OH_Drawing_Canvas | 指向画布对象的指针。 | 7266| sx | x轴方向的缩放比例。 | 7267| sy | y轴方向的缩放比例。 | 7268 7269 7270### OH_Drawing_CanvasSetMatrix() 7271 7272``` 7273void OH_Drawing_CanvasSetMatrix (OH_Drawing_Canvas* , OH_Drawing_Matrix* ) 7274``` 7275 7276**描述** 7277 7278设置画布的矩阵状态。 7279 7280本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7281 7282执行成功时返回OH_DRAWING_SUCCESS; 7283 7284OH_Drawing_Canvas、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7285 7286**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7287 7288**起始版本:** 12 7289 7290**参数:** 7291 7292| 名称 | 描述 | 7293| -------- | -------- | 7294| OH_Drawing_Canvas | 指向画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)的指针。 | 7295| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 7296 7297 7298### OH_Drawing_CanvasSkew() 7299 7300``` 7301void OH_Drawing_CanvasSkew (OH_Drawing_Canvas* , float sx, float sy ) 7302``` 7303 7304**描述** 7305 7306用于画布倾斜变换。等同于将当前画布矩阵左乘(premultiply)倾斜变换矩阵,并应用到画布上。其中倾斜变换矩阵为:\|1 sx 0\| \|sy 1 0\| \|0 0 1\|。 7307 7308本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7309 7310执行成功时返回OH_DRAWING_SUCCESS; 7311 7312OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7313 7314**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7315 7316**起始版本:** 12 7317 7318**参数:** 7319 7320| 名称 | 描述 | 7321| -------- | -------- | 7322| OH_Drawing_Canvas | 指向画布对象的指针。 | 7323| sx | 沿x轴的倾斜量。正值会使绘制沿y轴增量方向向右倾斜;负值会使绘制沿y轴增量方向向左倾斜。 | 7324| sy | 沿y轴的倾斜量。正值会使绘制沿x轴增量方向向下倾斜;负值会使绘制沿x轴增量方向向上倾斜。 | 7325 7326 7327### OH_Drawing_CanvasTranslate() 7328 7329``` 7330void OH_Drawing_CanvasTranslate (OH_Drawing_Canvas* , float dx, float dy ) 7331``` 7332 7333**描述** 7334 7335用于平移画布一段距离。 7336 7337本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7338 7339执行成功时返回OH_DRAWING_SUCCESS; 7340 7341OH_Drawing_Canvas为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7342 7343**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7344 7345**起始版本:** 11 7346 7347**参数:** 7348 7349| 名称 | 描述 | 7350| -------- | -------- | 7351| OH_Drawing_Canvas | 指向画布对象的指针。 | 7352| dx | x轴方向的移动距离。 | 7353| dy | y轴方向的移动距离。 | 7354 7355 7356### OH_Drawing_ColorFilterCreateBlendMode() 7357 7358``` 7359OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode (uint32_t color, OH_Drawing_BlendMode ) 7360``` 7361 7362**描述** 7363 7364创建具有混合模式的颜色滤波器。 7365 7366**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7367 7368**起始版本:** 11 7369 7370**参数:** 7371 7372| 名称 | 描述 | 7373| -------- | -------- | 7374| color | 表示颜色,是一个32位(ARGB)变量。 | 7375| OH_Drawing_BlendMode | 表示混合模式。支持可选的混合模式具体可见[OH_Drawing_BlendMode](#oh_drawing_blendmode)枚举。 | 7376 7377**返回:** 7378 7379返回创建的颜色滤波器对象的指针。 7380 7381 7382### OH_Drawing_ColorFilterCreateCompose() 7383 7384``` 7385OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose (OH_Drawing_ColorFilter* colorFilter1, OH_Drawing_ColorFilter* colorFilter2 ) 7386``` 7387 7388**描述** 7389 7390将两个颜色滤波器合成一个新的颜色滤波器。 7391 7392本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7393 7394执行成功时返回OH_DRAWING_SUCCESS; 7395 7396colorFilter1、colorFilter2任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7397 7398**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7399 7400**起始版本:** 11 7401 7402**参数:** 7403 7404| 名称 | 描述 | 7405| -------- | -------- | 7406| colorFilter1 | 指向颜色滤波器对象一的指针。 | 7407| colorFilter2 | 指向颜色滤波器对象二的指针。 | 7408 7409**返回:** 7410 7411返回创建的颜色滤波器对象的指针。 7412 7413 7414### OH_Drawing_ColorFilterCreateLinearToSrgbGamma() 7415 7416``` 7417OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma (void ) 7418``` 7419 7420**描述** 7421 7422创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 7423 7424**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7425 7426**起始版本:** 11 7427 7428**返回:** 7429 7430返回创建的颜色滤波器对象的指针。 7431 7432 7433### OH_Drawing_ColorFilterCreateLuma() 7434 7435``` 7436OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma (void ) 7437``` 7438 7439**描述** 7440 7441创建一个颜色滤波器将其输入的亮度值乘以透明度通道, 并将红色、绿色和蓝色通道设置为零。 7442 7443**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7444 7445**起始版本:** 11 7446 7447**返回:** 7448 7449返回创建的颜色滤波器对象的指针。 7450 7451 7452### OH_Drawing_ColorFilterCreateMatrix() 7453 7454``` 7455OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix (const float matrix[20]) 7456``` 7457 7458**描述** 7459 7460创建具有5x4颜色矩阵的颜色滤波器。 7461 7462本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7463 7464执行成功时返回OH_DRAWING_SUCCESS; 7465 7466matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7467 7468**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7469 7470**起始版本:** 11 7471 7472**参数:** 7473 7474| 名称 | 描述 | 7475| -------- | -------- | 7476| matrix | 表示矩阵,以长度为20的浮点数组表示。 | 7477 7478**返回:** 7479 7480返回创建的颜色滤波器对象的指针。 7481 7482 7483### OH_Drawing_ColorFilterCreateSrgbGammaToLinear() 7484 7485``` 7486OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear (void ) 7487``` 7488 7489**描述** 7490 7491创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 7492 7493**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7494 7495**起始版本:** 11 7496 7497**返回:** 7498 7499返回创建的颜色滤波器对象的指针。 7500 7501 7502### OH_Drawing_ColorFilterDestroy() 7503 7504``` 7505void OH_Drawing_ColorFilterDestroy (OH_Drawing_ColorFilter* ) 7506``` 7507 7508**描述** 7509 7510销毁颜色滤波器对象,并收回该对象占用的内存。 7511 7512**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7513 7514**起始版本:** 11 7515 7516**参数:** 7517 7518| 名称 | 描述 | 7519| -------- | -------- | 7520| OH_Drawing_ColorFilter | 表示指向颜色滤波器对象的指针。 | 7521 7522 7523### OH_Drawing_ColorSetArgb() 7524 7525``` 7526uint32_t OH_Drawing_ColorSetArgb (uint32_t alpha, uint32_t red, uint32_t green, uint32_t blue ) 7527``` 7528 7529**描述** 7530 7531用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 7532 7533**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7534 7535**起始版本:** 8 7536 7537**参数:** 7538 7539| 名称 | 描述 | 7540| -------- | -------- | 7541| alpha | 描述透明度的变量, 变量范围是0x00~0xFF。 | 7542| red | 描述红色的变量, 变量范围是0x00~0xFF。 | 7543| green | 描述绿色的变量, 变量范围是0x00~0xFF。 | 7544| blue | 描述蓝色的变量, 变量范围是0x00~0xFF。 | 7545 7546**返回:** 7547 7548函数返回一个描述颜色的32位(ARGB)变量。 7549 7550 7551### OH_Drawing_ColorSpaceCreateSrgb() 7552 7553``` 7554OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgb (void ) 7555``` 7556 7557**描述** 7558 7559创建一个标准颜色空间。 7560 7561**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7562 7563**起始版本:** 12 7564 7565**返回:** 7566 7567函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。 7568 7569 7570### OH_Drawing_ColorSpaceCreateSrgbLinear() 7571 7572``` 7573OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear (void ) 7574``` 7575 7576**描述** 7577 7578创建一个Gamma 1.0空间上的颜色空间。 7579 7580**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7581 7582**起始版本:** 12 7583 7584**返回:** 7585 7586函数返回一个指针,指针指向创建的颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)。 7587 7588 7589### OH_Drawing_ColorSpaceDestroy() 7590 7591``` 7592void OH_Drawing_ColorSpaceDestroy (OH_Drawing_ColorSpace* ) 7593``` 7594 7595**描述** 7596 7597销毁颜色空间对象,并回收该对象占有内存。 7598 7599**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7600 7601**起始版本:** 12 7602 7603**参数:** 7604 7605| 名称 | 描述 | 7606| -------- | -------- | 7607| OH_Drawing_ColorSpace | 指向颜色空间对象[OH_Drawing_ColorSpace](#oh_drawing_colorspace)的指针。 | 7608 7609 7610### OH_Drawing_CreateDashPathEffect() 7611 7612``` 7613OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect (float* intervals, int count, float phase ) 7614``` 7615 7616**描述** 7617 7618创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 7619 7620本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 7621 7622执行成功时返回OH_DRAWING_SUCCESS; 7623 7624intervals为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 7625 7626**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7627 7628**起始版本:** 12 7629 7630**参数:** 7631 7632| 名称 | 描述 | 7633| -------- | -------- | 7634| intervals | 虚线间隔数组首地址,偶数项的值表示虚线开的间隔长度, 奇数项的值表示虚线关的间隔长度,单位为像素。 | 7635| count | 虚线间隔数组元素的个数,必须为大于0的偶数。 | 7636| phase | 虚线间隔数组中偏移量。 | 7637 7638**返回:** 7639 7640函数返回一个指针,指针指向创建的路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)。 7641 7642 7643### OH_Drawing_CreateFontCollection() 7644 7645``` 7646OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection (void ) 7647``` 7648 7649**描述** 7650 7651创建字体集对象[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)对象。 7652 7653**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7654 7655**起始版本:** 8 7656 7657**返回:** 7658 7659指向创建的字体集对象的指针。 7660 7661 7662### OH_Drawing_CreateFontDescriptor() 7663 7664``` 7665OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor (void ) 7666``` 7667 7668**描述** 7669 7670构造字体描述对象,用于描述系统字体详细信息。 7671 7672**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7673 7674**起始版本:** 12 7675 7676**返回:** 7677 7678返回指向已创建的字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针。 7679 7680 7681### OH_Drawing_CreateFontParser() 7682 7683``` 7684OH_Drawing_FontParser* OH_Drawing_CreateFontParser (void ) 7685``` 7686 7687**描述** 7688 7689构造字体解析对象,用于解析系统字体。 7690 7691**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7692 7693**起始版本:** 12 7694 7695**返回:** 7696 7697返回指向已创建的字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针。 7698 7699 7700### OH_Drawing_CreateSharedFontCollection() 7701 7702``` 7703OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection (void ) 7704``` 7705 7706**描述** 7707 7708创建可共享的字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)。 7709 7710**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7711 7712**起始版本:** 12 7713 7714**返回:** 7715 7716指向创建的字体集对象的指针。 7717 7718### OH_Drawing_ClearFontCaches() 7719 7720``` 7721void OH_Drawing_ClearFontCaches (OH_Drawing_FontCollection* ) 7722``` 7723 7724**描述** 7725 7726清理字体排版缓存(字体排版缓存本身设有内存上限和清理机制,所占内存有限,如无内存要求,不建议清理)。 7727 7728**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7729 7730**起始版本:** 12 7731 7732**参数:** 7733 7734| 名称 | 描述 | 7735| -------- | -------- | 7736| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 7737 7738### OH_Drawing_CreateTextShadow() 7739 7740``` 7741OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow (void ) 7742``` 7743 7744**描述** 7745 7746创建指向字体阴影对象的指针。 7747 7748**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7749 7750**起始版本:** 12 7751 7752**返回:** 7753 7754指向创建的字体阴影对象。 7755 7756 7757### OH_Drawing_CreateTextStyle() 7758 7759``` 7760OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle (void ) 7761``` 7762 7763**描述** 7764 7765创建指向OH_Drawing_TextStyle对象的指针。 7766 7767**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7768 7769**起始版本:** 8 7770 7771**返回:** 7772 7773指向创建的OH_Drawing_TextStyle对象的指针。 7774 7775 7776### OH_Drawing_CreateTypography() 7777 7778``` 7779OH_Drawing_Typography* OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate* ) 7780``` 7781 7782**描述** 7783 7784创建指向OH_Drawing_Typography对象的指针。 7785 7786**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7787 7788**起始版本:** 8 7789 7790**参数:** 7791 7792| 名称 | 描述 | 7793| -------- | -------- | 7794| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 7795 7796**返回:** 7797 7798指向OH_Drawing_Typography对象的指针。 7799 7800 7801### OH_Drawing_CreateTypographyHandler() 7802 7803``` 7804OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle* , OH_Drawing_FontCollection* ) 7805``` 7806 7807**描述** 7808 7809创建指向OH_Drawing_TypographyCreate对象的指针。 7810 7811**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7812 7813**起始版本:** 8 7814 7815**参数:** 7816 7817| 名称 | 描述 | 7818| -------- | -------- | 7819| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 7820| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection的指针,可由[OH_Drawing_CreateFontCollection](#oh_drawing_createfontcollection)或[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)获取,建议使用[OH_Drawing_CreateSharedFontCollection](#oh_drawing_createsharedfontcollection)。 | 7821 7822**返回:** 7823 7824指向新创建的OH_Drawing_TypographyCreate对象的指针。 7825 7826 7827### OH_Drawing_CreateTypographyStyle() 7828 7829``` 7830OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle (void ) 7831``` 7832 7833**描述** 7834 7835创建指向OH_Drawing_TypographyStyle对象的指针。 7836 7837**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7838 7839**起始版本:** 8 7840 7841**返回:** 7842 7843指向创建的OH_Drawing_TypographyStyle对象的指针。 7844 7845 7846### OH_Drawing_DestroyFontCollection() 7847 7848``` 7849void OH_Drawing_DestroyFontCollection (OH_Drawing_FontCollection* ) 7850``` 7851 7852**描述** 7853 7854释放被字体集对象占据的内存。 7855 7856**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7857 7858**起始版本:** 8 7859 7860**参数:** 7861 7862| 名称 | 描述 | 7863| -------- | -------- | 7864| OH_Drawing_FontCollection | 指向字体集对象的指针。 | 7865 7866 7867### OH_Drawing_DestroyFontDescriptor() 7868 7869``` 7870void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor* ) 7871``` 7872 7873**描述** 7874 7875释放字体描述对象占用的内存。 7876 7877**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7878 7879**起始版本:** 12 7880 7881**参数:** 7882 7883| 名称 | 描述 | 7884| -------- | -------- | 7885| [OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md) | 指向字体描述对象[OH_Drawing_FontDescriptor](_o_h___drawing___font_descriptor.md)的指针,由[OH_Drawing_CreateFontDescriptor](#oh_drawing_createfontdescriptor)获取。 | 7886 7887 7888### OH_Drawing_DestroyFontParser() 7889 7890``` 7891void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser* ) 7892``` 7893 7894**描述** 7895 7896释放字体解析对象占用的内存。 7897 7898**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7899 7900**起始版本:** 12 7901 7902**参数:** 7903 7904| 名称 | 描述 | 7905| -------- | -------- | 7906| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 7907 7908 7909### OH_Drawing_DestroyLineMetrics() 7910 7911``` 7912void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics* ) 7913``` 7914 7915**描述** 7916 7917释放行位置信息对象占用的内存。 7918 7919**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7920 7921**起始版本:** 12 7922 7923**参数:** 7924 7925| 名称 | 描述 | 7926| -------- | -------- | 7927| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 7928 7929 7930### OH_Drawing_DestroySystemFontConfigInfo() 7931 7932``` 7933void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo* ) 7934``` 7935 7936**描述** 7937 7938释放系统字体配置信息占用的的内存。 7939 7940**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7941 7942**起始版本:** 12 7943 7944**参数:** 7945 7946| 名称 | 描述 | 7947| -------- | -------- | 7948| OH_Drawing_FontConfigInfo | 指向系统字体配置信息[OH_Drawing_FontConfigInfo](_o_h___drawing___font_config_info.md)的指针, 由[OH_Drawing_GetSystemFontConfigInfo](#oh_drawing_getsystemfontconfiginfo)获取。 | 7949 7950 7951### OH_Drawing_DestroySystemFontList() 7952 7953``` 7954void OH_Drawing_DestroySystemFontList (char** , size_t ) 7955``` 7956 7957**描述** 7958 7959释放系统字体名称列表占用的内存。 7960 7961**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7962 7963**起始版本:** 12 7964 7965**参数:** 7966 7967| 名称 | 描述 | 7968| -------- | -------- | 7969| char\*\* | 指向系统字体名称列表的指针。 | 7970| size_t\* | 系统字体名称列表的数量。 | 7971 7972 7973### OH_Drawing_DestroyTextShadow() 7974 7975``` 7976void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow* ) 7977``` 7978 7979**描述** 7980 7981释放被字体阴影对象占据的内存。 7982 7983**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 7984 7985**起始版本:** 12 7986 7987**参数:** 7988 7989| 名称 | 描述 | 7990| -------- | -------- | 7991| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 7992 7993 7994### OH_Drawing_DestroyTextShadows() 7995 7996``` 7997void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow* ) 7998``` 7999 8000**描述** 8001 8002释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 8003 8004**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8005 8006**起始版本:** 12 8007 8008**参数:** 8009 8010| 名称 | 描述 | 8011| -------- | -------- | 8012| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 8013 8014 8015### OH_Drawing_DestroyTextStyle() 8016 8017``` 8018void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle* ) 8019``` 8020 8021**描述** 8022 8023释放被OH_Drawing_TextStyle对象占据的内存。 8024 8025**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8026 8027**起始版本:** 8 8028 8029**参数:** 8030 8031| 名称 | 描述 | 8032| -------- | -------- | 8033| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 8034 8035 8036### OH_Drawing_DestroyTypography() 8037 8038``` 8039void OH_Drawing_DestroyTypography (OH_Drawing_Typography* ) 8040``` 8041 8042**描述** 8043 8044释放OH_Drawing_Typography对象占据的内存。 8045 8046**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8047 8048**起始版本:** 8 8049 8050**参数:** 8051 8052| 名称 | 描述 | 8053| -------- | -------- | 8054| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 8055 8056 8057### OH_Drawing_DestroyTypographyHandler() 8058 8059``` 8060void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate* ) 8061``` 8062 8063**描述** 8064 8065释放被OH_Drawing_TypographyCreate对象占据的内存。 8066 8067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8068 8069**起始版本:** 8 8070 8071**参数:** 8072 8073| 名称 | 描述 | 8074| -------- | -------- | 8075| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 8076 8077 8078### OH_Drawing_DestroyTypographyStyle() 8079 8080``` 8081void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle* ) 8082``` 8083 8084**描述** 8085 8086释放被OH_Drawing_TypographyStyle对象占据的内存。 8087 8088**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8089 8090**起始版本:** 8 8091 8092**参数:** 8093 8094| 名称 | 描述 | 8095| -------- | -------- | 8096| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 8097 8098 8099### OH_Drawing_DisableFontCollectionFallback() 8100 8101``` 8102void OH_Drawing_DisableFontCollectionFallback (OH_Drawing_FontCollection* fontCollection) 8103``` 8104 8105**描述** 8106 8107禁用备用字体。 8108 8109**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8110 8111**起始版本:** 12 8112 8113**参数:** 8114 8115| 名称 | 描述 | 8116| -------- | -------- | 8117| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 8118 8119 8120### OH_Drawing_DisableFontCollectionSystemFont() 8121 8122``` 8123void OH_Drawing_DisableFontCollectionSystemFont (OH_Drawing_FontCollection* fontCollection) 8124``` 8125 8126**描述** 8127 8128禁用系统字体。 8129 8130**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8131 8132**起始版本:** 12 8133 8134**参数:** 8135 8136| 名称 | 描述 | 8137| -------- | -------- | 8138| OH_Drawing_FontCollection | 指向字体集对象[OH_Drawing_FontCollection](#oh_drawing_fontcollection)的指针。 | 8139 8140 8141### OH_Drawing_FilterCreate() 8142 8143``` 8144OH_Drawing_Filter* OH_Drawing_FilterCreate (void ) 8145``` 8146 8147**描述** 8148 8149创建一个滤波器对象。 8150 8151**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8152 8153**起始版本:** 11 8154 8155**返回:** 8156 8157返回创建的滤波器对象的指针。 8158 8159 8160### OH_Drawing_FilterDestroy() 8161 8162``` 8163void OH_Drawing_FilterDestroy (OH_Drawing_Filter* ) 8164``` 8165 8166**描述** 8167 8168销毁滤波器对象,并收回该对象占用的内存。 8169 8170**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8171 8172**起始版本:** 11 8173 8174**参数:** 8175 8176| 名称 | 描述 | 8177| -------- | -------- | 8178| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8179 8180 8181### OH_Drawing_FilterGetColorFilter() 8182 8183``` 8184void OH_Drawing_FilterGetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8185``` 8186 8187**描述** 8188 8189从滤波器对象获取颜色滤波器对象。 8190 8191本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8192 8193执行成功时返回OH_DRAWING_SUCCESS; 8194 8195OH_Drawing_Filter、OH_Drawing_ColorFilter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8196 8197**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8198 8199**起始版本:** 12 8200 8201**参数:** 8202 8203| 名称 | 描述 | 8204| -------- | -------- | 8205| OH_Drawing_Filter | 指示指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 8206| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象[OH_Drawing_ColorFilter](#oh_drawing_colorfilter)的指针。 | 8207 8208 8209### OH_Drawing_FilterSetColorFilter() 8210 8211``` 8212void OH_Drawing_FilterSetColorFilter (OH_Drawing_Filter* , OH_Drawing_ColorFilter* ) 8213``` 8214 8215**描述** 8216 8217为滤波器对象设置颜色滤波器对象。 8218 8219本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8220 8221执行成功时返回OH_DRAWING_SUCCESS; 8222 8223OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8224 8225**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8226 8227**起始版本:** 11 8228 8229**参数:** 8230 8231| 名称 | 描述 | 8232| -------- | -------- | 8233| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8234| OH_Drawing_ColorFilter | 指示指向颜色滤波器对象的指针,为NULL表示清空滤波器对象中的颜色滤波器效果。 | 8235 8236 8237### OH_Drawing_FilterSetMaskFilter() 8238 8239``` 8240void OH_Drawing_FilterSetMaskFilter (OH_Drawing_Filter* , OH_Drawing_MaskFilter* ) 8241``` 8242 8243**描述** 8244 8245为滤波器对象设置蒙板滤波器对象。 8246 8247本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8248 8249执行成功时返回OH_DRAWING_SUCCESS; 8250 8251OH_Drawing_Filter为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8252 8253**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8254 8255**起始版本:** 11 8256 8257**参数:** 8258 8259| 名称 | 描述 | 8260| -------- | -------- | 8261| OH_Drawing_Filter | 指示指向滤波器对象的指针。 | 8262| OH_Drawing_MaskFilter | 指示指向模板滤波器对象的指针,为NULL表示清空滤波器对象中的模板滤波器效果。 | 8263 8264 8265### OH_Drawing_FontCountText() 8266 8267``` 8268int OH_Drawing_FontCountText (OH_Drawing_Font* , const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding ) 8269``` 8270 8271**描述** 8272 8273获取文本所表示的字符数量。 8274 8275本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8276 8277执行成功时返回OH_DRAWING_SUCCESS; 8278 8279OH_Drawing_Font、text任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8280 8281**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8282 8283**起始版本:** 12 8284 8285**参数:** 8286 8287| 名称 | 描述 | 8288| -------- | -------- | 8289| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8290| text | 文本存储首地址。 | 8291| byteLength | 文本长度,单位为字节。 | 8292| encoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 8293 8294 8295### OH_Drawing_FontCreate() 8296 8297``` 8298OH_Drawing_Font* OH_Drawing_FontCreate (void ) 8299``` 8300 8301**描述** 8302 8303用于创建一个字体对象。 8304 8305**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8306 8307**起始版本:** 11 8308 8309**返回:** 8310 8311函数会返回一个指针,指针指向创建的字体对象。 8312 8313 8314### OH_Drawing_FontDestroy() 8315 8316``` 8317void OH_Drawing_FontDestroy (OH_Drawing_Font* ) 8318``` 8319 8320**描述** 8321 8322用于销毁字体对象并回收该对象占有的内存。 8323 8324**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8325 8326**起始版本:** 11 8327 8328**参数:** 8329 8330| 名称 | 描述 | 8331| -------- | -------- | 8332| OH_Drawing_Font | 指向字体对象的指针。 | 8333 8334 8335### OH_Drawing_FontGetMetrics() 8336 8337``` 8338float OH_Drawing_FontGetMetrics (OH_Drawing_Font* , OH_Drawing_Font_Metrics* ) 8339``` 8340 8341**描述** 8342 8343获取字体度量信息。 8344 8345本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8346 8347执行成功时返回OH_DRAWING_SUCCESS; 8348 8349OH_Drawing_Font、OH_Drawing_Font_Metrics任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8350 8351**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8352 8353**起始版本:** 12 8354 8355**参数:** 8356 8357| 名称 | 描述 | 8358| -------- | -------- | 8359| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8360| OH_Drawing_Font_Metrics | 指向字体度量信息对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针。 | 8361 8362**返回:** 8363 8364函数返回一个浮点数变量,表示建议的行间距。 8365 8366 8367### OH_Drawing_FontGetTypeface() 8368 8369``` 8370OH_Drawing_Typeface* OH_Drawing_FontGetTypeface (OH_Drawing_Font* ) 8371``` 8372 8373**描述** 8374 8375获取字形对象。 8376 8377本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8378 8379执行成功时返回OH_DRAWING_SUCCESS; 8380 8381OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8382 8383**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8384 8385**起始版本:** 12 8386 8387**参数:** 8388 8389| 名称 | 描述 | 8390| -------- | -------- | 8391| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 8392 8393**返回:** 8394 8395OH_Drawing_Typeface 函数返回一个指针,指向字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8396 8397 8398### OH_Drawing_FontMgrCreate() 8399 8400``` 8401OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate (void ) 8402``` 8403 8404**描述** 8405 8406构造字体管理对象。 8407 8408**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8409 8410**起始版本:** 12 8411 8412**返回:** 8413 8414返回指向已创建的字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针。 8415 8416 8417### OH_Drawing_FontMgrCreateFontStyleSet() 8418 8419``` 8420OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet (OH_Drawing_FontMgr* , int index ) 8421``` 8422 8423**描述** 8424 8425由字体管理对象构造字体样式集对象。 8426 8427**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8428 8429**起始版本:** 12 8430 8431**参数:** 8432 8433| 名称 | 描述 | 8434| -------- | -------- | 8435| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8436| index | 用于从字体管理对象获取字体样式集对象的索引值。 | 8437 8438**返回:** 8439 8440返回指向已创建的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 8441 8442 8443### OH_Drawing_FontMgrDestroy() 8444 8445``` 8446void OH_Drawing_FontMgrDestroy (OH_Drawing_FontMgr* ) 8447``` 8448 8449**描述** 8450 8451释放字体管理对象占用的内存。 8452 8453**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8454 8455**起始版本:** 12 8456 8457**参数:** 8458 8459| 名称 | 描述 | 8460| -------- | -------- | 8461| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8462 8463 8464### OH_Drawing_FontMgrDestroyFamilyName() 8465 8466``` 8467void OH_Drawing_FontMgrDestroyFamilyName (char* familyName) 8468``` 8469 8470**描述** 8471 8472释放指定字体家族名称占用的内存。 8473 8474**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8475 8476**起始版本:** 12 8477 8478**参数:** 8479 8480| 名称 | 描述 | 8481| -------- | -------- | 8482| familyName | 指定字体家族名称数组。 | 8483 8484 8485### OH_Drawing_FontMgrDestroyFontStyleSet() 8486 8487``` 8488void OH_Drawing_FontMgrDestroyFontStyleSet (OH_Drawing_FontStyleSet* ) 8489``` 8490 8491**描述** 8492 8493释放字体样式集对象占用的内存。 8494 8495**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8496 8497**起始版本:** 12 8498 8499**参数:** 8500 8501| 名称 | 描述 | 8502| -------- | -------- | 8503| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8504 8505 8506### OH_Drawing_FontMgrGetFamilyCount() 8507 8508``` 8509int OH_Drawing_FontMgrGetFamilyCount (OH_Drawing_FontMgr* ) 8510``` 8511 8512**描述** 8513 8514获取字体家族的数量。 8515 8516**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8517 8518**起始版本:** 12 8519 8520**参数:** 8521 8522| 名称 | 描述 | 8523| -------- | -------- | 8524| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8525 8526**返回:** 8527 8528返回字体家族的数量。 8529 8530 8531### OH_Drawing_FontMgrGetFamilyName() 8532 8533``` 8534char* OH_Drawing_FontMgrGetFamilyName (OH_Drawing_FontMgr* , int index ) 8535``` 8536 8537**描述** 8538 8539由索引值获取字体家族名称。 8540 8541**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8542 8543**起始版本:** 12 8544 8545**参数:** 8546 8547| 名称 | 描述 | 8548| -------- | -------- | 8549| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8550| index | 用于获取对应字体家族名称的索引值。 | 8551 8552**返回:** 8553 8554返回索引值对应的字体家族名称。 8555 8556 8557### OH_Drawing_FontMgrMatchFamily() 8558 8559``` 8560OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily (OH_Drawing_FontMgr* , const char* familyName ) 8561``` 8562 8563**描述** 8564 8565由指定的字体家族名称,获取字体样式集对象。 8566 8567**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8568 8569**起始版本:** 12 8570 8571**参数:** 8572 8573| 名称 | 描述 | 8574| -------- | -------- | 8575| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8576| familyName | 指定的字体家族名称。 | 8577 8578**返回:** 8579 8580返回对应的字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)。 8581 8582 8583### OH_Drawing_FontMgrMatchFamilyStyle() 8584 8585``` 8586OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct ) 8587``` 8588 8589**描述** 8590 8591根据指定的字体样式信息和字体家族名称,获取字型对象。 8592 8593**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8594 8595**起始版本:** 12 8596 8597**参数:** 8598 8599| 名称 | 描述 | 8600| -------- | -------- | 8601| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8602| familyName | 指定的字体家族名称。 | 8603| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8604 8605**返回:** 8606 8607返回对应的字体样式的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8608 8609 8610### OH_Drawing_FontMgrMatchFamilyStyleCharacter() 8611 8612``` 8613OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter (OH_Drawing_FontMgr* , const char* familyName, OH_Drawing_FontStyleStruct , const char* bcp47[], int bcp47Count, int32_t character ) 8614``` 8615 8616**描述** 8617 8618为指定字符获取字型对象。 8619 8620**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8621 8622**起始版本:** 12 8623 8624**参数:** 8625 8626| 名称 | 描述 | 8627| -------- | -------- | 8628| OH_Drawing_FontMgr | 指向字体管理对象[OH_Drawing_FontMgr](#oh_drawing_fontmgr)的指针,由[OH_Drawing_FontMgrCreate](#oh_drawing_fontmgrcreate)获取。 | 8629| familyName | 指定的字体家族名称。 | 8630| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8631| bcp47 | 用来指示character语言编码数组,是ISO 639、15924和3166-1语言编码的组合。 | 8632| bcp47Count | 参数bcp47数组大小。 | 8633| character | 待匹配的UTF8字符值。 | 8634 8635**返回:** 8636 8637返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8638 8639 8640### OH_Drawing_FontParserGetFontByName() 8641 8642``` 8643OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser* , const char* ) 8644``` 8645 8646**描述** 8647 8648根据传入的系统字体名称获取系统字体的相关信息。 8649 8650**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8651 8652**起始版本:** 12 8653 8654**参数:** 8655 8656| 名称 | 描述 | 8657| -------- | -------- | 8658| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 8659| char\* | 系统字体名。 | 8660 8661**返回:** 8662 8663返回系统字体。 8664 8665 8666### OH_Drawing_FontParserGetSystemFontList() 8667 8668``` 8669char** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser* , size_t* ) 8670``` 8671 8672**描述** 8673 8674获取系统字体名称列表,此接口仅在2in1设备上可用。 8675 8676**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8677 8678**起始版本:** 12 8679 8680**参数:** 8681 8682| 名称 | 描述 | 8683| -------- | -------- | 8684| OH_Drawing_FontParser | 指向字体解析对象[OH_Drawing_FontParser](#oh_drawing_fontparser)的指针,由[OH_Drawing_CreateFontParser](#oh_drawing_createfontparser)获取。 | 8685| size_t | 返回获取到的系统字体名称数量。 | 8686 8687**返回:** 8688 8689返回获取到的系统字体列表。 8690 8691 8692### OH_Drawing_FontSetFakeBoldText() 8693 8694``` 8695void OH_Drawing_FontSetFakeBoldText (OH_Drawing_Font* , bool isFakeBoldText ) 8696``` 8697 8698**描述** 8699 8700用于设置增加描边宽度以近似粗体字体效果。 8701 8702本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8703 8704执行成功时返回OH_DRAWING_SUCCESS; 8705 8706OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8707 8708**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8709 8710**起始版本:** 11 8711 8712**参数:** 8713 8714| 名称 | 描述 | 8715| -------- | -------- | 8716| OH_Drawing_Font | 指向字体对象的指针。 | 8717| isFakeBoldText | 真为使能增加描边宽度,假为不使能。 | 8718 8719 8720### OH_Drawing_FontSetLinearText() 8721 8722``` 8723void OH_Drawing_FontSetLinearText (OH_Drawing_Font* , bool isLinearText ) 8724``` 8725 8726**描述** 8727 8728用于设置线性可缩放字体。 8729 8730本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8731 8732执行成功时返回OH_DRAWING_SUCCESS; 8733 8734OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8735 8736**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8737 8738**起始版本:** 11 8739 8740**参数:** 8741 8742| 名称 | 描述 | 8743| -------- | -------- | 8744| OH_Drawing_Font | 指向字体对象的指针。 | 8745| isLinearText | 真为使能线性可缩放字体,假为不使能。 | 8746 8747 8748### OH_Drawing_FontSetTextSize() 8749 8750``` 8751void OH_Drawing_FontSetTextSize (OH_Drawing_Font* , float textSize ) 8752``` 8753 8754**描述** 8755 8756用于给字体设置文字大小。 8757 8758本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8759 8760执行成功时返回OH_DRAWING_SUCCESS; 8761 8762OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8763 8764**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8765 8766**起始版本:** 11 8767 8768**参数:** 8769 8770| 名称 | 描述 | 8771| -------- | -------- | 8772| OH_Drawing_Font | 指向字体对象的指针。 | 8773| textSize | 字体大小。 | 8774 8775 8776### OH_Drawing_FontSetTextSkewX() 8777 8778``` 8779void OH_Drawing_FontSetTextSkewX (OH_Drawing_Font* , float skewX ) 8780``` 8781 8782**描述** 8783 8784用于给字体设置文本倾斜。 8785 8786本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8787 8788执行成功时返回OH_DRAWING_SUCCESS; 8789 8790OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8791 8792**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8793 8794**起始版本:** 11 8795 8796**参数:** 8797 8798| 名称 | 描述 | 8799| -------- | -------- | 8800| OH_Drawing_Font | 指向字体对象的指针。 | 8801| skewX | X轴相对于Y轴的倾斜度。 | 8802 8803 8804### OH_Drawing_FontSetTypeface() 8805 8806``` 8807void OH_Drawing_FontSetTypeface (OH_Drawing_Font* , OH_Drawing_Typeface* ) 8808``` 8809 8810**描述** 8811 8812用于给字体设置字形。 8813 8814本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 8815 8816执行成功时返回OH_DRAWING_SUCCESS; 8817 8818OH_Drawing_Font为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 8819 8820**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8821 8822**起始版本:** 11 8823 8824**参数:** 8825 8826| 名称 | 描述 | 8827| -------- | -------- | 8828| OH_Drawing_Font | 指向字体对象的指针。 | 8829| OH_Drawing_Typeface | 指向字形对象的指针,为NULL会使用系统默认字形对象。 | 8830 8831 8832### OH_Drawing_FontStyleSetCount() 8833 8834``` 8835int OH_Drawing_FontStyleSetCount (OH_Drawing_FontStyleSet* ) 8836``` 8837 8838**描述** 8839 8840获取字体样式集中字体的个数。 8841 8842**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8843 8844**起始版本:** 12 8845 8846**参数:** 8847 8848| 名称 | 描述 | 8849| -------- | -------- | 8850| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8851 8852**返回:** 8853 8854返回此字体样式集中字体的个数。 8855 8856 8857### OH_Drawing_FontStyleSetCreateTypeface() 8858 8859``` 8860OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface (OH_Drawing_FontStyleSet* , int index ) 8861``` 8862 8863**描述** 8864 8865为指定索引获取字型对象。 8866 8867**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8868 8869**起始版本:** 12 8870 8871**参数:** 8872 8873| 名称 | 描述 | 8874| -------- | -------- | 8875| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8876| index | 指定的字型对象的索引。 | 8877 8878**返回:** 8879 8880如果成功,返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface); 如果失败,返回nullptr。 8881 8882 8883### OH_Drawing_FontStyleSetFreeStyleName() 8884 8885``` 8886void OH_Drawing_FontStyleSetFreeStyleName (char** styleName) 8887``` 8888 8889**描述** 8890 8891释放指定字体样式的内存。 8892 8893**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8894 8895**起始版本:** 12 8896 8897**参数:** 8898 8899| 名称 | 描述 | 8900| -------- | -------- | 8901| styleName | 指定字体样式名称的字符串。 | 8902 8903 8904### OH_Drawing_FontStyleSetGetStyle() 8905 8906``` 8907OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle (OH_Drawing_FontStyleSet* , int32_t index, char** styleName ) 8908``` 8909 8910**描述** 8911 8912获取字体样式。 8913 8914**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8915 8916**起始版本:** 12 8917 8918**参数:** 8919 8920| 名称 | 描述 | 8921| -------- | -------- | 8922| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8923| index | 指定的字体样式的索引。 | 8924| styleName | 指定字体样式名称的字符串。 | 8925 8926**返回:** 8927 8928返回对应的字体样式。 8929 8930 8931### OH_Drawing_FontStyleSetMatchStyle() 8932 8933``` 8934OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle (OH_Drawing_FontStyleSet* , OH_Drawing_FontStyleStruct fontStyleStruct ) 8935``` 8936 8937**描述** 8938 8939获取最接近字体样式的字型对象。 8940 8941**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8942 8943**起始版本:** 12 8944 8945**参数:** 8946 8947| 名称 | 描述 | 8948| -------- | -------- | 8949| OH_Drawing_FontStyleSet | 指向字体样式集对象[OH_Drawing_FontStyleSet](#oh_drawing_fontstyleset)的指针。 | 8950| fontStyleStruct | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 8951 8952**返回:** 8953 8954返回对应的字型对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 8955 8956 8957### OH_Drawing_GetAffinityFromPositionAndAffinity() 8958 8959``` 8960int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 8961``` 8962 8963**描述** 8964 8965获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 8966 8967**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8968 8969**起始版本:** 11 8970 8971**参数:** 8972 8973| 名称 | 描述 | 8974| -------- | -------- | 8975| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 | 8976 8977**返回:** 8978 8979返回OH_Drawing_PositionAndAffinity对象的亲和性。 8980 8981 8982### OH_Drawing_GetBottomFromTextBox() 8983 8984``` 8985float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox* , int ) 8986``` 8987 8988**描述** 8989 8990获取文本框底部位置。 8991 8992**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 8993 8994**起始版本:** 11 8995 8996**参数:** 8997 8998| 名称 | 描述 | 8999| -------- | -------- | 9000| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9001| int | 文本框的索引。 | 9002 9003**返回:** 9004 9005返回文本框底部位置。 9006 9007 9008### OH_Drawing_GetEndFromRange() 9009 9010``` 9011size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range* ) 9012``` 9013 9014**描述** 9015 9016获取OH_Drawing_Range对象结束位置。 9017 9018**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9019 9020**起始版本:** 11 9021 9022**参数:** 9023 9024| 名称 | 描述 | 9025| -------- | -------- | 9026| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 | 9027 9028**返回:** 9029 9030返回OH_Drawing_Range对象结束位置。 9031 9032 9033### OH_Drawing_GetLeftFromTextBox() 9034 9035``` 9036float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox* , int ) 9037``` 9038 9039**描述** 9040 9041获取文本框左侧位置。 9042 9043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9044 9045**起始版本:** 11 9046 9047**参数:** 9048 9049| 名称 | 描述 | 9050| -------- | -------- | 9051| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9052| int | 文本框的索引。 | 9053 9054**返回:** 9055 9056返回文本框左侧位置。 9057 9058 9059### OH_Drawing_GetPositionFromPositionAndAffinity() 9060 9061``` 9062size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity* ) 9063``` 9064 9065**描述** 9066 9067获取OH_Drawing_PositionAndAffinity对象的位置属性。 9068 9069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9070 9071**起始版本:** 11 9072 9073**参数:** 9074 9075| 名称 | 描述 | 9076| -------- | -------- | 9077| OH_Drawing_PositionAndAffinity | 指向OH_Drawing_PositionAndAffinity对象的指针, 由[OH_Drawing_TypographyGetGlyphPositionAtCoordinate](#oh_drawing_typographygetglyphpositionatcoordinate)或 [OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster](#oh_drawing_typographygetglyphpositionatcoordinatewithcluster)获取。 | 9078 9079**返回:** 9080 9081返回OH_Drawing_PositionAndAffinity对象的位置属性。 9082 9083 9084### OH_Drawing_GetRightFromTextBox() 9085 9086``` 9087float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox* , int ) 9088``` 9089 9090**描述** 9091 9092获取文本框右侧位置。 9093 9094**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9095 9096**起始版本:** 11 9097 9098**参数:** 9099 9100| 名称 | 描述 | 9101| -------- | -------- | 9102| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9103| int | 文本框的索引。 | 9104 9105**返回:** 9106 9107返回文本框右侧位置。 9108 9109 9110### OH_Drawing_GetSizeOfTextBox() 9111 9112``` 9113size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox* ) 9114``` 9115 9116**描述** 9117 9118获取文本框数量大小。 9119 9120**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9121 9122**起始版本:** 11 9123 9124**参数:** 9125 9126| 名称 | 描述 | 9127| -------- | -------- | 9128| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9129 9130**返回:** 9131 9132返回文本框数量大小。 9133 9134 9135### OH_Drawing_GetStartFromRange() 9136 9137``` 9138size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range* ) 9139``` 9140 9141**描述** 9142 9143获取OH_Drawing_Range对象开始位置。 9144 9145**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9146 9147**起始版本:** 11 9148 9149**参数:** 9150 9151| 名称 | 描述 | 9152| -------- | -------- | 9153| OH_Drawing_Range | 指向OH_Drawing_Range对象的指针,由[OH_Drawing_TypographyGetWordBoundary](#oh_drawing_typographygetwordboundary)获取。 | 9154 9155**返回:** 9156 9157返回OH_Drawing_Range对象开始位置。 9158 9159 9160### OH_Drawing_GetSystemFontConfigInfo() 9161 9162``` 9163OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode* ) 9164``` 9165 9166**描述** 9167 9168获取系统字体配置信息。 9169 9170**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9171 9172**起始版本:** 12 9173 9174**参数:** 9175 9176| 名称 | 描述 | 9177| -------- | -------- | 9178| OH_Drawing_FontConfigJsonInfoCode | 错误码,具体可见[OH_Drawing_FontConfigInfoErrorCode](#oh_drawing_fontconfiginfoerrorcode)枚举。 | 9179 9180**返回:** 9181 9182返回系统字体配置信息的指针。 9183 9184 9185### OH_Drawing_GetTextDirectionFromTextBox() 9186 9187``` 9188int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox* , int ) 9189``` 9190 9191**描述** 9192 9193获取文本框方向。 9194 9195**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9196 9197**起始版本:** 11 9198 9199**参数:** 9200 9201| 名称 | 描述 | 9202| -------- | -------- | 9203| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9204| int | 文本框的索引。 | 9205 9206**返回:** 9207 9208返回文本框方向。 9209 9210 9211### OH_Drawing_GetTopFromTextBox() 9212 9213``` 9214float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox* , int ) 9215``` 9216 9217**描述** 9218 9219获取文本框顶部位置。 9220 9221**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9222 9223**起始版本:** 11 9224 9225**参数:** 9226 9227| 名称 | 描述 | 9228| -------- | -------- | 9229| OH_Drawing_TextBox | 指向OH_Drawing_TextBox对象的指针,由[OH_Drawing_TypographyGetRectsForRange](#oh_drawing_typographygetrectsforrange)或 [OH_Drawing_TypographyGetRectsForPlaceholders](#oh_drawing_typographygetrectsforplaceholders)获取。 | 9230| int | 文本框的索引。 | 9231 9232**返回:** 9233 9234返回文本框顶部位置。 9235 9236 9237### OH_Drawing_GpuContextCreateFromGL() 9238 9239``` 9240OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL (OH_Drawing_GpuContextOptions ) 9241``` 9242 9243**描述** 9244 9245用于创建一个使用OpenGL作为后端接口的图形处理器上下文对象。 9246 9247**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9248 9249**起始版本:** 12 9250 9251**参数:** 9252 9253| 名称 | 描述 | 9254| -------- | -------- | 9255| OH_Drawing_GpuContextOptions | 图形处理器上下文选项[OH_Drawing_GpuContextOptions](_o_h___drawing___gpu_context_options.md)。 | 9256 9257**返回:** 9258 9259返回一个指针,指针指向创建的图形处理器上下文对象[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 9260 9261 9262### OH_Drawing_GpuContextDestroy() 9263 9264``` 9265void OH_Drawing_GpuContextDestroy (OH_Drawing_GpuContext* ) 9266``` 9267 9268**描述** 9269 9270用于销毁图形处理器上下文对象并回收该对象占用的内存。 9271 9272**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9273 9274**起始版本:** 12 9275 9276**参数:** 9277 9278| 名称 | 描述 | 9279| -------- | -------- | 9280| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 | 9281 9282 9283### OH_Drawing_ImageBuildFromBitmap() 9284 9285``` 9286bool OH_Drawing_ImageBuildFromBitmap (OH_Drawing_Image* , OH_Drawing_Bitmap* ) 9287``` 9288 9289**描述** 9290 9291从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, 像素内存是共享的,不是复制。 9292 9293本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9294 9295执行成功时返回OH_DRAWING_SUCCESS; 9296 9297OH_Drawing_Image、OH_Drawing_Bitmap任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9298 9299**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9300 9301**起始版本:** 12 9302 9303**参数:** 9304 9305| 名称 | 描述 | 9306| -------- | -------- | 9307| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9308| OH_Drawing_Bitmap | 指向位图对象[OH_Drawing_Bitmap](#oh_drawing_bitmap)的指针。 | 9309 9310**返回:** 9311 9312函数返回true表示构造图片内容成功,函数返回false表示构建图片内容失败。 9313 9314 9315### OH_Drawing_ImageCreate() 9316 9317``` 9318OH_Drawing_Image* OH_Drawing_ImageCreate (void ) 9319``` 9320 9321**描述** 9322 9323创建一个图片对象,描述了要绘制的二维像素数组。 9324 9325**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9326 9327**起始版本:** 12 9328 9329**返回:** 9330 9331函数返回一个指针,指针指向创建的图片对象[OH_Drawing_Image](#oh_drawing_image)。 9332 9333 9334### OH_Drawing_ImageDestroy() 9335 9336``` 9337void OH_Drawing_ImageDestroy (OH_Drawing_Image* ) 9338``` 9339 9340**描述** 9341 9342销毁图片对象并回收该对象占有内存。 9343 9344**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9345 9346**起始版本:** 12 9347 9348**参数:** 9349 9350| 名称 | 描述 | 9351| -------- | -------- | 9352| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9353 9354 9355### OH_Drawing_ImageGetHeight() 9356 9357``` 9358int32_t OH_Drawing_ImageGetHeight (OH_Drawing_Image* ) 9359``` 9360 9361**描述** 9362 9363获取图片高度,即像素行数。 9364 9365本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9366 9367执行成功时返回OH_DRAWING_SUCCESS; 9368 9369OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9370 9371**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9372 9373**起始版本:** 12 9374 9375**参数:** 9376 9377| 名称 | 描述 | 9378| -------- | -------- | 9379| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9380 9381**返回:** 9382 9383函数返回图片高度。 9384 9385 9386### OH_Drawing_ImageGetImageInfo() 9387 9388``` 9389void OH_Drawing_ImageGetImageInfo (OH_Drawing_Image* , OH_Drawing_Image_Info* ) 9390``` 9391 9392**描述** 9393 9394获取图片信息。调用该接口后,传入的图片信息对象被填充。 9395 9396本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9397 9398执行成功时返回OH_DRAWING_SUCCESS; 9399 9400OH_Drawing_Image、OH_Drawing_Image_Info任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9401 9402**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9403 9404**起始版本:** 12 9405 9406**参数:** 9407 9408| 名称 | 描述 | 9409| -------- | -------- | 9410| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9411| OH_Drawing_Image_Info | 指向图片信息对象[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)的指针, 开发者可调用[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)创建。 | 9412 9413 9414### OH_Drawing_ImageGetWidth() 9415 9416``` 9417int32_t OH_Drawing_ImageGetWidth (OH_Drawing_Image* ) 9418``` 9419 9420**描述** 9421 9422获取图片宽度,即每行的像素个数。 9423 9424本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9425 9426执行成功时返回OH_DRAWING_SUCCESS; 9427 9428OH_Drawing_Image为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9429 9430**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9431 9432**起始版本:** 12 9433 9434**参数:** 9435 9436| 名称 | 描述 | 9437| -------- | -------- | 9438| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 9439 9440**返回:** 9441 9442函数返回图片宽度。 9443 9444 9445### OH_Drawing_LineMetricsGetSize() 9446 9447``` 9448size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics* ) 9449``` 9450 9451**描述** 9452 9453获取行数量。 9454 9455**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9456 9457**起始版本:** 12 9458 9459**参数:** 9460 9461| 名称 | 描述 | 9462| -------- | -------- | 9463| [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)获取。 | 9464 9465**返回:** 9466 9467返回行数量。 9468 9469 9470### OH_Drawing_MaskFilterCreateBlur() 9471 9472``` 9473OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur (OH_Drawing_BlurType blurType, float sigma, bool respectCTM ) 9474``` 9475 9476**描述** 9477 9478创建具有模糊效果的模板滤波器。 9479 9480**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9481 9482**起始版本:** 11 9483 9484**参数:** 9485 9486| 名称 | 描述 | 9487| -------- | -------- | 9488| blurType | 表示模糊类型。 | 9489| sigma | 表示要应用的高斯模糊的标准偏差。必须大于0。 | 9490| respectCTM | 表示模糊标准差值被CTM修改,默认为真。 | 9491 9492**返回:** 9493 9494返回创建的模板滤波器对象的指针。 9495 9496 9497### OH_Drawing_MaskFilterDestroy() 9498 9499``` 9500void OH_Drawing_MaskFilterDestroy (OH_Drawing_MaskFilter* ) 9501``` 9502 9503**描述** 9504 9505销毁模板滤波器对象,并收回该对象占用的内存。 9506 9507**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9508 9509**起始版本:** 11 9510 9511**参数:** 9512 9513| 名称 | 描述 | 9514| -------- | -------- | 9515| OH_Drawing_MaskFilter | 表示指向模板滤波器对象的指针。 | 9516 9517 9518### OH_Drawing_MatrixConcat() 9519 9520``` 9521void OH_Drawing_MatrixConcat (OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, const OH_Drawing_Matrix* b ) 9522``` 9523 9524**描述** 9525 9526将矩阵total设置为矩阵a乘以矩阵b。 9527 9528本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9529 9530执行成功时返回OH_DRAWING_SUCCESS; 9531 9532total、a、b任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9533 9534**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9535 9536**起始版本:** 12 9537 9538**参数:** 9539 9540| 名称 | 描述 | 9541| -------- | -------- | 9542| total | 指向最终的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9543| a | 指向矩阵对象a[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9544| b | 指向矩阵对象b[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9545 9546 9547### OH_Drawing_MatrixCreate() 9548 9549``` 9550OH_Drawing_Matrix* OH_Drawing_MatrixCreate (void ) 9551``` 9552 9553**描述** 9554 9555用于创建一个矩阵对象。 9556 9557**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9558 9559**起始版本:** 11 9560 9561**返回:** 9562 9563函数会返回一个指针,指针指向创建的矩阵对象。 9564 9565 9566### OH_Drawing_MatrixCreateRotation() 9567 9568``` 9569OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation (float deg, float x, float y ) 9570``` 9571 9572**描述** 9573 9574创建一个带旋转属性的矩阵对象。 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转后得到的矩阵。 9575 9576**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9577 9578**起始版本:** 12 9579 9580**参数:** 9581 9582| 名称 | 描述 | 9583| -------- | -------- | 9584| deg | 旋转的角度,单位为度。正数表示按顺时针旋转,负数表示按逆时针旋转。 | 9585| x | x轴上坐标点。 | 9586| y | y轴上坐标点。 | 9587 9588**返回:** 9589 9590函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9591 9592 9593### OH_Drawing_MatrixCreateScale() 9594 9595``` 9596OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale (float sx, float sy, float px, float py ) 9597``` 9598 9599**描述** 9600 9601创建一个带缩放属性的矩阵对象。 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放后得到的矩阵。 9602 9603**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9604 9605**起始版本:** 12 9606 9607**参数:** 9608 9609| 名称 | 描述 | 9610| -------- | -------- | 9611| sx | 水平缩放因子。 | 9612| sy | 垂直缩放因子。 | 9613| px | x轴上坐标点。 | 9614| py | y轴上坐标点。 | 9615 9616**返回:** 9617 9618函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9619 9620 9621### OH_Drawing_MatrixCreateTranslation() 9622 9623``` 9624OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation (float dx, float dy ) 9625``` 9626 9627**描述** 9628 9629创建一个带平移属性的矩阵对象。 该矩阵对象为:单位矩阵平移(dx, dy)后得到的矩阵。 9630 9631**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9632 9633**起始版本:** 12 9634 9635**参数:** 9636 9637| 名称 | 描述 | 9638| -------- | -------- | 9639| dx | 水平方向平移距离。 | 9640| dy | 垂直方向平移距离。 | 9641 9642**返回:** 9643 9644函数返回一个指针,指针指向创建的矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)。 9645 9646 9647### OH_Drawing_MatrixDestroy() 9648 9649``` 9650void OH_Drawing_MatrixDestroy (OH_Drawing_Matrix* ) 9651``` 9652 9653**描述** 9654 9655用于销毁矩阵对象并回收该对象占有的内存。 9656 9657**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9658 9659**起始版本:** 11 9660 9661**参数:** 9662 9663| 名称 | 描述 | 9664| -------- | -------- | 9665| OH_Drawing_Matrix | 指向字体对象的指针。 | 9666 9667 9668### OH_Drawing_MatrixGetValue() 9669 9670``` 9671float OH_Drawing_MatrixGetValue (OH_Drawing_Matrix* , int index ) 9672``` 9673 9674**描述** 9675 9676获取矩阵给定索引位的值。索引范围0-8。 9677 9678本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9679 9680执行成功时返回OH_DRAWING_SUCCESS; 9681 9682OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 9683 9684index小于0或者大于8时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 9685 9686**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9687 9688**起始版本:** 12 9689 9690**参数:** 9691 9692| 名称 | 描述 | 9693| -------- | -------- | 9694| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9695| index | 索引位置,范围0-8。 | 9696 9697**返回:** 9698 9699函数返回矩阵给定索引位对应的值。 9700 9701 9702### OH_Drawing_MatrixInvert() 9703 9704``` 9705bool OH_Drawing_MatrixInvert (OH_Drawing_Matrix* , OH_Drawing_Matrix* inverse ) 9706``` 9707 9708**描述** 9709 9710将矩阵inverse设置为矩阵的倒数,并返回结果。 9711 9712本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9713 9714执行成功时返回OH_DRAWING_SUCCESS; 9715 9716OH_Drawing_Matrix、inverse任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9717 9718**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9719 9720**起始版本:** 12 9721 9722**参数:** 9723 9724| 名称 | 描述 | 9725| -------- | -------- | 9726| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9727| inverse | 指向逆矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针, 开发者可调用[OH_Drawing_MatrixCreate](#oh_drawing_matrixcreate)接口创建。 | 9728 9729**返回:** 9730 9731函数返回true表示矩阵可逆,inverse被填充为逆矩阵;函数返回false表示矩阵不可逆,inverse不被改变。 9732 9733 9734### OH_Drawing_MatrixIsEqual() 9735 9736``` 9737bool OH_Drawing_MatrixIsEqual (OH_Drawing_Matrix* , OH_Drawing_Matrix* other ) 9738``` 9739 9740**描述** 9741 9742判断两个矩阵是否相等。 9743 9744本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9745 9746执行成功时返回OH_DRAWING_SUCCESS; 9747 9748OH_Drawing_Matrix、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9749 9750**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9751 9752**起始版本:** 12 9753 9754**参数:** 9755 9756| 名称 | 描述 | 9757| -------- | -------- | 9758| OH_Drawing_Matrix | 指向用于判断的其中一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9759| other | 指向用于判断的另一个矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9760 9761**返回:** 9762 9763函数返回两个矩阵的比较结果,返回true表示两个矩阵相等,返回false表示两个矩阵不相等。 9764 9765 9766### OH_Drawing_MatrixIsIdentity() 9767 9768``` 9769bool OH_Drawing_MatrixIsIdentity (OH_Drawing_Matrix* ) 9770``` 9771 9772**描述** 9773 9774判断矩阵是否是单位矩阵。 9775 9776本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9777 9778执行成功时返回OH_DRAWING_SUCCESS; 9779 9780OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 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 9792**返回:** 9793 9794函数返回true表示矩阵是单位矩阵,函数返回false表示矩阵不是单位矩阵。 9795 9796 9797### OH_Drawing_MatrixPostRotate() 9798 9799``` 9800void OH_Drawing_MatrixPostRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9801``` 9802 9803**描述** 9804 9805将矩阵设置为矩阵右乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 9806 9807本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9808 9809执行成功时返回OH_DRAWING_SUCCESS; 9810 9811OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9812 9813**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9814 9815**起始版本:** 12 9816 9817**参数:** 9818 9819| 名称 | 描述 | 9820| -------- | -------- | 9821| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9822| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 9823| px | 旋转中心点的横坐标。 | 9824| py | 旋转中心点的纵坐标。 | 9825 9826 9827### OH_Drawing_MatrixPostScale() 9828 9829``` 9830void OH_Drawing_MatrixPostScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9831``` 9832 9833**描述** 9834 9835将矩阵设置为矩阵右乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 9836 9837本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9838 9839执行成功时返回OH_DRAWING_SUCCESS; 9840 9841OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9842 9843 9844**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9845 9846**起始版本:** 12 9847 9848**参数:** 9849 9850| 名称 | 描述 | 9851| -------- | -------- | 9852| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9853| sx | x轴方向的缩放比例因子。 | 9854| sy | y轴方向的缩放比例因子。 | 9855| px | 缩放中心点的横坐标。 | 9856| py | 缩放中心点的纵坐标。 | 9857 9858 9859### OH_Drawing_MatrixPostTranslate() 9860 9861``` 9862void OH_Drawing_MatrixPostTranslate (OH_Drawing_Matrix* , float dx, float dy ) 9863``` 9864 9865**描述** 9866 9867将矩阵设置为矩阵右乘平移一定距离后的单位矩阵后得到的矩阵。 9868 9869本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9870 9871执行成功时返回OH_DRAWING_SUCCESS; 9872 9873OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9874 9875 9876**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9877 9878**起始版本:** 12 9879 9880**参数:** 9881 9882| 名称 | 描述 | 9883| -------- | -------- | 9884| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9885| dx | 表示在x轴方向上的平移距离。 | 9886| dy | 表示在y轴方向上的平移距离。 | 9887 9888 9889### OH_Drawing_MatrixPreRotate() 9890 9891``` 9892void OH_Drawing_MatrixPreRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 9893``` 9894 9895**描述** 9896 9897将矩阵设置为矩阵左乘围绕轴心点旋转一定角度的单位矩阵后得到的矩阵。 9898 9899本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9900 9901执行成功时返回OH_DRAWING_SUCCESS; 9902 9903OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9904 9905 9906**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9907 9908**起始版本:** 12 9909 9910**参数:** 9911 9912| 名称 | 描述 | 9913| -------- | -------- | 9914| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9915| degree | 旋转角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 9916| px | 旋转中心点的横坐标。 | 9917| py | 旋转中心点的纵坐标。 | 9918 9919 9920### OH_Drawing_MatrixPreScale() 9921 9922``` 9923void OH_Drawing_MatrixPreScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 9924``` 9925 9926**描述** 9927 9928将矩阵设置为矩阵左乘围绕轴心点按一定缩放因子缩放后的单位矩阵后得到的矩阵。 9929 9930本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9931 9932执行成功时返回OH_DRAWING_SUCCESS; 9933 9934OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9935 9936 9937**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9938 9939**起始版本:** 12 9940 9941**参数:** 9942 9943| 名称 | 描述 | 9944| -------- | -------- | 9945| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9946| sx | x轴方向的缩放比例因子。 | 9947| sy | y轴方向的缩放比例因子。 | 9948| px | 缩放中心点的横坐标。 | 9949| py | 缩放中心点的纵坐标。 | 9950 9951 9952### OH_Drawing_MatrixPreTranslate() 9953 9954``` 9955void OH_Drawing_MatrixPreTranslate (OH_Drawing_Matrix* , float dx, float dy ) 9956``` 9957 9958**描述** 9959 9960将矩阵设置为矩阵左乘平移一定距离后的单位矩阵后得到的矩阵。 9961 9962本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9963 9964执行成功时返回OH_DRAWING_SUCCESS; 9965 9966OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9967 9968**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9969 9970**起始版本:** 12 9971 9972**参数:** 9973 9974| 名称 | 描述 | 9975| -------- | -------- | 9976| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 9977| dx | 表示在x轴方向上的平移距离。 | 9978| dy | 表示在y轴方向上的平移距离。 | 9979 9980 9981### OH_Drawing_MatrixReset() 9982 9983``` 9984void OH_Drawing_MatrixReset (OH_Drawing_Matrix* ) 9985``` 9986 9987**描述** 9988 9989重置当前矩阵为单位矩阵: | 1 0 0 | | 0 1 0 | | 0 0 1 |。 9990 9991本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 9992 9993执行成功时返回OH_DRAWING_SUCCESS; 9994 9995OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 9996 9997**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 9998 9999**起始版本:** 12 10000 10001**参数:** 10002 10003| 名称 | 描述 | 10004| -------- | -------- | 10005| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10006 10007 10008### OH_Drawing_MatrixRotate() 10009 10010``` 10011void OH_Drawing_MatrixRotate (OH_Drawing_Matrix* , float degree, float px, float py ) 10012``` 10013 10014**描述** 10015 10016设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 10017 10018本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10019 10020执行成功时返回OH_DRAWING_SUCCESS; 10021 10022OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10023 10024**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10025 10026**起始版本:** 12 10027 10028**参数:** 10029 10030| 名称 | 描述 | 10031| -------- | -------- | 10032| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10033| degree | 角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 | 10034| px | x轴上坐标点。 | 10035| py | y轴上坐标点。 | 10036 10037 10038### OH_Drawing_MatrixScale() 10039 10040``` 10041void OH_Drawing_MatrixScale (OH_Drawing_Matrix* , float sx, float sy, float px, float py ) 10042``` 10043 10044**描述** 10045 10046设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 10047 10048本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10049 10050执行成功时返回OH_DRAWING_SUCCESS; 10051 10052OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10053 10054**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10055 10056**起始版本:** 12 10057 10058**参数:** 10059 10060| 名称 | 描述 | 10061| -------- | -------- | 10062| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10063| sx | 水平缩放因子。 | 10064| sy | 垂直缩放因子。 | 10065| px | x轴上坐标点。 | 10066| py | y轴上坐标点。 | 10067 10068 10069### OH_Drawing_MatrixSetMatrix() 10070 10071``` 10072void OH_Drawing_MatrixSetMatrix (OH_Drawing_Matrix* , float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2 ) 10073``` 10074 10075**描述** 10076 10077用于给矩阵对象设置参数。 10078 10079本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10080 10081执行成功时返回OH_DRAWING_SUCCESS; 10082 10083OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10084 10085**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10086 10087**起始版本:** 11 10088 10089**参数:** 10090 10091| 名称 | 描述 | 10092| -------- | -------- | 10093| OH_Drawing_Matrix | 指向矩阵对象的指针。 | 10094| scaleX | 水平缩放系数。 | 10095| skewX | 水平倾斜系数。 | 10096| transX | 水平位移系数。 | 10097| skewY | 垂直倾斜系数。 | 10098| scaleY | 垂直缩放系数。 | 10099| transY | 垂直位移系数。 | 10100| persp0 | X轴透视系数。 | 10101| persp1 | Y轴透视系数。 | 10102| persp2 | 透视缩放系数。 | 10103 10104 10105### OH_Drawing_MatrixSetPolyToPoly() 10106 10107``` 10108bool OH_Drawing_MatrixSetPolyToPoly (OH_Drawing_Matrix* , const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count ) 10109``` 10110 10111**描述** 10112 10113通过设置源点以及目标点,生成对应的变换矩阵。 源点以及目标点的个数要大于等于0,小于等于4。 10114 10115本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10116 10117执行成功时返回OH_DRAWING_SUCCESS; 10118 10119OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10120 10121count小于0或者大于4时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10122 10123**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10124 10125**起始版本:** 12 10126 10127**参数:** 10128 10129| 名称 | 描述 | 10130| -------- | -------- | 10131| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10132| src | 源点数组,为NULL时count应当为0。 | 10133| dst | 目标点数组,个数要与源点相等,为NULL时count应当为0。 | 10134| count | 源点数组以及目标点数组的个数,为0时将矩阵对象设为单位矩阵。 | 10135 10136**返回:** 10137 10138函数返回是否可以生成对应矩阵以用来完成变换。true表示矩阵生成成功,false表示无法生成对应矩阵。 10139 10140 10141### OH_Drawing_MatrixSetRectToRect() 10142 10143``` 10144bool OH_Drawing_MatrixSetRectToRect (OH_Drawing_Matrix* , const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf ) 10145``` 10146 10147**描述** 10148 10149将矩阵以缩放方式适配目标矩阵。 10150 10151本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10152 10153执行成功时返回OH_DRAWING_SUCCESS; 10154 10155OH_Drawing_Matrix、src、dst任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10156 10157**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10158 10159**起始版本:** 12 10160 10161**参数:** 10162 10163| 名称 | 描述 | 10164| -------- | -------- | 10165| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10166| src | 指向映射源的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 | 10167| dst | 指向要映射到的[OH_Drawing_Rect](#oh_drawing_rect)对象Rect的指针。 | 10168| stf | 缩放方式,支持方式[OH_Drawing_ScaleToFit](#oh_drawing_scaletofit)。 | 10169 10170**返回:** 10171 10172如果设置失败,则返回false;如果设置成功,则返回true;如果矩阵为空,则返回true,并将矩阵设置为:|0 0 0| |0 0 0| |0 0 1| 10173 10174### OH_Drawing_MatrixTranslate() 10175 10176``` 10177void OH_Drawing_MatrixTranslate (OH_Drawing_Matrix* , float dx, float dy ) 10178``` 10179 10180**描述** 10181 10182设置矩阵为单位矩阵,并平移(dx, dy)。 10183 10184本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10185 10186执行成功时返回OH_DRAWING_SUCCESS; 10187 10188OH_Drawing_Matrix为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10189 10190**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10191 10192**起始版本:** 12 10193 10194**参数:** 10195 10196| 名称 | 描述 | 10197| -------- | -------- | 10198| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 10199| dx | 水平方向平移距离。 | 10200| dy | 垂直方向平移距离。 | 10201 10202 10203### OH_Drawing_MemoryStreamCreate() 10204 10205``` 10206OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate (const void* data, size_t length, bool copyData ) 10207``` 10208 10209**描述** 10210 10211创建一个内存流对象。 10212 10213本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10214 10215执行成功时返回OH_DRAWING_SUCCESS; 10216 10217data为NULL或者length等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10218 10219**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10220 10221**起始版本:** 12 10222 10223**参数:** 10224 10225| 名称 | 描述 | 10226| -------- | -------- | 10227| data | 数据段。 | 10228| length | 数据段长度。 | 10229| copyData | 是否拷贝数据。true表示内存流对象会拷贝一份数据段数据, false表示内存流对象直接使用数据段数据,不拷贝。 | 10230 10231**返回:** 10232 10233函数会返回一个指针,指针指向创建的内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)。 10234 10235 10236### OH_Drawing_MemoryStreamDestroy() 10237 10238``` 10239void OH_Drawing_MemoryStreamDestroy (OH_Drawing_MemoryStream* ) 10240``` 10241 10242**描述** 10243 10244销毁内存流对象并回收该对象占有内存。 10245 10246**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10247 10248**起始版本:** 12 10249 10250**参数:** 10251 10252| 名称 | 描述 | 10253| -------- | -------- | 10254| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 | 10255 10256 10257### OH_Drawing_PathAddArc() 10258 10259``` 10260void OH_Drawing_PathAddArc (OH_Drawing_Path* , const OH_Drawing_Rect* , float startAngle, float sweepAngle ) 10261``` 10262 10263**描述** 10264 10265将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫掠角度添加弧, 添加的弧是椭圆边界椭圆的一部分,单位为度。正扫掠表示按顺时针方向延长弧, 负扫掠表示按逆时针方向延长弧。如果扫掠角度<= -360°,或扫掠角度>= 360°, 并且起始角度对90取模接近于0,则添加椭圆而不是弧。 10266 10267本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10268 10269执行成功时返回OH_DRAWING_SUCCESS; 10270 10271OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10272 10273**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10274 10275**起始版本:** 12 10276 10277**参数:** 10278 10279| 名称 | 描述 | 10280| -------- | -------- | 10281| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10282| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10283| startAngle | 弧的起始角度,单位为度。 | 10284| sweepAngle | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 | 10285 10286### OH_Drawing_PathAddOval() 10287 10288``` 10289void OH_Drawing_PathAddOval (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection ) 10290``` 10291 10292**描述** 10293 10294按指定方向,向路径添加椭圆。 10295 10296本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10297 10298执行成功时返回OH_DRAWING_SUCCESS; 10299 10300OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10301 10302OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10303 10304**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10305 10306**起始版本:** 12 10307 10308**参数:** 10309 10310| 名称 | 描述 | 10311| -------- | -------- | 10312| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10313| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10314| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10315 10316### OH_Drawing_PathAddOvalWithInitialPoint() 10317 10318``` 10319void OH_Drawing_PathAddOvalWithInitialPoint (OH_Drawing_Path* , const OH_Drawing_Rect* , uint32_t start, OH_Drawing_PathDirection ) 10320``` 10321 10322**描述** 10323 10324将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。 10325 10326本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10327 10328执行成功时返回OH_DRAWING_SUCCESS; 10329 10330OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10331 10332OH_Drawing_PathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10333 10334**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10335 10336**起始版本:** 12 10337 10338**参数:** 10339 10340| 名称 | 描述 | 10341| -------- | -------- | 10342| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10343| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10344| start | 表示椭圆初始点的索引。 | 10345| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10346 10347 10348### OH_Drawing_PathAddPath() 10349 10350``` 10351void OH_Drawing_PathAddPath (OH_Drawing_Path* , const OH_Drawing_Path* src, const OH_Drawing_Matrix* ) 10352``` 10353 10354**描述** 10355 10356将源路径矩阵变换后,添加到当前路径中。 10357 10358本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10359 10360执行成功时返回OH_DRAWING_SUCCESS; 10361 10362OH_Drawing_Path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10363 10364**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10365 10366**起始版本:** 12 10367 10368**参数:** 10369 10370| 名称 | 描述 | 10371| -------- | -------- | 10372| OH_Drawing_Path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10373| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10374| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 | 10375 10376 10377### OH_Drawing_PathAddPathWithMatrixAndMode() 10378 10379``` 10380void OH_Drawing_PathAddPathWithMatrixAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_PathAddMode ) 10381``` 10382 10383**描述** 10384 10385将源路径矩阵变换后,以规定模式添加到当前路径中。 10386 10387本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10388 10389执行成功时返回OH_DRAWING_SUCCESS; 10390 10391path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10392 10393OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10394 10395**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10396 10397**起始版本:** 12 10398 10399**参数:** 10400 10401| 名称 | 描述 | 10402| -------- | -------- | 10403| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10404| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10405| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针,为NULL表示单位矩阵。 | 10406| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10407 10408 10409### OH_Drawing_PathAddPathWithMode() 10410 10411``` 10412void OH_Drawing_PathAddPathWithMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode ) 10413``` 10414 10415**描述** 10416 10417将源路径以规定模式添加到当前路径中。 10418 10419本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10420 10421执行成功时返回OH_DRAWING_SUCCESS; 10422 10423path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10424 10425OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10426 10427**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10428 10429**起始版本:** 12 10430 10431**参数:** 10432 10433| 名称 | 描述 | 10434| -------- | -------- | 10435| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10436| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10437| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10438 10439 10440### OH_Drawing_PathAddPathWithOffsetAndMode() 10441 10442``` 10443void OH_Drawing_PathAddPathWithOffsetAndMode (OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, OH_Drawing_PathAddMode ) 10444``` 10445 10446**描述** 10447 10448将源路径偏移后,以规定模式添加到当前路径中。 10449 10450本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10451 10452执行成功时返回OH_DRAWING_SUCCESS; 10453 10454path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10455 10456OH_Drawing_PathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10457 10458**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10459 10460**起始版本:** 12 10461 10462**参数:** 10463 10464| 名称 | 描述 | 10465| -------- | -------- | 10466| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10467| src | 指向源路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10468| dx | 添加到目标路径横坐标的偏移量。 | 10469| dy | 添加到目标路径纵坐标的偏移量。 | 10470| OH_Drawing_PathAddMode | 路径添加模式[OH_Drawing_PathAddMode](#oh_drawing_pathaddmode)。 | 10471 10472 10473### OH_Drawing_PathAddRect() 10474 10475``` 10476void OH_Drawing_PathAddRect (OH_Drawing_Path* , float left, float top, float right, float bottom, OH_Drawing_PathDirection ) 10477``` 10478 10479**描述** 10480 10481按指定方向,向路径添加矩形轮廓。 10482 10483本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10484 10485执行成功时返回OH_DRAWING_SUCCESS; 10486 10487OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10488 10489OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10490 10491**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10492 10493**起始版本:** 12 10494 10495**参数:** 10496 10497| 名称 | 描述 | 10498| -------- | -------- | 10499| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10500| left | 矩形左上角的x轴坐标。 | 10501| top | 矩形左上角的y轴坐标。 | 10502| right | 矩形右下角的x轴坐标。 | 10503| bottom | 矩形右下角的y轴坐标。 | 10504| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10505 10506 10507### OH_Drawing_PathAddRectWithInitialCorner() 10508 10509``` 10510void OH_Drawing_PathAddRectWithInitialCorner (OH_Drawing_Path* , const OH_Drawing_Rect* , OH_Drawing_PathDirection , uint32_t start ) 10511``` 10512 10513**描述** 10514 10515按指定方向,向路径添加矩形轮廓。 10516 10517本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10518 10519执行成功时返回OH_DRAWING_SUCCESS; 10520 10521OH_Drawing_Path、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10522 10523OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10524 10525**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10526 10527**起始版本:** 12 10528 10529**参数:** 10530 10531| 名称 | 描述 | 10532| -------- | -------- | 10533| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10534| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针。 | 10535| OH_Drawing_PathDirection | 表示绘制方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10536| start | 起始点的位置,表示从矩形的哪个角开始绘制路径。0:左上角,1:右上角,2:右下角,3:左下角。 | 10537 10538 10539### OH_Drawing_PathAddRoundRect() 10540 10541``` 10542void OH_Drawing_PathAddRoundRect (OH_Drawing_Path* , const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection ) 10543``` 10544 10545**描述** 10546 10547按指定方向,向路径添加圆角矩形轮廓。 10548 10549本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10550 10551执行成功时返回OH_DRAWING_SUCCESS; 10552 10553OH_Drawing_Path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 10554 10555OH_Drawing_PathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 10556 10557**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10558 10559**起始版本:** 12 10560 10561**参数:** 10562 10563| 名称 | 描述 | 10564| -------- | -------- | 10565| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10566| roundRect | 指向圆角矩形对象[OH_Drawing_RoundRect](#oh_drawing_roundrect)的指针。 | 10567| OH_Drawing_PathDirection | 路径方向[OH_Drawing_PathDirection](#oh_drawing_pathdirection)。 | 10568 10569 10570### OH_Drawing_PathArcTo() 10571 10572``` 10573void OH_Drawing_PathArcTo (OH_Drawing_Path* , float x1, float y1, float x2, float y2, float startDeg, float sweepDeg ) 10574``` 10575 10576**描述** 10577 10578用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 10579 10580本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10581 10582执行成功时返回OH_DRAWING_SUCCESS; 10583 10584OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10585 10586**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10587 10588**起始版本:** 8 10589 10590**参数:** 10591 10592| 名称 | 描述 | 10593| -------- | -------- | 10594| OH_Drawing_Path | 指向路径对象的指针。 | 10595| x1 | 包围椭圆的矩形左上角点位置的横坐标。 | 10596| y1 | 包围椭圆的矩形左上角点位置的纵坐标。 | 10597| x2 | 包围椭圆的矩形右下角点位置的横坐标。 | 10598| y2 | 包围椭圆的矩形右下角点位置的纵坐标。 | 10599| startDeg | 起始的角度。角度的起始方向(0°)为x轴正方向。 | 10600| sweepDeg | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 | 10601 10602 10603### OH_Drawing_PathClose() 10604 10605``` 10606void OH_Drawing_PathClose (OH_Drawing_Path* ) 10607``` 10608 10609**描述** 10610 10611用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 10612 10613本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10614 10615执行成功时返回OH_DRAWING_SUCCESS; 10616 10617OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10618 10619**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10620 10621**起始版本:** 8 10622 10623**参数:** 10624 10625| 名称 | 描述 | 10626| -------- | -------- | 10627| OH_Drawing_Path | 指向路径对象的指针。 | 10628 10629 10630### OH_Drawing_PathConicTo() 10631 10632``` 10633void OH_Drawing_PathConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10634``` 10635 10636**描述** 10637 10638在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。 10639 10640本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10641 10642执行成功时返回OH_DRAWING_SUCCESS; 10643 10644OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10645 10646**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10647 10648**起始版本:** 12 10649 10650**参数:** 10651 10652| 名称 | 描述 | 10653| -------- | -------- | 10654| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10655| ctrlX | 控制点位置的横坐标。 | 10656| ctrlY | 控制点位置的纵坐标。 | 10657| endX | 结束点位置的横坐标。 | 10658| endY | 结束点位置的纵坐标。 | 10659| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathLineTo](#oh_drawing_pathlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathQuadTo](#oh_drawing_pathquadto)。 | 10660 10661 10662### OH_Drawing_PathContains() 10663 10664``` 10665bool OH_Drawing_PathContains (OH_Drawing_Path* , float x, float y ) 10666``` 10667 10668**描述** 10669 10670判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](#oh_drawing_pathfilltype-1)。 10671 10672本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10673 10674执行成功时返回OH_DRAWING_SUCCESS; 10675 10676OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10677 10678**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10679 10680**起始版本:** 12 10681 10682**参数:** 10683 10684| 名称 | 描述 | 10685| -------- | -------- | 10686| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10687| x | x轴上坐标点。 | 10688| y | y轴上坐标点。 | 10689 10690**返回:** 10691 10692函数返回true表示点在路径内,函数返回false表示点在路径外。 10693 10694 10695### OH_Drawing_PathCopy() 10696 10697``` 10698OH_Drawing_Path* OH_Drawing_PathCopy (OH_Drawing_Path* ) 10699``` 10700 10701**描述** 10702 10703创建一个路径对象副本[OH_Drawing_Path](#oh_drawing_path),用于拷贝一个已有路径对象。 10704 10705本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10706 10707执行成功时返回OH_DRAWING_SUCCESS; 10708 10709OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10710 10711**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10712 10713**起始版本:** 12 10714 10715**参数:** 10716 10717| 名称 | 描述 | 10718| -------- | -------- | 10719| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10720 10721**返回:** 10722 10723函数返回一个指针,指针指向创建的路径对象副本[OH_Drawing_Path](#oh_drawing_path)。 10724 10725 10726### OH_Drawing_PathCreate() 10727 10728``` 10729OH_Drawing_Path* OH_Drawing_PathCreate (void ) 10730``` 10731 10732**描述** 10733 10734用于创建一个路径对象。 10735 10736**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10737 10738**起始版本:** 8 10739 10740**返回:** 10741 10742函数会返回一个指针,指针指向创建的路径对象。 10743 10744 10745### OH_Drawing_PathCubicTo() 10746 10747``` 10748void OH_Drawing_PathCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 10749``` 10750 10751**描述** 10752 10753用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 10754 10755本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10756 10757执行成功时返回OH_DRAWING_SUCCESS; 10758 10759OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10760 10761**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10762 10763**起始版本:** 8 10764 10765**参数:** 10766 10767| 名称 | 描述 | 10768| -------- | -------- | 10769| OH_Drawing_Path | 指向路径对象的指针。 | 10770| ctrlX1 | 第一个控制点位置的横坐标。 | 10771| ctrlY1 | 第一个控制点位置的纵坐标。 | 10772| ctrlX2 | 第二个控制点位置的横坐标。 | 10773| ctrlY2 | 第二个控制点位置的纵坐标。 | 10774| endX | 目标点位置的横坐标。 | 10775| endY | 目标点位置的纵坐标。 | 10776 10777 10778### OH_Drawing_PathDestroy() 10779 10780``` 10781void OH_Drawing_PathDestroy (OH_Drawing_Path* ) 10782``` 10783 10784**描述** 10785 10786用于销毁路径对象并回收该对象占有的内存。 10787 10788**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10789 10790**起始版本:** 8 10791 10792**参数:** 10793 10794| 名称 | 描述 | 10795| -------- | -------- | 10796| OH_Drawing_Path | 指向路径对象的指针。 | 10797 10798 10799### OH_Drawing_PathEffectDestroy() 10800 10801``` 10802void OH_Drawing_PathEffectDestroy (OH_Drawing_PathEffect* ) 10803``` 10804 10805**描述** 10806 10807销毁路径效果对象并回收该对象占有内存。 10808 10809**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10810 10811**起始版本:** 12 10812 10813**参数:** 10814 10815| 名称 | 描述 | 10816| -------- | -------- | 10817| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针。 | 10818 10819 10820### OH_Drawing_PathGetLength() 10821 10822``` 10823float OH_Drawing_PathGetLength (OH_Drawing_Path* , bool forceClosed ) 10824``` 10825 10826**描述** 10827 10828获取当前路径的长度。 10829 10830本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10831 10832执行成功时返回OH_DRAWING_SUCCESS; 10833 10834OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10835 10836**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10837 10838**起始版本:** 12 10839 10840**参数:** 10841 10842| 名称 | 描述 | 10843| -------- | -------- | 10844| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10845| forceClosed | 表示调用后是否可以自由修改/删除路径。true表示可以自由修改/删除路径。false表示不能自由修改/删除路径。 | 10846 10847**返回:** 10848 10849函数返回当前路径的长度。 10850 10851 10852### OH_Drawing_PathLineTo() 10853 10854``` 10855void OH_Drawing_PathLineTo (OH_Drawing_Path* , float x, float y ) 10856``` 10857 10858**描述** 10859 10860用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 10861 10862本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10863 10864执行成功时返回OH_DRAWING_SUCCESS; 10865 10866OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10867 10868**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10869 10870**起始版本:** 8 10871 10872**参数:** 10873 10874| 名称 | 描述 | 10875| -------- | -------- | 10876| OH_Drawing_Path | 指向路径对象的指针。 | 10877| x | 目标点的横坐标。 | 10878| y | 目标点的纵坐标。 | 10879 10880 10881### OH_Drawing_PathMoveTo() 10882 10883``` 10884void OH_Drawing_PathMoveTo (OH_Drawing_Path* , float x, float y ) 10885``` 10886 10887**描述** 10888 10889用于设置自定义路径的起始点位置。 10890 10891本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10892 10893执行成功时返回OH_DRAWING_SUCCESS; 10894 10895OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10896 10897**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10898 10899**起始版本:** 8 10900 10901**参数:** 10902 10903| 名称 | 描述 | 10904| -------- | -------- | 10905| OH_Drawing_Path | 指向路径对象的指针。 | 10906| x | 起始点的横坐标。 | 10907| y | 起始点的纵坐标。 | 10908 10909 10910### OH_Drawing_PathOffset() 10911 10912``` 10913void OH_Drawing_PathOffset (OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy ) 10914``` 10915 10916**描述** 10917 10918将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。 10919 10920本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10921 10922执行成功时返回OH_DRAWING_SUCCESS; 10923 10924path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10925 10926**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10927 10928**起始版本:** 12 10929 10930**参数:** 10931 10932| 名称 | 描述 | 10933| -------- | -------- | 10934| path | 指向当前路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10935| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针,为NULL时会将结果存储到当前路径对象中。 | 10936| dx | x轴方向的偏移量。 | 10937| dy | y轴方向的偏移量。 | 10938 10939 10940### OH_Drawing_PathQuadTo() 10941 10942``` 10943void OH_Drawing_PathQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 10944``` 10945 10946**描述** 10947 10948用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 10949 10950本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10951 10952执行成功时返回OH_DRAWING_SUCCESS; 10953 10954OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10955 10956**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10957 10958**起始版本:** 8 10959 10960**参数:** 10961 10962| 名称 | 描述 | 10963| -------- | -------- | 10964| OH_Drawing_Path | 指向路径对象的指针。 | 10965| ctrlX | 控制点位置的横坐标。 | 10966| ctrlY | 控制点位置的纵坐标。 | 10967| endX | 目标点位置的横坐标。 | 10968| endY | 目标点位置的纵坐标。 | 10969 10970 10971### OH_Drawing_PathRConicTo() 10972 10973``` 10974void OH_Drawing_PathRConicTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY, float weight ) 10975``` 10976 10977**描述** 10978 10979使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线。 10980 10981本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 10982 10983执行成功时返回OH_DRAWING_SUCCESS; 10984 10985OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 10986 10987**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 10988 10989**起始版本:** 12 10990 10991**参数:** 10992 10993| 名称 | 描述 | 10994| -------- | -------- | 10995| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 10996| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 | 10997| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 | 10998| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 10999| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 11000| weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。若小于等于0则等同于使用[OH_Drawing_PathRLineTo](#oh_drawing_pathrlineto)添加一条到结束点的线段,若为1则等同于[OH_Drawing_PathRQuadTo](#oh_drawing_pathrquadto)。 | 11001 11002 11003### OH_Drawing_PathRCubicTo() 11004 11005``` 11006void OH_Drawing_PathRCubicTo (OH_Drawing_Path* , float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY ) 11007``` 11008 11009**描述** 11010 11011使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。 11012 11013本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11014 11015执行成功时返回OH_DRAWING_SUCCESS; 11016 11017OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11018 11019**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11020 11021**起始版本:** 12 11022 11023**参数:** 11024 11025| 名称 | 描述 | 11026| -------- | -------- | 11027| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11028| ctrlX1 | 相对于路径终点的x轴偏移量,用于指定第一个控制点的横坐标。 | 11029| ctrlY1 | 相对于路径终点的y轴偏移量,用于指定第一个控制点的纵坐标。 | 11030| ctrlX2 | 相对于路径终点的x轴偏移量,用于指定第二个控制点的横坐标。 | 11031| ctrlY2 | 相对于路径终点的y轴偏移量,用于指定第二个控制点的纵坐标。 | 11032| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 11033| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 11034 11035 11036### OH_Drawing_PathReset() 11037 11038``` 11039void OH_Drawing_PathReset (OH_Drawing_Path* ) 11040``` 11041 11042**描述** 11043 11044用于重置自定义路径数据。 11045 11046本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11047 11048执行成功时返回OH_DRAWING_SUCCESS; 11049 11050OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11051 11052**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11053 11054**起始版本:** 8 11055 11056**参数:** 11057 11058| 名称 | 描述 | 11059| -------- | -------- | 11060| OH_Drawing_Path | 指向路径对象的指针。 | 11061 11062 11063### OH_Drawing_PathRLineTo() 11064 11065``` 11066void OH_Drawing_PathRLineTo (OH_Drawing_Path* , float x, float y ) 11067``` 11068 11069**描述** 11070 11071使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。 11072 11073本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11074 11075执行成功时返回OH_DRAWING_SUCCESS; 11076 11077OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11078 11079**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11080 11081**起始版本:** 12 11082 11083**参数:** 11084 11085| 名称 | 描述 | 11086| -------- | -------- | 11087| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11088| x | 相对于当前路径终点的x轴偏移量,用于指定目标点的横坐标。 | 11089| y | 相对于当前路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 11090 11091 11092### OH_Drawing_PathRMoveTo() 11093 11094``` 11095void OH_Drawing_PathRMoveTo (OH_Drawing_Path* , float x, float y ) 11096``` 11097 11098**描述** 11099 11100用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。 11101 11102本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11103 11104执行成功时返回OH_DRAWING_SUCCESS; 11105 11106OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11107 11108**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11109 11110**起始版本:** 12 11111 11112**参数:** 11113 11114| 名称 | 描述 | 11115| -------- | -------- | 11116| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11117| x | 相对于当前路径终点的x轴偏移量,用于指定新的路径起始点的横坐标。 | 11118| y | 相对于当前路径终点的y轴偏移量,用于指定新的路径起始点的纵坐标。 | 11119 11120 11121### OH_Drawing_PathRQuadTo() 11122 11123``` 11124void OH_Drawing_PathRQuadTo (OH_Drawing_Path* , float ctrlX, float ctrlY, float endX, float endY ) 11125``` 11126 11127**描述** 11128 11129使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。 11130 11131本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11132 11133执行成功时返回OH_DRAWING_SUCCESS; 11134 11135OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11136 11137**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11138 11139**起始版本:** 12 11140 11141**参数:** 11142 11143| 名称 | 描述 | 11144| -------- | -------- | 11145| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11146| ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 | 11147| ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 | 11148| endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 | 11149| endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 | 11150 11151 11152### OH_Drawing_PathSetFillType() 11153 11154``` 11155void OH_Drawing_PathSetFillType (OH_Drawing_Path* , OH_Drawing_PathFillType ) 11156``` 11157 11158**描述** 11159 11160设置填充路径的规则。 11161 11162本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11163 11164执行成功时返回OH_DRAWING_SUCCESS; 11165 11166OH_Drawing_Path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11167 11168OH_Drawing_PathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11169 11170**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11171 11172**起始版本:** 12 11173 11174**参数:** 11175 11176| 名称 | 描述 | 11177| -------- | -------- | 11178| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11179| OH_Drawing_PathFillType | 路径填充规则[OH_Drawing_PathFillType](#oh_drawing_pathfilltype)。 | 11180 11181 11182### OH_Drawing_PathTransform() 11183 11184``` 11185void OH_Drawing_PathTransform (OH_Drawing_Path* , const OH_Drawing_Matrix* ) 11186``` 11187 11188**描述** 11189 11190对路径进行矩阵变换。 11191 11192本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11193 11194执行成功时返回OH_DRAWING_SUCCESS; 11195 11196OH_Drawing_Path、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11197 11198**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11199 11200**起始版本:** 12 11201 11202**参数:** 11203 11204| 名称 | 描述 | 11205| -------- | -------- | 11206| OH_Drawing_Path | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11207| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 11208 11209 11210### OH_Drawing_PathTransformWithPerspectiveClip() 11211 11212``` 11213void OH_Drawing_PathTransformWithPerspectiveClip (OH_Drawing_Path* src, const OH_Drawing_Matrix* , OH_Drawing_Path* dst, bool applyPerspectiveClip ) 11214``` 11215 11216**描述** 11217 11218对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为空,则替换源路径。 11219 11220本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11221 11222执行成功时返回OH_DRAWING_SUCCESS; 11223 11224src、OH_Drawing_Matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11225 11226**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11227 11228**起始版本:** 12 11229 11230**参数:** 11231 11232| 名称 | 描述 | 11233| -------- | -------- | 11234| src | 指向路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11235| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。 | 11236| dst | 指向目标路径对象[OH_Drawing_Path](#oh_drawing_path)的指针。 | 11237| applyPerspectiveClip | 表示变换路径是否应用透视裁剪。true表示应用透视裁剪,false表示不用透视裁剪。 | 11238 11239 11240### OH_Drawing_PenCreate() 11241 11242``` 11243OH_Drawing_Pen* OH_Drawing_PenCreate (void ) 11244``` 11245 11246**描述** 11247 11248用于创建一个画笔对象。 11249 11250**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11251 11252**起始版本:** 8 11253 11254**返回:** 11255 11256函数会返回一个指针,指针指向创建的画笔对象。 11257 11258 11259### OH_Drawing_PenDestroy() 11260 11261``` 11262void OH_Drawing_PenDestroy (OH_Drawing_Pen* ) 11263``` 11264 11265**描述** 11266 11267用于销毁画笔对象并回收该对象占有的内存。 11268 11269**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11270 11271**起始版本:** 8 11272 11273**参数:** 11274 11275| 名称 | 描述 | 11276| -------- | -------- | 11277| OH_Drawing_Pen | 指向画笔对象的指针。 | 11278 11279 11280### OH_Drawing_PenGetAlpha() 11281 11282``` 11283uint8_t OH_Drawing_PenGetAlpha (const OH_Drawing_Pen* ) 11284``` 11285 11286**描述** 11287 11288获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 11289 11290本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11291 11292执行成功时返回OH_DRAWING_SUCCESS; 11293 11294OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11295 11296**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11297 11298**起始版本:** 11 11299 11300**参数:** 11301 11302| 名称 | 描述 | 11303| -------- | -------- | 11304| OH_Drawing_Pen | 表示指向画笔对象的指针。 | 11305 11306**返回:** 11307 11308返回一个8比特的值表示透明度。 11309 11310 11311### OH_Drawing_PenGetCap() 11312 11313``` 11314OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap (const OH_Drawing_Pen* ) 11315``` 11316 11317**描述** 11318 11319用于获取画笔笔帽的样式。 11320 11321本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11322 11323执行成功时返回OH_DRAWING_SUCCESS; 11324 11325OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11326 11327**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11328 11329**起始版本:** 8 11330 11331**参数:** 11332 11333| 名称 | 描述 | 11334| -------- | -------- | 11335| OH_Drawing_Pen | 指向画笔对象的指针。 | 11336 11337**返回:** 11338 11339函数返回画笔笔帽样式。 11340 11341 11342### OH_Drawing_PenGetColor() 11343 11344``` 11345uint32_t OH_Drawing_PenGetColor (const OH_Drawing_Pen* ) 11346``` 11347 11348**描述** 11349 11350用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 11351 11352本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11353 11354执行成功时返回OH_DRAWING_SUCCESS; 11355 11356OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11357 11358**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11359 11360**起始版本:** 8 11361 11362**参数:** 11363 11364| 名称 | 描述 | 11365| -------- | -------- | 11366| OH_Drawing_Pen | 指向画笔对象的指针。 | 11367 11368**返回:** 11369 11370函数返回一个描述颜色的32位(ARGB)变量。 11371 11372 11373### OH_Drawing_PenGetFilter() 11374 11375``` 11376void OH_Drawing_PenGetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11377``` 11378 11379**描述** 11380 11381从画笔获取滤波器[OH_Drawing_Filter](#oh_drawing_filter)。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 11382 11383本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11384 11385执行成功时返回OH_DRAWING_SUCCESS; 11386 11387OH_Drawing_Pen、OH_Drawing_Filter任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11388 11389**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11390 11391**起始版本:** 12 11392 11393**参数:** 11394 11395| 名称 | 描述 | 11396| -------- | -------- | 11397| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11398| OH_Drawing_Filter | 指向滤波器对象[OH_Drawing_Filter](#oh_drawing_filter)的指针。 | 11399 11400 11401### OH_Drawing_PenGetJoin() 11402 11403``` 11404OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin (const OH_Drawing_Pen* ) 11405``` 11406 11407**描述** 11408 11409用于获取画笔绘制折线转角的样式。 11410 11411本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11412 11413执行成功时返回OH_DRAWING_SUCCESS; 11414 11415OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11416 11417**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11418 11419**起始版本:** 8 11420 11421**参数:** 11422 11423| 名称 | 描述 | 11424| -------- | -------- | 11425| OH_Drawing_Pen | 指向画笔对象的指针。 | 11426 11427**返回:** 11428 11429函数返回折线转角的样式。 11430 11431### OH_Drawing_PenGetMiterLimit() 11432 11433``` 11434float OH_Drawing_PenGetMiterLimit (const OH_Drawing_Pen* ) 11435``` 11436 11437**描述** 11438 11439用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 11440 11441本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11442 11443执行成功时返回OH_DRAWING_SUCCESS; 11444 11445OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11446 11447**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11448 11449**起始版本:** 8 11450 11451**参数:** 11452 11453| 名称 | 描述 | 11454| -------- | -------- | 11455| OH_Drawing_Pen | 指向画笔对象的指针。 | 11456 11457**返回:** 11458 11459函数返回尖角的限制值。 11460 11461 11462### OH_Drawing_PenGetWidth() 11463 11464``` 11465float OH_Drawing_PenGetWidth (const OH_Drawing_Pen* ) 11466``` 11467 11468**描述** 11469 11470获取画笔的线宽,线宽描述了画笔绘制图形轮廓的宽度。 11471 11472本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11473 11474执行成功时返回OH_DRAWING_SUCCESS; 11475 11476OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11477 11478**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11479 11480**起始版本:** 8 11481 11482**参数:** 11483 11484| 名称 | 描述 | 11485| -------- | -------- | 11486| OH_Drawing_Pen | 指向画笔对象的指针。 | 11487 11488**返回:** 11489 11490函数返回画笔的线宽。 11491 11492 11493### OH_Drawing_PenIsAntiAlias() 11494 11495``` 11496bool OH_Drawing_PenIsAntiAlias (const OH_Drawing_Pen* ) 11497``` 11498 11499**描述** 11500 11501用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 11502 11503本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11504 11505执行成功时返回OH_DRAWING_SUCCESS; 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 11519**返回:** 11520 11521函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 11522 11523 11524### OH_Drawing_PenReset() 11525 11526``` 11527void OH_Drawing_PenReset (OH_Drawing_Pen* ) 11528``` 11529 11530**描述** 11531 11532将画笔重置至初始值。 11533 11534本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11535 11536执行成功时返回OH_DRAWING_SUCCESS; 11537 11538OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11539 11540**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11541 11542**起始版本:** 12 11543 11544**参数:** 11545 11546| 名称 | 描述 | 11547| -------- | -------- | 11548| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11549 11550 11551### OH_Drawing_PenSetAlpha() 11552 11553``` 11554void OH_Drawing_PenSetAlpha (OH_Drawing_Pen* , uint8_t alpha ) 11555``` 11556 11557**描述** 11558 11559为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 11560 11561本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11562 11563执行成功时返回OH_DRAWING_SUCCESS; 11564 11565OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11566 11567**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11568 11569**起始版本:** 11 11570 11571**参数:** 11572 11573| 名称 | 描述 | 11574| -------- | -------- | 11575| OH_Drawing_Pen | 表示指向画笔对象的指针。 | 11576| alpha | 表示要设置的透明度值,是一个8比特的变量。 | 11577 11578 11579### OH_Drawing_PenSetAntiAlias() 11580 11581``` 11582void OH_Drawing_PenSetAntiAlias (OH_Drawing_Pen* , bool ) 11583``` 11584 11585**描述** 11586 11587用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 11588 11589本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11590 11591执行成功时返回OH_DRAWING_SUCCESS; 11592 11593OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11594 11595**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11596 11597**起始版本:** 8 11598 11599**参数:** 11600 11601| 名称 | 描述 | 11602| -------- | -------- | 11603| OH_Drawing_Pen | 指向画笔对象的指针。 | 11604| bool | 真为抗锯齿,假则不做抗锯齿处理。 | 11605 11606 11607### OH_Drawing_PenSetBlendMode() 11608 11609``` 11610void OH_Drawing_PenSetBlendMode (OH_Drawing_Pen* , OH_Drawing_BlendMode ) 11611``` 11612 11613**描述** 11614 11615为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 11616 11617本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11618 11619执行成功时返回OH_DRAWING_SUCCESS; 11620 11621OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11622 11623OH_Drawing_BlendMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11624 11625**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11626 11627**起始版本:** 12 11628 11629**参数:** 11630 11631| 名称 | 描述 | 11632| -------- | -------- | 11633| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11634| OH_Drawing_BlendMode | 混合模式枚举类型[OH_Drawing_BlendMode](#oh_drawing_blendmode)。 | 11635 11636 11637### OH_Drawing_PenSetCap() 11638 11639``` 11640void OH_Drawing_PenSetCap (OH_Drawing_Pen* , OH_Drawing_PenLineCapStyle ) 11641``` 11642 11643**描述** 11644 11645用于设置画笔笔帽样式。 11646 11647本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11648 11649执行成功时返回OH_DRAWING_SUCCESS; 11650 11651OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11652 11653OH_Drawing_PenLineCapStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11654 11655**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11656 11657**起始版本:** 8 11658 11659**参数:** 11660 11661| 名称 | 描述 | 11662| -------- | -------- | 11663| OH_Drawing_Pen | 指向画笔对象的指针。 | 11664| OH_Drawing_PenLineCapStyle | 描述画笔笔帽样式的变量。 | 11665 11666 11667### OH_Drawing_PenSetColor() 11668 11669``` 11670void OH_Drawing_PenSetColor (OH_Drawing_Pen* , uint32_t color ) 11671``` 11672 11673**描述** 11674 11675用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 11676 11677本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11678 11679执行成功时返回OH_DRAWING_SUCCESS; 11680 11681OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11682 11683**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11684 11685**起始版本:** 8 11686 11687**参数:** 11688 11689| 名称 | 描述 | 11690| -------- | -------- | 11691| OH_Drawing_Pen | 指向画笔对象的指针。 | 11692| color | 描述颜色的32位(ARGB)变量。 | 11693 11694 11695### OH_Drawing_PenSetFilter() 11696 11697``` 11698void OH_Drawing_PenSetFilter (OH_Drawing_Pen* , OH_Drawing_Filter* ) 11699``` 11700 11701**描述** 11702 11703设置画笔滤波器。 11704 11705本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11706 11707执行成功时返回OH_DRAWING_SUCCESS; 11708 11709OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11710 11711**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11712 11713**起始版本:** 11 11714 11715**参数:** 11716 11717| 名称 | 描述 | 11718| -------- | -------- | 11719| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11720| OH_Drawing_Filter | 指向滤波器[OH_Drawing_Filter](#oh_drawing_filter)的指针,为NULL表示清空画笔滤波器。 | 11721 11722 11723### OH_Drawing_PenSetJoin() 11724 11725``` 11726void OH_Drawing_PenSetJoin (OH_Drawing_Pen* , OH_Drawing_PenLineJoinStyle ) 11727``` 11728 11729**描述** 11730 11731用于设置画笔绘制转角的样式。 11732 11733本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11734 11735执行成功时返回OH_DRAWING_SUCCESS; 11736 11737OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 11738 11739OH_Drawing_PenLineJoinStyle不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 11740 11741**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11742 11743**起始版本:** 8 11744 11745**参数:** 11746 11747| 名称 | 描述 | 11748| -------- | -------- | 11749| OH_Drawing_Pen | 指向画笔对象的指针。 | 11750| OH_Drawing_PenLineJoinStyle | 折线转角样式。 | 11751 11752 11753### OH_Drawing_PenSetMiterLimit() 11754 11755``` 11756void OH_Drawing_PenSetMiterLimit (OH_Drawing_Pen* , float miter ) 11757``` 11758 11759**描述** 11760 11761用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 11762 11763本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11764 11765执行成功时返回OH_DRAWING_SUCCESS; 11766 11767OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11768 11769**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11770 11771**起始版本:** 8 11772 11773**参数:** 11774 11775| 名称 | 描述 | 11776| -------- | -------- | 11777| OH_Drawing_Pen | 指向画笔对象的指针。 | 11778| miter | 描述尖角限制值的变量。 | 11779 11780 11781### OH_Drawing_PenSetPathEffect() 11782 11783``` 11784void OH_Drawing_PenSetPathEffect (OH_Drawing_Pen* , OH_Drawing_PathEffect* ) 11785``` 11786 11787**描述** 11788 11789设置画笔路径效果。 11790 11791本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11792 11793执行成功时返回OH_DRAWING_SUCCESS; 11794 11795OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11796 11797**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11798 11799**起始版本:** 12 11800 11801**参数:** 11802 11803| 名称 | 描述 | 11804| -------- | -------- | 11805| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11806| OH_Drawing_PathEffect | 指向路径效果对象[OH_Drawing_PathEffect](#oh_drawing_patheffect)的指针,为NULL表示清空路径效果。 | 11807 11808 11809### OH_Drawing_PenSetShaderEffect() 11810 11811``` 11812void OH_Drawing_PenSetShaderEffect (OH_Drawing_Pen* , OH_Drawing_ShaderEffect* ) 11813``` 11814 11815**描述** 11816 11817设置画笔着色器效果。 11818 11819本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11820 11821执行成功时返回OH_DRAWING_SUCCESS; 11822 11823OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11824 11825**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11826 11827**起始版本:** 11 11828 11829**参数:** 11830 11831| 名称 | 描述 | 11832| -------- | -------- | 11833| OH_Drawing_Pen | 指向画笔对象[OH_Drawing_Pen](#oh_drawing_pen)的指针。 | 11834| OH_Drawing_ShaderEffect | 指向着色器对象[OH_Drawing_ShaderEffect](#oh_drawing_shadereffect)的指针,为NULL表示清空着色器效果。 | 11835 11836 11837### OH_Drawing_PenSetWidth() 11838 11839``` 11840void OH_Drawing_PenSetWidth (OH_Drawing_Pen* , float width ) 11841``` 11842 11843**描述** 11844 11845用于设置画笔的线宽。0线宽被视作特殊的极细线宽,在绘制时始终会被绘制为1像素,不随画布的缩放而改变;负数线宽在实际绘制时会被视作0线宽。 11846 11847本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11848 11849执行成功时返回OH_DRAWING_SUCCESS; 11850 11851OH_Drawing_Pen为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11852 11853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11854 11855**起始版本:** 8 11856 11857**参数:** 11858 11859| 名称 | 描述 | 11860| -------- | -------- | 11861| OH_Drawing_Pen | 指向画笔对象的指针。 | 11862| width | 描述画笔线宽的变量。 | 11863 11864 11865### OH_Drawing_PointCreate() 11866 11867``` 11868OH_Drawing_Point* OH_Drawing_PointCreate (float x, float y ) 11869``` 11870 11871**描述** 11872 11873用于创建一个坐标点对象。 11874 11875**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11876 11877**起始版本:** 11 11878 11879**参数:** 11880 11881| 名称 | 描述 | 11882| -------- | -------- | 11883| x | X轴坐标。 | 11884| y | Y轴坐标。 | 11885 11886**返回:** 11887 11888函数会返回一个指针,指针指向创建的坐标点对象。 11889 11890 11891### OH_Drawing_PointDestroy() 11892 11893``` 11894void OH_Drawing_PointDestroy (OH_Drawing_Point* ) 11895``` 11896 11897**描述** 11898 11899用于销毁坐标点对象并回收该对象占有的内存。 11900 11901**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11902 11903**起始版本:** 11 11904 11905**参数:** 11906 11907| 名称 | 描述 | 11908| -------- | -------- | 11909| OH_Drawing_Point | 指向坐标点对象的指针。 | 11910 11911 11912### OH_Drawing_RectCopy() 11913 11914``` 11915void OH_Drawing_RectCopy (OH_Drawing_Rect* sRect, OH_Drawing_Rect* dRect ) 11916``` 11917 11918**描述** 11919 11920用于将源矩形对象复制到目标矩形对象。 11921 11922本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 11923 11924执行成功时返回OH_DRAWING_SUCCESS; 11925 11926sRect、dRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 11927 11928**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11929 11930**起始版本:** 12 11931 11932**参数:** 11933 11934| 名称 | 描述 | 11935| -------- | -------- | 11936| sRect | 指向源矩形对象的指针。 | 11937| dRect | 指向目标矩形对象的指针。 | 11938 11939 11940### OH_Drawing_RectCreate() 11941 11942``` 11943OH_Drawing_Rect* OH_Drawing_RectCreate (float left, float top, float right, float bottom ) 11944``` 11945 11946**描述** 11947 11948用于创建一个矩形对象,不会对设置的坐标排序,即允许矩形设置的左上角坐标大于对应的矩形右下角坐标。 11949 11950**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11951 11952**起始版本:** 11 11953 11954**参数:** 11955 11956| 名称 | 描述 | 11957| -------- | -------- | 11958| left | 矩形左上角的横坐标。 | 11959| top | 矩形左上角的纵坐标。 | 11960| right | 矩形右下角的横坐标。 | 11961| bottom | 矩形右下角的纵坐标。 | 11962 11963**返回:** 11964 11965函数会返回一个指针,指针指向创建的矩形对象。 11966 11967 11968### OH_Drawing_RectDestroy() 11969 11970``` 11971void OH_Drawing_RectDestroy (OH_Drawing_Rect* ) 11972``` 11973 11974**描述** 11975 11976用于销毁矩形对象并回收该对象占有的内存。 11977 11978**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 11979 11980**起始版本:** 11 11981 11982**参数:** 11983 11984| 名称 | 描述 | 11985| -------- | -------- | 11986| OH_Drawing_Rect | 指向矩形对象的指针。 | 11987 11988 11989### OH_Drawing_RectGetBottom() 11990 11991``` 11992float OH_Drawing_RectGetBottom (OH_Drawing_Rect* ) 11993``` 11994 11995**描述** 11996 11997用于获取给矩形设置的右下角的纵坐标。 11998 11999本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12000 12001执行成功时返回OH_DRAWING_SUCCESS; 12002 12003OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12004 12005**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12006 12007**起始版本:** 12 12008 12009**参数:** 12010 12011| 名称 | 描述 | 12012| -------- | -------- | 12013| OH_Drawing_Rect | 指向矩形对象的指针。 | 12014 12015**返回:** 12016 12017矩形右下角的纵坐标。 12018 12019 12020### OH_Drawing_RectGetHeight() 12021 12022``` 12023float OH_Drawing_RectGetHeight (OH_Drawing_Rect* ) 12024``` 12025 12026**描述** 12027 12028用于获取矩形对象高度,计算方式为设置的矩形的右下角纵坐标减去左上角纵坐标。 12029 12030本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12031 12032执行成功时返回OH_DRAWING_SUCCESS; 12033 12034OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12035 12036**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12037 12038**起始版本:** 12 12039 12040**参数:** 12041 12042| 名称 | 描述 | 12043| -------- | -------- | 12044| OH_Drawing_Rect | 指向矩形对象的指针。 | 12045 12046**返回:** 12047 12048返回矩形对象的高度。 12049 12050 12051### OH_Drawing_RectGetLeft() 12052 12053``` 12054float OH_Drawing_RectGetLeft (OH_Drawing_Rect* ) 12055``` 12056 12057**描述** 12058 12059用于获取给矩形设置的左上角的横坐标。 12060 12061本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12062 12063执行成功时返回OH_DRAWING_SUCCESS; 12064 12065OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12066 12067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12068 12069**起始版本:** 12 12070 12071**参数:** 12072 12073| 名称 | 描述 | 12074| -------- | -------- | 12075| OH_Drawing_Rect | 指向矩形对象的指针。 | 12076 12077**返回:** 12078 12079矩形左上角的横坐标。 12080 12081 12082### OH_Drawing_RectGetRight() 12083 12084``` 12085float OH_Drawing_RectGetRight (OH_Drawing_Rect* ) 12086``` 12087 12088**描述** 12089 12090用于获取给矩形设置的右下角的横坐标。 12091 12092本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12093 12094执行成功时返回OH_DRAWING_SUCCESS; 12095 12096OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12097 12098**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12099 12100**起始版本:** 12 12101 12102**参数:** 12103 12104| 名称 | 描述 | 12105| -------- | -------- | 12106| OH_Drawing_Rect | 指向矩形对象的指针。 | 12107 12108**返回:** 12109 12110矩形右下角的横坐标。 12111 12112 12113### OH_Drawing_RectGetTop() 12114 12115``` 12116float OH_Drawing_RectGetTop (OH_Drawing_Rect* ) 12117``` 12118 12119**描述** 12120 12121用于获取给矩形设置的左上角的纵坐标。 12122 12123本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12124 12125执行成功时返回OH_DRAWING_SUCCESS; 12126 12127OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12128 12129**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12130 12131**起始版本:** 12 12132 12133**参数:** 12134 12135| 名称 | 描述 | 12136| -------- | -------- | 12137| OH_Drawing_Rect | 指向矩形对象的指针。 | 12138 12139**返回:** 12140 12141矩形左上角的纵坐标。 12142 12143 12144### OH_Drawing_RectGetWidth() 12145 12146``` 12147float OH_Drawing_RectGetWidth (OH_Drawing_Rect* ) 12148``` 12149 12150**描述** 12151 12152用于获取矩形对象的宽度,计算方式为设置的矩形的右下角横坐标减去左上角横坐标。 12153 12154本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12155 12156执行成功时返回OH_DRAWING_SUCCESS; 12157 12158OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12159 12160**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12161 12162**起始版本:** 12 12163 12164**参数:** 12165 12166| 名称 | 描述 | 12167| -------- | -------- | 12168| OH_Drawing_Rect | 指向矩形对象的指针。 | 12169 12170**返回:** 12171 12172返回矩形对象的宽度。 12173 12174 12175### OH_Drawing_RectIntersect() 12176 12177``` 12178bool OH_Drawing_RectIntersect (OH_Drawing_Rect* rect, const OH_Drawing_Rect* other ) 12179``` 12180 12181**描述** 12182 12183用于判断两个矩形是否相交,若相交,将rect设置为两个矩形的交集。 12184 12185本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12186 12187执行成功时返回OH_DRAWING_SUCCESS; 12188 12189rect、other任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12190 12191**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12192 12193**起始版本:** 12 12194 12195**参数:** 12196 12197| 名称 | 描述 | 12198| -------- | -------- | 12199| rect | 指向矩形对象的指针。 | 12200| other | 指向矩形对象的指针。 | 12201 12202**返回:** 12203 12204返回两个矩形是否相交的结果。true表示这两个矩形相交,rect被设置为两个矩形的交集;false表示不相交,rect保持不变。 12205 12206 12207### OH_Drawing_RectSetBottom() 12208 12209``` 12210void OH_Drawing_RectSetBottom (OH_Drawing_Rect* rect, float bottom ) 12211``` 12212 12213**描述** 12214 12215用于设置矩形右下角的纵坐标。 12216 12217本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12218 12219执行成功时返回OH_DRAWING_SUCCESS; 12220 12221rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12222 12223**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12224 12225**起始版本:** 12 12226 12227**参数:** 12228 12229| 名称 | 描述 | 12230| -------- | -------- | 12231| rect | 指向矩形对象的指针。 | 12232| bottom | 矩形右下角的纵坐标。 | 12233 12234 12235### OH_Drawing_RectSetLeft() 12236 12237``` 12238void OH_Drawing_RectSetLeft (OH_Drawing_Rect* rect, float left ) 12239``` 12240 12241**描述** 12242 12243用于设置矩形左上角的横坐标。 12244 12245本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12246 12247执行成功时返回OH_DRAWING_SUCCESS; 12248 12249rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12250 12251**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12252 12253**起始版本:** 12 12254 12255**参数:** 12256 12257| 名称 | 描述 | 12258| -------- | -------- | 12259| rect | 指向矩形对象的指针。 | 12260| left | 矩形左上角的横坐标。 | 12261 12262 12263### OH_Drawing_RectSetRight() 12264 12265``` 12266void OH_Drawing_RectSetRight (OH_Drawing_Rect* rect, float right ) 12267``` 12268 12269**描述** 12270 12271用于设置矩形右下角的横坐标。 12272 12273本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12274 12275执行成功时返回OH_DRAWING_SUCCESS; 12276 12277rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12278 12279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12280 12281**起始版本:** 12 12282 12283**参数:** 12284 12285| 名称 | 描述 | 12286| -------- | -------- | 12287| rect | 指向矩形对象的指针。 | 12288| right | 矩形右下角的横坐标。 | 12289 12290 12291### OH_Drawing_RectSetTop() 12292 12293``` 12294void OH_Drawing_RectSetTop (OH_Drawing_Rect* rect, float top ) 12295``` 12296 12297**描述** 12298 12299用于设置矩形左上角的纵坐标。 12300 12301本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12302 12303执行成功时返回OH_DRAWING_SUCCESS; 12304 12305rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12306 12307**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12308 12309**起始版本:** 12 12310 12311**参数:** 12312 12313| 名称 | 描述 | 12314| -------- | -------- | 12315| rect | 指向矩形对象的指针。 | 12316| top | 矩形左上角的纵坐标。 | 12317 12318 12319### OH_Drawing_RegionCreate() 12320 12321``` 12322OH_Drawing_Region* OH_Drawing_RegionCreate (void ) 12323``` 12324 12325**描述** 12326 12327用于创建一个区域对象,实现更精确的图形控制。 12328 12329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12330 12331**起始版本:** 12 12332 12333**返回:** 12334 12335函数会返回一个指针,指针指向创建的区域对象。 12336 12337 12338### OH_Drawing_RegionDestroy() 12339 12340``` 12341void OH_Drawing_RegionDestroy (OH_Drawing_Region* ) 12342``` 12343 12344**描述** 12345 12346用于销毁区域对象并回收该对象占有的内存。 12347 12348**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12349 12350**起始版本:** 12 12351 12352**参数:** 12353 12354| 名称 | 描述 | 12355| -------- | -------- | 12356| OH_Drawing_Region | 指向区域对象的指针。 | 12357 12358 12359### OH_Drawing_RegionSetRect() 12360 12361``` 12362bool OH_Drawing_RegionSetRect (OH_Drawing_Region* region, const OH_Drawing_Rect* rect ) 12363``` 12364 12365**描述** 12366 12367用于尝试给区域对象设置矩形边界。 12368 12369本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12370 12371执行成功时返回OH_DRAWING_SUCCESS; 12372 12373region、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12374 12375**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12376 12377**起始版本:** 12 12378 12379**参数:** 12380 12381| 名称 | 描述 | 12382| -------- | -------- | 12383| region | 指向区域对象的指针。 | 12384| rect | 指向矩形对象的指针。 | 12385 12386**返回:** 12387 12388返回区域对象设置矩形边界是否成功的结果。true表示设置矩形边界成功,false表示设置矩形边界失败。 12389 12390 12391### OH_Drawing_RegisterFont() 12392 12393``` 12394uint32_t OH_Drawing_RegisterFont (OH_Drawing_FontCollection* , const char* fontFamily, const char* familySrc ) 12395``` 12396 12397**描述** 12398 12399用于在字体管理器中注册自定义字体,支持的字体文件格式包含:ttf、otf。 12400 12401**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12402 12403**起始版本:** 11 12404 12405**参数:** 12406 12407| 名称 | 描述 | 12408| -------- | -------- | 12409| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 | 12410| fontFamily | 指需要注册的字体的字体名称。 | 12411| familySrc | 指需要注册的字体文件的路径。 | 12412 12413**返回:** 12414 12415返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败,9文件损坏。 12416 12417 12418### OH_Drawing_RegisterFontBuffer() 12419 12420``` 12421uint32_t OH_Drawing_RegisterFontBuffer (OH_Drawing_FontCollection* , const char* fontFamily, uint8_t* fontBuffer, size_t length ) 12422``` 12423 12424**描述** 12425 12426用于在字体管理器中注册字体缓冲区。 12427 12428**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12429 12430**起始版本:** 11 12431 12432**参数:** 12433 12434| 名称 | 描述 | 12435| -------- | -------- | 12436| OH_Drawing_FontCollection | 指向OH_Drawing_FontCollection对象的指针。 | 12437| fontFamily | 指需要注册的字体的字体名称。 | 12438| fontBuffer | 指需要注册的字体文件的缓冲区。 | 12439| length | 指需要注册的字体文件的长度。 | 12440 12441**返回:** 12442 12443返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空,9文件损坏。 12444 12445 12446### OH_Drawing_RoundRectCreate() 12447 12448``` 12449OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate (const OH_Drawing_Rect* , float xRad, float yRad ) 12450``` 12451 12452**描述** 12453 12454用于创建一个圆角矩形对象。 12455 12456本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12457 12458执行成功时返回OH_DRAWING_SUCCESS; 12459 12460OH_Drawing_Rect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12461 12462**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12463 12464**起始版本:** 11 12465 12466**参数:** 12467 12468| 名称 | 描述 | 12469| -------- | -------- | 12470| OH_Drawing_Rect | 指向矩形对象的指针。 | 12471| xRad | X轴上的圆角半径。 | 12472| yRad | Y轴上的圆角半径。 | 12473 12474**返回:** 12475 12476函数会返回一个指针,指针指向创建的圆角矩形对象。 12477 12478 12479### OH_Drawing_RoundRectDestroy() 12480 12481``` 12482void OH_Drawing_RoundRectDestroy (OH_Drawing_RoundRect* ) 12483``` 12484 12485**描述** 12486 12487用于销毁圆角矩形对象并回收该对象占有的内存。 12488 12489**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12490 12491**起始版本:** 11 12492 12493**参数:** 12494 12495| 名称 | 描述 | 12496| -------- | -------- | 12497| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12498 12499 12500### OH_Drawing_RoundRectGetCorner() 12501 12502``` 12503OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos ) 12504``` 12505 12506**描述** 12507 12508用于获取圆角矩形中指定圆角位置的圆角半径。 12509 12510本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12511 12512执行成功时返回OH_DRAWING_SUCCESS; 12513 12514OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12515 12516**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12517 12518**起始版本:** 12 12519 12520**参数:** 12521 12522| 名称 | 描述 | 12523| -------- | -------- | 12524| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12525| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 | 12526 12527**返回:** 12528 12529返回指定圆角位置的圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。 12530 12531 12532### OH_Drawing_RoundRectSetCorner() 12533 12534``` 12535void OH_Drawing_RoundRectSetCorner (OH_Drawing_RoundRect* , OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii ) 12536``` 12537 12538**描述** 12539 12540用于设置圆角矩形中指定圆角位置的圆角半径。 12541 12542本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12543 12544执行成功时返回OH_DRAWING_SUCCESS; 12545 12546OH_Drawing_RoundRect为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 12547 12548**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12549 12550**起始版本:** 12 12551 12552**参数:** 12553 12554| 名称 | 描述 | 12555| -------- | -------- | 12556| OH_Drawing_RoundRect | 指向圆角矩形对象的指针。 | 12557| pos | 圆角位置的枚举,支持类型可见[OH_Drawing_CornerPos](#oh_drawing_cornerpos)。 | 12558| OH_Drawing_Corner_Radii | 圆角半径结构体[OH_Drawing_Corner_Radii](#oh_drawing_corner_radii),其中包含x轴方向和y轴方向上的半径。 | 12559 12560 12561### OH_Drawing_SamplingOptionsCreate() 12562 12563``` 12564OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate (OH_Drawing_FilterMode , OH_Drawing_MipmapMode ) 12565``` 12566 12567**描述** 12568 12569创建一个采样选项对象。 12570 12571本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 12572 12573执行成功时返回OH_DRAWING_SUCCESS; 12574 12575OH_Drawing_MipmapMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 12576 12577**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12578 12579**起始版本:** 12 12580 12581**参数:** 12582 12583| 名称 | 描述 | 12584| -------- | -------- | 12585| OH_Drawing_FilterMode | 过滤采样模式[OH_Drawing_FilterMode](#oh_drawing_filtermode) | 12586| OH_Drawing_MipmapMode | 多级渐远纹理采样模式[OH_Drawing_MipmapMode](#oh_drawing_mipmapmode)。 | 12587 12588**返回:** 12589 12590函数会返回一个指针,指针指向创建的采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)。 12591 12592 12593### OH_Drawing_SamplingOptionsDestroy() 12594 12595``` 12596void OH_Drawing_SamplingOptionsDestroy (OH_Drawing_SamplingOptions* ) 12597``` 12598 12599**描述** 12600 12601销毁采样选项对象并回收该对象占有内存。 12602 12603**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12604 12605**起始版本:** 12 12606 12607**参数:** 12608 12609| 名称 | 描述 | 12610| -------- | -------- | 12611| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 | 12612 12613 12614### OH_Drawing_SetTextStyleBackgroundBrush() 12615 12616``` 12617void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12618``` 12619 12620**描述** 12621 12622设置背景色画刷。 12623 12624**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12625 12626**起始版本:** 12 12627 12628**参数:** 12629 12630| 名称 | 描述 | 12631| -------- | -------- | 12632| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12633| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 12634 12635 12636### OH_Drawing_SetTextStyleBackgroundPen() 12637 12638``` 12639void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12640``` 12641 12642**描述** 12643 12644设置背景色画笔。 12645 12646**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12647 12648**起始版本:** 12 12649 12650**参数:** 12651 12652| 名称 | 描述 | 12653| -------- | -------- | 12654| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12655| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 12656 12657 12658### OH_Drawing_SetTextStyleBaseLine() 12659 12660``` 12661void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle* , int ) 12662``` 12663 12664**描述** 12665 12666设置字体基线位置。 12667 12668**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12669 12670**起始版本:** 8 12671 12672**参数:** 12673 12674| 名称 | 描述 | 12675| -------- | -------- | 12676| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12677| int | 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 | 12678 12679 12680### OH_Drawing_SetTextStyleColor() 12681 12682``` 12683void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle* , uint32_t ) 12684``` 12685 12686**描述** 12687 12688设置文本颜色。 12689 12690**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12691 12692**起始版本:** 8 12693 12694**参数:** 12695 12696| 名称 | 描述 | 12697| -------- | -------- | 12698| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12699| uint32_t | 颜色。 | 12700 12701 12702### OH_Drawing_SetTextStyleDecoration() 12703 12704``` 12705void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle* , int ) 12706``` 12707 12708**描述** 12709 12710设置装饰。 12711 12712**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12713 12714**起始版本:** 8 12715 12716**参数:** 12717 12718| 名称 | 描述 | 12719| -------- | -------- | 12720| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12721| int | 设置装饰,设置1为下划线,设置2为上划线,设置3为删除线,设置0或其它为无装饰,具体可见[OH_Drawing_TextDecoration](#oh_drawing_textdecoration)枚举。 | 12722 12723 12724### OH_Drawing_SetTextStyleDecorationColor() 12725 12726``` 12727void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle* , uint32_t ) 12728``` 12729 12730**描述** 12731 12732设置装饰颜色。 12733 12734**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12735 12736**起始版本:** 8 12737 12738**参数:** 12739 12740| 名称 | 描述 | 12741| -------- | -------- | 12742| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12743| uint32_t | 颜色。 | 12744 12745 12746### OH_Drawing_SetTextStyleDecorationStyle() 12747 12748``` 12749void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle* , int ) 12750``` 12751 12752**描述** 12753 12754设置文本装饰样式。 12755 12756**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12757 12758**起始版本:** 11 12759 12760**参数:** 12761 12762| 名称 | 描述 | 12763| -------- | -------- | 12764| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12765| int | 设置的文本装饰样式,支持可选的装饰样式具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 | 12766 12767 12768### OH_Drawing_SetTextStyleDecorationThicknessScale() 12769 12770``` 12771void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle* , double ) 12772``` 12773 12774**描述** 12775 12776设置文本装饰线的厚度缩放比例。 12777 12778**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12779 12780**起始版本:** 11 12781 12782**参数:** 12783 12784| 名称 | 描述 | 12785| -------- | -------- | 12786| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12787| double | 缩放比例。 | 12788 12789 12790### OH_Drawing_SetTextStyleEllipsis() 12791 12792``` 12793void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle* , const char* ) 12794``` 12795 12796**描述** 12797 12798设置文本的省略号内容。 12799 12800**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12801 12802**起始版本:** 11 12803 12804**参数:** 12805 12806| 名称 | 描述 | 12807| -------- | -------- | 12808| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12809| char\* | 设置省略号内容,数据类型为指向char的指针。 | 12810 12811 12812### OH_Drawing_SetTextStyleEllipsisModal() 12813 12814``` 12815void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle* , int ) 12816``` 12817 12818**描述** 12819 12820设置文本的省略号样式。 12821 12822**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12823 12824**起始版本:** 11 12825 12826**参数:** 12827 12828| 名称 | 描述 | 12829| -------- | -------- | 12830| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12831| int | 设置省略号样式,支持可选的省略号样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 | 12832 12833 12834### OH_Drawing_SetTextStyleFontFamilies() 12835 12836``` 12837void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle* , int , const char* fontFamilies[] ) 12838``` 12839 12840**描述** 12841 12842设置字体类型。 12843 12844**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12845 12846**起始版本:** 8 12847 12848**参数:** 12849 12850| 名称 | 描述 | 12851| -------- | -------- | 12852| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12853| int | 字体名称数量。 | 12854| char | 指向字体类型的指针。 | 12855 12856 12857### OH_Drawing_SetTextStyleFontHeight() 12858 12859``` 12860void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle* , double ) 12861``` 12862 12863**描述** 12864 12865设置行高,按当前字体大小的倍数进行设置。 12866 12867**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12868 12869**起始版本:** 8 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_SetTextStyleFontSize() 12880 12881``` 12882void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle* , double ) 12883``` 12884 12885**描述** 12886 12887设置字号。 12888 12889**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12890 12891**起始版本:** 8 12892 12893**参数:** 12894 12895| 名称 | 描述 | 12896| -------- | -------- | 12897| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12898| double | 字号。 | 12899 12900 12901### OH_Drawing_SetTextStyleFontStyle() 12902 12903``` 12904void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle* , int ) 12905``` 12906 12907**描述** 12908 12909设置字体风格。 12910 12911**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12912 12913**起始版本:** 8 12914 12915**参数:** 12916 12917| 名称 | 描述 | 12918| -------- | -------- | 12919| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12920| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 12921 12922 12923### OH_Drawing_SetTextStyleFontStyleStruct() 12924 12925``` 12926void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle ) 12927``` 12928 12929**描述** 12930 12931设置字体样式,包括字体字重、字体宽度和字体斜度。 12932 12933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12934 12935**起始版本:** 12 12936 12937**参数:** 12938 12939| 名称 | 描述 | 12940| -------- | -------- | 12941| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12942| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 12943 12944 12945### OH_Drawing_SetTextStyleFontWeight() 12946 12947``` 12948void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle* , int ) 12949``` 12950 12951**描述** 12952 12953设置字重。 12954 12955**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12956 12957**起始版本:** 8 12958 12959**参数:** 12960 12961| 名称 | 描述 | 12962| -------- | -------- | 12963| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12964| 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)枚举。 | 12965 12966 12967### OH_Drawing_SetTextStyleForegroundBrush() 12968 12969``` 12970void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 12971``` 12972 12973**描述** 12974 12975设置前景色画刷。 12976 12977**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 12978 12979**起始版本:** 12 12980 12981**参数:** 12982 12983| 名称 | 描述 | 12984| -------- | -------- | 12985| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 12986| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 12987 12988 12989### OH_Drawing_SetTextStyleForegroundPen() 12990 12991``` 12992void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 12993``` 12994 12995**描述** 12996 12997设置前景色画笔。 12998 12999**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13000 13001**起始版本:** 12 13002 13003**参数:** 13004 13005| 名称 | 描述 | 13006| -------- | -------- | 13007| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13008| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 13009 13010 13011### OH_Drawing_SetTextStyleHalfLeading() 13012 13013``` 13014void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle* , bool ) 13015``` 13016 13017**描述** 13018 13019设置文本为一半行间距。 13020 13021**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13022 13023**起始版本:** 11 13024 13025**参数:** 13026 13027| 名称 | 描述 | 13028| -------- | -------- | 13029| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13030| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 13031 13032 13033### OH_Drawing_SetTextStyleLetterSpacing() 13034 13035``` 13036void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle* , double ) 13037``` 13038 13039**描述** 13040 13041设置文本的字符间距。 13042 13043**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13044 13045**起始版本:** 11 13046 13047**参数:** 13048 13049| 名称 | 描述 | 13050| -------- | -------- | 13051| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13052| double | 间距大小。 | 13053 13054 13055### OH_Drawing_SetTextStyleLocale() 13056 13057``` 13058void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle* , const char* ) 13059``` 13060 13061**描述** 13062 13063设置文本语言类型。 13064 13065**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13066 13067**起始版本:** 8 13068 13069**参数:** 13070 13071| 名称 | 描述 | 13072| -------- | -------- | 13073| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13074| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。| 13075 13076 13077### OH_Drawing_SetTextStyleWordSpacing() 13078 13079``` 13080void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle* , double ) 13081``` 13082 13083**描述** 13084 13085设置文本的单词间距。 13086 13087**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13088 13089**起始版本:** 11 13090 13091**参数:** 13092 13093| 名称 | 描述 | 13094| -------- | -------- | 13095| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13096| double | 间距大小。 | 13097 13098 13099### OH_Drawing_SetTypographyStyleFontStyleStruct() 13100 13101``` 13102void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle, OH_Drawing_FontStyleStruct fontStyle ) 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| [OH_Drawing_FontStyleStruct](_o_h___drawing___font_style_struct.md) | 字体样式对象,包括字体字重、字体宽度和字体斜度信息。 | 13119 13120 13121### OH_Drawing_SetTypographyStyleTextStrutStyle() 13122 13123``` 13124void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle* , OH_Drawing_StrutStyle* ) 13125``` 13126 13127**描述** 13128 13129设置文本支柱样式。 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| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 | 13141 13142 13143### OH_Drawing_SetTypographyTextAlign() 13144 13145``` 13146void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle* , int ) 13147``` 13148 13149**描述** 13150 13151设置文本对齐方式。 13152 13153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13154 13155**起始版本:** 8 13156 13157**参数:** 13158 13159| 名称 | 描述 | 13160| -------- | -------- | 13161| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13162| int | 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 | 13163 13164 13165### OH_Drawing_SetTypographyTextBreakStrategy() 13166 13167``` 13168void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle* , int ) 13169``` 13170 13171**描述** 13172 13173设置文本的中断策略。 13174 13175**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13176 13177**起始版本:** 11 13178 13179**参数:** 13180 13181| 名称 | 描述 | 13182| -------- | -------- | 13183| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13184| int | 设置中断策略,支持可选的中断策略具体可见[OH_Drawing_BreakStrategy](#oh_drawing_breakstrategy)枚举。 | 13185 13186 13187### OH_Drawing_SetTypographyTextDirection() 13188 13189``` 13190void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle* , int ) 13191``` 13192 13193**描述** 13194 13195设置文本方向。 13196 13197**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13198 13199**起始版本:** 8 13200 13201**参数:** 13202 13203| 名称 | 描述 | 13204| -------- | -------- | 13205| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13206| int | 设置文本方向,设置1为从左到右,设置0或其它为从右到左,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 | 13207 13208 13209### OH_Drawing_SetTypographyTextEllipsis() 13210 13211``` 13212void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle* style, const char* ellipsis ) 13213``` 13214 13215**描述** 13216 13217设置省略号样式。 13218 13219**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13220 13221**起始版本:** 12 13222 13223**参数:** 13224 13225| 名称 | 描述 | 13226| -------- | -------- | 13227| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13228| char | 省略号样式。 | 13229 13230 13231### OH_Drawing_SetTypographyTextEllipsisModal() 13232 13233``` 13234void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle* , int ) 13235``` 13236 13237**描述** 13238 13239设置文本的省略号样式。 13240 13241**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13242 13243**起始版本:** 11 13244 13245**参数:** 13246 13247| 名称 | 描述 | 13248| -------- | -------- | 13249| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13250| int | 设置省略号样式,支持可选的省略号样式样式具体可见[OH_Drawing_EllipsisModal](#oh_drawing_ellipsismodal)枚举。 | 13251 13252 13253### OH_Drawing_SetTypographyTextFontFamily() 13254 13255``` 13256void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle* , const char* ) 13257``` 13258 13259**描述** 13260 13261设置字体家族的名称。 13262 13263**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13264 13265**起始版本:** 12 13266 13267**参数:** 13268 13269| 名称 | 描述 | 13270| -------- | -------- | 13271| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13272| char | 字体家族的名称,数据类型为指向char的指针。 | 13273 13274 13275### OH_Drawing_SetTypographyTextFontHeight() 13276 13277``` 13278void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle* , double ) 13279``` 13280 13281**描述** 13282 13283设置文本排版字体高度。 13284 13285**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13286 13287**起始版本:** 12 13288 13289**参数:** 13290 13291| 名称 | 描述 | 13292| -------- | -------- | 13293| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13294| double | 字体高度。 | 13295 13296 13297### OH_Drawing_SetTypographyTextFontSize() 13298 13299``` 13300void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle* , double ) 13301``` 13302 13303**描述** 13304 13305设置文本排版字号。 13306 13307**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13308 13309**起始版本:** 12 13310 13311**参数:** 13312 13313| 名称 | 描述 | 13314| -------- | -------- | 13315| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13316| double | 字号(大于0)。 | 13317 13318 13319### OH_Drawing_SetTypographyTextFontStyle() 13320 13321``` 13322void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle* , int ) 13323``` 13324 13325**描述** 13326 13327设置字体风格。 13328 13329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13330 13331**起始版本:** 12 13332 13333**参数:** 13334 13335| 名称 | 描述 | 13336| -------- | -------- | 13337| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13338| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 13339 13340 13341### OH_Drawing_SetTypographyTextFontWeight() 13342 13343``` 13344void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle* , int ) 13345``` 13346 13347**描述** 13348 13349设置文本排版字重。 13350 13351**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13352 13353**起始版本:** 12 13354 13355**参数:** 13356 13357| 名称 | 描述 | 13358| -------- | -------- | 13359| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13360| 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)枚举。 | 13361 13362 13363### OH_Drawing_SetTypographyTextHalfLeading() 13364 13365``` 13366void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13367``` 13368 13369**描述** 13370 13371设置文本排版是否为一半行间距。 13372 13373**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13374 13375**起始版本:** 12 13376 13377**参数:** 13378 13379| 名称 | 描述 | 13380| -------- | -------- | 13381| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13382| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 13383 13384 13385### OH_Drawing_SetTypographyTextLineStyleFontFamilies() 13386 13387``` 13388void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle* , int , const char* fontFamilies[] ) 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| int | 字体名称数量。 | 13405| char | 指向字体类型的指针。 | 13406 13407 13408### OH_Drawing_SetTypographyTextLineStyleFontHeight() 13409 13410``` 13411void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle* , double ) 13412``` 13413 13414**描述** 13415 13416设置文本排版行样式字体高度。 13417 13418**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13419 13420**起始版本:** 12 13421 13422**参数:** 13423 13424| 名称 | 描述 | 13425| -------- | -------- | 13426| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13427| double | 字体高度。 | 13428 13429 13430### OH_Drawing_SetTypographyTextLineStyleFontSize() 13431 13432``` 13433void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle* , double ) 13434``` 13435 13436**描述** 13437 13438设置文本排版行样式字号。 13439 13440**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13441 13442**起始版本:** 12 13443 13444**参数:** 13445 13446| 名称 | 描述 | 13447| -------- | -------- | 13448| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13449| double | 字号(大于0)。 | 13450 13451 13452### OH_Drawing_SetTypographyTextLineStyleFontStyle() 13453 13454``` 13455void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle* , int ) 13456``` 13457 13458**描述** 13459 13460设置文本排版行样式风格。 13461 13462**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13463 13464**起始版本:** 12 13465 13466**参数:** 13467 13468| 名称 | 描述 | 13469| -------- | -------- | 13470| OH_Drawing_TypographyStyle | 指向文本风格指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13471| int | 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 | 13472 13473 13474### OH_Drawing_SetTypographyTextLineStyleFontWeight() 13475 13476``` 13477void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle* , int ) 13478``` 13479 13480**描述** 13481 13482设置文本排版行样式字重。 13483 13484**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13485 13486**起始版本:** 12 13487 13488**参数:** 13489 13490| 名称 | 描述 | 13491| -------- | -------- | 13492| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13493| 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)枚举。 | 13494 13495 13496### OH_Drawing_SetTypographyTextLineStyleHalfLeading() 13497 13498``` 13499void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle* , bool ) 13500``` 13501 13502**描述** 13503 13504设置文本排版行样式是否为一半行间距。 13505 13506**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13507 13508**起始版本:** 12 13509 13510**参数:** 13511 13512| 名称 | 描述 | 13513| -------- | -------- | 13514| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13515| bool | 设置一半行间距是否生效,true表示生效,false表示不生效。 | 13516 13517 13518### OH_Drawing_SetTypographyTextLineStyleOnly() 13519 13520``` 13521void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle* , bool ) 13522``` 13523 13524**描述** 13525 13526设置文本排版是否仅启用行样式。 13527 13528**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13529 13530**起始版本:** 12 13531 13532**参数:** 13533 13534| 名称 | 描述 | 13535| -------- | -------- | 13536| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13537| bool | 设置仅启用行样式是否生效,true表示生效,false表示不生效。 | 13538 13539 13540### OH_Drawing_SetTypographyTextLineStyleSpacingScale() 13541 13542``` 13543void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle* , double ) 13544``` 13545 13546**描述** 13547 13548设置文本排版行样式间距比例。 13549 13550**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13551 13552**起始版本:** 12 13553 13554**参数:** 13555 13556| 名称 | 描述 | 13557| -------- | -------- | 13558| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13559| double | 间距比例。 | 13560 13561 13562### OH_Drawing_SetTypographyTextLocale() 13563 13564``` 13565void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle* style, const char* locale ) 13566``` 13567 13568**描述** 13569 13570设置段落语言类型。 13571 13572**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13573 13574**起始版本:** 12 13575 13576**参数:** 13577 13578| 名称 | 描述 | 13579| -------- | -------- | 13580| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13581| char | 语言类型,数据类型为指向char的指针,如'en'代表英文,'zh-Hans'代表简体中文,'zh-Hant'代表繁体中文。 | 13582 13583 13584### OH_Drawing_SetTypographyTextMaxLines() 13585 13586``` 13587void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle* , int ) 13588``` 13589 13590**描述** 13591 13592设置文本最大行数。 13593 13594**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13595 13596**起始版本:** 8 13597 13598**参数:** 13599 13600| 名称 | 描述 | 13601| -------- | -------- | 13602| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13603| int | 最大行数。 | 13604 13605### OH_Drawing_SetTypographyTextSplitRatio() 13606 13607``` 13608void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle* style, float textSplitRatio ) 13609``` 13610 13611**描述** 13612 13613设置文本划分比率。 13614 13615**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13616 13617**起始版本:** 12 13618 13619**参数:** 13620 13621| 名称 | 描述 | 13622| -------- | -------- | 13623| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13624| float | 文本划分比率。 | 13625 13626 13627### OH_Drawing_SetTypographyTextStyle() 13628 13629``` 13630void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle* , OH_Drawing_TextStyle* ) 13631``` 13632 13633**描述** 13634 13635设置段落样式。 13636 13637**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13638 13639**起始版本:** 12 13640 13641**参数:** 13642 13643| 名称 | 描述 | 13644| -------- | -------- | 13645| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13646| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 13647 13648 13649### OH_Drawing_SetTypographyTextUseLineStyle() 13650 13651``` 13652void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle* , bool ) 13653``` 13654 13655**描述** 13656 13657设置文本排版是否启用行样式。 13658 13659**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13660 13661**起始版本:** 12 13662 13663**参数:** 13664 13665| 名称 | 描述 | 13666| -------- | -------- | 13667| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13668| bool | 设置行样式是否启用,true表示启用,false表示不启用。 | 13669 13670 13671### OH_Drawing_SetTypographyTextWordBreakType() 13672 13673``` 13674void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle* , int ) 13675``` 13676 13677**描述** 13678 13679设置单词的断词方式。 13680 13681**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13682 13683**起始版本:** 11 13684 13685**参数:** 13686 13687| 名称 | 描述 | 13688| -------- | -------- | 13689| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 13690| int | 设置断词方式,支持可选的断词方式样式具体可见[OH_Drawing_WordBreakType](#oh_drawing_wordbreaktype)枚举。 | 13691 13692 13693### OH_Drawing_ShaderEffectCreateImageShader() 13694 13695``` 13696OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader (OH_Drawing_Image* , OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* , const OH_Drawing_Matrix* ) 13697``` 13698 13699**描述** 13700 13701创建图像着色器。此接口不建议用于录制类型的画布,会影响性能。 13702 13703本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13704 13705执行成功时返回OH_DRAWING_SUCCESS; 13706 13707OH_Drawing_Image、OH_Drawing_SamplingOptions任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13708 13709tileX、tileY任意一个不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13710 13711**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13712 13713**起始版本:** 12 13714 13715**参数:** 13716 13717| 名称 | 描述 | 13718| -------- | -------- | 13719| OH_Drawing_Image | 指向图片对象[OH_Drawing_Image](#oh_drawing_image)的指针。 | 13720| tileX | 水平方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13721| tileY | 垂直方向着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13722| OH_Drawing_SamplingOptions | 指向采样选项对象[OH_Drawing_SamplingOptions](#oh_drawing_samplingoptions)的指针。 | 13723| OH_Drawing_Matrix | 指向矩阵对象[OH_Drawing_Matrix](#oh_drawing_matrix)的指针。如果矩阵指针为空,默认传入单位矩阵。 | 13724 13725**返回:** 13726 13727返回创建的着色器对象的指针。 13728 13729 13730### OH_Drawing_ShaderEffectCreateLinearGradient() 13731 13732``` 13733OH_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 ) 13734``` 13735 13736**描述** 13737 13738创建着色器,在两个指定点之间生成线性渐变。 13739 13740本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13741 13742执行成功时返回OH_DRAWING_SUCCESS; 13743 13744startPt、endPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13745 13746OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13747 13748**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13749 13750**起始版本:** 11 13751 13752**参数:** 13753 13754| 名称 | 描述 | 13755| -------- | -------- | 13756| startPt | 表示渐变的起点。 | 13757| endPt | 表示渐变的终点。 | 13758| colors | 表示在两个点之间分布的颜色。 | 13759| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在起点和终点之间。 | 13760| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13761| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13762 13763**返回:** 13764 13765返回创建的着色器对象的指针。 13766 13767 13768### OH_Drawing_ShaderEffectCreateRadialGradient() 13769 13770``` 13771OH_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 ) 13772``` 13773 13774**描述** 13775 13776创建着色器,在给定圆心和半径的情况下生成径向渐变。 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 13777 13778本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13779 13780执行成功时返回OH_DRAWING_SUCCESS; 13781 13782centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13783 13784OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13785 13786**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13787 13788**起始版本:** 11 13789 13790**参数:** 13791 13792| 名称 | 描述 | 13793| -------- | -------- | 13794| centerPt | 表示渐变的圆心。 | 13795| radius | 表示渐变的圆半径。 | 13796| colors | 表示在径向上分布的颜色。 | 13797| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在径向上。 | 13798| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13799| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13800 13801**返回:** 13802 13803返回创建的着色器对象的指针。 13804 13805 13806### OH_Drawing_ShaderEffectCreateSweepGradient() 13807 13808``` 13809OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient (const OH_Drawing_Point* centerPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode ) 13810``` 13811 13812**描述** 13813 13814创建着色器,在给定中心的情况下生成扇形渐变。颜色从0°到360°渐变被称为扇形渐变。 13815 13816本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13817 13818执行成功时返回OH_DRAWING_SUCCESS; 13819 13820centerPt、colors任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13821 13822OH_Drawing_TileMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 13823 13824**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13825 13826**起始版本:** 11 13827 13828**参数:** 13829 13830| 名称 | 描述 | 13831| -------- | -------- | 13832| centerPt | 表示渐变的圆心。 | 13833| colors | 表示在两个点之间分布的颜色。 | 13834| pos | 表示每种对应颜色在颜色数组中的相对位置,如果pos为NULL,颜色均匀分布在0°和360°之间。 | 13835| size | 表示颜色和位置的数量(如果pos不为NULL)。 | 13836| OH_Drawing_TileMode | 着色器效果平铺模式类型,支持可选的具体模式可见[OH_Drawing_TileMode](#oh_drawing_tilemode-1)枚举。 | 13837 13838**返回:** 13839 13840返回创建的着色器对象的指针。 13841 13842 13843### OH_Drawing_ShaderEffectDestroy() 13844 13845``` 13846void OH_Drawing_ShaderEffectDestroy (OH_Drawing_ShaderEffect* ) 13847``` 13848 13849**描述** 13850 13851销毁着色器对象,并收回该对象占用的内存。 13852 13853**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13854 13855**起始版本:** 11 13856 13857**参数:** 13858 13859| 名称 | 描述 | 13860| -------- | -------- | 13861| OH_Drawing_ShaderEffect | 表示指向着色器对象的指针。 | 13862 13863 13864### OH_Drawing_SurfaceCreateFromGpuContext() 13865 13866``` 13867OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext (OH_Drawing_GpuContext* , bool budgeted, OH_Drawing_Image_Info ) 13868``` 13869 13870**描述** 13871 13872使用图形处理器上下文创建一个surface对象,用于管理画布绘制的内容。 13873 13874本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13875 13876执行成功时返回OH_DRAWING_SUCCESS; 13877 13878OH_Drawing_GpuContext为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13879 13880**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13881 13882**起始版本:** 12 13883 13884**参数:** 13885 13886| 名称 | 描述 | 13887| -------- | -------- | 13888| OH_Drawing_GpuContext | 指向图形处理器上下文对象的指针[OH_Drawing_GpuContext](#oh_drawing_gpucontext)。 | 13889| budgeted | 用于控制内存分配是否计入缓存预算,true则计入高速缓存预算,false则不计入高速缓存预算。 | 13890| [OH_Drawing_Image_Info](_o_h___drawing___image___info.md) | 图片信息[OH_Drawing_Image_Info](_o_h___drawing___image___info.md)结构体。 | 13891 13892**返回:** 13893 13894返回一个指针,指针指向创建的surface对象[OH_Drawing_Surface](#oh_drawing_surface)。 13895 13896 13897### OH_Drawing_SurfaceDestroy() 13898 13899``` 13900void OH_Drawing_SurfaceDestroy (OH_Drawing_Surface* ) 13901``` 13902 13903**描述** 13904 13905销毁surface对象并回收该对象占用的内存。 13906 13907**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13908 13909**起始版本:** 12 13910 13911**参数:** 13912 13913| 名称 | 描述 | 13914| -------- | -------- | 13915| OH_Drawing_Surface | 指向创建的surface对象的指针。 | 13916 13917 13918### OH_Drawing_SurfaceGetCanvas() 13919 13920``` 13921OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas (OH_Drawing_Surface* ) 13922``` 13923 13924**描述** 13925 13926通过surface对象获取画布对象。 13927 13928本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13929 13930执行成功时返回OH_DRAWING_SUCCESS; 13931 13932OH_Drawing_Surface为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13933 13934**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13935 13936**起始版本:** 12 13937 13938**参数:** 13939 13940| 名称 | 描述 | 13941| -------- | -------- | 13942| OH_Drawing_Surface | 指向创建的surface对象的指针。 | 13943 13944**返回:** 13945 13946返回一个指针,指针指向创建的画布对象[OH_Drawing_Canvas](#oh_drawing_canvas)。返回的指针不需要由调用者管理。 13947 13948 13949### OH_Drawing_TextBlobBuilderAllocRunPos() 13950 13951``` 13952const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos (OH_Drawing_TextBlobBuilder* , const OH_Drawing_Font* , int32_t count, const OH_Drawing_Rect* ) 13953``` 13954 13955**描述** 13956 13957申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, 当调用[OH_Drawing_TextBlobBuilderMake](#oh_drawing_textblobbuildermake)后禁止使用。 13958 13959本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 13960 13961执行成功时返回OH_DRAWING_SUCCESS; 13962 13963OH_Drawing_TextBlobBuilder、OH_Drawing_Font任意一个为NULL或者count小于等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 13964 13965**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13966 13967**起始版本:** 11 13968 13969**参数:** 13970 13971| 名称 | 描述 | 13972| -------- | -------- | 13973| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 13974| OH_Drawing_Font | 指向字体对象的指针。 | 13975| count | 文字的数量。 | 13976| OH_Drawing_Rect | 文本的边界框,为NULL表示不设置边界框。 | 13977 13978 13979### OH_Drawing_TextBlobBuilderCreate() 13980 13981``` 13982OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate (void ) 13983``` 13984 13985**描述** 13986 13987用于创建一个文本构造器对象。 13988 13989**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 13990 13991**起始版本:** 11 13992 13993**返回:** 13994 13995函数会返回一个指针,指针指向创建的文本构造器对象。 13996 13997 13998### OH_Drawing_TextBlobBuilderDestroy() 13999 14000``` 14001void OH_Drawing_TextBlobBuilderDestroy (OH_Drawing_TextBlobBuilder* ) 14002``` 14003 14004**描述** 14005 14006用于销毁文本构造器对象并回收该对象占有的内存。 14007 14008**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14009 14010**起始版本:** 11 14011 14012**参数:** 14013 14014| 名称 | 描述 | 14015| -------- | -------- | 14016| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 14017 14018 14019### OH_Drawing_TextBlobBuilderMake() 14020 14021``` 14022OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake (OH_Drawing_TextBlobBuilder* ) 14023``` 14024 14025**描述** 14026 14027用于从文本构造器中创建文本对象。 14028 14029本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14030 14031执行成功时返回OH_DRAWING_SUCCESS; 14032 14033OH_Drawing_TextBlobBuilder为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 14034 14035**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14036 14037**起始版本:** 11 14038 14039**参数:** 14040 14041| 名称 | 描述 | 14042| -------- | -------- | 14043| OH_Drawing_TextBlobBuilder | 指向文本构造器对象的指针。 | 14044 14045**返回:** 14046 14047返回一个指针,指针指向创建的文本对象。 14048 14049 14050### OH_Drawing_TextBlobCreateFromPosText() 14051 14052``` 14053OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText (const void * text, size_t byteLength, OH_Drawing_Point2D* , const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14054``` 14055 14056**描述** 14057 14058使用文本创建文本对象,文本对象中每个字符的坐标由OH_Drawing_Point2D数组中对应的坐标信息决定。 14059 14060本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14061 14062执行成功时返回OH_DRAWING_SUCCESS; 14063 14064text、OH_Drawing_Point2D、OH_Drawing_Font任意一个为NULL或byteLength等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 14065 14066OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 14067 14068**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14069 14070**起始版本:** 12 14071 14072**参数:** 14073 14074| 名称 | 描述 | 14075| -------- | -------- | 14076| text | 指向文本的指针。 | 14077| byteLength | 文本的字节长度。 | 14078| [OH_Drawing_Point2D](_o_h___drawing___point2_d.md) | 二维点[OH_Drawing_Point2D](_o_h___drawing___point2_d.md)数组首地址,数组个数由[OH_Drawing_FontCountText](#oh_drawing_fontcounttext)计算结果决定。 | 14079| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 14080| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 14081 14082**返回:** 14083 14084函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 14085 14086 14087### OH_Drawing_TextBlobCreateFromString() 14088 14089``` 14090OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString (const char* str, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14091``` 14092 14093**描述** 14094 14095使用字符串创建文本对象。 14096 14097本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14098 14099执行成功时返回OH_DRAWING_SUCCESS; 14100 14101str、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 14102 14103OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 14104 14105**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14106 14107**起始版本:** 12 14108 14109**参数:** 14110 14111| 名称 | 描述 | 14112| -------- | -------- | 14113| str | 指向字符串的指针。 | 14114| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 14115| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 14116 14117**返回:** 14118 14119函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 14120 14121 14122### OH_Drawing_TextBlobCreateFromText() 14123 14124``` 14125OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText (const void * text, size_t byteLength, const OH_Drawing_Font* , OH_Drawing_TextEncoding ) 14126``` 14127 14128**描述** 14129 14130使用文本创建一个文本对象。 14131 14132本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14133 14134执行成功时返回OH_DRAWING_SUCCESS; 14135 14136text、OH_Drawing_Font任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER; 14137 14138OH_Drawing_TextEncoding不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 14139 14140**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14141 14142**起始版本:** 12 14143 14144**参数:** 14145 14146| 名称 | 描述 | 14147| -------- | -------- | 14148| text | 指向文本的指针。 | 14149| byteLength | 文本的字节长度。 | 14150| OH_Drawing_Font | 指向字体对象[OH_Drawing_Font](#oh_drawing_font)的指针。 | 14151| OH_Drawing_TextEncoding | 文本编码类型[OH_Drawing_TextEncoding](#oh_drawing_textencoding)。 | 14152 14153**返回:** 14154 14155函数返回一个指针,指针指向创建的文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)。 14156 14157 14158### OH_Drawing_TextBlobDestroy() 14159 14160``` 14161void OH_Drawing_TextBlobDestroy (OH_Drawing_TextBlob* ) 14162``` 14163 14164**描述** 14165 14166用于销毁文本对象并回收该对象占有的内存。 14167 14168**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14169 14170**起始版本:** 11 14171 14172**参数:** 14173 14174| 名称 | 描述 | 14175| -------- | -------- | 14176| OH_Drawing_TextBlob | 指向文本对象的指针。 | 14177 14178 14179### OH_Drawing_TextBlobGetBounds() 14180 14181``` 14182void OH_Drawing_TextBlobGetBounds (OH_Drawing_TextBlob* , OH_Drawing_Rect* ) 14183``` 14184 14185**描述** 14186 14187获取文本对象的边界范围。 14188 14189本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 14190 14191执行成功时返回OH_DRAWING_SUCCESS; 14192 14193OH_Drawing_TextBlob、OH_Drawing_Rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 14194 14195**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14196 14197**起始版本:** 12 14198 14199**参数:** 14200 14201| 名称 | 描述 | 14202| -------- | -------- | 14203| OH_Drawing_TextBlob | 指向文本对象[OH_Drawing_TextBlob](#oh_drawing_textblob)的指针。 | 14204| OH_Drawing_Rect | 指向矩形对象[OH_Drawing_Rect](#oh_drawing_rect)的指针, 开发者可调用[OH_Drawing_RectCreate](#oh_drawing_rectcreate)接口创建。 | 14205 14206 14207### OH_Drawing_TextStyleAddFontFeature() 14208 14209``` 14210void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle* , const char* tag, int value ) 14211``` 14212 14213**描述** 14214 14215添加文本字体特征。 14216 14217**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14218 14219**起始版本:** 12 14220 14221**参数:** 14222 14223| 名称 | 描述 | 14224| -------- | -------- | 14225| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14226| char | 指向字体特征键值对中关键字所标识的字符串。 | 14227| int | 要设置的字体特征键值对的值。 | 14228 14229 14230### OH_Drawing_TextStyleAddFontVariation() 14231 14232``` 14233void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle* , const char* axis, int value ) 14234``` 14235 14236**描述** 14237 14238添加可变字体属性。对应的字体文件(.ttf文件)需要支持可变调节,此接口才能生效。当对应的字体不支持可变调节时,此接口调用不生效。 14239 14240**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14241 14242**起始版本:** 12 14243 14244**参数:** 14245 14246| 名称 | 描述 | 14247| -------- | -------- | 14248| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14249| char | 可变字体属性键值对中的键。目前仅支持'wght',表示字重属性。 | 14250| int | 设置的可变字体属性键值对的值。目前默认字体下字重属性支持的取值范围为\[0,900\]。 | 14251 14252 14253### OH_Drawing_TextStyleAddShadow() 14254 14255``` 14256void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle* , const OH_Drawing_TextShadow* ) 14257``` 14258 14259**描述** 14260 14261字体阴影容器中添加字体阴影元素。 14262 14263**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14264 14265**起始版本:** 12 14266 14267**参数:** 14268 14269| 名称 | 描述 | 14270| -------- | -------- | 14271| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14272| OH_Drawing_TextShadow | 指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针,由[OH_Drawing_CreateTextShadow](#oh_drawing_createtextshadow)获取。 | 14273 14274 14275### OH_Drawing_TextStyleClearFontFeature() 14276 14277``` 14278void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle* ) 14279``` 14280 14281**描述** 14282 14283清除字体特征map容器中的所有内容。 14284 14285**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14286 14287**起始版本:** 12 14288 14289**参数:** 14290 14291| 名称 | 描述 | 14292| -------- | -------- | 14293| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14294 14295 14296### OH_Drawing_TextStyleClearShadows() 14297 14298``` 14299void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle* ) 14300``` 14301 14302**描述** 14303 14304清除字体阴影容器中的所有元素。 14305 14306**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14307 14308**起始版本:** 12 14309 14310**参数:** 14311 14312| 名称 | 描述 | 14313| -------- | -------- | 14314| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14315 14316 14317### OH_Drawing_TextStyleDestroyFontFamilies() 14318 14319``` 14320void OH_Drawing_TextStyleDestroyFontFamilies (char** fontFamilies, size_t num ) 14321``` 14322 14323**描述** 14324 14325释放字体类型名称列表占用的内存。 14326 14327**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14328 14329**起始版本:** 12 14330 14331**参数:** 14332 14333| 名称 | 描述 | 14334| -------- | -------- | 14335| char\*\* | 指向字体类型名称列表的指针。 | 14336| size_t | 字体类型名称列表的数量。 | 14337 14338 14339### OH_Drawing_TextStyleDestroyFontFeatures() 14340 14341``` 14342void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature* , size_t fontFeatureSize ) 14343``` 14344 14345**描述** 14346 14347释放存放字体特征所有内容的结构体数组所占用的空间。 14348 14349**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14350 14351**起始版本:** 12 14352 14353**参数:** 14354 14355| 名称 | 描述 | 14356| -------- | -------- | 14357| [OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) | 指向存放容器所有键值对的结构体数组指针,由[OH_Drawing_TextStyleGetFontFeatures](#oh_drawing_textstylegetfontfeatures)获取。 | 14358| fontFeatureSize | 存放容器所有键值对的结构体数组的大小。 | 14359 14360 14361### OH_Drawing_TextStyleGetBackgroundBrush() 14362 14363``` 14364void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14365``` 14366 14367**描述** 14368 14369返回设置的背景色画刷。 14370 14371**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14372 14373**起始版本:** 12 14374 14375**参数:** 14376 14377| 名称 | 描述 | 14378| -------- | -------- | 14379| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14380| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 14381 14382 14383### OH_Drawing_TextStyleGetBackgroundPen() 14384 14385``` 14386void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14387``` 14388 14389**描述** 14390 14391返回设置的背景色画笔。 14392 14393**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14394 14395**起始版本:** 12 14396 14397**参数:** 14398 14399| 名称 | 描述 | 14400| -------- | -------- | 14401| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14402| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 14403 14404 14405### OH_Drawing_TextStyleGetBaseline() 14406 14407``` 14408OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle* ) 14409``` 14410 14411**描述** 14412 14413获取字体基线位置。 14414 14415**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14416 14417**起始版本:** 12 14418 14419**参数:** 14420 14421| 名称 | 描述 | 14422| -------- | -------- | 14423| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14424 14425**返回:** 14426 14427返回字体基线位置,具体可见[OH_Drawing_TextBaseline](#oh_drawing_textbaseline)枚举。 14428 14429 14430### OH_Drawing_TextStyleGetBaselineShift() 14431 14432``` 14433double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle* ) 14434``` 14435 14436**描述** 14437 14438获取文本的基线漂移。 14439 14440**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14441 14442**起始版本:** 12 14443 14444**参数:** 14445 14446| 名称 | 描述 | 14447| -------- | -------- | 14448| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14449 14450**返回:** 14451 14452double 基线漂移的值。 14453 14454 14455### OH_Drawing_TextStyleGetColor() 14456 14457``` 14458uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle* ) 14459``` 14460 14461**描述** 14462 14463获取文本颜色。 14464 14465**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14466 14467**起始版本:** 12 14468 14469**参数:** 14470 14471| 名称 | 描述 | 14472| -------- | -------- | 14473| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14474 14475**返回:** 14476 14477uint32_t 返回文本颜色。 14478 14479 14480### OH_Drawing_TextStyleGetDecorationStyle() 14481 14482``` 14483OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle* ) 14484``` 14485 14486**描述** 14487 14488获取文本装饰样式。 14489 14490**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14491 14492**起始版本:** 12 14493 14494**参数:** 14495 14496| 名称 | 描述 | 14497| -------- | -------- | 14498| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14499 14500**返回:** 14501 14502返回文本装饰样式,具体可见[OH_Drawing_TextDecorationStyle](#oh_drawing_textdecorationstyle)枚举。 14503 14504 14505### OH_Drawing_TextStyleGetFontFamilies() 14506 14507``` 14508char** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle* , size_t* num ) 14509``` 14510 14511**描述** 14512 14513获取字体类型名称列表。 14514 14515**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14516 14517**起始版本:** 12 14518 14519**参数:** 14520 14521| 名称 | 描述 | 14522| -------- | -------- | 14523| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14524| size_t | 指向字体名称数量的指针。 | 14525 14526**返回:** 14527 14528返回获取到的字体类型列表。 14529 14530 14531### OH_Drawing_TextStyleGetFontFeatures() 14532 14533``` 14534OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle* ) 14535``` 14536 14537**描述** 14538 14539获取字体特征map容器中的所有内容。 14540 14541**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14542 14543**起始版本:** 12 14544 14545**参数:** 14546 14547| 名称 | 描述 | 14548| -------- | -------- | 14549| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14550 14551**返回:** 14552 14553[OH_Drawing_FontFeature](_o_h___drawing___font_feature.md) 要获取的字体特征容器的所有内容,指向存放容器所有键值对的一个结构体数组。 14554 14555 14556### OH_Drawing_TextStyleGetFontFeatureSize() 14557 14558``` 14559size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle* ) 14560``` 14561 14562**描述** 14563 14564获取字体特征map容器的大小。 14565 14566**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14567 14568**起始版本:** 12 14569 14570**参数:** 14571 14572| 名称 | 描述 | 14573| -------- | -------- | 14574| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14575 14576**返回:** 14577 14578size_t 字体特征map容器的大小。 14579 14580 14581### OH_Drawing_TextStyleGetFontHeight() 14582 14583``` 14584double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle* ) 14585``` 14586 14587**描述** 14588 14589获取字体高度。 14590 14591**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14592 14593**起始版本:** 12 14594 14595**参数:** 14596 14597| 名称 | 描述 | 14598| -------- | -------- | 14599| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14600 14601**返回:** 14602 14603double 返回字体高度。 14604 14605 14606### OH_Drawing_TextStyleGetFontMetrics() 14607 14608``` 14609bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography* , OH_Drawing_TextStyle* , OH_Drawing_Font_Metrics* ) 14610``` 14611 14612**描述** 14613 14614获取文本字体属性。 14615 14616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14617 14618**起始版本:** 12 14619 14620**参数:** 14621 14622| 名称 | 描述 | 14623| -------- | -------- | 14624| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 14625| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14626| OH_Drawing_Font_Metrics | 指向字体属性对象[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)的指针,由[OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md)获取。 | 14627 14628**返回:** 14629 14630是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。 14631 14632 14633### OH_Drawing_TextStyleGetFontSize() 14634 14635``` 14636double OH_Drawing_TextStyleGetFontSize (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 14655double 返回字号。 14656 14657 14658### OH_Drawing_TextStyleGetFontStyle() 14659 14660``` 14661OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle* ) 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 14678**返回:** 14679 14680返回字体风格,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 14681 14682 14683### OH_Drawing_TextStyleGetFontStyleStruct() 14684 14685``` 14686OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle* drawingTextStyle) 14687``` 14688 14689**描述** 14690 14691获取字体样式,包括字体字重、字体宽度和字体斜度。 14692 14693**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14694 14695**起始版本:** 12 14696 14697**参数:** 14698 14699| 名称 | 描述 | 14700| -------- | -------- | 14701| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14702 14703**返回:** 14704 14705返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。 14706 14707 14708### OH_Drawing_TextStyleGetFontWeight() 14709 14710``` 14711OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle* ) 14712``` 14713 14714**描述** 14715 14716获取字重。 14717 14718**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14719 14720**起始版本:** 12 14721 14722**参数:** 14723 14724| 名称 | 描述 | 14725| -------- | -------- | 14726| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14727 14728**返回:** 14729 14730返回字重,具体可见[OH_Drawing_FontWeight](#oh_drawing_fontweight)枚举。 14731 14732 14733### OH_Drawing_TextStyleGetForegroundBrush() 14734 14735``` 14736void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle* , OH_Drawing_Brush* ) 14737``` 14738 14739**描述** 14740 14741返回设置的前景色画刷。 14742 14743**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14744 14745**起始版本:** 12 14746 14747**参数:** 14748 14749| 名称 | 描述 | 14750| -------- | -------- | 14751| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14752| OH_Drawing_Brush | 指向画刷[OH_Drawing_Brush](#oh_drawing_brush)对象的指针,由[OH_Drawing_BrushCreate](#oh_drawing_brushcreate)获取。 | 14753 14754 14755### OH_Drawing_TextStyleGetForegroundPen() 14756 14757``` 14758void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle* , OH_Drawing_Pen* ) 14759``` 14760 14761**描述** 14762 14763返回设置的前景色画笔。 14764 14765**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14766 14767**起始版本:** 12 14768 14769**参数:** 14770 14771| 名称 | 描述 | 14772| -------- | -------- | 14773| OH_Drawing_TextStyle | 指向字体风格[OH_Drawing_TextStyle](#oh_drawing_textstyle)对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14774| OH_Drawing_Pen | 指向画笔[OH_Drawing_Pen](#oh_drawing_pen)对象的指针,由[OH_Drawing_PenCreate](#oh_drawing_pencreate)获取。 | 14775 14776 14777### OH_Drawing_TextStyleGetHalfLeading() 14778 14779``` 14780bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle* ) 14781``` 14782 14783**描述** 14784 14785获取当前文档是否设置为一半行间距。 14786 14787**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14788 14789**起始版本:** 12 14790 14791**参数:** 14792 14793| 名称 | 描述 | 14794| -------- | -------- | 14795| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14796 14797**返回:** 14798 14799bool 返回当前文档设置为一半行间距的结果,true表示设置为一半行间距,false表示未设置为一半行间距。 14800 14801 14802### OH_Drawing_TextStyleGetLetterSpacing() 14803 14804``` 14805double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle* ) 14806``` 14807 14808**描述** 14809 14810获取文本的字符间距。 14811 14812**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14813 14814**起始版本:** 12 14815 14816**参数:** 14817 14818| 名称 | 描述 | 14819| -------- | -------- | 14820| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14821 14822**返回:** 14823 14824double 返回字符间距大小。 14825 14826 14827### OH_Drawing_TextStyleGetLocale() 14828 14829``` 14830const char* OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle* ) 14831``` 14832 14833**描述** 14834 14835获取文本语言类型。 14836 14837**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14838 14839**起始版本:** 12 14840 14841**参数:** 14842 14843| 名称 | 描述 | 14844| -------- | -------- | 14845| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14846 14847**返回:** 14848 14849char 返回语言区域,数据类型为指向char的指针。语言区域格式为:语言-国家。如zh-CN表示中文(中国),en-US表示英语(美国)等。具体参考BCP 47语言标签标准。 14850 14851 14852### OH_Drawing_TextStyleGetShadowCount() 14853 14854``` 14855int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle* ) 14856``` 14857 14858**描述** 14859 14860获取字体阴影容器的大小。 14861 14862**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14863 14864**起始版本:** 12 14865 14866**参数:** 14867 14868| 名称 | 描述 | 14869| -------- | -------- | 14870| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14871 14872**返回:** 14873 14874int 返回字体阴影容器的大小。 14875 14876 14877### OH_Drawing_TextStyleGetShadows() 14878 14879``` 14880OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle* ) 14881``` 14882 14883**描述** 14884 14885获取字体阴影容器。 14886 14887**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14888 14889**起始版本:** 12 14890 14891**参数:** 14892 14893| 名称 | 描述 | 14894| -------- | -------- | 14895| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14896 14897**返回:** 14898 14899返回指向字体阴影容器[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。 14900 14901 14902### OH_Drawing_TextStyleGetShadowWithIndex() 14903 14904``` 14905OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle* , int ) 14906``` 14907 14908**描述** 14909 14910根据下标获取字体阴影容器中的元素。 14911 14912**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14913 14914**起始版本:** 12 14915 14916**参数:** 14917 14918| 名称 | 描述 | 14919| -------- | -------- | 14920| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14921| int | 下标索引。 | 14922 14923**返回:** 14924 14925返回指向字体阴影对象[OH_Drawing_TextShadow](#oh_drawing_textshadow)的指针。 14926 14927 14928### OH_Drawing_TextStyleGetWordSpacing() 14929 14930``` 14931double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle* ) 14932``` 14933 14934**描述** 14935 14936获取文本的单词间距。 14937 14938**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14939 14940**起始版本:** 12 14941 14942**参数:** 14943 14944| 名称 | 描述 | 14945| -------- | -------- | 14946| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 14947 14948**返回:** 14949 14950double 返回单词间距大小。 14951 14952 14953### OH_Drawing_TextStyleIsAttributeMatched() 14954 14955``` 14956bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType ) 14957``` 14958 14959**描述** 14960 14961判断两个字体风格对象是否有一样的文本样式类型。 14962 14963**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14964 14965**起始版本:** 12 14966 14967**参数:** 14968 14969| 名称 | 描述 | 14970| -------- | -------- | 14971| style | 比较的字体风格对象。 | 14972| comparedStyle | 比较的字体风格对象。 | 14973| textStyleType | 文本样式类型枚举[OH_Drawing_TextStyleType](#oh_drawing_textstyletype)。 | 14974 14975**返回:** 14976 14977返回两个TextStyle对象是否有对应的文本样式类型一样的结果,true表示其文本样式类型一样,false表示不一样。 14978 14979 14980### OH_Drawing_TextStyleIsEqual() 14981 14982``` 14983bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 14984``` 14985 14986**描述** 14987 14988判断两个字体风格对象是否相等。 14989 14990**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 14991 14992**起始版本:** 12 14993 14994**参数:** 14995 14996| 名称 | 描述 | 14997| -------- | -------- | 14998| style | 比较的字体风格对象。 | 14999| comparedStyle | 比较的字体风格对象。 | 15000 15001**返回:** 15002 15003返回两个字体风格对象是否相等的结果,true表示相等,false表示不相等。 15004 15005 15006### OH_Drawing_TextStyleIsEqualByFont() 15007 15008``` 15009bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle ) 15010``` 15011 15012**描述** 15013 15014判断两个字体风格对象的字体样式属性是否相等。 15015 15016**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15017 15018**起始版本:** 12 15019 15020**参数:** 15021 15022| 名称 | 描述 | 15023| -------- | -------- | 15024| style | 比较的字体风格对象。 | 15025| comparedStyle | 比较的字体风格对象。 | 15026 15027**返回:** 15028 15029返回两个字体风格对象的字体样式属性是否相等的结果。 15030 15031 15032### OH_Drawing_TextStyleIsPlaceholder() 15033 15034``` 15035bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle* style) 15036``` 15037 15038**描述** 15039 15040返回是否有设置文本占位符。 15041 15042**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15043 15044**起始版本:** 12 15045 15046**参数:** 15047 15048| 名称 | 描述 | 15049| -------- | -------- | 15050| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 15051 15052**返回:** 15053 15054返回是否有设置文本占位符,true表示有设置文本占位符,false表示未设置文本占位符。 15055 15056 15057### OH_Drawing_TextStyleSetBackgroundRect() 15058 15059``` 15060void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle* , const OH_Drawing_RectStyle_Info* , int styleId ) 15061``` 15062 15063**描述** 15064 15065设置文本背景矩形框和样式id。样式id仅当背景框为圆角矩形时有效。 15066 15067**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15068 15069**起始版本:** 12 15070 15071**参数:** 15072 15073| 名称 | 描述 | 15074| -------- | -------- | 15075| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 15076| [OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md) | 指向[OH_Drawing_RectStyle_Info](_o_h___drawing___rect_style___info.md)对象的指针。 | 15077| int | 要设置的样式id,仅当背景框为圆角矩形时有效。文本处理时会被划分为多个分段,每个分段都有自己的TextStyle,id标识着这个分段将被绘制于第几个背景矩形框中。 若一行中每个分段的id全为0,表示所有分段绘制在同一个圆角矩形背景框中; 若一行中的id为0, 1,则id为0的分段绘制在一个圆角矩形背景框内,id为1的分段绘制在另一个圆角矩形背景框内,以此类推。 | 15078 15079 15080### OH_Drawing_TextStyleSetBaselineShift() 15081 15082``` 15083void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle* , double lineShift ) 15084``` 15085 15086**描述** 15087 15088设置文本的基线漂移。 15089 15090**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15091 15092**起始版本:** 12 15093 15094**参数:** 15095 15096| 名称 | 描述 | 15097| -------- | -------- | 15098| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 15099| double | 文本的基线漂移。 | 15100 15101 15102### OH_Drawing_TextStyleSetPlaceholder() 15103 15104``` 15105void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle* style) 15106``` 15107 15108**描述** 15109 15110设置占位符。 15111 15112**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15113 15114**起始版本:** 12 15115 15116**参数:** 15117 15118| 名称 | 描述 | 15119| -------- | -------- | 15120| OH_Drawing_TextStyle | 指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 15121 15122 15123### OH_Drawing_TypefaceCreateDefault() 15124 15125``` 15126OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault (void ) 15127``` 15128 15129**描述** 15130 15131用于创建一个默认的字形对象。 15132 15133**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15134 15135**起始版本:** 11 15136 15137**返回:** 15138 15139返回一个指针,指针指向创建的字形对象。 15140 15141 15142### OH_Drawing_TypefaceCreateFromFile() 15143 15144``` 15145OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile (const char* path, int index ) 15146``` 15147 15148**描述** 15149 15150通过文件创建一个字形对象。 15151 15152本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 15153 15154执行成功时返回OH_DRAWING_SUCCESS; 15155 15156path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 15157 15158**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15159 15160**起始版本:** 12 15161 15162**参数:** 15163 15164| 名称 | 描述 | 15165| -------- | -------- | 15166| path | 指向文件路径的指针。 | 15167| index | 文件索引。 | 15168 15169**返回:** 15170 15171函数返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 15172 15173 15174### OH_Drawing_TypefaceCreateFromStream() 15175 15176``` 15177OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream (OH_Drawing_MemoryStream* , int32_t index ) 15178``` 15179 15180**描述** 15181 15182通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 内存流传入后,所有权转移,开发者不能再释放它。 15183 15184本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](#oh_drawing_errorcodeget)查看错误码[OH_Drawing_ErrorCode](#oh_drawing_errorcode)的取值。 15185 15186执行成功时返回OH_DRAWING_SUCCESS; 15187 15188OH_Drawing_MemoryStream为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 15189 15190**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15191 15192**起始版本:** 12 15193 15194**参数:** 15195 15196| 名称 | 描述 | 15197| -------- | -------- | 15198| OH_Drawing_MemoryStream | 指向内存流对象[OH_Drawing_MemoryStream](#oh_drawing_memorystream)的指针。 | 15199| index | 内存流索引。 | 15200 15201**返回:** 15202 15203返回一个指针,指针指向创建的字形对象[OH_Drawing_Typeface](#oh_drawing_typeface)。 15204 15205 15206### OH_Drawing_TypefaceDestroy() 15207 15208``` 15209void OH_Drawing_TypefaceDestroy (OH_Drawing_Typeface* ) 15210``` 15211 15212**描述** 15213 15214用于销毁字形对象并回收该对象占有的内存。 15215 15216**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15217 15218**起始版本:** 11 15219 15220**参数:** 15221 15222| 名称 | 描述 | 15223| -------- | -------- | 15224| OH_Drawing_Typeface | 指向字形对象的指针。 | 15225 15226 15227### OH_Drawing_TypographyDestroyEllipsis() 15228 15229``` 15230void OH_Drawing_TypographyDestroyEllipsis (char* ellipsis) 15231``` 15232 15233**描述** 15234 15235释放省略号名称列表占用的内存。 15236 15237**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15238 15239**起始版本:** 12 15240 15241**参数:** 15242 15243| 名称 | 描述 | 15244| -------- | -------- | 15245| ellipsis | 表示指向省略号名称列表的指针。 | 15246 15247 15248### OH_Drawing_TypographyDestroyLineFontMetrics() 15249 15250``` 15251void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics* ) 15252``` 15253 15254**描述** 15255 15256释放指定行所有字体度量结构体集合所占用的所有空间。 15257 15258**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15259 15260**起始版本:** 12 15261 15262**参数:** 15263 15264| 名称 | 描述 | 15265| -------- | -------- | 15266| [OH_Drawing_Font_Metrics](_o_h___drawing___font___metrics.md) | 指示要释放空间的指定行所有字体度量结构体集合的第一个地址。 | 15267 15268 15269### OH_Drawing_TypographyDidExceedMaxLines() 15270 15271``` 15272bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography* ) 15273``` 15274 15275**描述** 15276 15277获取文本是否超过最大行。 15278 15279**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15280 15281**起始版本:** 11 15282 15283**参数:** 15284 15285| 名称 | 描述 | 15286| -------- | -------- | 15287| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15288 15289**返回:** 15290 15291返回文本是否超过最大行,true表示超过,false表示未超过。 15292 15293 15294### OH_Drawing_TypographyGetAlphabeticBaseline() 15295 15296``` 15297double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography* ) 15298``` 15299 15300**描述** 15301 15302获取字母文字基线。 15303 15304**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15305 15306**起始版本:** 9 15307 15308**参数:** 15309 15310| 名称 | 描述 | 15311| -------- | -------- | 15312| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15313 15314**返回:** 15315 15316返回字母文字基线。 15317 15318 15319### OH_Drawing_TypographyGetEffectiveAlignment() 15320 15321``` 15322int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 15323``` 15324 15325**描述** 15326 15327获取文字对齐方式。 15328 15329**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15330 15331**起始版本:** 12 15332 15333**参数:** 15334 15335| 名称 | 描述 | 15336| -------- | -------- | 15337| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15338 15339**返回:** 15340 15341返回文字对齐方式。 15342 15343 15344### OH_Drawing_TypographyGetGlyphPositionAtCoordinate() 15345 15346``` 15347OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography* , double , double ) 15348``` 15349 15350**描述** 15351 15352获取坐标处文本的索引位置和亲和性。 15353 15354**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15355 15356**起始版本:** 11 15357 15358**参数:** 15359 15360| 名称 | 描述 | 15361| -------- | -------- | 15362| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15363| double | 光标的x坐标。 | 15364| double | 光标的y坐标。 | 15365 15366**返回:** 15367 15368返回坐标处字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。 15369 15370 15371### OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster() 15372 15373``` 15374OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography* , double , double ) 15375``` 15376 15377**描述** 15378 15379获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 15380 15381**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15382 15383**起始版本:** 11 15384 15385**参数:** 15386 15387| 名称 | 描述 | 15388| -------- | -------- | 15389| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15390| double | 光标的x坐标。 | 15391| double | 光标的y坐标。 | 15392 15393**返回:** 15394 15395返回坐标处指定类型字体的索引位置和亲和性,返回类型为[OH_Drawing_PositionAndAffinity](#oh_drawing_positionandaffinity)结构体。 15396 15397 15398### OH_Drawing_TypographyGetHeight() 15399 15400``` 15401double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography* ) 15402``` 15403 15404**描述** 15405 15406获取高度。 15407 15408**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15409 15410**起始版本:** 9 15411 15412**参数:** 15413 15414| 名称 | 描述 | 15415| -------- | -------- | 15416| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15417 15418**返回:** 15419 15420返回高度。 15421 15422 15423### OH_Drawing_TypographyGetIdeographicBaseline() 15424 15425``` 15426double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography* ) 15427``` 15428 15429**描述** 15430 15431获取表意文字基线。 15432 15433**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15434 15435**起始版本:** 9 15436 15437**参数:** 15438 15439| 名称 | 描述 | 15440| -------- | -------- | 15441| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15442 15443**返回:** 15444 15445返回表意文字基线。 15446 15447 15448### OH_Drawing_TypographyGetIndentsWithIndex() 15449 15450``` 15451float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography* , int ) 15452``` 15453 15454**描述** 15455 15456根据下标获取排版缩进容器中的元素。 15457 15458**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15459 15460**起始版本:** 12 15461 15462**参数:** 15463 15464| 名称 | 描述 | 15465| -------- | -------- | 15466| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15467| int | 下标索引。 | 15468 15469**返回:** 15470 15471float 返回索引对应的元素值。 15472 15473 15474### OH_Drawing_TypographyGetLineCount() 15475 15476``` 15477size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography* ) 15478``` 15479 15480**描述** 15481 15482获取文本行数。 15483 15484**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15485 15486**起始版本:** 11 15487 15488**参数:** 15489 15490| 名称 | 描述 | 15491| -------- | -------- | 15492| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15493 15494**返回:** 15495 15496返回行数。 15497 15498 15499### OH_Drawing_TypographyGetLineFontMetrics() 15500 15501``` 15502OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography* , size_t lineNumber, size_t* fontMetricsSize ) 15503``` 15504 15505**描述** 15506 15507从目标行获取所有字体指标。 15508 15509**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15510 15511**起始版本:** 12 15512 15513**参数:** 15514 15515| 名称 | 描述 | 15516| -------- | -------- | 15517| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15518| lineNumber | 指定行数,取值为整数,最小有效值为1,最大行取决于文本输入后字体引擎解析出来的行数,若输入值大于最大行会返回错误值并打印错误消息。 | 15519| fontMetricsSize | 指示从当前行返回的字体度量结构的大小。 | 15520 15521**返回:** 15522 15523返回当前行的所有字符度量。 15524 15525 15526### OH_Drawing_TypographyGetLineHeight() 15527 15528``` 15529double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography* , int ) 15530``` 15531 15532**描述** 15533 15534获取指定行的行高 15535 15536**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15537 15538**起始版本:** 11 15539 15540**参数:** 15541 15542| 名称 | 描述 | 15543| -------- | -------- | 15544| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15545| int | 要指定的行数。 | 15546 15547**返回:** 15548 15549返回指定行的行高。 15550 15551 15552### OH_Drawing_TypographyGetLineInfo() 15553 15554``` 15555bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography* , int , bool , bool , OH_Drawing_LineMetrics* ) 15556``` 15557 15558**描述** 15559 15560获取指定行的位置信息或指定行第一个字符的位置信息。 15561 15562**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15563 15564**起始版本:** 12 15565 15566**参数:** 15567 15568| 名称 | 描述 | 15569| -------- | -------- | 15570| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15571| int | 行号。 | 15572| bool | true为获取整行的位置信息,false为获取第一个字符的位置信息。 | 15573| bool | 文字宽度是否包含空白符,true表示不包含空白符,false表示包含空白符。 | 15574| OH_Drawing_LineMetrics | 指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针,由[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)获取。 | 15575 15576**返回:** 15577 15578指定行的行位置信息或第一个字符的位置信息是否成功获取,true表示成功获取,false表示未成功获取。 15579 15580 15581### OH_Drawing_TypographyGetLineMetrics() 15582 15583``` 15584OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography* ) 15585``` 15586 15587**描述** 15588 15589获取行位置信息。 15590 15591**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15592 15593**起始版本:** 12 15594 15595**参数:** 15596 15597| 名称 | 描述 | 15598| -------- | -------- | 15599| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15600 15601**返回:** 15602 15603返回指向行位置信息对象[OH_Drawing_LineMetrics](_o_h___drawing___line_metrics.md)的指针。 15604 15605 15606### OH_Drawing_TypographyGetLineMetricsAt() 15607 15608``` 15609bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography* , int , OH_Drawing_LineMetrics* ) 15610``` 15611 15612**描述** 15613 15614获取指定行位置信息对象。 15615 15616**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15617 15618**起始版本:** 12 15619 15620**参数:** 15621 15622| 名称 | 描述 | 15623| -------- | -------- | 15624| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15625| int | 要获取的行数。 | 15626| [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)获取。 | 15627 15628**返回:** 15629 15630行位置信息对象是否成功获取,true表示成功获取,false表示未成功获取。 15631 15632 15633### OH_Drawing_TypographyGetLineTextRange() 15634 15635``` 15636OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography* , int , bool ) 15637``` 15638 15639**描述** 15640 15641获取行的边界。 15642 15643**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15644 15645**起始版本:** 12 15646 15647**参数:** 15648 15649| 名称 | 描述 | 15650| -------- | -------- | 15651| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15652| int | 行索引 | 15653| bool | 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 | 15654 15655**返回:** 15656 15657返回指向行边界对象的指针[OH_Drawing_Range](#oh_drawing_range)。 15658 15659 15660### OH_Drawing_TypographyGetLineWidth() 15661 15662``` 15663double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography* , int ) 15664``` 15665 15666**描述** 15667 15668获取指定行的行宽。 15669 15670**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15671 15672**起始版本:** 11 15673 15674**参数:** 15675 15676| 名称 | 描述 | 15677| -------- | -------- | 15678| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15679| int | 要指定的行数。 | 15680 15681**返回:** 15682 15683返回指定行的行宽。 15684 15685 15686### OH_Drawing_TypographyGetLongestLine() 15687 15688``` 15689double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography* ) 15690``` 15691 15692**描述** 15693 15694获取最长行的宽度,建议实际使用时将返回值向上取整。当文本内容为空时,返回float的最小值, 即:-340282346638528859811704183484516925440.000000。 15695 15696**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15697 15698**起始版本:** 9 15699 15700**参数:** 15701 15702| 名称 | 描述 | 15703| -------- | -------- | 15704| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15705 15706**返回:** 15707 15708返回最长行的宽度。 15709 15710 15711### OH_Drawing_TypographyGetMaxIntrinsicWidth() 15712 15713``` 15714double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography* ) 15715``` 15716 15717**描述** 15718 15719获取最大固有宽度。 15720 15721**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15722 15723**起始版本:** 9 15724 15725**参数:** 15726 15727| 名称 | 描述 | 15728| -------- | -------- | 15729| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15730 15731**返回:** 15732 15733返回最大固有宽度。 15734 15735 15736### OH_Drawing_TypographyGetMaxWidth() 15737 15738``` 15739double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography* ) 15740``` 15741 15742**描述** 15743 15744获取最大宽度。 15745 15746**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15747 15748**起始版本:** 9 15749 15750**参数:** 15751 15752| 名称 | 描述 | 15753| -------- | -------- | 15754| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15755 15756**返回:** 15757 15758返回最大宽度。 15759 15760 15761### OH_Drawing_TypographyGetMinIntrinsicWidth() 15762 15763``` 15764double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography* ) 15765``` 15766 15767**描述** 15768 15769获取最小固有宽度。 15770 15771**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15772 15773**起始版本:** 9 15774 15775**参数:** 15776 15777| 名称 | 描述 | 15778| -------- | -------- | 15779| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15780 15781**返回:** 15782 15783返回最小固有宽度。 15784 15785 15786### OH_Drawing_TypographyGetRectsForPlaceholders() 15787 15788``` 15789OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography* ) 15790``` 15791 15792**描述** 15793 15794获取占位符的文本框。 15795 15796**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15797 15798**起始版本:** 11 15799 15800**参数:** 15801 15802| 名称 | 描述 | 15803| -------- | -------- | 15804| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15805 15806**返回:** 15807 15808返回占位符的文本框,返回类型为[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。 15809 15810### OH_Drawing_TypographyGetRectsForRange() 15811 15812``` 15813OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography* , size_t , size_t , OH_Drawing_RectHeightStyle , OH_Drawing_RectWidthStyle ) 15814``` 15815 15816**描述** 15817 15818获取指定范围内的文本框。 15819 15820**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15821 15822**起始版本:** 11 15823 15824**参数:** 15825 15826| 名称 | 描述 | 15827| -------- | -------- | 15828| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15829| size_t | 设置开始位置。 | 15830| size_t | 设置结束位置。 | 15831| OH_Drawing_RectHeightStyle | 设置高度样式,支持可选的高度样式具体可见[OH_Drawing_RectHeightStyle](#oh_drawing_rectheightstyle)枚举。 | 15832| OH_Drawing_RectWidthStyle | 设置宽度样式,支持可选的宽度样式具体可见[OH_Drawing_RectWidthStyle](#oh_drawing_rectwidthstyle)枚举。 | 15833 15834**返回:** 15835 15836返回指定范围内的文本框,具体可见[OH_Drawing_TextBox](#oh_drawing_textbox)结构体。 15837 15838 15839### OH_Drawing_TypographyGetTextAlign() 15840 15841``` 15842OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle* ) 15843``` 15844 15845**描述** 15846 15847获取文本对齐方式。 15848 15849**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15850 15851**起始版本:** 12 15852 15853**参数:** 15854 15855| 名称 | 描述 | 15856| -------- | -------- | 15857| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15858 15859**返回:** 15860 15861返回文本对齐方式。1为右对齐,2为居中对齐,3为两端对齐,4为与文字方向相同,5为文字方向相反,0或其它为左对齐, 具体可见[OH_Drawing_TextAlign](#oh_drawing_textalign)枚举。 15862 15863 15864### OH_Drawing_TypographyGetTextDirection() 15865 15866``` 15867OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle* ) 15868``` 15869 15870**描述** 15871 15872获取文本方向。 15873 15874**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15875 15876**起始版本:** 12 15877 15878**参数:** 15879 15880| 名称 | 描述 | 15881| -------- | -------- | 15882| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15883 15884**返回:** 15885 15886返回文本方向。1为从左到右,0或其它为从右到左,具体可见[OH_Drawing_TextDirection](#oh_drawing_textdirection)枚举。 15887 15888 15889### OH_Drawing_TypographyGetTextEllipsis() 15890 15891``` 15892char* OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle* ) 15893``` 15894 15895**描述** 15896 15897获取设置的省略号内容。 15898 15899**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15900 15901**起始版本:** 12 15902 15903**参数:** 15904 15905| 名称 | 描述 | 15906| -------- | -------- | 15907| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15908 15909**返回:** 15910 15911返回设置的省略号内容。 15912 15913 15914### OH_Drawing_TypographyGetTextMaxLines() 15915 15916``` 15917size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle* ) 15918``` 15919 15920**描述** 15921 15922获取文本的最大行数。 15923 15924**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15925 15926**起始版本:** 12 15927 15928**参数:** 15929 15930| 名称 | 描述 | 15931| -------- | -------- | 15932| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15933 15934**返回:** 15935 15936返回结果为文本最大行数。 15937 15938 15939### OH_Drawing_TypographyGetTextStyle() 15940 15941``` 15942OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle* style) 15943``` 15944 15945**描述** 15946 15947获取字体风格。 15948 15949**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15950 15951**起始版本:** 12 15952 15953**参数:** 15954 15955| 名称 | 描述 | 15956| -------- | -------- | 15957| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 15958 15959**返回:** 15960 15961返回指向字体风格对象[OH_Drawing_TextStyle](#oh_drawing_textstyle)的指针。 15962 15963 15964### OH_Drawing_TypographyGetUnresolvedGlyphsCount() 15965 15966``` 15967int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography* ) 15968``` 15969 15970**描述** 15971 15972获取文本中尚未解析的字形的数量。 15973 15974**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 15975 15976**起始版本:** 12 15977 15978**参数:** 15979 15980| 名称 | 描述 | 15981| -------- | -------- | 15982| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 15983 15984**返回:** 15985 15986返回文本中尚未解析的字形的数量。 15987 15988 15989### OH_Drawing_TypographyGetWordBoundary() 15990 15991``` 15992OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography* , size_t ) 15993``` 15994 15995**描述** 15996 15997获取单词的边界。 15998 15999**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16000 16001**起始版本:** 11 16002 16003**参数:** 16004 16005| 名称 | 描述 | 16006| -------- | -------- | 16007| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16008| size_t | 单词索引。 | 16009 16010**返回:** 16011 16012返回单词边界,返回类型为[OH_Drawing_Range](#oh_drawing_range)结构体。 16013 16014 16015### OH_Drawing_TypographyHandlerAddPlaceholder() 16016 16017``` 16018void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate* , OH_Drawing_PlaceholderSpan* ) 16019``` 16020 16021**描述** 16022 16023设置占位符。 16024 16025**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16026 16027**起始版本:** 11 16028 16029**参数:** 16030 16031| 名称 | 描述 | 16032| -------- | -------- | 16033| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 16034| [OH_Drawing_PlaceholderSpan](_o_h___drawing___placeholder_span.md) | 指向OH_Drawing_PlaceholderSpan对象的指针。 | 16035 16036 16037### OH_Drawing_TypographyHandlerAddSymbol() 16038 16039``` 16040void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate* , uint32_t symbol ) 16041``` 16042 16043**描述** 16044 16045设置排版创建过程中的符号。 16046 16047**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16048 16049**起始版本:** 12 16050 16051**参数:** 16052 16053| 名称 | 描述 | 16054| -------- | -------- | 16055| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 16056| 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) | 16057 16058 16059### OH_Drawing_TypographyHandlerAddText() 16060 16061``` 16062void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate* , const char* ) 16063``` 16064 16065**描述** 16066 16067设置文本内容。 16068 16069**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16070 16071**起始版本:** 8 16072 16073**参数:** 16074 16075| 名称 | 描述 | 16076| -------- | -------- | 16077| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 16078| char | 指向文本内容的指针。 | 16079 16080 16081### OH_Drawing_TypographyHandlerPopTextStyle() 16082 16083``` 16084void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate* ) 16085``` 16086 16087**描述** 16088 16089排版弹出。 16090 16091**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16092 16093**起始版本:** 8 16094 16095**参数:** 16096 16097| 名称 | 描述 | 16098| -------- | -------- | 16099| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 16100 16101 16102### OH_Drawing_TypographyHandlerPushTextStyle() 16103 16104``` 16105void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate* , OH_Drawing_TextStyle* ) 16106``` 16107 16108**描述** 16109 16110设置排版风格。 16111 16112**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16113 16114**起始版本:** 8 16115 16116**参数:** 16117 16118| 名称 | 描述 | 16119| -------- | -------- | 16120| OH_Drawing_TypographyCreate | 指向OH_Drawing_TypographyCreate对象的指针,由[OH_Drawing_CreateTypographyHandler](#oh_drawing_createtypographyhandler)获取。 | 16121| OH_Drawing_TextStyle | 指向OH_Drawing_TextStyle对象的指针,由[OH_Drawing_CreateTextStyle](#oh_drawing_createtextstyle)获取。 | 16122 16123 16124### OH_Drawing_TypographyIsEllipsized() 16125 16126``` 16127bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle* style) 16128``` 16129 16130**描述** 16131 16132获取文本是否有省略号。 16133 16134**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16135 16136**起始版本:** 12 16137 16138**参数:** 16139 16140| 名称 | 描述 | 16141| -------- | -------- | 16142| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16143 16144**返回:** 16145 16146返回文本是否有省略号,true表示有省略号,false表示无省略号。 16147 16148 16149### OH_Drawing_TypographyIsLineUnlimited() 16150 16151``` 16152bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle* style) 16153``` 16154 16155**描述** 16156 16157获取文本是否有最大行数限制。 16158 16159**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16160 16161**起始版本:** 12 16162 16163**参数:** 16164 16165| 名称 | 描述 | 16166| -------- | -------- | 16167| OH_Drawing_TypographyStyle | 指向文本风格[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16168 16169**返回:** 16170 16171返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。 16172 16173 16174### OH_Drawing_TypographyLayout() 16175 16176``` 16177void OH_Drawing_TypographyLayout (OH_Drawing_Typography* , double ) 16178``` 16179 16180**描述** 16181 16182排版布局。 16183 16184**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16185 16186**起始版本:** 8 16187 16188**参数:** 16189 16190| 名称 | 描述 | 16191| -------- | -------- | 16192| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16193| double | 文本最大宽度 | 16194 16195 16196### OH_Drawing_TypographyMarkDirty() 16197 16198``` 16199void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography* ) 16200``` 16201 16202**描述** 16203 16204将排版标记为脏数据,用于初始化排版状态。 16205 16206**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16207 16208**起始版本:** 12 16209 16210**参数:** 16211 16212| 名称 | 描述 | 16213| -------- | -------- | 16214| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16215 16216 16217### OH_Drawing_TypographyPaint() 16218 16219``` 16220void OH_Drawing_TypographyPaint (OH_Drawing_Typography* , OH_Drawing_Canvas* , double , double ) 16221``` 16222 16223**描述** 16224 16225显示文本。 16226 16227**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16228 16229**起始版本:** 8 16230 16231**参数:** 16232 16233| 名称 | 描述 | 16234| -------- | -------- | 16235| OH_Drawing_Typography | 指向OH_Drawing_Typography对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16236| OH_Drawing_Canvas | 指向OH_Drawing_Canvas对象的指针,由OH_Drawing_CanvasCreate()获取。 | 16237| double | x坐标。 | 16238| double | y坐标。 | 16239 16240 16241### OH_Drawing_TypographySetIndents() 16242 16243``` 16244void OH_Drawing_TypographySetIndents (OH_Drawing_Typography* , int , const float indents[] ) 16245``` 16246 16247**描述** 16248 16249设置文本的排版缩进,不调用此接口默认文本无缩进。 16250 16251**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16252 16253**起始版本:** 12 16254 16255**参数:** 16256 16257| 名称 | 描述 | 16258| -------- | -------- | 16259| OH_Drawing_Typography | 指向文本对象[OH_Drawing_Typography](#oh_drawing_typography)的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16260| int | 为段落设置的缩进数量。该值应小于或等于 indents 数组的长度,以避免访问数组越界导致的显示异常。| 16261| float | 指向浮点类型数组的指针,每个数组元素表示一个缩进宽度,单位为物理像素(px)。在应用[OH_Drawing_Typography](#oh_drawing_typography)接口时,需要先声明并初始化该浮点数组。 | 16262 16263 16264### OH_Drawing_TypographyStyleDestroyStrutStyle() 16265 16266``` 16267void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle* ) 16268``` 16269 16270**描述** 16271 16272释放被支柱样式对象占据的内存。 16273 16274**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16275 16276**起始版本:** 12 16277 16278**参数:** 16279 16280| 名称 | 描述 | 16281| -------- | -------- | 16282| [OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md) | 指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针,由[OH_Drawing_TypographyStyleGetStrutStyle](#oh_drawing_typographystylegetstrutstyle)获取。 | 16283 16284 16285### OH_Drawing_TypographyStyleEquals() 16286 16287``` 16288bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to ) 16289``` 16290 16291**描述** 16292 16293判断排版样式是否相同。 16294 16295**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16296 16297**起始版本:** 12 16298 16299**参数:** 16300 16301| 名称 | 描述 | 16302| -------- | -------- | 16303| from | 被比较的排版样式。 | 16304| to | 用于比较的排版样式。 | 16305 16306**返回:** 16307 16308返回排版样式是否相同。true表示相同,false表示不相同。 16309 16310 16311### OH_Drawing_TypographyStyleGetEffectiveAlignment() 16312 16313``` 16314OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle* style) 16315``` 16316 16317**描述** 16318 16319获取文本对齐模式。 16320 16321**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16322 16323**起始版本:** 12 16324 16325**参数:** 16326 16327| 名称 | 描述 | 16328| -------- | -------- | 16329| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16330 16331**返回:** 16332 16333返回文本对齐模式的枚举值[OH_Drawing_TextAlign](#oh_drawing_textalign)。 16334 16335 16336### OH_Drawing_TypographyStyleGetFontStyleStruct() 16337 16338``` 16339OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle* drawingStyle) 16340``` 16341 16342**描述** 16343 16344获取文本字体样式,包括字体字重、字体宽度和字体斜度。 16345 16346**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16347 16348**起始版本:** 12 16349 16350**参数:** 16351 16352| 名称 | 描述 | 16353| -------- | -------- | 16354| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16355 16356**返回:** 16357 16358返回获取到的字体样式对象,包括字体字重、字体宽度和字体斜度信息。 16359 16360 16361### OH_Drawing_TypographyStyleGetStrutStyle() 16362 16363``` 16364OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle* ) 16365``` 16366 16367**描述** 16368 16369获取文本支柱样式。 16370 16371**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16372 16373**起始版本:** 12 16374 16375**参数:** 16376 16377| 名称 | 描述 | 16378| -------- | -------- | 16379| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16380 16381**返回:** 16382 16383返回指向支柱样式对象[OH_Drawing_StrutStyle](_o_h___drawing___strut_style.md)的指针。 16384 16385 16386### OH_Drawing_TypographyStyleIsHintEnabled() 16387 16388``` 16389bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle* style) 16390``` 16391 16392**描述** 16393 16394获取文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 16395 16396**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16397 16398**起始版本:** 12 16399 16400**参数:** 16401 16402| 名称 | 描述 | 16403| -------- | -------- | 16404| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16405 16406**返回:** 16407 16408返回文本是否启用字体提示,true表示启用,false表示不启用。 16409 16410 16411### OH_Drawing_TypographyStyleSetHintsEnabled() 16412 16413``` 16414void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle* style, bool hintsEnabled ) 16415``` 16416 16417**描述** 16418 16419设置文本是否启用字体提示。字体提示用于在渲染小字号文本时改善其可读性和外观。 16420 16421**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16422 16423**起始版本:** 12 16424 16425**参数:** 16426 16427| 名称 | 描述 | 16428| -------- | -------- | 16429| OH_Drawing_TypographyStyle | 指向文本风格对象[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16430| hintsEnabled | 是否启用字体提示,true表示启用,false表示不启用。 | 16431 16432 16433### OH_Drawing_TypographyStyleStrutStyleEquals() 16434 16435``` 16436bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle* from, OH_Drawing_StrutStyle* to ) 16437``` 16438 16439**描述** 16440 16441判断支柱样式结构体是否相同。 16442 16443**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16444 16445**起始版本:** 12 16446 16447**参数:** 16448 16449| 名称 | 描述 | 16450| -------- | -------- | 16451| from | 被比较的支柱样式结构体。 | 16452| to | 用于比较的支柱样式结构体。 | 16453 16454**返回:** 16455 16456返回支柱样式结构体是否相同,true表示相同,false表示不相同。 16457 16458### OH_Drawing_TypographyTextGetHeightBehavior() 16459 16460``` 16461OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle* ) 16462``` 16463 16464**描述** 16465 16466获取文本高度修饰符模式。 16467 16468**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16469 16470**起始版本:** 12 16471 16472**参数:** 16473 16474| 名称 | 描述 | 16475| -------- | -------- | 16476| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16477 16478**返回:** 16479 16480返回文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 16481 16482 16483### OH_Drawing_TypographyTextGetLineStyle() 16484 16485``` 16486bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle* ) 16487``` 16488 16489**描述** 16490 16491获取文本排版是否启用行样式。 16492 16493**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16494 16495**起始版本:** 12 16496 16497**参数:** 16498 16499| 名称 | 描述 | 16500| -------- | -------- | 16501| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16502 16503**返回:** 16504 16505返回行样式是否启用的结果,true表示启用,false表示不启用。 16506 16507 16508### OH_Drawing_TypographyTextlineGetStyleOnly() 16509 16510``` 16511bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle* ) 16512``` 16513 16514**描述** 16515 16516获取文本排版是否仅启用行样式。 16517 16518**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16519 16520**起始版本:** 12 16521 16522**参数:** 16523 16524| 名称 | 描述 | 16525| -------- | -------- | 16526| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16527 16528**返回:** 16529 16530返回文本排版是否仅启用行样式,true表示启用,false表示不启用。 16531 16532 16533### OH_Drawing_TypographyTextlineStyleDestroyFontFamilies() 16534 16535``` 16536void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char** fontFamilies, size_t fontFamiliesNum ) 16537``` 16538 16539**描述** 16540 16541释放字体类型占用的内存。 16542 16543**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16544 16545**起始版本:** 12 16546 16547**参数:** 16548 16549| 名称 | 描述 | 16550| -------- | -------- | 16551| fontFamilies | 表示指向字体字体类型的指针。 | 16552| fontFamiliesNum | 字体名称的数量。 | 16553 16554 16555### OH_Drawing_TypographyTextlineStyleGetFontFamilies() 16556 16557``` 16558char** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle* ) 16559``` 16560 16561**描述** 16562 16563获取文本排版行样式字体家族名。 16564 16565**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16566 16567**起始版本:** 12 16568 16569**参数:** 16570 16571| 名称 | 描述 | 16572| -------- | -------- | 16573| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16574 16575**返回:** 16576 16577返回文本排版行样式字体家族名。 16578 16579 16580### OH_Drawing_TypographyTextlineStyleGetFontSize() 16581 16582``` 16583double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle* ) 16584``` 16585 16586**描述** 16587 16588获取文本排版行样式字号。 16589 16590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16591 16592**起始版本:** 12 16593 16594**参数:** 16595 16596| 名称 | 描述 | 16597| -------- | -------- | 16598| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16599 16600**返回:** 16601 16602返回文本排版行样式字号。 16603 16604 16605### OH_Drawing_TypographyTextlineStyleGetFontStyle() 16606 16607``` 16608OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle* ) 16609``` 16610 16611**描述** 16612 16613获取文本排版行样式风格。 16614 16615**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16616 16617**起始版本:** 12 16618 16619**参数:** 16620 16621| 名称 | 描述 | 16622| -------- | -------- | 16623| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16624 16625**返回:** 16626 16627返回获取文本排版行样式风格。1为斜体,0或其它为非斜体,具体可见[OH_Drawing_FontStyle](#oh_drawing_fontstyle)枚举。 16628 16629 16630### OH_Drawing_TypographyTextlineStyleGetFontWeight() 16631 16632``` 16633OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle* ) 16634``` 16635 16636**描述** 16637 16638获取文本排版行样式字重。 16639 16640**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16641 16642**起始版本:** 12 16643 16644**参数:** 16645 16646| 名称 | 描述 | 16647| -------- | -------- | 16648| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16649 16650**返回:** 16651 16652返回文本排版行样式字重。 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)枚举 16653 16654 16655### OH_Drawing_TypographyTextlineStyleGetHalfLeading() 16656 16657``` 16658bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle* ) 16659``` 16660 16661**描述** 16662 16663获取文本排版行样式是否为一半行间距。 16664 16665**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16666 16667**起始版本:** 12 16668 16669**参数:** 16670 16671| 名称 | 描述 | 16672| -------- | -------- | 16673| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16674 16675**返回:** 16676 16677文本排版行样式是否为一半行间距,true表示是一半行间距,false表示不是。 16678 16679 16680### OH_Drawing_TypographyTextlineStyleGetHeightOnly() 16681 16682``` 16683bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle* ) 16684``` 16685 16686**描述** 16687 16688获取字体渲染过程中计算字体块高度相关参数的方法。 16689 16690**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16691 16692**起始版本:** 12 16693 16694**参数:** 16695 16696| 名称 | 描述 | 16697| -------- | -------- | 16698| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16699 16700**返回:** 16701 16702返回计算字体块高度相关参数的方法,true表示以字号为准计算,false表示以行距计算。 16703 16704 16705### OH_Drawing_TypographyTextlineStyleGetHeightScale() 16706 16707``` 16708double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle* ) 16709``` 16710 16711**描述** 16712 16713获取文本排版中字体高度规模。 16714 16715**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16716 16717**起始版本:** 12 16718 16719**参数:** 16720 16721| 名称 | 描述 | 16722| -------- | -------- | 16723| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16724 16725**返回:** 16726 16727返回文本排版中字体高度规模。 16728 16729 16730### OH_Drawing_TypographyTextlineStyleGetSpacingScale() 16731 16732``` 16733double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle* ) 16734``` 16735 16736**描述** 16737 16738获取文本排版行样式间距比例。 16739 16740**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16741 16742**起始版本:** 12 16743 16744**参数:** 16745 16746| 名称 | 描述 | 16747| -------- | -------- | 16748| OH_Drawing_TypographyStyle | 表示指向[OH_Drawing_TypographyStyle](#oh_drawing_typographystyle)对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16749 16750**返回:** 16751 16752返回文本排版行样式间距比例。 16753 16754 16755### OH_Drawing_TypographyTextSetHeightBehavior() 16756 16757``` 16758void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle* , OH_Drawing_TextHeightBehavior heightMode ) 16759``` 16760 16761**描述** 16762 16763设置文本高度修饰符模式。 16764 16765**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16766 16767**起始版本:** 12 16768 16769**参数:** 16770 16771| 名称 | 描述 | 16772| -------- | -------- | 16773| OH_Drawing_TypographyStyle | 指向OH_Drawing_TypographyStyle对象的指针,由[OH_Drawing_CreateTypographyStyle](#oh_drawing_createtypographystyle)获取。 | 16774| heightMode | 文本高度修饰符模式,为[OH_Drawing_TextHeightBehavior](#oh_drawing_textheightbehavior)类型的枚举值。 | 16775 16776 16777### OH_Drawing_TypographyUpdateFontSize() 16778 16779``` 16780void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography* , size_t from, size_t to, float fontSize ) 16781``` 16782 16783**描述** 16784 16785更新文本中的字体大小。 16786 16787**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing 16788 16789**起始版本:** 12 16790 16791**参数:** 16792 16793| 名称 | 描述 | 16794| -------- | -------- | 16795| OH_Drawing_Typography | 表示指向文本[OH_Drawing_Typography](#oh_drawing_typography)对象的指针,由[OH_Drawing_CreateTypography](#oh_drawing_createtypography)获取。 | 16796| from | 表示原来的字体大小。 | 16797| to | 表示更新后字体大小。 | 16798| fontSize | 表示字体的大小。 |